var CFG_DOMAIN_URL = "http://www.dermandar.com/"; var CFG_STATIC_DOMAIN_URL = "http://static.dermandar.com/"; if (window.location.protocol == "https:") { CFG_DOMAIN_URL = "https://www.dermandar.com/"; CFG_STATIC_DOMAIN_URL = "https://static.dermandar.com/"; } var iconSelf = new google.maps.MarkerImage( CFG_STATIC_DOMAIN_URL+"design/images/markers/forest_green.png", new google.maps.Size(16, 32), new google.maps.Point(0, 0), new google.maps.Point(8, 28) ); var iconRecent = new google.maps.MarkerImage( CFG_STATIC_DOMAIN_URL+"design/images/markers/azure.png", new google.maps.Size(16, 32), new google.maps.Point(0, 0), new google.maps.Point(8, 28) ); var iconOthers = new google.maps.MarkerImage( CFG_STATIC_DOMAIN_URL+"design/images/markers/crimson.png", new google.maps.Size(16, 32), new google.maps.Point(0, 0), new google.maps.Point(8, 28) ); var iconShadow = new google.maps.MarkerImage( CFG_STATIC_DOMAIN_URL+"design/images/markers/shadow.png", new google.maps.Size(30, 32), new google.maps.Point(0, 0), new google.maps.Point(8, 28) ); function dmd_HTML5SupportDetection() { var parentDiv=document.createElement("div"); $("#s_t").append(parentDiv); parentDiv.style.position="absolute"; parentDiv.style.display="block"; parentDiv.style.width="200px"; parentDiv.style.height="200px"; parentDiv.style.left="0px"; parentDiv.style.top="0px"; parentDiv.style.backgroundColor="black"; //parentDiv.style.WebkitPerspective="200px"; parentDiv.style.WebkitTransformStyle="preserve-3d"; var childDiv=document.createElement("div"); parentDiv.appendChild(childDiv); childDiv.style.position="absolute"; childDiv.style.display="block"; childDiv.style.width="100px"; childDiv.style.height="100px"; childDiv.style.left="0px"; childDiv.style.top="0px"; childDiv.style.WebkitTransform="rotateY(19deg)"; childDiv.style.backgroundColor="red"; childDiv.style.WebkitTransformStyle="preserve-3d"; var old_pos={}; old_pos.left=$(childDiv).offset().left; old_pos.top=$(childDiv).offset().top; parentDiv.style.WebkitPerspective="100px"; var new_pos={}; new_pos.left=$(childDiv).offset().left; new_pos.top=$(childDiv).offset().top; $("#s_t").remove(); if ((Math.abs(old_pos.left-new_pos.left) > 1E-3) || (Math.abs(old_pos.top-new_pos.top) > 1E-3)) { return true; } else { return false; } }; $(function() { var test = document.createElement("input"); var placeHolderSupported = ("placeholder" in test); if(!placeHolderSupported) { var active = document.activeElement; $(":text").focus(function () { if ($(this).attr("placeholder") != "" && $(this).val() == $(this).attr("placeholder")) { $(this).val("").removeClass("hasPlaceholder"); } }).blur(function () { if ($(this).attr("placeholder") != "" && ($(this).val() == "" || $(this).val() == $(this).attr("placeholder"))) { $(this).val($(this).attr("placeholder")).addClass("hasPlaceholder"); } }); $(":text").blur(); $(active).focus(); $("form").submit(function () { $(this).find(".hasPlaceholder").each(function() { $(this).val(""); }); }); } }); function PanoramaListing(container) { this.views = {}; this.container = container; this.initialize = function() { this.dom = document.createElement("div"); this.dom.id = "selection"; var tabDiv = document.createElement("div"); $(tabDiv).addClass("tabsBox"); $(this.dom).append(tabDiv); this.tabs = document.createElement("ul"); $(this.tabs).addClass("selectionTabs").addClass("vui-button-group"); $(tabDiv).append(this.tabs); this.viewport = document.createElement("div"); $(this.dom).append(this.viewport); var _this = this; $(function() { $("#" + _this.container).append(_this.dom); if (typeof _this.defaultViewType != "undefined") { $(_this.setView(_this.defaultViewType)); } }); } this.addSection = function(name, type, isDefault, settings) { var view = new PanoramaListingSection(name, type, settings); this.views[type] = view; var _this = this; $(view.anchor).click(function() { _this.setView(view.type); }); $(this.tabs).append(view.tab); $(this.viewport).append(view.dom); if (isDefault) { this.defaultViewType = type; } return view; } this.setView = function(type) { if (typeof this.currentView != "undefined") { if (this.currentView.type == type) { return; } this.currentView.setVisible(false); } this.currentView = this.views[type]; this.currentView.setVisible(true); } this.initialize(); } function PanoramaListingSection(name, type, settings) { this.name = name; this.type = type; this.limit = 8; this.offset = 0; this.everLoaded = false; this.settings = settings || {}; this.initialize = function() { this.createTab(); this.createView(); } this.setVisible = function(visible) { if (visible) { $(this.dom).show(); } else { $(this.dom).hide(); } this.setSelected(visible); if (visible & !this.everLoaded) { this.everLoaded = true; this.loadData(); } } this.createView = function() { this.dom = document.createElement("div"); this.list = document.createElement("ul"); $(this.list).addClass("listing"); $(this.dom).append(this.list); $(this.dom).append('
'); this.moreButton = document.createElement("a"); this.moreButton.href = "javascript:void(0)"; $(this.moreButton).addClass("vui-button").addClass("loadMore"); $(this.moreButton).html("Load more " + this.name); $(this.moreButton).hide(); this.loader = document.createElement("div"); $(this.loader).addClass("listingLoader"); $(this.loader).html(" "); $(this.dom).append(this.loader); var _this = this; $(this.moreButton).click(function() { _this.loadMore(); }); $(this.dom).append(this.moreButton); $(this.loader).hide(); $(this.dom).hide(); } this.setLoading = function(loading) { if (loading) { $(this.loader).show(); $(this.moreButton).hide(); } else { $(this.loader).hide(); } } this.loadMore = function() { this.offset += this.limit; this.loadData(); } this.loadData = function() { this.setLoading(true); var _this = this; var url = "/api/browse/" + this.type; switch (this.type) { case "user": url += "/" + this.settings.username; break; case "nearby": url += "/" + geoip_latitude() + "/" + geoip_longitude(); break; case "keyword": url += "/" + encodeURIComponent(this.query); break; case "related": url += "/" + this.settings.panoid; break; } url += "/" + this.offset + "/" + this.limit + "/"; //url += Math.random(); $.getJSON(url, function(data) { _this.renderData(data); }); } this.renderData = function(data) { for (var panoKey in data.panos) { var pano = data.panos[panoKey]; this.renderPano(pano); } this.setLoading(false); if (data.max_results > this.offset + this.limit) { $(this.moreButton).css("display", "block"); } } this.renderPano = function(pano) { var li = renderPanorama(pano, "li"); $(this.list).append(li); } this.createTab = function() { this.tab = document.createElement("li"); this.anchor = document.createElement("a"); $(this.anchor).addClass("vui-button"); $(this.anchor).html(this.name); $(this.tab).append(this.anchor); } this.setSelected = function(selected) { if (selected) { $(this.anchor).addClass("vui-state-active"); } else { $(this.anchor).removeClass("vui-state-active"); } } this.initialize(); } function renderPanorama(pano, elementType, options) { var defaults = { width: 200, hoverable: true } var options = $.extend({}, defaults, options); var li = document.createElement(elementType); var thumbDiv = document.createElement("div"); var a = document.createElement("a"); a.href = "/p/" + pano.publicid + "/" + pano.slug; $(a).css("background-image", "url(" + CFG_STATIC_DOMAIN_URL + "php/getimage.php?epid=" + pano.publicid + "&equi=1&w=" + options.width + "&h=120)"); $(a).addClass("panoThumb").css("width", options.width); var title = document.createElement("span"); $(title).addClass("panoThumbTitle"); $(title).html(pano.name); $(a).append(title); a.onmouserover = function(){ this.innerHTML = ''; }; $(thumbDiv).append(a); $(li).append(thumbDiv); var thumbMeta = document.createElement("div"); $(thumbMeta).addClass("panoThumbMeta"); if (typeof userSettings != "undefined" && userSettings.username == pano.owner_username) { var edit = document.createElement("a"); $(edit).addClass("icon").addClass("icon_edit").attr("href","javascript:void(0)"); $(edit).css("float", "right"); $(edit).click(function() { var editor = new PanoramaEditor({ panorama: pano, defaultView: "details", updateCallback: function(panoData) { showLoadingDialog(); $.post("/api/edit/update", panoData, function(data) { if (data.success) { window.location.reload(false); } else { editor.setVisible(true); } }, "json"); }, deleteCallback: function() { showLoadingDialog(); $.post("/api/edit/delete", {"publicid": pano.publicid}, function(data) { if (data.success) { window.location.reload(false); } else { editor.setVisible(true); } }, "json"); } }); }); $(thumbMeta).append(edit); } $(thumbMeta).append("Created " + new Date(pano.creation_time*1000).toRelativeTime() + "This panorama is not Geo-Tagged
"); if (editable) { $(maskContent).append(""); } $(mask).append(maskContent); $("#panoMap").prepend(mask); } /* SCROLL FIX */ // http://www.switchonthecode.com/tutorials/javascript-tutorial-the-scroll-wheel function handleWheel(e) { var app = document.getElementById("createPanorama"); e = e ? e : window.e; var wheelData = e.detail ? e.detail * -1 : e.wheelDelta / 40; if (app) { var o = {x: e.screenX, y: e.screenY, delta: wheelData, ctrlKey: e.ctrlKey, altKey: e.altKey, shiftKey: e.shiftKey} app.handleWheel(o); cancelEvent(e); } } function hookEvent(element, eventName, callback) { if(typeof(element) == "string") element = document.getElementById(element); if(element == null) return; if(element.addEventListener) { if(eventName == "mousewheel") element.addEventListener("DOMMouseScroll", callback, false); element.addEventListener(eventName, callback, false); } else if(element.attachEvent) element.attachEvent("on" + eventName, callback); } function unhookEvent(element, eventName, callback) { if(typeof(element) == "string") element = document.getElementById(element); if(element == null) return; if(element.removeEventListener) { if(eventName == "mousewheel") element.removeEventListener("DOMMouseScroll", callback, false); element.removeEventListener(eventName, callback, false); } else if(element.detachEvent) element.detachEvent("on" + eventName, callback); } function cancelEvent(e) { e = e ? e : window.event; if(e.stopPropagation) e.stopPropagation(); if(e.preventDefault) e.preventDefault(); e.cancelBubble = true; e.cancel = true; e.returnValue = false; return false; } function hideFlash() { $("div:has(>object)").each(function() { if ($(this).attr("id").match(/dmd_pano_/)) $(this).css("visibility", "hidden"); }); } function showFlash() { if($(".dialogBox").length <= 1) $("div:has(>object)").each(function() { if ($(this).attr("id").match(/dmd_pano_/)) $(this).css("visibility", "visible"); }); } function PanoramaEditor(options) { this.defaults = { defaultView: "details" } this.options = $.extend({}, this.defaults, options); this.initialize = function() { var _this = this; this.dialog = new ModalDialog("Panorama Settings"); this.tabbedPane = new TabbedPane(); var fieldset = document.createElement("fieldset"); var p = document.createElement("p"); $(p).append(''); this.name = document.createElement("input"); $(this.name).addClass("textInput").attr("placeholder", "Panorama Title..."); $(p).append(this.name); $(fieldset).append(p); p = document.createElement("p"); $(p).append(''); this.privateInput = document.createElement("input"); this.privateInput.type = "checkbox"; $(p).append(this.privateInput); var privateLabel = document.createElement("label"); $(privateLabel).click(function() { $(_this.privateInput).trigger("click"); }); $(privateLabel).html("Hide from our galeries and search results."); $(p).append(privateLabel); $(fieldset).append(p); $(fieldset).append('Enter your tags delimited by commas.
'); p = document.createElement("p"); $(p).append(''); this.tags = document.createElement("input"); $(this.tags).addClass("textInput").attr("placeholder", "Example: beach, summer"); $(p).append(this.tags); $(fieldset).append(p); p = document.createElement("p"); $(p).append(''); this.description = document.createElement("textarea"); $(this.description).addClass("textInput"); $(p).append(this.description); $(fieldset).append(p); this.tabbedPane.addFieldset("Details", fieldset, this.options.defaultView == "details"); fieldset = document.createElement("fieldset"); p = document.createElement("p"); $(p).append(''); this.enableGeo = document.createElement("input"); this.enableGeo.type = "checkbox"; $(this.enableGeo).change(function() { if ($(this).is(":checked")) { if (typeof _this.options.panorama != "undefined") { var pano = _this.options.panorama; if((pano.latitude==0)&&(pano.latitude==0)) _this.marker.setPosition(_this.map.getCenter()); } _this.marker.setMap(_this.map); _this.map.panTo(_this.marker.getPosition()); } else { _this.marker.setMap(null); } }); $(p).append(this.enableGeo); var geoLabel = document.createElement("label"); $(geoLabel).click(function() { $(_this.enableGeo).trigger("click").trigger("change"); }); $(geoLabel).html("Show my panorama on the world map."); $(p).append(geoLabel); $(fieldset).append(p); var mapDiv = document.createElement("div"); $(mapDiv).height(172); var mapOptions = { zoom: 1, streetViewControl: false, center: new google.maps.LatLng(0, 0), mapTypeId: google.maps.MapTypeId.HYBRID }; this.map = new google.maps.Map(mapDiv, mapOptions); this.marker = new google.maps.Marker({ position: new google.maps.LatLng(0, 0), map: null, icon: iconSelf, shadow: iconShadow }); this.marker.setDraggable(true); //this.map.panTo(this.marker.getPosition()); $(fieldset).append(mapDiv); this.tabbedPane.addFieldset("Location", fieldset, this.options.defaultView == "geo", function() { google.maps.event.trigger(_this.map, "resize"); _this.map.panTo(_this.marker.getPosition()); }); google.maps.event.addListener(this.marker, "dragend", function() { _this.map.panTo(_this.marker.getPosition()); }); this.dialog.addContentElement(this.tabbedPane.dom); if (typeof this.options.panorama != "undefined") { var pano = this.options.panorama; $(this.name).val(pano.name); $(this.tags).val(pano.tags); if (!pano["public"]) { $(this.privateInput).attr("checked","checked"); } $(this.description).val(pano.description); if (pano.longitude != 0 || pano.latitude != 0) { this.marker.setPosition(new google.maps.LatLng(pano.latitude, pano.longitude)); this.map.panTo(this.marker.getPosition()); $(this.enableGeo).attr("checked","checked").trigger("change"); } this.deleteButton = this.dialog.addButton("Delete Panorama", function() { $(_this.deleteButton).hide(); $(_this.makeSureDiv).show(); }); $(this.deleteButton).addClass("vui-button-red").css("float", "left"); this.makeSureDiv = document.createElement("div"); $(this.makeSureDiv).css("float", "left").hide(); $(this.makeSureDiv).append("Are you sure? "); this.cancelDelete = document.createElement("a"); $(this.cancelDelete).html("No").attr("href", "javascript:void(0)"); $(this.cancelDelete).addClass("vui-button").click(function() { $(_this.makeSureDiv).hide(); $(_this.deleteButton).show(); }); $(this.makeSureDiv).append(this.cancelDelete); this.confirmDelete = document.createElement("a"); $(this.confirmDelete).html("Yes").attr("href", "javascript:void(0)"); $(this.confirmDelete).addClass("vui-button").addClass("vui-button-red").click(function() { if (_this.options.deleteCallback) { _this.options.deleteCallback(); } _this.dialog.dispose(); }); $(this.makeSureDiv).append(this.confirmDelete); this.dialog.addFooterElement(this.makeSureDiv); } this.dialog.addButton("Cancel", function() { showFlash(); _this.cancelClicked(); }); this.dialog.addButton("Update", function() { showFlash(); _this.updateClicked(); }); this.dialog.setVisible(true, function() { google.maps.event.trigger(_this.map, "resize"); _this.map.panTo(_this.marker.getPosition()); }); } this.cancelClicked = function() { this.dialog.dispose(); if (this.options.cancelCallback) { this.options.cancelCallback(); } } this.updateClicked = function() { var results = this.getResults(); if (results === false) { return; } this.dialog.setVisible(false); if (this.options.updateCallback) { this.options.updateCallback(results); } } this.getResults = function() { var pano = {}; if (typeof this.options.panorama != "undefined") { pano.publicid = this.options.panorama.publicid; } pano.name = $(this.name).val(); pano.tags = $(this.tags).val(); pano.description = $(this.description).val(); pano["public"] = !$(this.privateInput).is(":checked"); if ($(this.enableGeo).is(":checked")) { var latlng = this.marker.getPosition(); pano.latitude = latlng.lat(); pano.longitude = latlng.lng(); } else { pano.latitude = 0; pano.longitude = 0; } if (pano.name == "") { $(this.name).focus(); return false; } return pano; } this.initialize(); } function showEmbedCode(panoId) { var dialog = new ModalDialog("Embed Code"); /* 425 × 344 480 × 385 640 × 505 960 × 745*/ var fVersion = dmdEmbedder.getFlashVersion(); var fieldset = document.createElement("div"); var p = null; /* var p = document.createElement("p"); $(p).css("height", "30px").append('Code Type:'); var codeType = new ToggleGroup(); codeType.addButton("Javascript (HTML5 & Flash)", "javascript", true); codeType.addButton("Flash Object Embed", "normal"); $(p).append(codeType.dom); $(fieldset).append(p); */ p = document.createElement("p"); $(p).css("height", "30px").append('Preset/Custom:'); var preset = new ToggleGroup(); preset.addButton("Dermandar Presets", "preset", true); preset.addButton("Custom Width & Height", "custom"); $(p).append(preset.dom); $(fieldset).append(p); dialog.addContentElement(fieldset); var presetFieldset = document.createElement("div"); p = document.createElement("p"); $(p).css("height", "30px").append('Aspect Ratio:'); var aspectRatio = new ToggleGroup(); aspectRatio.addButton("Normal", "normal", true); aspectRatio.addButton("Wide", "wide"); $(p).append(aspectRatio.dom); $(presetFieldset).append(p); p = document.createElement("p"); $(p).css("height", "30px").append('Width:'); var sizeButtons = new ToggleGroup(); sizeButtons.addButton("425px", 425, true); sizeButtons.addButton("480px", 480); sizeButtons.addButton("640px", 640); sizeButtons.addButton("960px", 960); $(p).append(sizeButtons.dom); $(presetFieldset).append(p); dialog.addContentElement(presetFieldset); var customFieldset = document.createElement("div"); p = document.createElement("p"); $(p).css("height", "30px").append('Size:'); var inputWidth = document.createElement("input"); $(inputWidth).width(50).addClass("textInput"); inputWidth.type = "text"; inputWidth.value = "425"; var inputHeight = document.createElement("input"); $(inputHeight).width(50).addClass("textInput"); inputHeight.type = "text"; inputHeight.value = "327"; $(p).append(inputWidth).append(" x ").append(inputHeight); $(customFieldset).append(p); $(customFieldset).hide(); dialog.addContentElement(customFieldset); preset.addChangeListener(function() { if (preset.getValue() == "preset") { $(customFieldset).hide(); $(presetFieldset).show(); } else { $(presetFieldset).hide(); $(customFieldset).show(); } }); preset.addChangeListener(function() { updateCode(); }); aspectRatio.addChangeListener(function() { updateCode(); }); sizeButtons.addChangeListener(function() { updateCode(); }); $(inputWidth).change(function() { updateCode(); }); $(inputHeight).change(function() { updateCode(); }); var embedCode = document.createElement("textarea"); $(embedCode).css({ width: "99%", height: "120px" }); $(embedCode).click(function() { this.focus(); this.select(); return false; }); dialog.addContentElement(embedCode); var updateCode = function() { var width = 0; var height = 0; if (preset.getValue() == "preset") { width = sizeButtons.getValue(); if (aspectRatio.getValue() == "normal") { height = Math.round(width/1.3); } else { height = Math.round(width/1.8); } } else { width = $(inputWidth).val(); height = $(inputHeight).val(); } var code; /* if (codeType.getValue() == "normal") { code = ""; } else { */ code = "\r\n" + "\r\n" + ""; /* } */ $(embedCode).val(code); } updateCode(); dialog.addButton("Close", function() { showFlash(); dialog.dispose(); }); dialog.setVisible(true); hideFlash(); } function showShareDialog(url) { var dialog = new ModalDialog("Share This Panorma"); dialog.addButton("Close", function() { dialog.dispose(); }); dialog.setVisible(true); } function showLoadingDialog() { var modalDialog = new ModalDialog(); var div = document.createElement("div"); $(div).css({ padding: "40px 20px", "font-size": "18px", color: "#888", "text-align": "center" }).html("Loading... Please wait!"); modalDialog.addContentElement(div); modalDialog.setVisible(true); return modalDialog; } function ModalDialog(title) { this.title = title; this.initialize = function() { this.dom = document.createElement("div"); $(this.dom).addClass("dialogBox"); this.content = document.createElement("div"); $(this.content).addClass("dialogContent"); $(this.content).addClass("dmd_form"); $(this.dom).append(this.content); if (typeof this.title != "undefined") { $(this.content).append("Username must be 4 to 32 characters long, can only contain English characters, numbers and one of these special characters: underscore, dash, period, single quote.
'); this.usernameValidator = document.createElement("p"); $(this.usernameValidator).addClass("helper"); $(this.signupForm).append(this.usernameValidator); p=document.createElement("p"); this.signupUsername = document.createElement("input"); $(this.signupUsername).blur(function() { var username = $(this).val(); if (username == "") { return; } $.getJSON("../php/auth.php", "action=check_username¶ms="+encodeURIComponent("username=" + encodeURIComponent(username)), function (ret) { if (ret.valid) { $(_this.usernameValidator).hide(); } else { $(_this.usernameValidator).html("The username \"" + username + "\" is not valid.").css("color","red").show(); } }); }); this.signupUsername.type = "text"; $(this.signupUsername).addClass("textInput"); $(this.signupUsername).attr("placeholder","Username"); $(p).append('Username:').append(this.signupUsername); $(this.signupForm).append(p); p=document.createElement("p"); this.signupEmail = document.createElement("input"); this.signupEmail.type = "text"; $(this.signupEmail).addClass("textInput"); $(this.signupEmail).attr("placeholder","Email Address"); $(p).append('Email:').append(this.signupEmail); $(this.signupForm).append(p); $(this.signupForm).append('Password must be minimum 6 characters long.
'); p=document.createElement("p"); this.signupPassword = document.createElement("input"); this.signupPassword.type = "password"; $(this.signupPassword).addClass("textInput"); $(this.signupPassword).attr("placeholder","Password").css({ width: "140px", "margin-right": "4px" }); this.signupPassword2 = document.createElement("input"); this.signupPassword2.type = "password"; $(this.signupPassword2).addClass("textInput"); $(this.signupPassword2).attr("placeholder","Password Again").css({ width: "140px" }); $(p).append('Password Twice:').append(this.signupPassword).append(this.signupPassword2); $(this.signupForm).append(p); p=document.createElement("p"); this.signupSubmit = document.createElement("input"); this.signupSubmit.type = "submit"; this.signupSubmit.value = "Sign me up"; $(this.signupSubmit).addClass("vui-button"); $(p).append('').append(this.signupSubmit); $(this.signupForm).append(p); $(this.signupForm).append("By signing up, you agree to Dermandar's Terms of Service.
"); $(this.signupSubmit).click(function() { var username = $(_this.signupUsername).val(); var email = $(_this.signupEmail).val(); var password = $(_this.signupPassword).val(); var password2 = $(_this.signupPassword2).val(); if (username == "") { $(_this.loginUsername).focus(); return; } if (!isValidEmail(email)) { $(_this.signupEmail).focus(); $(_this.note).html("Invalid email address").show(); return; } if (password == "" || password.length < 6) { $(_this.note).html("Invalid Password").show(); $(_this.loginPassword).focus(); return; } if (password != password2) { $(_this.note).html("Your passwords do not match").show(); $(_this.signupPassword).focus(); return; } _this.setLoading(true); $.post("/php/auth.php", "action=signup¶ms="+encodeURIComponent("username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password) + "&email=" + encodeURIComponent(email)), function(ret) { if (ret.error) { $(_this.note).html(ret.error_info); } else { _this.signupSuccessful(); } _this.setLoading(false); }, "json"); }); this.tabbedPane.addFieldset("Create a new account", this.signupForm, true); this.dialog.addContentElement(this.tabbedPane.dom); this.dialog.setVisible(true); } this.loginSuccessful = function() { if (typeof this.options.successCallback != "undefined") { this.options.successCallback("login"); } this.dialog.dispose(); } this.signupSuccessful = function() { if (typeof this.options.successCallback != "undefined") { this.options.successCallback("signup"); } this.dialog.dispose(); } this.setLoading = function(loading) { if (loading) { $("input", this.tabbedPane.dom).attr("disabled", "disabled"); $(this.note).html("Loading! Please wait...").show(); } else { $("input", this.tabbedPane.dom).removeAttr("disabled"); } } this.initialize(); } function ToggleGroup() { this.listeners = []; this.initialize = function() { this.dom = document.createElement("ul"); $(this.dom).addClass("vui-button-group"); } this.addChangeListener = function(callback) { this.listeners.push(callback); } this.fireChange = function() { for (var i=0; i< this.listeners.length; i++) { var listener = this.listeners[i]; listener(); } } this.setValue = function(value) { this.value = value; this.fireChange(); } this.getValue = function() { return this.value; } this.addButton = function(title, value, selected) { var _this = this; var li = document.createElement("li"); var a = document.createElement("a"); a.href = "javascript:void(0)"; a.innerHTML = title; $(a).addClass("vui-button"); $(a).click(function() { _this.setValue(value); $(".vui-state-active", _this.dom).removeClass("vui-state-active"); $(this).addClass("vui-state-active"); }); $(li).append(a); $(this.dom).append(li); if (selected) { $(a).trigger("click"); } } this.initialize(); } function reportViolation(id) { var dialog = new ModalDialog("Report this panorama"); var fieldset = document.createElement("div"); var p = document.createElement("p"); $(p).height(30); var reportLabel = document.createElement("span"); $(reportLabel).addClass("inputLabel"); reportLabel.innerHTML = "Report Type:"; var buttonGroup = new ToggleGroup(); buttonGroup.addButton("Abuse", "abuse", true); buttonGroup.addButton("Copyright", "copyright", false); $(p).append(reportLabel).append(buttonGroup.dom); $(fieldset).append(p); p = document.createElement("p"); var reportLabel = document.createElement("span"); $(reportLabel).addClass("inputLabel"); reportLabel.innerHTML = "Details:"; var details = document.createElement("textarea"); $(details).width(300).height(100); $(p).append(reportLabel).append(details); $(fieldset).append(p); dialog.addButton("Cancel", function() { showFlash(); dialog.dispose(); }); dialog.addButton("Report", function() { $.post("/api/edit/report/" + buttonGroup.getValue(), { publicid: id, details: $(details).val() }, function() { }); $(dialog.footer).slideUp(); $(dialog.content).html("Thank you! Your report will reviewed soon.").css({ "text-align": "center", "font-size": "14px" }); setTimeout(function() { $(dialog.dom).fadeOut("normal", function() { dialog.dispose(); showFlash(); }); }, 4000); }); dialog.addContentElement(fieldset); dialog.setVisible(true); hideFlash(); } ///////////////////////////////////////////////////////// function loadTab(obj,index){ if(obj.parentNode == null || obj.parentNode.parentNode == null){ return null; } var parent = obj.parentNode.parentNode; var content = parent.getElementsByClassName("desctabscontent")[0]; var tabs = parent.getElementsByClassName("desctabs")[0]; var tabsNodes = tabs.childNodes; var contentNodes = content.childNodes; for(var i = 0; i < tabsNodes.length; i++) { if(tabsNodes[i].getAttribute("index") == index){ tabsNodes[i].classList.add("seleteddesctab"); }else{ tabsNodes[i].classList.remove("seleteddesctab"); } } for(var i = 0; i < contentNodes.length; i++) { if(contentNodes[i].getAttribute("index") == index){ contentNodes[i].style.display = "block"; }else{ contentNodes[i].style.display = "none"; } } return false; } function renderPanorama1(pano, elementType, options) { var defaults = { width: 600, hoverable: true } var options = $.extend({}, defaults, options); var li = document.createElement(elementType); //// var mainDiv = document.createElement("div"); mainDiv.innerHTML = ""+ "Name: "+ pano.name +""+ "
"+ "Created "+ new Date(pano.creation_time * 1000).toDateString() +" By "+
"" + pano.owner_username + "
" +
pano.views + " views"+
"
Description: "+ (pano.description.length>0?pano.description:"No Description") + "
"+ "