User:Matxx25/global.js

function CompareTwoUnits { var $compareForm = $('#compare-form'); var $compareContainer = $('#compare-container'); $compareForm.append(       $(' ')           .append( $(' ').attr( 'id', 'unit1' ) )           .append( $(' ').attr( 'id', 'unit2' ) )           .append( $('') )    );

$.getJSON('/api.php?format=json&action=parse&text=', function(data) {       console.log('parse');        var code = data.parse.text['*'];        //console.log(data);        //console.log(code);        lines = code.split(' ')       units = [];        $.each(lines,function(k,v){ var line = v.split(' &#160; = &#160; ') units.push({id:line[0],name:line[1]}) });       console.log(units);    }); $compareForm.find('form').on('submit',function(e){       var unit1 = $(this).find('#unit1').val;        var unit2 = $(this).find('#unit2').val;        $.getJSON('/api.php?action=parse&text=&format=json', function(data) { var code = data.parse.text['*']; $compareContainer.html(code); });       e.preventDefault;    }); } $(CompareTwoUnits)

//// AjaxRC window.ajaxPages = ["Special:RecentChanges","Spécial:Modifications_récentes","Spécial:WikiActivity","Special:Watchlist","Special:Log","Special:Contributions"]; //window.ajaxIndicator = 'http://images2.wikia.nocookie.net/__cb20100609110347/software/images/a/a9/Indicator.gif'; //window.ajaxRefresh = 30000; window.AjaxRCRefreshText = 'Auto-refresh'; window.AjaxRCRefreshHoverText = 'Automatically refresh the page'; //window.ajaxCallAgain = window.ajaxCallAgain || []; //window.ajaxCallAgain.push(function1, function2, function3); //*/

importArticles({   type: 'script',    articles: [        'u:dev:LastEdited/code.js',        'u:dev:QuickDiff/code.js',        'u:dev:QuickToolsv2/code.js',        'u:dev:FindAndReplace/code.js',        'u:dev:AjaxRC/code.js',        'u:dev:AjaxUndo/code.js',    ] });

/*// action unknown... $.getJSON('/api.php?format=json&action=raw&titles=RéférencesUnités&prop=revisions&rvprop=content', function(data) {   console.log('raw');    console.log(data);    window.Data = data; }); //*/

/*// raw content (not parsed) $.getJSON('/api.php?format=json&action=query&titles=RéférencesUnités&prop=revisions&rvprop=content', function(data) {   console.log('query');    console.log(data);    window.Data = data; }); //*/