diff options
3 files changed, 13 insertions, 286 deletions
diff --git a/askbot/skins/default/media/style/askbot-modal.css b/askbot/skins/default/media/style/askbot-modal.css index 4385c90e..6f16dc5d 100755 --- a/askbot/skins/default/media/style/askbot-modal.css +++ b/askbot/skins/default/media/style/askbot-modal.css @@ -9,12 +9,16 @@ z-index: 1000; } -#AskbotAskWidget iframe{ +#AskbotAskWidget div{ width:600px; height:200px; margin: 100px auto; background-color: #fff; border:1px solid #000; padding:15px; - text-align:center; + text-align:right; +} + +#AskbotAskWidget iframe{ + width:600px; } diff --git a/askbot/skins/default/templates/widgets/askbot_widget.js b/askbot/skins/default/templates/widgets/askbot_widget.js index cac8495a..f7b0c356 100755 --- a/askbot/skins/default/templates/widgets/askbot_widget.js +++ b/askbot/skins/default/templates/widgets/askbot_widget.js @@ -14,6 +14,9 @@ var AskbotAskWidget = { var motherDiv = document.createElement('div'); motherDiv.setAttribute("id", AskbotAskWidget.element_id); + var containerDiv = document.createElement('div'); + motherDiv.appendChild(containerDiv); + {%if widget.outer_style %} outerStyle = document.createElement('style'); outerStyle.innerText = "{{widget.outer_style}}"; @@ -26,17 +29,16 @@ var AskbotAskWidget = { closeButton.setAttribute('onClick', 'AskbotAskWidget.widgetToggle();'); closeButton.innerText = 'Close'; - motherDiv.appendChild(closeButton); + containerDiv.appendChild(closeButton); var iframe = document.createElement('iframe'); iframe.setAttribute('src', 'http://{{host}}{% url ask_by_widget widget.id %}'); - motherDiv.appendChild(iframe); + containerDiv.appendChild(iframe); var body = document.getElementsByTagName('body')[0]; if (body){ body.insertBefore(motherDiv, body.firstChild); - body.insertBefore(AskbotAskWidget.createButton(), body.firstChild); body.insertBefore(link, body.firstChild); } }, @@ -45,8 +47,7 @@ var AskbotAskWidget = { var buttonDiv = document.createElement('div'); buttonDiv.setAttribute('id', "AskbotAskButton"); - var closeButton = document.createElement('a'); - closeButton.setAttribute('href', '#'); + var closeButton = document.createElement('button'); closeButton.setAttribute('onClick', 'AskbotAskWidget.widgetToggle();'); closeButton.innerText = label; @@ -58,3 +59,4 @@ var AskbotAskWidget = { window.onload = AskbotAskWidget.toHtml; +document.write(AskbotAskWidget.createButton().outerHTML); diff --git a/askbot/skins/default/templates/widgets/askbot_widget.js.bk b/askbot/skins/default/templates/widgets/askbot_widget.js.bk deleted file mode 100755 index 794392f2..00000000 --- a/askbot/skins/default/templates/widgets/askbot_widget.js.bk +++ /dev/null @@ -1,279 +0,0 @@ -/** - * 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 = '' + - '<div id="AskbotPopupInner">' + - '<div id="AskbotPopupTitleBar">' + - '<div id="AskbotPopupTitle"></div>' + - '<div id="AskbotPopupControls">' + - '<img src="close.gif" onclick="this.hidePopWin(false);" id="AskbotPopCloseBox" />' + - '</div>' + - '</div>' + - '<iframe src="'+ this.gDefaultPage +'" style="width:100%;height:100%;background-color:transparent;" scrolling="auto" frameborder="0" allowtransparency="true" id="AskbotPopupFrame" name="AskbotPopupFrame" width="100%" height="100%"></iframe>' + - '</div>'; - 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; -} - |