User:Andr3w/vector.js

From SQLZOO
< User:Andr3w
Revision as of 13:24, 6 March 2014 by Andr3w (Talk | contribs)

Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
//Deal with variations in the "how to" scripts
//Copy this to common.js when tested
$(
  $('div.ht').each(function(){
    var lnglst = $('.def',this);
    var varlst = [];
    if (lnglst.length>1){
      $('.def',this).each(function(){
        var clist = $(this).attr('class').split(' ');
        for(var i=0;i<clist.length;i++)
          if (clist[i].length>2 && clist[i].substr(0,2)=='e-')
            varlst.push({engine:clist[i].substr(2),val:$(this)})
      });
    }
    if (varlst.length>0){
      var msg = $('<div/>',{'class':'variations'});
      msg.append($('<div/>',{text:'There are variations'}));
      for(var i=0;i<varlst.length;i++){
        $('<div/>',{'class':'a-'+varlst[i].name})
          .append($('<div/>',{text:varlist[i].name}))
          .append($('<div/>',{text:varlist[i].text(),'class':'mw-geshi sql'}))
          .appendTo(msg);
      }
    }
    $(this).append(msg);
  })
)
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense