From 679617db5ec664d333ade8c5557f230cb364559c Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Mon, 13 Aug 2012 11:06:46 -0600 Subject: fixed complete template --- .../default/templates/ask_widget_complete.html | 2 +- .../default/templates/widgets/askbot_widget.js.bk | 279 +++++++++++++++++++++ 2 files changed, 280 insertions(+), 1 deletion(-) create mode 100755 askbot/skins/default/templates/widgets/askbot_widget.js.bk diff --git a/askbot/skins/default/templates/ask_widget_complete.html b/askbot/skins/default/templates/ask_widget_complete.html index eb3156b1..580c1f94 100644 --- a/askbot/skins/default/templates/ask_widget_complete.html +++ b/askbot/skins/default/templates/ask_widget_complete.html @@ -3,6 +3,6 @@ {%endblock%} {%block body%} -Question posted +Question posted {%endblock%} diff --git a/askbot/skins/default/templates/widgets/askbot_widget.js.bk b/askbot/skins/default/templates/widgets/askbot_widget.js.bk new file mode 100755 index 00000000..794392f2 --- /dev/null +++ b/askbot/skins/default/templates/widgets/askbot_widget.js.bk @@ -0,0 +1,279 @@ +/** + * SUBMODAL v1.6 + * Used for displaying DHTML only popups instead of using buggy modal windows. + * + * By Subimage LLC + * http://www.subimage.com + * + * Contributions by: + * Eric Angel - tab index code + * Scott - hiding/showing selects for IE users + * Todd Huss - inserting modal dynamically and anchor classes + * + * Up to date code can be found at http://submodal.googlecode.com + */ +///review this + +var AskbotWidget = { + gPopupMask: null, + gPopupContainer: null, + gPopFrame: null, + gReturnFunc: null, + gPopupIsShown: false, + gDefaultPage: "/loading.html", + gHideSelects: false, + gi: 0, + gReturnVal: null, + gTabIndexes: new Array(), + gTabbableTags: new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME"), + + + //functions + initPopUp: function() { + // Add the HTML to the body + theBody = document.getElementsByTagName('BODY')[0]; + popmask = document.createElement('div'); + popmask.id = 'AskbotPopupMask'; + popcont = document.createElement('div'); + popcont.id = 'AskbotPopupContainer'; + popcont.innerHTML = '' + + '
' + + '
' + + '
' + + '
' + + '' + + '
' + + '
' + + '' + + '
'; + theBody.appendChild(popmask); + theBody.appendChild(popcont); + + this.gPopupMask = document.getElementById("AskbotPopupMask"); + this.gPopupContainer = document.getElementById("AskbotPopupContainer"); + this.gPopFrame = document.getElementById("AskbotPopupFrame"); + + // check to see if this is IE version 6 or lower. hide select boxes if so + // maybe they'll fix this in version 7? + var brsVersion = parseInt(window.navigator.appVersion.charAt(0), 10); + if (brsVersion <= 6 && window.navigator.userAgent.indexOf("MSIE") > -1) { + this.gHideSelects = true; + } + + // Add onclick handlers to 'a' elements of class submodal or submodal-width-height + var elms = document.getElementsByTagName('a'); + for (i = 0; i < elms.length; i++) { + if (elms[i].className.indexOf("submodal") == 0) { + // var onclick = 'function (){showPopWin(\''+elms[i].href+'\','+width+', '+height+', null);return false;};'; + // elms[i].onclick = eval(onclick); + elms[i].onclick = function(){ + // default width and height + var width = 400; + var height = 200; + // Parse out optional width and height from className + params = this.className.split('-'); + if (params.length == 3) { + width = parseInt(params[1]); + height = parseInt(params[2]); + } + this.showPopWin(this.href,width,height,null); return false; + } + } + } + }, + + + showPopWin: function(url, width, height, returnFunc, showCloseBox) { + // show or hide the window close widget + if (showCloseBox == null || showCloseBox == true) { + document.getElementById("AskbotPopCloseBox").style.display = "block"; + } else { + document.getElementById("AskbotPopCloseBox").style.display = "none"; + } + this.gPopupIsShown = true; + this.disableTabIndexes(); + this.gPopupMask.style.display = "block"; + this.gPopupContainer.style.display = "block"; + // calculate where to place the window on screen + this.centerPopWin(width, height); + + var titleBarHeight = parseInt(document.getElementById("AskbotPopupTitleBar").offsetHeight, 10); + + + this.gPopupContainer.style.width = width + "px"; + this.gPopupContainer.style.height = (height+titleBarHeight) + "px"; + + this.setMaskSize(); + + // need to set the width of the iframe to the title bar width because of the dropshadow + // some oddness was occuring and causing the frame to poke outside the border in IE6 + this.gPopFrame.style.width = parseInt(document.getElementById("AskbotPopupTitleBar").offsetWidth, 10) + "px"; + this.gPopFrame.style.height = (height) + "px"; + + // set the url + this.gPopFrame.src = url; + + this.gReturnFunc = returnFunc; + // for IE + if (this.gHideSelects == true) { + this.hideSelectBoxes(); + } + + window.setTimeout("this.setPopTitle();", 600); + }, + + centerPopWin: function(width, height) { + if (gPopupIsShown == true) { + if (width == null || isNaN(width)) { + width = this.gPopupContainer.offsetWidth; + } + if (height == null) { + height = this.gPopupContainer.offsetHeight; + } + + //var theBody = document.documentElement; + var theBody = document.getElementsByTagName("BODY")[0]; + //theBody.style.overflow = "hidden"; + var scTop = parseInt(getScrollTop(),10); + var scLeft = parseInt(theBody.scrollLeft,10); + + this.setMaskSize(); + + //window.status = gPopupMask.style.top + " " + gPopupMask.style.left + " " + gi++; + + var titleBarHeight = parseInt(document.getElementById("AskbotPopupTitleBar").offsetHeight, 10); + + var fullHeight = getViewportHeight(); + var fullWidth = getViewportWidth(); + + this.gPopupContainer.style.top = (scTop + ((fullHeight - (height+titleBarHeight)) / 2)) + "px"; + this.gPopupContainer.style.left = (scLeft + ((fullWidth - width) / 2)) + "px"; + //alert(fullWidth + " " + width + " " + gPopupContainer.style.left); + } + }, + + setMaskSize: function () { + var theBody = document.getElementsByTagName("BODY")[0]; + + var fullHeight = getViewportHeight(); + var fullWidth = getViewportWidth(); + + // Determine what's bigger, scrollHeight or fullHeight / width + if (fullHeight > theBody.scrollHeight) { + popHeight = fullHeight; + } else { + popHeight = theBody.scrollHeight; + } + + if (fullWidth > theBody.scrollWidth) { + popWidth = fullWidth; + } else { + popWidth = theBody.scrollWidth; + } + + this.gPopupMask.style.height = popHeight + "px"; + this.gPopupMask.style.width = popWidth + "px"; + }, + + hidePopWin: function (callReturnFunc) { + this.gPopupIsShown = false; + var theBody = document.getElementsByTagName("BODY")[0]; + theBody.style.overflow = ""; + this.restoreTabIndexes(); + if (this.gPopupMask == null) { + return; + } + this.gPopupMask.style.display = "none"; + this.gPopupContainer.style.display = "none"; + if (callReturnFunc == true && gReturnFunc != null) { + // Set the return code to run in a timeout. + // Was having issues using with an Ajax.Request(); + this.gReturnVal = window.frames["AskbotPopupFrame"].returnVal; + window.setTimeout('this.gReturnFunc(gReturnVal);', 1); + } + this.gPopFrame.src = this.gDefaultPage; + // display all select boxes + if (this.gHideSelects == true) { + this.displaySelectBoxes(); + } + }, + + setPopTitle: function () { + return; + if (window.frames["AskbotPopupFrame"].document.title == null) { + window.setTimeout("this.setPopTitle();", 10); + } else { + document.getElementById("AskbotpopupTitle").innerHTML = window.frames["AskbotPopupFrame"].document.title; + } + }, + + disableTabIndexes: function() { + if (document.all) { + var i = 0; + for (var j = 0; j < gTabbableTags.length; j++) { + var tagElements = document.getElementsByTagName(gTabbableTags[j]); + for (var k = 0 ; k < tagElements.length; k++) { + this.gTabIndexes[i] = tagElements[k].tabIndex; + tagElements[k].tabIndex="-1"; + i++; + } + } + } + }, + + restoreTabIndexes: function () { + if (document.all) { + var i = 0; + for (var j = 0; j < gTabbableTags.length; j++) { + var tagElements = document.getElementsByTagName(gTabbableTags[j]); + for (var k = 0 ; k < tagElements.length; k++) { + tagElements[k].tabIndex = gTabIndexes[i]; + tagElements[k].tabEnabled = true; + i++; + } + } + } + }, + + hideSelectBoxes: function () { + var x = document.getElementsByTagName("SELECT"); + + for (i=0;x && i < x.length; i++) { + x[i].style.visibility = "hidden"; + } + }, + + displaySelectBoxes: function () { + var x = document.getElementsByTagName("SELECT"); + + for (i=0;x && i < x.length; i++){ + x[i].style.visibility = "visible"; + } + } +}; + +/** + * Initializes popup code on load. + */ +// +addEvent(window, "resize", centerPopWin); +addEvent(window, "scroll", centerPopWin); +window.onscroll = centerPopWin; + + + +/** + * Makes all drop down form select boxes on the screen visible so they do not + * reappear after the dialog is closed. + * + * IE has a problem with wanting select form tags to always be the + * topmost z-index or layer. + */ +function keyDownHandler(e) { + if (AskbotWidget.gPopupIsShown && e.keyCode == 9) return false; +} + +if (!document.all) { + document.onkeypress = keyDownHandler; +} + -- cgit v1.2.3-1-g7c22