Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

lrn2kanji

Name: Anonymous 2008-01-02 12:16

greasemonkey script that inserts kanji where the meaning was before.

fucking mess i know, but still.

/*

kanjireplace.user.js

*/

//grade 1 kanjis taken from wikipedia
var kanjis = [
['六', 'six'],
['一', 'one', 'unity', 'beginning'],
['七', 'seven'],
['上', 'top', 'superior'],
['下', 'under', 'below', 'down', 'inferior'],
['三', 'three'],
['中', 'central', 'middle', 'hit', 'attain'],
['九', 'nine'],
['二', 'two', 'twice'],
['五', 'five'],
['人', 'man', 'person', 'mankind', 'someone else'],
['休', 'rest', 'stop', 'retire', 'dont'],
['先', 'first', 'previous'],
['入', 'enter', 'join'],
['八', 'eight'],
['円', 'round', 'circular'],
['出', 'stand', 'produce'],
['力', 'power', 'capability', 'influence'],
['十', 'ten', 'complete', 'perfect'],
['千', 'thousand', 'many', 'very'],
['口', 'mouth', 'open', 'entrance', 'gate'],
['右', 'west', 'right'],
['四', 'four'],
['名', 'name', 'title', 'rank', 'position'],
['土', 'soil', 'earth', 'peasant'],
['夕', 'evening', 'night', 'dusk', 'slanted'],
['大', 'big', 'vast', 'large', 'great', 'high'],
['天', 'sky', 'heaven', 'god'],
['女', 'female', 'woman', 'girl', 'feminine'],
['子', 'offspring', 'child', 'son', 'daughter', 'fruit'],
['字', 'letter', 'character', 'word'],
['学', 'learning', 'knowledge', 'school'],
['小', 'small', 'tiny', 'young', 'little'],
['山', 'mountain', 'hill', 'peak'],
['川', 'stream', 'river', 'flow', 'boil'],
['左', 'left', 'east', 'improper'],
['年', 'year', 'new year', 'age'],
['手', 'hand'],
['文', 'literature', 'writing', 'culture', 'surname'],
['日', 'sun', 'daytime', 'day'],
['早', 'early', 'soon', 'morning'],
['月', 'moon', 'month'],
['木', 'tree', 'lumber', 'wooden'],
['本', 'root', 'origin', 'source', 'basis'],
['村', 'village', 'hamlet', 'vulgar', 'chav', 'uncouth'],
['林', 'forest', 'grove'],
['校', 'school'],
['森', 'forest', 'dark', 'vegatation'],
['正', 'right', 'proper', 'correct'],
['気', 'air', 'gas', 'steam', 'vapor', 'spirit'],
['水', 'water', 'liquid', 'lotion', 'juice'],
['火', 'fire', 'flame', 'burn', 'anger', 'rage'],
['犬', 'dog'],
['玉', 'gem', 'jade'],
['王', 'king', 'ruler', 'royal'],
['生', 'life', 'living', 'lifetime', 'birth'],
['田', 'field'],
['町', 'path'],
['男', 'male', 'man', 'boy', 'son', 'masculine'],
['白', 'white', 'pure', 'bright'],
['百', 'hundred', 'many'],
['目', 'eye', 'look', 'see'],
['石', 'rock', 'mineral'],
['空', 'sky', 'empty', 'hollow', 'bare', 'deserted'],
['立', 'stand', 'set', 'establish'],
['竹', 'bamboo'],
['糸', 'silk'],
['耳', 'ear'],
['花', 'flower', 'blossom'],
['草', 'grass', 'straw', 'thatch', 'herbs'],
['虫', 'insects', 'worms'],
['見', 'see', 'observe', 'behold', 'perceive'],
['貝', 'shell', 'money', 'currency'],
['赤', 'red', 'bare', 'communist'],
['足', 'foot', 'enough', 'attain', 'satisfy'],
['車', 'cart', 'vehicle', 'carry'],
['金', 'gold', 'metal', 'money'],
['雨', 'rain', 'rainy'],
['青', 'blue', 'green', 'black', 'young'],
['音', 'sound', 'tone', 'pitch']
];

