﻿/*page.js*/
function Page() { var a; this.init() };
/*page.maps.js*/
Page.prototype.Map = function (c) { var b, a, d; d = this.Map; b = false; this.Map.companyName = "eworx Network and Internet GmbH"; this.Map.selector = "#map_canvas"; this.Map.inputSelector = "#saddr"; this.Map.buttonSelector = "#calcRoute"; this.Map.directionSelector = "#map_directions"; this.Map.zoom = 10; this.Map.destinationAddress = "Hanriederstraße 25, 4150 Rohrbach"; this.Map.marker = []; this.Map.info = []; this.Map.infoState = []; this.Map.infoTmpl = "<strong>[name]</strong><br/>[address]"; this.Map.addressTmpl = '<div class="address">[address]</div>'; this.Map.stepTmpl = '<div class="step"><span class="number">[number].</span><span class="distance">[distance]</span><span class="instructions">[instructions]</span></div>'; this.Map.directionTmpl = '[start]<div class="total">[distance]/[time]</div>[steps][destination]'; if (c === undefined) { c = {} } if ($(this.Map.selector).length > 0) { if (window.google === undefined) { $.getScript("http://maps.google.com/maps/api/js?sensor=false&language=" + this.language, function () { if (d.setup(c) === false) { $("body").removeClass("Map") } }) } else { if (this.Map.setup(c) === false) { b = true } if (!b) { $("body").addClass("Map") } } } }; Page.prototype.Map.setup = function (b) { var a; a = false; if (b !== undefined) { this.selector = b.selector === undefined ? this.selector : b.selector; this.zoom = b.zoom || this.zoom; this.destinationAddress = b.destination === undefined ? this.destinationAddress : b.destination; this.inputSelector = b.input === undefined ? this.inputSelector : b.input; this.buttonSelector = b.button === undefined ? this.buttonSelector : b.button; this.directionSelector = b.direction === undefined ? this.directionSelector : b.direction; this.companyName = b.name === undefined ? this.companyName : b.name; this.infoTmpl = b.infoTemplate === undefined ? this.infoTmpl : b.infoTemplate; this.addressTmpl = b.addressTemplate === undefined ? this.addressTmpl : b.addressTemplate; this.stepTmpl = b.stepTemplate === undefined ? this.stepTmpl : b.stepTemplate; this.directionTmpl = b.directionTemplate === undefined ? this.directionTmpl : b.directionTemplate } if (window.google === undefined) { alert("error: no google object found."); a = true } else { if (window.google.maps === undefined) { alert("error: no google maps object found."); a = true } } if (!a) { this.geocoder = new google.maps.Geocoder(); this.directionsService = new google.maps.DirectionsService(); this.directionsDisplay = new google.maps.DirectionsRenderer(); this.input = $(this.inputSelector); this.button = $(this.buttonSelector); this.init() } return true }; Page.prototype.Map.companyName = null; Page.prototype.Map.selector = null; Page.prototype.Map.input = null; Page.prototype.Map.inputSelector = null; Page.prototype.Map.button = null; Page.prototype.Map.buttonSelector = null; Page.prototype.Map.zoom = null; Page.prototype.Map.map = null; Page.prototype.Map.geocoder = null; Page.prototype.Map.directionsService = null; Page.prototype.Map.directionsDisplay = null; Page.prototype.Map.marker = null; Page.prototype.Map.info = null; Page.prototype.Map.infoState = null; Page.prototype.Map.destinationAddress = null; Page.prototype.Map.destination = null; Page.prototype.Map.directionSelector = null; Page.prototype.Map.direction = null; Page.prototype.Map.stepTmpl = ""; Page.prototype.Map.addressTmpl = ""; Page.prototype.Map.infoTmpl = ""; Page.prototype.Map.init = function () { var b, a, d, e, c; d = this; b = $(this.selector); e = this.input.val(); a = { zoom: this.zoom, mapTypeId: google.maps.MapTypeId.ROADMAP }; if (b) { b.css({ width: "100%", height: "100%" }); this.button.click(function () { if (d.input.val() != "") { d.route(d.input.val(), d.destinationAddress) } return false }); this.input.keydown(function (f) { if (f.keyCode == "13") { d.button.trigger("click"); return false } }); this.map = new google.maps.Map(b.get(0), a); this.directionsDisplay.setMap(this.map); if (e) { this.route(e, this.destinationAddress) } else { this.showDestAddress() } } }; Page.prototype.Map.route = function (d, a) { var b, c; this.removeError(); _map = this; if (d != "" && a != "") { if (this.marker) { this.clearMarker } b = { origin: d, destination: a, travelMode: google.maps.DirectionsTravelMode.DRIVING }; this.directionsService.route(b, function (e, f) { var h, g, k; if (f == google.maps.DirectionsStatus.OK) { _map.directionsDisplay.setDirections(e); _map.removeError(); h = e.routes[0].legs[0]; g = h.steps; k = ""; for (var j = 0; j < g.length; j++) { k += _map.stepTmpl.replace(/\[number\]/g, j + 1).replace(/\[instructions\]/g, g[j].instructions).replace(/\[distance\]/g, g[j].distance.text) } k = _map.directionTmpl.replace(/\[steps\]/g, k); k = k.replace(/\[start\]/g, _map.addressTmpl.replace(/\[address\]/g, h.start_address)).replace(/\[destination\]/g, _map.addressTmpl.replace(/\[address\]/g, h.end_address)).replace(/\[distance\]/g, h.distance.text).replace(/\[time\]/g, h.duration.text); _map.direction = $(_map.directionSelector); if (_map.direction.length > 0) { _map.direction.html(k) } } else { _map.showError(); _map.resetMap(); _map.showDestAddress() } }); return true } else { return false } }; Page.prototype.Map.toggleInfo = function (a) { if (this.infoState[a] === "undefined") { this.infoState[a] = 1 } else { if (this.infoState[a] === 1) { this.infoState[a] = 0 } else { this.infoState[a] = 1 } } if (this.infoState[a] === 1) { this.info[a].open(this.map, this.marker[a]) } else { this.info[a].close(this.map) } }; Page.prototype.Map.showDestAddress = function () { _map = this; this.geocoder.geocode({ address: this.destinationAddress }, function (b, a) { if (a == google.maps.GeocoderStatus.OK) { _map.map.setCenter(b[0].geometry.location); _map.marker[0] = new google.maps.Marker({ position: b[0].geometry.location, title: _map.companyName + " - " + _map.destinationAddress }); _map.info[0] = new google.maps.InfoWindow({ content: _map.infoTmpl.replace(/\[name\]/g, _map.companyName).replace(/\[address\]/g, _map.destinationAddress) }); google.maps.event.addListener(_map.marker[0], "click", function () { _map.toggleInfo(0) }); _map.marker[0].setMap(_map.map) } }) }; Page.prototype.Map.showError = function () { var a; a = $(this.selector).parent(); if (a.find(".mapsError").length === 0) { a.append('<div class="mapsError" style="background:#c00;color:#fff;opacity:0.8;position:absolute;left:0;top:0;width:100%;padding:5px 0;text-align:center;">Die eingebene Adresse wurde nicht gefunden.</div>') } }; Page.prototype.Map.removeError = function () { $(this.selector).parent().find(".mapsError").remove() }; Page.prototype.Map.clearMarker = function () { var a; for (a = 0; a < this.marker.length; a++) { this.marker[a].setMap(null) } }; Page.prototype.Map.resetMap = function () { this.clearMarker(); this.directionsDisplay.setMap(null); this.directionsDisplay = new google.maps.DirectionsRenderer(); this.directionsDisplay.setMap(this.map) };
/*page.slideshow.js*/
Page.prototype.Slideshow = function (a) { if (this.Slideshow.debug) { console.log("slideshow started") } if (a === undefined) { a = {} } if (this.Slideshow.debug) { console.log(a) } if (this.Slideshow.setup(a) === false) { } }; Page.prototype.Slideshow.debug = false; Page.prototype.Slideshow.obj = null; Page.prototype.Slideshow.objSelector = null; Page.prototype.Slideshow.btnObj = null; Page.prototype.Slideshow.btnSelector = ".button"; Page.prototype.Slideshow.items = []; Page.prototype.Slideshow.canvas = null; Page.prototype.Slideshow.canvasSelector = ".canvas"; Page.prototype.Slideshow.limitOffset = -1; Page.prototype.Slideshow.minImgCount = 2; Page.prototype.Slideshow.btnInactiveClass = "inactive"; Page.prototype.Slideshow.templButton = '<a class="button[class]" goto="[value]"><span class="inner">[content]</span></a>'; Page.prototype.Slideshow.templButtonCtrl = '<div class="controls">[prevBtn][nextBtn]</div>'; Page.prototype.Slideshow.index = 0; Page.prototype.Slideshow.setup = function (b) { var a; a = false; if (this.debug) { console.log("setup called") } this.objSelector = "#slideshow"; this.index = 0; if (b !== undefined) { this.objSelector = b.selector === undefined ? this.objSelector : b.selector } this.obj = $(this.objSelector); if (this.debug) { console.log(this.obj) } this.items = this.obj.find("li"); if (this.debug) { console.log(this.items) } this.canvas = this.obj.find(this.canvasSelector).first(); if (this.debug) { console.log(this.canvas) } if (this.debug) { console.log("setup error: " + a) } if (a === false) { this.obj.addClass("run"); this.init() } return true }; Page.prototype.Slideshow.init = function () { var d, c, a, b; d = ""; c = ""; a = ""; b = this; if (this.items.length > this.minImgCount) { c = this.templButton.replace(/\[content\]/g, "Vorheriges").replace(/\[class\]/g, " prev").replace(/\[value\]/g, "-1"); a = this.templButton.replace(/\[content\]/g, "Nächstes").replace(/\[class\]/g, " next").replace(/\[value\]/g, "1"); d = this.templButtonCtrl.replace(/\[prevBtn\]/g, c).replace(/\[nextBtn\]/g, a); this.obj.append(d); this.obj.find(this.btnSelector).click(function () { b.go(this) }); this.canvas.css({ position: "relative" }); if (this.debug) { console.log("buttons"); console.log(this.obj.find(this.btnSelector)) } } }; Page.prototype.Slideshow.go = function (b) { var c, d, a; a = this.items.length + this.limitOffset; if (this.debug) { console.log("goto"); console.log(b); console.log(a) } if (b !== NaN) { c = $(b); if (c.length > 0) { d = parseInt(c.attr("goto"), 10); if (d !== NaN) { this.index += d; this.index = this.checkLimits(this.index, a, true) } } } else { this.index = b; this.index = this.checkLimits(this.index, a, true) } this.setCanvasPosition(this.index); if (this.debug) { console.log(this.index) } }; Page.prototype.Slideshow.checkLimits = function (c, a, b) { var d = 0; if (c !== NaN && a != NaN) { d = c; if (b === true) { if (c >= a) { d = 0 } if (c < 0) { d = a - 1 } } else { if (c >= a) { d = a - 1 } if (c < 0) { d = 0 } } } return d }; Page.prototype.Slideshow.setCanvasPosition = function (b) { var d, c, a; c = $(this.items[b]); if (c.length > 0) { a = c.position(); d = 0; d = parseInt(a.left, 10); d *= -1; d += "px"; this.canvas.stop().animate({ left: d }, 500); return true } else { return false } };
/*page.init.js*/
$(function () { var a = new Page(); if (!$("body").hasClass("EditMode")) { $("a[rel^=prettyPhoto]").prettyPhoto({ overlay_gallery: false, theme: "facebook", social_tools: "" }); $("a[rel=popup], a[name=popup]").prettyPhoto({ overlay_gallery: false, theme: "facebook", social_tools: "" }) } $("#jsLink").css("display", "inline"); $(".backLink a").click(function () { history.back(); return false }) }); Page.prototype.init = function () { var a = this; this.language = "de"; this.Map({ name: "Upper Austria Research GmbH", destination: "Hafenstraße 47-51, 4020 Linz, Bauteil B, Stiege 2, 2.Stock" }); this.Slideshow({ useDatasource: false }) };
