MediaWiki:Common.js: Difference between revisions

Eran Hodis (talk | contribs)
No edit summary
m Resaved by maintenance script
Tag: content model change
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
function getElementsByClassName( fromElm, elmName, className){
return $(fromElm).find(elmName + '.' + className);
}
/* Any JavaScript here will be loaded for all users on every page load. */
/* Any JavaScript here will be loaded for all users on every page load. */


Line 199: Line 203:
         Button.firstChild.data = expandCaption;
         Button.firstChild.data = expandCaption;
     } else {
     } else {
        if ( hasClass( Table, "ConSurf")) {  // this if clause and its contents added by EH 2008/2009
              var Buttons = Table.getElementsByTagName( "input" ) ;
              for (var i = 0; i < Buttons.length; i++) {
                  Buttons[i].value = Buttons[i].value.replace("[  ]","[x]");
                  strStart = Buttons[i].value.lastIndexOf(" [");
                  chainLetter = Buttons[i].value.slice(0,strStart);
                  jmolScriptSetConsurfChainVar = "consurf_"+chainLetter+" = 0;";
                  jmolScript(jmolScriptSetConsurfChainVar,targetSuffix);
              }
              // get the suffix of the Jmol applet on which we want to act by checking the target suffix added onto a child Jmol button's id
              var targetSuffix = String(Buttons[0].id);
              strStart = targetSuffix.lastIndexOf("_");
              targetSuffix = targetSuffix.slice(strStart + 1);
              //now figure out the currently loaded file in the Jmol applet
              fromJmol = jmolGetPropertyAsArray("fileName","all",targetSuffix);
      var currFile = fromJmol;
      currFile = String(currFile);
      strStart = currFile.lastIndexOf("\/cgi-bin");
      currFile = currFile.slice(strStart);
      currFile = currFile.replace(/zapped/,"");
      currFile = currFile.replace(/getpdb\.pl\?/,"");
      currFile = currFile.replace(/getpdbz\?/,"");
              //now color it in consurf colors
              jmolScript("select protein; define ~consurf_to_do selected; consurf_initial_scene = true; script \"/wiki/ConSurf/" + currFile.slice(1,3) + "/" + currFile + "_consurf.spt\"",targetSuffix);
        }
         for ( var i = 1; i < Rows.length; i++ ) {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = Rows[0].style.display;
             Rows[i].style.display = Rows[0].style.display;
Line 473: Line 450:
  }
  }
}
}
 
JSconfig.readCookies();
JSconfig.readCookies();
addOnloadHook(JSconfig.setUpForm);
addOnloadHook(JSconfig.setUpForm);
if ("undefined"!= typeof mwCustomEditButtons) {
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "/wiki/extensions/Proteopedia/img/button_appletJmol.png",
    "speedTip": "3D structure",
    "tagOpen": "<Structure load='",
    "tagClose": "' size='350' frame='true' align='right' caption='Insert caption here' scene='Insert optional scene name here' />",
    "sampleText": "Insert PDB code or filename here"
  };
  mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "/wiki/extensions/Proteopedia/img/button_scrolling.png",
    "speedTip": "Scrolling text next to 3D structure",
    "tagOpen": "==Your Heading Here (maybe something like 'Structure')==\n<StructureSection load='3rec' size='350' side='right' caption='Escherichia coli reca protein-bound DNA (PDB entry [[3rec]])' scene=''>",
    "tagClose": "</StructureSection>",
    "sampleText": "\n\nAnything in this section will appear adjacent to the 3D structure and will be scrollable.\n\n"
  };
}


/*</source>*/
/*</source>*/