window.kanjiReplace = function(nodes){
    for(var i=0; i<nodes.length; i++){
        var parent = nodes[i];
        var childs = nodes[i].childNodes;
        for(var j=0; j<childs.length; j++){
            var cur = childs[j];
            if(cur.nodeType == 3 && cur.nodeValue.length > 40){
                for(var k=0; k<kanjis.length; k++){
                    for(var m=1; m<kanjis[k].length; m++){
                        var ind;
                        if((ind = cur.nodeValue.indexOf(kanjis[k][m])) != -1){
                            var a = document.createTextNode(cur.nodeValue.substring(0, ind));
                            var c = document.createTextNode(cur.nodeValue.substring(ind+kanjis[k][m].length));
                            var b = document.createElement('span');
                            b.setAttribute('title', cur.nodeValue.substring(ind, ind+kanjis[k][m].length));
                            b.appendChild(document.createTextNode(kanjis[k][0]));
                            var replacer = document.createElement('span');
                            replacer.appendChild(a);
                            replacer.appendChild(b);
                            replacer.appendChild(c);
                            parent.replaceChild(replacer, cur);
                        }
                    }
                }
            }
        }
    }
}

window.addEventListener('load', function(){
    //add spaces to the ends of the kanjis
    for(var i=0; i<kanjis.length; i++)
        for(var j=0; j<kanjis[i].length; j++)
            kanjis[i][j] = ' '+kanjis[i][j]+' ';
    //replace meanings with kanjis   
    kanjiReplace(document.getElementsByTagName('p'));
    kanjiReplace(document.getElementsByTagName('span'));
    kanjiReplace(document.getElementsByTagName('div'));
    kanjiReplace(document.getElementsByTagName('blockquote'));
    kanjiReplace(document.getElementsByTagName('i'));
}, true);

Name: sage 2008-01-02 13:22

My other 先 is a 休.

Name: Anonymous 2008-01-02 13:46

my other 車 is a くるmd

Name: Anonymous 2008-01-02 13:56

my other 車 is a  くっだ

Name: Anonymous 2008-01-02 13:56

くっだー

Name: sage 2008-01-02 13:59

['下', 'under', 'below', 'down', 'inferior'],

Name: Anonymous 2008-01-02 14:40

new version, way less buggy:

/*

kanjireplace.user.js

*/

//grade 1 kanjis taken from wikipedia
var kanjis = [
['六', 'six'],
['一', 'one', 'unity', 'beginning'],
['七', 'seven'],
['上', 'top', 'superior'],
['下', 'under', 'below', 'down', 'inferior'],
['三', 'three'],
['中', 'central', 'middle', 'hit', 'attain'],
['九', 'nine'],
['二', 'two', 'twice'],
['五', 'five'],
['人', 'man', 'person', 'mankind', 'someone else'],
['休', 'rest', 'stop', 'retire', 'dont'],
['先', 'first', 'previous'],
['入', 'enter', 'join'],
['八', 'eight'],
['円', 'round', 'circular'],
['出', 'stand', 'produce'],
['力', 'power', 'capability', 'influence'],
['十', 'ten', 'complete', 'perfect'],
['千', 'thousand', 'many', 'very'],
['口', 'mouth', 'open', 'entrance', 'gate'],
['右', 'west', 'right'],
['四', 'four'],
['名', 'name', 'title', 'rank', 'position'],
['土', 'soil', 'earth', 'peasant'],
['夕', 'evening', 'night', 'dusk', 'slanted'],
['大', 'big', 'vast', 'large', 'great', 'high'],
['天', 'sky', 'heaven', 'god'],
['女', 'female', 'woman', 'girl', 'feminine'],
['子', 'offspring', 'child', 'son', 'daughter', 'fruit'],
['字', 'letter', 'character', 'word'],
['学', 'learning', 'knowledge', 'school'],
['小', 'small', 'tiny', 'young', 'little'],
['山', 'mountain', 'hill', 'peak'],
['川', 'stream', 'river', 'flow', 'boil'],
['左', 'left', 'east', 'improper'],
['年', 'year', 'new year', 'age'],
['手', 'hand'],
['文', 'literature', 'writing', 'culture', 'surname'],
['日', 'sun', 'daytime', 'day'],
['早', 'early', 'soon', 'morning'],
['月', 'moon', 'month'],
['木', 'tree', 'lumber', 'wooden'],
['本', 'root', 'origin', 'source', 'basis'],
['村', 'village', 'hamlet', 'vulgar', 'chav', 'uncouth'],
['林', 'forest', 'grove'],
['校', 'school'],
['森', 'forest', 'dark', 'vegatation'],
['正', 'right', 'proper', 'correct'],
['気', 'air', 'gas', 'steam', 'vapor', 'spirit'],
['水', 'water', 'liquid', 'lotion', 'juice'],
['火', 'fire', 'flame', 'burn', 'anger', 'rage'],
['犬', 'dog'],
['玉', 'gem', 'jade'],
['王', 'king', 'ruler', 'royal'],
['生', 'life', 'living', 'lifetime', 'birth'],
['田', 'field'],
['町', 'path'],
['男', 'male', 'man', 'boy', 'son', 'masculine'],
['白', 'white', 'pure', 'bright'],
['百', 'hundred', 'many'],
['目', 'eye', 'look', 'see'],
['石', 'rock', 'mineral'],
['空', 'sky', 'empty', 'hollow', 'bare', 'deserted'],
['立', 'stand', 'set', 'establish'],
['竹', 'bamboo'],
['糸', 'silk'],
['耳', 'ear'],
['花', 'flower', 'blossom'],
['草', 'grass', 'straw', 'thatch', 'herbs'],
['虫', 'insects', 'worms'],
['見', 'see', 'observe', 'behold', 'perceive'],
['貝', 'shell', 'money', 'currency'],
['赤', 'red', 'bare', 'communist'],
['足', 'foot', 'enough', 'attain', 'satisfy'],
['車', 'cart', 'vehicle', 'carry'],
['金', 'gold', 'metal', 'money'],
['雨', 'rain', 'rainy'],
['青', 'blue', 'green', 'black', 'young'],
['音', 'sound', 'tone', 'pitch']
];

