tabs2spaces in global.js

This commit is contained in:
Sarjuuk
2015-08-06 12:49:38 +02:00
parent bfa1f261e0
commit 38ac7b1dcb

View File

@@ -18696,296 +18696,296 @@ var g_zone_areas = {};
var MapViewer = new function() var MapViewer = new function()
{ {
var imgWidth, var imgWidth,
imgHeight, imgHeight,
scale, scale,
desiredScale, desiredScale,
mapper, mapper,
oldOnClick, oldOnClick,
oldOnUpdate, oldOnUpdate,
oldParent, oldParent,
oldSibling, oldSibling,
tempParent, tempParent,
placeholder, placeholder,
container, container,
screen, screen,
imgDiv, imgDiv,
aCover; aCover;
function computeDimensions() function computeDimensions()
{ {
var availHeight = Math.max(50, Math.min(618, $WH.g_getWindowSize().h - 72)); var availHeight = Math.max(50, Math.min(618, $WH.g_getWindowSize().h - 72));
desiredScale = 1; desiredScale = 1;
scale = 1;//Math.min(1, availHeight / 515); scale = 1;//Math.min(1, availHeight / 515);
// no scaling because it doesnt work with background images // no scaling because it doesnt work with background images
if(desiredScale > 1) if(desiredScale > 1)
desiredScale = 1; desiredScale = 1;
if(scale > 1) if(scale > 1)
scale = 1; scale = 1;
imgWidth = Math.round(scale * 772); imgWidth = Math.round(scale * 772);
imgHeight = Math.round(scale * 515); imgHeight = Math.round(scale * 515);
var lbWidth = Math.max(480, imgWidth); var lbWidth = Math.max(480, imgWidth);
Lightbox.setSize(lbWidth + 20, imgHeight + 52); Lightbox.setSize(lbWidth + 20, imgHeight + 52);
} }
function getPound(extra) function getPound(extra)
{ {
var extraBits = function(map, s) var extraBits = function(map, s)
{ {
s += ':' + map.zone; s += ':' + map.zone;
if(map.level) if(map.level)
s += '.' + map.level; s += '.' + map.level;
return s; return s;
}; };
var buff = '#map'; var buff = '#map';
if(tempParent) if(tempParent)
buff += '=' + mapper.getLink(); buff += '=' + mapper.getLink();
else if(Mapper.zoneDefaultLevel[mapper.zone]) else if(Mapper.zoneDefaultLevel[mapper.zone])
{ {
if(Mapper.zoneDefaultLevel[mapper.zone] != mapper.level) if(Mapper.zoneDefaultLevel[mapper.zone] != mapper.level)
buff = extraBits(mapper, buff); buff = extraBits(mapper, buff);
} }
else if(mapper.level != 0) else if(mapper.level != 0)
buff = extraBits(mapper, buff); buff = extraBits(mapper, buff);
else if((!$WH.isset('g_mapperData') || !g_mapperData[mapper.zone]) && (!$WH.isset('g_mapper_data') || !g_mapper_data[mapper.zone])) else if((!$WH.isset('g_mapperData') || !g_mapperData[mapper.zone]) && (!$WH.isset('g_mapper_data') || !g_mapper_data[mapper.zone]))
buff = extraBits(mapper, buff); buff = extraBits(mapper, buff);
return buff; return buff;
} }
function onUpdate() function onUpdate()
{ {
if(oldOnUpdate) if(oldOnUpdate)
oldOnUpdate(mapper); oldOnUpdate(mapper);
location.replace(getPound(true)); location.replace(getPound(true));
} }
function render(resizing) function render(resizing)
{ {
if(resizing && (scale == desiredScale) && $WH.g_getWindowSize().h > container.offsetHeight) if(resizing && (scale == desiredScale) && $WH.g_getWindowSize().h > container.offsetHeight)
return; return;
container.style.visibility = 'hidden'; container.style.visibility = 'hidden';
computeDimensions(0); computeDimensions(0);
if(!resizing) if(!resizing)
{ {
if(!placeholder) if(!placeholder)
{ {
placeholder = $WH.ce('div'); placeholder = $WH.ce('div');
placeholder.style.height = '325px'; placeholder.style.height = '325px';
placeholder.style.padding = '3px'; placeholder.style.padding = '3px';
placeholder.style.marginTop = '10px'; placeholder.style.marginTop = '10px';
} }
mapper.parent.style.borderWidth = '0px'; mapper.parent.style.borderWidth = '0px';
mapper.parent.style.marginTop = '0px'; mapper.parent.style.marginTop = '0px';
mapper.span.style.cursor = 'pointer'; mapper.span.style.cursor = 'pointer';
if(mapper.span.onclick) if(mapper.span.onclick)
oldOnClick = mapper.span.onclick; oldOnClick = mapper.span.onclick;
mapper.span.onclick = Lightbox.hide; mapper.span.onclick = Lightbox.hide;
mapper.span.onmouseover = function() { aCover.style.display = 'block'; }; mapper.span.onmouseover = function() { aCover.style.display = 'block'; };
mapper.span.onmouseout = function() { setTimeout(function() { if(!aCover.hasMouse) aCover.style.display = 'none'; }, 10); }; mapper.span.onmouseout = function() { setTimeout(function() { if(!aCover.hasMouse) aCover.style.display = 'none'; }, 10); };
if(mapper.onMapUpdate) if(mapper.onMapUpdate)
oldOnUpdate = mapper.onMapUpdate; oldOnUpdate = mapper.onMapUpdate;
mapper.onMapUpdate = onUpdate; mapper.onMapUpdate = onUpdate;
if(!tempParent) if(!tempParent)
{ {
oldParent = mapper.parent.parentNode; oldParent = mapper.parent.parentNode;
oldSibling = mapper.parent.nextSibling; oldSibling = mapper.parent.nextSibling;
oldParent.insertBefore(placeholder, mapper.parent); oldParent.insertBefore(placeholder, mapper.parent);
$WH.de(mapper.parent); $WH.de(mapper.parent);
$WH.ae(mapDiv, mapper.parent); $WH.ae(mapDiv, mapper.parent);
} }
else else
{ {
$WH.de(tempParent); $WH.de(tempParent);
$WH.ae(mapDiv, tempParent); $WH.ae(mapDiv, tempParent);
} }
if(location.hash.indexOf('#show') == -1) if(location.hash.indexOf('#show') == -1)
location.replace(getPound(false)); location.replace(getPound(false));
else if($WH.isset('mapShower')) else if($WH.isset('mapShower'))
mapShower.onExpand(); mapShower.onExpand();
} }
Lightbox.reveal(); Lightbox.reveal();
container.style.visibility = 'visible'; container.style.visibility = 'visible';
} }
function onResize() function onResize()
{ {
render(1); render(1);
} }
function onHide() function onHide()
{ {
if(oldOnClick) if(oldOnClick)
mapper.span.onclick = oldOnClick; mapper.span.onclick = oldOnClick;
else else
mapper.span.onclick = null; mapper.span.onclick = null;
oldOnClick = null; oldOnClick = null;
if(oldOnUpdate) if(oldOnUpdate)
mapper.onMapUpdate = oldOnUpdate mapper.onMapUpdate = oldOnUpdate
else else
mapper.onMapUpdate = null; mapper.onMapUpdate = null;
oldOnUpdate = null; oldOnUpdate = null;
mapper.span.style.cursor = ''; mapper.span.style.cursor = '';
mapper.span.onmouseover = null; mapper.span.onmouseover = null;
mapper.span.onmouseout = null; mapper.span.onmouseout = null;
if(!tempParent) if(!tempParent)
{ {
$WH.de(placeholder); $WH.de(placeholder);
$WH.de(mapper.parent); $WH.de(mapper.parent);
mapper.parent.style.borderWidth = ''; mapper.parent.style.borderWidth = '';
mapper.parent.style.marginTop = ''; mapper.parent.style.marginTop = '';
if(oldSibling) if(oldSibling)
oldParent.insertBefore(mapper.parent, oldSibling); oldParent.insertBefore(mapper.parent, oldSibling);
else else
$WH.ae(oldParent, mapper.parent); $WH.ae(oldParent, mapper.parent);
oldParent = oldSibling = null; oldParent = oldSibling = null;
} }
else else
{ {
$WH.de(tempParent); $WH.de(tempParent);
tempParent = null; tempParent = null;
} }
mapper.toggleZoom(); mapper.toggleZoom();
if(location.hash.indexOf('#show') == -1) if(location.hash.indexOf('#show') == -1)
location.replace('#.'); location.replace('#.');
else if($WH.isset('mapShower')) else if($WH.isset('mapShower'))
mapShower.onCollapse(); mapShower.onCollapse();
} }
function onShow(dest, first, opt) function onShow(dest, first, opt)
{ {
mapper = opt.mapper; mapper = opt.mapper;
container = dest; container = dest;
if(first) if(first)
{ {
dest.className = 'mapviewer'; dest.className = 'mapviewer';
screen = $WH.ce('div'); screen = $WH.ce('div');
screen.style.width = '772px'; screen.style.width = '772px';
screen.style.height = '515px'; screen.style.height = '515px';
screen.className = 'mapviewer-screen'; screen.className = 'mapviewer-screen';
aCover = $WH.ce('a'); aCover = $WH.ce('a');
aCover.className = 'mapviewer-cover'; aCover.className = 'mapviewer-cover';
aCover.href = 'javascript:;'; aCover.href = 'javascript:;';
aCover.onclick = Lightbox.hide; aCover.onclick = Lightbox.hide;
aCover.onmouseover = function() { aCover.hasMouse = true; }; aCover.onmouseover = function() { aCover.hasMouse = true; };
aCover.onmouseout = function() { aCover.hasMouse = false; }; aCover.onmouseout = function() { aCover.hasMouse = false; };
var foo = $WH.ce('span'); var foo = $WH.ce('span');
var b = $WH.ce('b'); var b = $WH.ce('b');
$WH.ae(b, $WH.ct(LANG.close)); $WH.ae(b, $WH.ct(LANG.close));
$WH.ae(foo, b); $WH.ae(foo, b);
$WH.ae(aCover, foo); $WH.ae(aCover, foo);
$WH.ae(screen, aCover); $WH.ae(screen, aCover);
mapDiv = $WH.ce('div'); mapDiv = $WH.ce('div');
$WH.ae(screen, mapDiv); $WH.ae(screen, mapDiv);
$WH.ae(dest, screen); $WH.ae(dest, screen);
var aClose = $WH.ce('a'); var aClose = $WH.ce('a');
// aClose.className = 'dialog-x'; // aClose.className = 'dialog-x';
aClose.className = 'dialog-cancel'; aClose.className = 'dialog-cancel';
aClose.href = 'javascript:;'; aClose.href = 'javascript:;';
aClose.onclick = Lightbox.hide; aClose.onclick = Lightbox.hide;
$WH.ae(aClose, $WH.ct(LANG.close)); $WH.ae(aClose, $WH.ct(LANG.close));
$WH.ae(dest, aClose); $WH.ae(dest, aClose);
var d = $WH.ce('div'); var d = $WH.ce('div');
d.className = 'clear'; d.className = 'clear';
$WH.ae(dest, d); $WH.ae(dest, d);
} }
onRender(); onRender();
} }
function onRender() function onRender()
{ {
render(); render();
} }
this.checkPound = function() this.checkPound = function()
{ {
if(location.hash && location.hash.indexOf('#map') == 0) if(location.hash && location.hash.indexOf('#map') == 0)
{ {
var parts = location.hash.split('='); var parts = location.hash.split('=');
if(parts.length == 2) if(parts.length == 2)
{ {
var link = parts[1]; var link = parts[1];
if(link) if(link)
{ {
/*tempParent = $WH.ce('div'); /*tempParent = $WH.ce('div');
tempParent.id = 'fewuiojfdksl'; tempParent.id = 'fewuiojfdksl';
$WH.ae(document.body, tempParent); $WH.ae(document.body, tempParent);
var map = new Mapper({ parent: tempParent.id }); var map = new Mapper({ parent: tempParent.id });
map.setLink(link, true); map.setLink(link, true);
map.toggleZoom();*/ map.toggleZoom();*/
MapViewer.show({ link: link }); MapViewer.show({ link: link });
} }
} }
else else
{ {
parts = location.hash.split(':'); parts = location.hash.split(':');
var map = $WH.ge('sjdhfkljawelis'); var map = $WH.ge('sjdhfkljawelis');
if(map) if(map)
map.onclick(); map.onclick();
if(parts.length == 2) if(parts.length == 2)
{ {
if(!map) if(!map)
MapViewer.show({ link: parts[1]}); MapViewer.show({ link: parts[1]});
var subparts = parts[1].split('.'); var subparts = parts[1].split('.');
var opts = { zone: subparts[0] }; var opts = { zone: subparts[0] };
if(subparts.length == 2) if(subparts.length == 2)
opts.level = parseInt(subparts[1])+1; opts.level = parseInt(subparts[1])+1;
mapper.update(opts); mapper.update(opts);
//if(Mapper.multiLevelZones[mapper.zone]) //if(Mapper.multiLevelZones[mapper.zone])
// mapper.setMap(Mapper.multiLevelZones[mapper.zone][floor], floor, true); // mapper.setMap(Mapper.multiLevelZones[mapper.zone][floor], floor, true);
} }
} }
} }
} }
this.show = function(opt) this.show = function(opt)
{ {
if(opt.link) if(opt.link)
{ {
tempParent = $WH.ce('div'); tempParent = $WH.ce('div');
tempParent.id = 'fewuiojfdksl'; tempParent.id = 'fewuiojfdksl';
$WH.ae(document.body, tempParent); $WH.ae(document.body, tempParent);
var map = new Mapper({ parent: tempParent.id }); var map = new Mapper({ parent: tempParent.id });
map.setLink(opt.link, true); map.setLink(opt.link, true);
map.toggleZoom(); map.toggleZoom();
} }
else else
Lightbox.show('mapviewer', { onShow: onShow, onHide: onHide, onResize: onResize }, opt); Lightbox.show('mapviewer', { onShow: onShow, onHide: onHide, onResize: onResize }, opt);
} }
$(document).ready(this.checkPound); $(document).ready(this.checkPound);
}; };
var ModelViewer = new function() { var ModelViewer = new function() {