לדלג לתוכן

מדיה ויקי:Gadget-rollBackSummary.js: הבדלים בין גרסאות בדף

מתוך צפונות ויקי
מאין תקציר עריכה
מאין תקציר עריכה
שורה 1: שורה 1:
var slideShowLinks;
var slideShowLinks;
var currentImage;
var currentImage;
function changeSlideShowImage(text) {
var slideshowimage = document.getElementById('slideshowimage');
var slideshowlinkright = document.getElementById('slideshowlinkright');
var slideshowlinkleft = document.getElementById('slideshowlinkleft');
var imagelink = document.getElementById('file').getElementsByTagName('A')[0].href;
}
function toggleSlideShowImage(direction) {
// figure out which image to load
var nextImage = currentImage;
if (direction) // = 1 = up
  nextImage++;
else // = 0 = down
  nextImage--;
// load image page
var a = sajax_init_object();
a.open('GET', wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(slideShowLinks[nextImage]) + 'action=render', true);
a.onreadystatechange = function() {
  if (a.readyState != 4) return;
  changeSlideShowImage(a.responseText);
  // alert("[" + a.status + ":" + a.statusText + "]\n" + a.responseText);
};
a.send(null);
}


function initSlideShow() {
function initSlideShow() {
שורה 16: שורה 44:


  var td1SS = document.createElement('TD');
  var td1SS = document.createElement('TD');
  td1SS.id = 'slideshowcontent';
  var img1SS = document.createElement('IMG');
img1SS.id = 'slideshowimage';
td1SS.appendChild(img1SS);
  var tr1SS = document.createElement('TR');
  var tr1SS = document.createElement('TR');
  tr1SS.appendChild(td1SS);
  tr1SS.appendChild(td1SS);
שורה 29: שורה 59:


  var a2SS = document.createElement('A');
  var a2SS = document.createElement('A');
  a2SS.id = 'slideshowlinkleft';
  a2SS.id = 'slideshowlinkright';
  a2SS.href = 'javascript:toggleSlideShowImage(0)'; 0 = right/down
  a2SS.href = 'javascript:toggleSlideShowImage(0)'; 0 = right/down
  a2SS.innerHTML = '<';
  a2SS.innerHTML = '<';

גרסה מ־16:21, 21 באוגוסט 2008

var slideShowLinks;
var currentImage;

function changeSlideShowImage(text) {
 var slideshowimage = document.getElementById('slideshowimage');
 var slideshowlinkright = document.getElementById('slideshowlinkright');
 var slideshowlinkleft = document.getElementById('slideshowlinkleft');

 var imagelink = document.getElementById('file').getElementsByTagName('A')[0].href;
 
}

function toggleSlideShowImage(direction) {
 // figure out which image to load
 var nextImage = currentImage;
 if (direction) // = 1 = up
  nextImage++;
 else // = 0 = down
  nextImage--;
 
 // load image page
 var a = sajax_init_object();
 a.open('GET', wgServer + wgScriptPath + '/index.php?title=' + encodeURIComponent(slideShowLinks[nextImage]) + 'action=render', true);
 a.onreadystatechange = function() {
  if (a.readyState != 4) return;
  changeSlideShowImage(a.responseText);
  // alert("[" + a.status + ":" + a.statusText + "]\n" + a.responseText);
 };
 a.send(null);
}

function initSlideShow() {
 if (!(wgPageName == 'מיוחד:כל_הדפים' && getParamValue('namespace') == 6)) return;

 // get all link in page and remove non-images
 slideShowLinks = document.getElementsByTagName('A');
 for (var i = 0; i < slideShowLinks.length; i++)
  if (slideShowLinks[i].title.indexOf('תמונה:') != 0)
   slideShowLinks.splice(i, 1);

 // create the frame, hide almost everything else
 var tables = document.getElementById('bodyContent').getElementsByTagName('TABLE');
 tables[2].style.display = 'none';

 var td1SS = document.createElement('TD');
 var img1SS = document.createElement('IMG');
 img1SS.id = 'slideshowimage';
 td1SS.appendChild(img1SS);
 var tr1SS = document.createElement('TR');
 tr1SS.appendChild(td1SS);

 var td2SS = document.createElement('TD');
 td2SS.className = 'slideShowLinks';

 var a1SS = document.createElement('A');
 a1SS.id = 'slideshowlinkleft';
 a1SS.href = 'javascript:toggleSlideShowImage(1)'; 1 = left/up
 a1SS.innerHTML = '>';

 var a2SS = document.createElement('A');
 a2SS.id = 'slideshowlinkright';
 a2SS.href = 'javascript:toggleSlideShowImage(0)'; 0 = right/down
 a2SS.innerHTML = '<';

 td2SS.appendChild(a1SS);
 td2SS.appendChild(document.createTextNode(' | '));
 td2SS.appendChild(a2SS);

 var tr2SS = document.createElement('TR');
 tr2SS.appendChild(td2SS);
 var tbodySS = document.createElement('TBODY');
 tbodySS.appendChild(tr1SS);
 tbodySS.appendChild(tr2SS);
 var tableSS = document.createElement('TABLE');
 tableSS.className = 'slideshowTable';
 tableSS.appendChild(tbodySS);
 tables[2].parentNode.insertBefore(tableSS, tables[2]);

 // start the show
 currentImage = 1;
 toggleSlideShowImage(0);
}