window.kanjiReplace = function(nodes){
    for(var i=0; i<nodes.length; i++){
        var childs = nodes[i].childNodes;
        for(var j=0; j<childs.length; j++)
            window.kanjiReplaceSingle(childs[j]);
    }
}

window.kanjiReplaceSingle = function(cur){
    //only do text nodes over a certain length
    if(cur.nodeType != 3 || cur.nodeValue.length < 40)
        return;
    var nodeValue = cur.nodeValue;
    for(var k=0; k<kanjis.length; k++){
        for(var m=1; m<kanjis[k].length; m++){
            var ind;
            if((ind = nodeValue.indexOf(kanjis[k][m])) != -1){
                var a = document.createTextNode(nodeValue.substring(0, ind));
                var c = document.createTextNode(nodeValue.substring(ind+kanjis[k][m].length));
                var b = document.createElement('span');
                b.setAttribute('title', kanjis[k][m]);
                b.appendChild(document.createTextNode(kanjis[k][0]));
                cur.parentNode.insertBefore(a, cur);
                cur.parentNode.insertBefore(b, cur);
                cur.parentNode.insertBefore(c, cur);
                cur.parentNode.removeChild(cur);
                kanjiReplaceSingle(a);
                kanjiReplaceSingle(c);   
                return;
            }
        }
    }

}

window.addEventListener('load', function(){
    //add spaces to the ends of the kanjis
    for(var i=0; i<kanjis.length; i++)
        for(var j=0; j<kanjis[i].length; j++)
            kanjis[i][j] = ' '+kanjis[i][j];
    //replace meanings with kanjis   
    kanjiReplace(document.getElementsByTagName('p'));
    kanjiReplace(document.getElementsByTagName('span'));
    kanjiReplace(document.getElementsByTagName('div'));
    kanjiReplace(document.getElementsByTagName('blockquote'));
    kanjiReplace(document.getElementsByTagName('i'));
}, true);

Name: Anonymous 2008-01-02 16:39

>>7
can you read japanese now?

Name: Anonymous 2008-01-02 17:21

actaually i feel like i am learning some stuff, just by browsing you learn more.

Name: Anonymous 2008-01-02 17:22

>>9
Too bad you don't.

Name: Anonymous 2008-01-02 18:16

i think Kanji is a pretty cool guy. eh kills weeoboos and dosent afraid of anything

Name: Anonymous 2008-01-02 18:17

Also 下 this shit.

Name: Anonymous 2008-01-02 20:15

That looks more like Chinese.

Name: Anonymous 2008-01-02 20:38

My other karu is a kuduru.

Name: Anonymous 2008-01-04 21:57

var childs = nodes[i].childNodes;
childs

Name: Anonymous 2008-01-04 22:22

['入', 'enter', 'join'],
['λ', 'lambda'],

Name: Anonymous 2008-01-04 23:17

>>14
My other カー is a クッデル.

Name: Anonymous 2008-01-05 3:41

>>17
you mean your other カル

Name: Anonymous 2008-01-05 5:06

>>17,18
I think you both mean ケイドル.

Name: Anonymous 2008-01-05 13:32

>>19
Keidoru?! Kuddoru maybe.

Name: Anonymous 2009-03-18 3:13

Don't call me gay, but I need some mary jay!

Marijuana MUST be legalized.

Name: Anonymous 2010-06-01 4:47

['入', 'enter', 'join'] MY ANUS

Don't change these.
Name: Email:
Entire Thread Thread List