|
 |
| (8 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) |
| Zeile 1: |
Zeile 1: |
|  | /* Das folgende JavaScript wird für alle Benutzer geladen. */ |  | /* Das folgende JavaScript wird für alle Benutzer geladen. */ |
| Â | //================================================================================ | Â | //================================================================================ |
| − |
| Â |
| − | /** Skript für [[Vorlage:Galerie]] */
| Â |
| − | /** Skript für [[Vorlage:Scroll Gallery]] ??? */
| Â |
| − | jQuery( document ).ready(function() {
| Â |
| − |  if (document.URL.match(/printable/g)) return;
| Â |
| − |
| Â |
| − |  function toggleImageFunction(group, remindex, shwindex) {
| Â |
| − |   return function() {
| Â |
| − |    document.getElementById("ImageGroupsGr" + group + "Im" + remindex).style["display"] = "none";
| Â |
| − |    document.getElementById("ImageGroupsGr" + group + "Im" + shwindex).style["display"] = "block";
| Â |
| − |    return false;
| Â |
| − |   };
| Â |
| − |  }
| Â |
| − |
| Â |
| − |  var divs = document.getElementsByTagName("div");
| Â |
| − |  var i = 0, j = 0;
| Â |
| − |  var units, search;
| Â |
| − |  var currentimage;
| Â |
| − |  var UnitNode;
| Â |
| − |  for (i = 0; i < divs.length; i++) {
| Â |
| − |   if (divs[i].className !== "ImageGroup") { continue; }
| Â |
| − |   UnitNode = undefined;
| Â |
| − |   search = divs[i].getElementsByTagName("div");
| Â |
| − |   for (j = 0; j < search.length; j++) {
| Â |
| − |    if (search[j].className !== "ImageGroupUnits") { continue; }
| Â |
| − |    UnitNode=search[j];
| Â |
| − |    break;
| Â |
| − |   }
| Â |
| − |   if (UnitNode === undefined) { continue; }
| Â |
| − |   units = [];
| Â |
| − |   for (j = 0 ; j < UnitNode.childNodes.length ; j++ ) {
| Â |
| − |    var temp = UnitNode.childNodes[j];
| Â |
| − |    if (temp.className === "center") { units.push(temp); }
| Â |
| − |   }
| Â |
| − |   var rightlink = undefined;
| Â |
| − |   var commentText = undefined;
| Â |
| − |   for (j = 0; j < units.length; j++) {
| Â |
| − |    currentimage = units[j];
| Â |
| − |    currentimage.id = "ImageGroupsGr" + i + "Im" + j;
| Â |
| − |    var leftlink = document.createElement("a");
| Â |
| − |    if (commentText !== undefined) {
| Â |
| − |     leftlink.setAttribute("title", commentText);
| Â |
| − |    }
| Â |
| − |    var comment;
| Â |
| − |    if (typeof(currentimage.getAttribute("title")) !== "string") {
| Â |
| − |     commentText = (j+1) + "/" + units.length;
| Â |
| − |     comment = document.createElement("tt").appendChild(document.createTextNode("("+ commentText + ")"));
| Â |
| − |    } else {
| Â |
| − |     commentText = currentimage.getAttribute("title");
| Â |
| − |     comment = document.createElement("span").appendChild(document.createTextNode(commentText));
| Â |
| − |     currentimage.removeAttribute("title");
| Â |
| − |    }
| Â |
| − |    if(rightlink !== undefined) {
| Â |
| − |     rightlink.setAttribute("title", commentText);
| Â |
| − |    }
| Â |
| − |    var imghead = document.createElement("div");
| Â |
| − |    rightlink = document.createElement("a");
| Â |
| − |    if (j !== 0) {
| Â |
| − |     leftlink.href = "#";
| Â |
| − |     leftlink.onclick = toggleImageFunction(i, j, j-1);
| Â |
| − |     leftlink.appendChild(document.createTextNode("◀"));
| Â |
| − |    }
| Â |
| − |    if (j !== units.length - 1) {
| Â |
| − |     rightlink.href = "#";
| Â |
| − |     rightlink.onclick = toggleImageFunction(i, j, j+1);
| Â |
| − |     rightlink.appendChild(document.createTextNode("▶"));
| Â |
| − |    }
| Â |
| − |    imghead.style["fontSize"] = "110%";
| Â |
| − |    imghead.style["fontweight"] = "bold";
| Â |
| − |    imghead.appendChild(leftlink);
| Â |
| − |    imghead.appendChild(document.createTextNode("\xA0"));
| Â |
| − |    imghead.appendChild(comment);
| Â |
| − |    imghead.appendChild(document.createTextNode("\xA0"));
| Â |
| − |    imghead.appendChild(rightlink);
| Â |
| − |    if (units.length > 1) {
| Â |
| − |     currentimage.insertBefore(imghead,currentimage.childNodes[0]);
| Â |
| − |    }
| Â |
| − |    if (j !== 0) {
| Â |
| − |     currentimage.style["display"] = "none";
| Â |
| − |    }
| Â |
| − |   }
| Â |
| − |  }
| Â |
| − | });
| Â |