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

From SQLZOO
Jump to: navigation, search
(Blanked the page)
 
Line 1: Line 1:
//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(varlst[i].val.clone().removeClass('def'))
+
          .appendTo(msg);
+
      }
+
    }
+
    $(this).append(msg);
+
  })
+
)
+

Latest revision as of 23:36, 6 March 2014

 
Personal tools
Namespaces

Variants
Actions
Reference
Toolbox
Google AdSense