Jump to content

User:0-pigeon/Gadget-map.js

From Wikipedia!

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
window.mapBigger = function() {
 var mapSizeA = $('.map-body').attr('id', 'map-class-ta');
 var mapSizeB = $('.map-body').attr('id', 'map-class-tb');
 var mapSizeC = $('.map-body').attr('id', 'map-class-tc');
 var mapSizeD = $('.map-body').attr('id', 'map-class-td');
  if (mapSizeA) {
   $('.map-body').attr('id', 'map-class-tb');
  }
  else if (mapSizeB) {
   $('.map-body').attr('id', 'map-class-tc');
  }
  else if (mapSizeC) {
   $('.map-body').attr('id', 'map-class-td');
  }
}
window.mapSmaller = function() {
 var mapSizeA = $('.map-body').attr('id', 'map-class-ta');
 var mapSizeB = $('.map-body').attr('id', 'map-class-tb');
 var mapSizeC = $('.map-body').attr('id', 'map-class-tc');
 var mapSizeD = $('.map-body').attr('id', 'map-class-td');
  if (mapSizeD) {
   $('.map-body').attr('id', 'map-class-tc');
  }
  else if (mapSizeB) {
   $('.map-body').attr('id', 'map-class-ta');
  }
  else if (mapSizeC) {
   $('.map-body').attr('id', 'map-class-tb');
  }
}

window.mapSizer = function() {
 var mapSizeA = $('.map-body').attr('id', 'map-class-ta');
 var mapSizeB = $('.map-body').attr('id', 'map-class-tb');
 var mapSizeC = $('.map-body').attr('id', 'map-class-tc');
 var mapSizeD = $('.map-body').attr('id', 'map-class-td');
  if (mapSizeA) {
   $('.map-body').attr('id', 'map-class-tb');
   window.mapSizeMode = 1
  }
  else if (mapSizeD) {
   $('.map-body').attr('id', 'map-class-tc');
   window.mapSizeMode = 0
  }
  else if (mapSizeB && window.mapSizeMode = 1) {
   $('.map-body').attr('id', 'map-class-tc');
  }
  else if (mapSizeB && window.mapSizeMode = 0) {
  $('.map-body').attr('id', 'map-class-ta');
  }
  else if (mapSizeC && window.mapSizeMode = 1) {
   $('.map-body').attr('id', 'map-class-td');
  }
  else if (mapSizeC && window.mapSizeMode = 0) {
   $('.map-body').attr('id', 'map-class-tb');
  }
}


/*
 
 var srca = $('#srca');

$(function() {
 var mapSizeA = $('.map-body').attr('id', 'map-class-ta');
 var mapSizeB = $('.map-body').attr('id', 'map-class-tb');
 var mapSizeC = $('.map-body').attr('id', 'map-class-tc');
 var mapSizeD = $('.map-body').attr('id', 'map-class-td');
*//* aa ab ac ad ae af ag
     ba bb bc bd be bf bg
     ca cb cc cd ce cf cg
     da db dc dd de df dg
     ea eb ec ed ee ef eg
     fa fb fc fd fe ff fg
     ga gb gc gg ge gf gg
  *//*
  if (mapSizeA) {
   var qtext = '<tr>'   '<td>'   '<a '   'href="javascript:mapSizer();">'   '<img src="'   src   '-'   {v}   '-'   {h}   '/>'   '</a>'   '</td>'   '</tr>'
  }
  else if (mapSizeB) {
   var qtext = '<tr>'   '<td>'   '<a '   'href="javascript:mapGoBack();">'   '<img src="'   src   '-'   {vc}   '-'   {hc}   '/>'   '</a>'   '</td>'   '<td>'   '<a '   'href="javascript:mapGoUp();">'   '<img src="'   src   '-'   {vd}   '-'   {hc}   '/>'   '</a>'   '</td>'   '<td>'   '<a '   'href="javascript:mapBigger();">'   '<img src="'   src   '-'   {vd}   '-'   {hc}   '/>'   '</a>'   '</td>'   '</tr>'
  


 var text = '<table '   'class="'   'maptable"'   '>'   '<tr>'   '<td colspan="0">'   '<table class="maptable-q">'   qtext   '</table>'   '</td>'   '</tr>'   '<tr>'   '<td id="linksa">'   linksa   '</td>'   '<td id="linksb">'   linksb   '</td>'   '<td id="linksc">'   linksc   '</td>'   '</tr>'   '</table>'

 $('.map-body').text(text)
}

*/
 var imageid = $('#imageid');
 var maxhimageid = $('#maxhimageid');
 var maxvimageid = $('#maxvimageid');


window.mapGoBack = function() {
 var currentimagevid = 0
 var currentimagehid = 0
  $('#mapP').text(text).replace(/{h}/g, currentimagehid).replace(/{v}/g, currentimagevid);
}


window.mapGoLeft = function() {
 if (currentimagehid != 0) {
  var h = Math.floor(currentimagehid - 1)
   $('#mapP').text(text).replace(/{h}/g, h).replace(/{v}/g, currentimagevid);
 }
 else {
  $('#mapP').text(text).replace(/{h}/g, maxhimageid).replace(/{v}/g, currentimagevid);
}


window.mapGoRight = function() {
 if (currentimagehid != maxhimageid) {
 var h = Math.floor(currentimagehid   1)
  $('#mapP').text(text).replace(/{h}/g, h).replace(/{v}/g, currentimagevid);
 }
 else {
  $('#mapP').text(text).replace(/{h}/g, 0).replace(/{v}/g, currentimagevid)
 }
}
window.mapGoDown = function() {
 if (currentimagehid != 0) {
  var v = Math.floor(currentimagevid - 1)
   $('#mapP').text(text).replace(/{v}/g, v).replace(/{h}/g, currentimagehid);
   var currentimagevid = v
 }
 else {
  $('#mapP').text(text).replace(/{v}/g, maxvimageid).replace(/{h}/g, currentimagehid);
}