Difference between revisions of "MediaWiki: Common.js"

From Teknologisk videncenter
Jump to: navigation, search
m
m (Undo revision 24153 by Heth (talk))
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
var stylepath = "/skins";
 
/* Testing Heth
 
/* Testing Heth
 
  .slideshow div {
 
  .slideshow div {
Line 15: Line 16:
 
  *  Maintainers: [[User:R. Koot]]
 
  *  Maintainers: [[User:R. Koot]]
 
  */
 
  */
/**HETH PLAYING**/
+
// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
addOnloadHook(function() {
+
//HeTh select in preferences importScriptURI('//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
if (!wgUserGroups || wgUserGroups.join('').indexOf('autoconfirmed') === -1) {
+
//HeTh select in preferences + '&action=raw&ctype=text/javascript');
    try {
 
    document.body.className += " notAutoconfirmed";
 
    } catch (e) {}
 
}
 
});
 
 
 
function dieWhitespaceDie () {
 
try {
 
//this is for us low res folks
 
//hides some of the members of the dpl list on main page, if list too long.
 
//this is not cross browser (yet). IE uses different method names for height
 
if (wgPageName !== "Main_Page" || wgAction !== "view") {return;}
 
var firstLead = document.getElementById('l_table_numb4'); //switch to last after height:100% hack.
 
var excessWS = (firstLead.parentNode.clientHeight - firstLead.clientHeight);
 
var DPLList = document.getElementById('MainPage_latest_news_text').getElementsByTagName('ul')[0];
 
var DPL = DPLList.getElementsByTagName('li');
 
var DPLlength = DPL.length;
 
//10 is just emergancy cut off. should stop way before that.
 
  if (DPLlength < 10) {throw new Error("Latest news should have more items...");}
 
var curItem, prev = -1;
 
for (var i = 1; i < 10;i++) { //note, start at 1.
 
  curItem = DPL[DPLlength - i];
 
  prev = excessWS;
 
  excessWS -= curItem.clientHeight;
 
  if (excessWS < 5 || prev === excessWS)  { break;}
 
  DPLList.removeChild(curItem); //this should perhaps use a range, so only a single re-draw.
 
  if (prev === (firstLead.parentNode.clientHeight - firstLead.clientHeight)) {break;}
 
}
 
} catch (e) {}
 
 
}
 
addOnloadHook(dieWhitespaceDie);
 
/***HETH PLAYING END **/
 

Latest revision as of 10:38, 12 December 2012

var stylepath = "/skins";
/* Testing Heth
 .slideshow div {
  _position: absolute;
}

.slideshow div div {
  _position: static;
}
*/
// Added 28/3-2009 HeTh
/** Collapsible tables *********************************************************
 *
 *  Description: Allows tables to be collapsed, showing only the header. See
 *               [[Wikipedia:NavFrame]].
 *  Maintainers: [[User:R. Koot]]
 */
// install [[Wikipedia:User:Cacycle/wikEd]] in-browser text editor
//HeTh select in preferences importScriptURI('//en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js'
//HeTh select in preferences  + '&action=raw&ctype=text/javascript');