Difference between revisions of "User:Andr3w/vector.js"

From SQLZOO
Jump to: navigation, search
Line 19: Line 19:
 
         $('<div/>',{'class':'a-'+varlst[i].engine})
 
         $('<div/>',{'class':'a-'+varlst[i].engine})
 
           .append($('<div/>',{text:varlst[i].engine}))
 
           .append($('<div/>',{text:varlst[i].engine}))
           .append($('<div/>',{'class':'mw-geshi'})
+
           .append(varlist[i].val.clone())
            .append($('<div/>',{text:varlst[i].val.text(),'class':'sql source-sql'})))
+
 
           .appendTo(msg);
 
           .appendTo(msg);
 
       }
 
       }

Revision as of 14:30, 6 March 2014

//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].engine})
          .append($('<div/>',{text:varlst[i].engine}))
          .append(varlist[i].val.clone())
          .appendTo(msg);
      }
    }
    $(this).append(msg);
  })
)
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense