diff options
Diffstat (limited to 'static/js')
| -rwxr-xr-x | static/js/FancyZoom.js | 761 | ||||
| -rwxr-xr-x | static/js/FancyZoomHTML.js | 0 | ||||
| -rwxr-xr-x | static/js/away.js | 28 | ||||
| -rwxr-xr-x | static/js/dumpsearch.js | 39 | ||||
| -rwxr-xr-x | static/js/jquery.editinplace.1.0.1.packed.js | 287 | ||||
| -rw-r--r-- | static/js/jquery.js | 171 | ||||
| -rw-r--r-- | static/js/jquery.mousewheel.js | 85 |
7 files changed, 1371 insertions, 0 deletions
diff --git a/static/js/FancyZoom.js b/static/js/FancyZoom.js new file mode 100755 index 0000000..42d71ce --- /dev/null +++ b/static/js/FancyZoom.js @@ -0,0 +1,761 @@ +// FancyZoom.js - v1.1 - http://www.fancyzoom.com +// +// Copyright (c) 2008 Cabel Sasser / Panic Inc +// All rights reserved. +// +// Requires: FancyZoomHTML.js +// Instructions: Include JS files in page, call setupZoom() in onLoad. That's it! +// Any <a href> links to images will be updated to zoom inline. +// Add rel="nozoom" to your <a href> to disable zooming for an image. +// +// Redistribution and use of this effect in source form, with or without modification, +// are permitted provided that the following conditions are met: +// +// * USE OF SOURCE ON COMMERCIAL (FOR-PROFIT) WEBSITE REQUIRES ONE-TIME LICENSE FEE PER DOMAIN. +// Reasonably priced! Visit www.fancyzoom.com for licensing instructions. Thanks! +// +// * Non-commercial (personal) website use is permitted without license/payment! +// +// * Redistribution of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// * Redistribution of source code and derived works cannot be sold without specific +// written prior permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var includeCaption = true; // Turn on the "caption" feature, and write out the caption HTML +var zoomTime = 5; // Milliseconds between frames of zoom animation +var zoomSteps = 15; // Number of zoom animation frames +var includeFade = 1; // Set to 1 to fade the image in / out as it zooms +var minBorder = 90; // Amount of padding between large, scaled down images, and the window edges +var shadowSettings = '0px 5px 25px rgba(0, 0, 0, '; // Blur, radius, color of shadow for compatible browsers + +var zoomImagesURI = '/images-global/zoom/'; // Location of the zoom and shadow images + +// Init. Do not add anything below this line, unless it's something awesome. + +var myWidth = 0, myHeight = 0, myScroll = 0; myScrollWidth = 0; myScrollHeight = 0; +var zoomOpen = false, preloadFrame = 1, preloadActive = false, preloadTime = 0, imgPreload = new Image(); +var preloadAnimTimer = 0; + +var zoomActive = new Array(); var zoomTimer = new Array(); +var zoomOrigW = new Array(); var zoomOrigH = new Array(); +var zoomOrigX = new Array(); var zoomOrigY = new Array(); + +var zoomID = "ZoomBox"; +var theID = "ZoomImage"; +var zoomCaption = "ZoomCaption"; +var zoomCaptionDiv = "ZoomCapDiv"; + +if (navigator.userAgent.indexOf("MSIE") != -1) { + var browserIsIE = true; +} + +// Zoom: Setup The Page! Called in your <body>'s onLoad handler. + +function setupZoom() { + prepZooms(); + insertZoomHTML(); + zoomdiv = document.getElementById(zoomID); + zoomimg = document.getElementById(theID); +} + +// Zoom: Inject Javascript functions into hrefs pointing to images, one by one! +// Skip any href that contains a rel="nozoom" tag. +// This is done at page load time via an onLoad() handler. + +function prepZooms() { + if (! document.getElementsByTagName) { + return; + } + var links = document.getElementsByTagName("a"); + for (i = 0; i < links.length; i++) { + if (links[i].getAttribute("href")) { + if (links[i].getAttribute("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)/gi) != -1) { + if (links[i].getAttribute("rel") != "nozoom") { + links[i].onclick = function (event) { return zoomClick(this, event); }; + links[i].onmouseover = function () { zoomPreload(this); }; + } + } + } + } +} + +// Zoom: Load an image into an image object. When done loading, function sets preloadActive to false, +// so other bits know that they can proceed with the zoom. +// Preloaded image is stored in imgPreload and swapped out in the zoom function. + +function zoomPreload(from) { + + var theimage = from.getAttribute("href"); + + // Only preload if we have to, i.e. the image isn't this image already + + if (imgPreload.src.indexOf(from.getAttribute("href").substr(from.getAttribute("href").lastIndexOf("/"))) == -1) { + preloadActive = true; + imgPreload = new Image(); + + // Set a function to fire when the preload is complete, setting flags along the way. + + imgPreload.onload = function() { + preloadActive = false; + } + + // Load it! + imgPreload.src = theimage; + } +} + +// Zoom: Start the preloading animation cycle. + +function preloadAnimStart() { + preloadTime = new Date(); + document.getElementById("ZoomSpin").style.left = (myWidth / 2) + 'px'; + document.getElementById("ZoomSpin").style.top = ((myHeight / 2) + myScroll) + 'px'; + document.getElementById("ZoomSpin").style.visibility = "visible"; + preloadFrame = 1; + document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; + preloadAnimTimer = setInterval("preloadAnim()", 100); +} + +// Zoom: Display and ANIMATE the jibber-jabber widget. Once preloadActive is false, bail and zoom it up! + +function preloadAnim(from) { + if (preloadActive != false) { + document.getElementById("SpinImage").src = zoomImagesURI+'zoom-spin-'+preloadFrame+'.png'; + preloadFrame++; + if (preloadFrame > 12) preloadFrame = 1; + } else { + document.getElementById("ZoomSpin").style.visibility = "hidden"; + clearInterval(preloadAnimTimer); + preloadAnimTimer = 0; + zoomIn(preloadFrom); + } +} + +// ZOOM CLICK: We got a click! Should we do the zoom? Or wait for the preload to complete? +// todo?: Double check that imgPreload src = clicked src + +function zoomClick(from, evt) { + + var shift = getShift(evt); + + // Check for Command / Alt key. If pressed, pass them through -- don't zoom! + if (! evt && window.event && (window.event.metaKey || window.event.altKey)) { + return true; + } else if (evt && (evt.metaKey|| evt.altKey)) { + return true; + } + + // Get browser dimensions + getSize(); + + // If preloading still, wait, and display the spinner. + if (preloadActive == true) { + // But only display the spinner if it's not already being displayed! + if (preloadAnimTimer == 0) { + preloadFrom = from; + preloadAnimStart(); + } + } else { + // Otherwise, we're loaded: do the zoom! + zoomIn(from, shift); + } + + return false; + +} + +// Zoom: Move an element in to endH endW, using zoomHost as a starting point. +// "from" is an object reference to the href that spawned the zoom. + +function zoomIn(from, shift) { + + zoomimg.src = from.getAttribute("href"); + + // Determine the zoom settings from where we came from, the element in the <a>. + // If there's no element in the <a>, or we can't get the width, make stuff up + + if (from.childNodes[0].width) { + startW = from.childNodes[0].width; + startH = from.childNodes[0].height; + startPos = findElementPos(from.childNodes[0]); + } else { + startW = 50; + startH = 12; + startPos = findElementPos(from); + } + + hostX = startPos[0]; + hostY = startPos[1]; + + // Make up for a scrolled containing div. + // TODO: This HAS to move into findElementPos. + + if (document.getElementById('scroller')) { + hostX = hostX - document.getElementById('scroller').scrollLeft; + } + + // Determine the target zoom settings from the preloaded image object + + endW = imgPreload.width; + endH = imgPreload.height; + + // Start! But only if we're not zooming already! + + if (zoomActive[theID] != true) { + + // Clear everything out just in case something is already open + + if (document.getElementById("ShadowBox")) { + document.getElementById("ShadowBox").style.visibility = "hidden"; + } else if (! browserIsIE) { + + // Wipe timer if shadow is fading in still + if (fadeActive["ZoomImage"]) { + clearInterval(fadeTimer["ZoomImage"]); + fadeActive["ZoomImage"] = false; + fadeTimer["ZoomImage"] = false; + } + + document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; + } + + document.getElementById("ZoomClose").style.visibility = "hidden"; + + // Setup the CAPTION, if existing. Hide it first, set the text. + + if (includeCaption) { + document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; + if (from.getAttribute('title') && includeCaption) { + // Yes, there's a caption, set it up + document.getElementById(zoomCaption).innerHTML = from.getAttribute('title'); + } else { + document.getElementById(zoomCaption).innerHTML = ""; + } + } + + // Store original position in an array for future zoomOut. + + zoomOrigW[theID] = startW; + zoomOrigH[theID] = startH; + zoomOrigX[theID] = hostX; + zoomOrigY[theID] = hostY; + + // Now set the starting dimensions + + zoomimg.style.width = startW + 'px'; + zoomimg.style.height = startH + 'px'; + zoomdiv.style.left = hostX + 'px'; + zoomdiv.style.top = hostY + 'px'; + + // Show the zooming image container, make it invisible + + if (includeFade == 1) { + setOpacity(0, zoomID); + } + zoomdiv.style.visibility = "visible"; + + // If it's too big to fit in the window, shrink the width and height to fit (with ratio). + + sizeRatio = endW / endH; + if (endW > myWidth - minBorder) { + endW = myWidth - minBorder; + endH = endW / sizeRatio; + } + if (endH > myHeight - minBorder) { + endH = myHeight - minBorder; + endW = endH * sizeRatio; + } + + zoomChangeX = ((myWidth / 2) - (endW / 2) - hostX); + zoomChangeY = (((myHeight / 2) - (endH / 2) - hostY) + myScroll); + zoomChangeW = (endW - startW); + zoomChangeH = (endH - startH); + + // Shift key? + + if (shift) { + tempSteps = zoomSteps * 7; + } else { + tempSteps = zoomSteps; + } + + // Setup Zoom + + zoomCurrent = 0; + + // Setup Fade with Zoom, If Requested + + if (includeFade == 1) { + fadeCurrent = 0; + fadeAmount = (0 - 100) / tempSteps; + } else { + fadeAmount = 0; + } + + // Do It! + + zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+hostX+", "+zoomChangeX+", "+hostY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDoneIn(zoomID)')", zoomTime); + zoomActive[theID] = true; + } +} + +// Zoom it back out. + +function zoomOut(from, evt) { + + // Get shift key status. + // IE events don't seem to get passed through the function, so grab it from the window. + + if (getShift(evt)) { + tempSteps = zoomSteps * 7; + } else { + tempSteps = zoomSteps; + } + + // Check to see if something is happening/open + + if (zoomActive[theID] != true) { + + // First, get rid of the shadow if necessary. + + if (document.getElementById("ShadowBox")) { + document.getElementById("ShadowBox").style.visibility = "hidden"; + } else if (! browserIsIE) { + + // Wipe timer if shadow is fading in still + if (fadeActive["ZoomImage"]) { + clearInterval(fadeTimer["ZoomImage"]); + fadeActive["ZoomImage"] = false; + fadeTimer["ZoomImage"] = false; + } + + document.getElementById("ZoomImage").style.webkitBoxShadow = shadowSettings + '0.0)'; + } + + // ..and the close box... + + document.getElementById("ZoomClose").style.visibility = "hidden"; + + // ...and the caption if necessary! + + if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { + // fadeElementSetup(zoomCaptionDiv, 100, 0, 5, 1); + document.getElementById(zoomCaptionDiv).style.visibility = "hidden"; + } + + // Now, figure out where we came from, to get back there + + startX = parseInt(zoomdiv.style.left); + startY = parseInt(zoomdiv.style.top); + startW = zoomimg.width; + startH = zoomimg.height; + zoomChangeX = zoomOrigX[theID] - startX; + zoomChangeY = zoomOrigY[theID] - startY; + zoomChangeW = zoomOrigW[theID] - startW; + zoomChangeH = zoomOrigH[theID] - startH; + + // Setup Zoom + + zoomCurrent = 0; + + // Setup Fade with Zoom, If Requested + + if (includeFade == 1) { + fadeCurrent = 0; + fadeAmount = (100 - 0) / tempSteps; + } else { + fadeAmount = 0; + } + + // Do It! + + zoomTimer[theID] = setInterval("zoomElement('"+zoomID+"', '"+theID+"', "+zoomCurrent+", "+startW+", "+zoomChangeW+", "+startH+", "+zoomChangeH+", "+startX+", "+zoomChangeX+", "+startY+", "+zoomChangeY+", "+tempSteps+", "+includeFade+", "+fadeAmount+", 'zoomDone(zoomID, theID)')", zoomTime); + zoomActive[theID] = true; + } +} + +// Finished Zooming In + +function zoomDoneIn(zoomdiv, theID) { + + // Note that it's open + + zoomOpen = true; + zoomdiv = document.getElementById(zoomdiv); + + // Position the table shadow behind the zoomed in image, and display it + + if (document.getElementById("ShadowBox")) { + + setOpacity(0, "ShadowBox"); + shadowdiv = document.getElementById("ShadowBox"); + + shadowLeft = parseInt(zoomdiv.style.left) - 13; + shadowTop = parseInt(zoomdiv.style.top) - 8; + shadowWidth = zoomdiv.offsetWidth + 26; + shadowHeight = zoomdiv.offsetHeight + 26; + + shadowdiv.style.width = shadowWidth + 'px'; + shadowdiv.style.height = shadowHeight + 'px'; + shadowdiv.style.left = shadowLeft + 'px'; + shadowdiv.style.top = shadowTop + 'px'; + + document.getElementById("ShadowBox").style.visibility = "visible"; + fadeElementSetup("ShadowBox", 0, 100, 5); + + } else if (! browserIsIE) { + // Or, do a fade of the modern shadow + fadeElementSetup("ZoomImage", 0, .8, 5, 0, "shadow"); + } + + // Position and display the CAPTION, if existing + + if (includeCaption && document.getElementById(zoomCaption).innerHTML != "") { + // setOpacity(0, zoomCaptionDiv); + zoomcapd = document.getElementById(zoomCaptionDiv); + zoomcapd.style.top = parseInt(zoomdiv.style.top) + (zoomdiv.offsetHeight + 15) + 'px'; + zoomcapd.style.left = (myWidth / 2) - (zoomcapd.offsetWidth / 2) + 'px'; + zoomcapd.style.visibility = "visible"; + // fadeElementSetup(zoomCaptionDiv, 0, 100, 5); + } + + // Display Close Box (fade it if it's not IE) + + if (!browserIsIE) setOpacity(0, "ZoomClose"); + document.getElementById("ZoomClose").style.visibility = "visible"; + if (!browserIsIE) fadeElementSetup("ZoomClose", 0, 100, 5); + + // Get keypresses + document.onkeypress = getKey; + +} + +// Finished Zooming Out + +function zoomDone(zoomdiv, theID) { + + // No longer open + + zoomOpen = false; + + // Clear stuff out, clean up + + zoomOrigH[theID] = ""; + zoomOrigW[theID] = ""; + document.getElementById(zoomdiv).style.visibility = "hidden"; + zoomActive[theID] == false; + + // Stop getting keypresses + + document.onkeypress = null; + +} + +// Actually zoom the element + +function zoomElement(zoomdiv, theID, zoomCurrent, zoomStartW, zoomChangeW, zoomStartH, zoomChangeH, zoomStartX, zoomChangeX, zoomStartY, zoomChangeY, zoomSteps, includeFade, fadeAmount, execWhenDone) { + + // console.log("Zooming Step #"+zoomCurrent+ " of "+zoomSteps+" (zoom " + zoomStartW + "/" + zoomChangeW + ") (zoom " + zoomStartH + "/" + zoomChangeH + ") (zoom " + zoomStartX + "/" + zoomChangeX + ") (zoom " + zoomStartY + "/" + zoomChangeY + ") Fade: "+fadeAmount); + + // Test if we're done, or if we continue + + if (zoomCurrent == (zoomSteps + 1)) { + zoomActive[theID] = false; + clearInterval(zoomTimer[theID]); + + if (execWhenDone != "") { + eval(execWhenDone); + } + } else { + + // Do the Fade! + + if (includeFade == 1) { + if (fadeAmount < 0) { + setOpacity(Math.abs(zoomCurrent * fadeAmount), zoomdiv); + } else { + setOpacity(100 - (zoomCurrent * fadeAmount), zoomdiv); + } + } + + // Calculate this step's difference, and move it! + + moveW = cubicInOut(zoomCurrent, zoomStartW, zoomChangeW, zoomSteps); + moveH = cubicInOut(zoomCurrent, zoomStartH, zoomChangeH, zoomSteps); + moveX = cubicInOut(zoomCurrent, zoomStartX, zoomChangeX, zoomSteps); + moveY = cubicInOut(zoomCurrent, zoomStartY, zoomChangeY, zoomSteps); + + document.getElementById(zoomdiv).style.left = moveX + 'px'; + document.getElementById(zoomdiv).style.top = moveY + 'px'; + zoomimg.style.width = moveW + 'px'; + zoomimg.style.height = moveH + 'px'; + + zoomCurrent++; + + clearInterval(zoomTimer[theID]); + zoomTimer[theID] = setInterval("zoomElement('"+zoomdiv+"', '"+theID+"', "+zoomCurrent+", "+zoomStartW+", "+zoomChangeW+", "+zoomStartH+", "+zoomChangeH+", "+zoomStartX+", "+zoomChangeX+", "+zoomStartY+", "+zoomChangeY+", "+zoomSteps+", "+includeFade+", "+fadeAmount+", '"+execWhenDone+"')", zoomTime); + } +} + +// Zoom Utility: Get Key Press when image is open, and act accordingly + +function getKey(evt) { + if (! evt) { + theKey = event.keyCode; + } else { + theKey = evt.keyCode; + } + + if (theKey == 27) { // ESC + zoomOut(this, evt); + } +} + +//////////////////////////// +// +// FADE Functions +// + +function fadeOut(elem) { + if (elem.id) { + fadeElementSetup(elem.id, 100, 0, 10); + } +} + +function fadeIn(elem) { + if (elem.id) { + fadeElementSetup(elem.id, 0, 100, 10); + } +} + +// Fade: Initialize the fade function + +var fadeActive = new Array(); +var fadeQueue = new Array(); +var fadeTimer = new Array(); +var fadeClose = new Array(); +var fadeMode = new Array(); + +function fadeElementSetup(theID, fdStart, fdEnd, fdSteps, fdClose, fdMode) { + + // alert("Fading: "+theID+" Steps: "+fdSteps+" Mode: "+fdMode); + + if (fadeActive[theID] == true) { + // Already animating, queue up this command + fadeQueue[theID] = new Array(theID, fdStart, fdEnd, fdSteps); + } else { + fadeSteps = fdSteps; + fadeCurrent = 0; + fadeAmount = (fdStart - fdEnd) / fadeSteps; + fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); + fadeActive[theID] = true; + fadeMode[theID] = fdMode; + + if (fdClose == 1) { + fadeClose[theID] = true; + } else { + fadeClose[theID] = false; + } + } +} + +// Fade: Do the fade. This function will call itself, modifying the parameters, so +// many instances can run concurrently. Can fade using opacity, or fade using a box-shadow. + +function fadeElement(theID, fadeCurrent, fadeAmount, fadeSteps) { + + if (fadeCurrent == fadeSteps) { + + // We're done, so clear. + + clearInterval(fadeTimer[theID]); + fadeActive[theID] = false; + fadeTimer[theID] = false; + + // Should we close it once the fade is complete? + + if (fadeClose[theID] == true) { + document.getElementById(theID).style.visibility = "hidden"; + } + + // Hang on.. did a command queue while we were working? If so, make it happen now + + if (fadeQueue[theID] && fadeQueue[theID] != false) { + fadeElementSetup(fadeQueue[theID][0], fadeQueue[theID][1], fadeQueue[theID][2], fadeQueue[theID][3]); + fadeQueue[theID] = false; + } + } else { + + fadeCurrent++; + + // Now actually do the fade adjustment. + + if (fadeMode[theID] == "shadow") { + + // Do a special fade on the webkit-box-shadow of the object + + if (fadeAmount < 0) { + document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (Math.abs(fadeCurrent * fadeAmount)) + ')'; + } else { + document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (100 - (fadeCurrent * fadeAmount)) + ')'; + } + + } else { + + // Set the opacity depending on if we're adding or subtracting (pos or neg) + + if (fadeAmount < 0) { + setOpacity(Math.abs(fadeCurrent * fadeAmount), theID); + } else { + setOpacity(100 - (fadeCurrent * fadeAmount), theID); + } + } + + // Keep going, and send myself the updated variables + clearInterval(fadeTimer[theID]); + fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15); + } +} + +//////////////////////////// +// +// UTILITY functions +// + +// Utility: Set the opacity, compatible with a number of browsers. Value from 0 to 100. + +function setOpacity(opacity, theID) { + + var object = document.getElementById(theID).style; + + // If it's 100, set it to 99 for Firefox. + + if (navigator.userAgent.indexOf("Firefox") != -1) { + if (opacity == 100) { opacity = 99.9999; } // This is majorly awkward + } + + // Multi-browser opacity setting + + object.filter = "alpha(opacity=" + opacity + ")"; // IE/Win + object.opacity = (opacity / 100); // Safari 1.2, Firefox+Mozilla + +} + +// Utility: Math functions for animation calucations - From http://www.robertpenner.com/easing/ +// +// t = time, b = begin, c = change, d = duration +// time = current frame, begin is fixed, change is basically finish - begin, duration is fixed (frames), + +function linear(t, b, c, d) +{ + return c*t/d + b; +} + +function sineInOut(t, b, c, d) +{ + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; +} + +function cubicIn(t, b, c, d) { + return c*(t/=d)*t*t + b; +} + +function cubicOut(t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; +} + +function cubicInOut(t, b, c, d) +{ + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; +} + +function bounceOut(t, b, c, d) +{ + if ((t/=d) < (1/2.75)){ + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)){ + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)){ + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } +} + + +// Utility: Get the size of the window, and set myWidth and myHeight +// Credit to quirksmode.org + +function getSize() { + + // Window Size + + if (self.innerHeight) { // Everyone but IE + myWidth = window.innerWidth; + myHeight = window.innerHeight; + myScroll = window.pageYOffset; + } else if (document.documentElement && document.documentElement.clientHeight) { // IE6 Strict + myWidth = document.documentElement.clientWidth; + myHeight = document.documentElement.clientHeight; + myScroll = document.documentElement.scrollTop; + } else if (document.body) { // Other IE, such as IE7 + myWidth = document.body.clientWidth; + myHeight = document.body.clientHeight; + myScroll = document.body.scrollTop; + } + + // Page size w/offscreen areas + + if (window.innerHeight && window.scrollMaxY) { + myScrollWidth = document.body.scrollWidth; + myScrollHeight = window.innerHeight + window.scrollMaxY; + } else if (document.body.scrollHeight > document.body.offsetHeight) { // All but Explorer Mac + myScrollWidth = document.body.scrollWidth; + myScrollHeight = document.body.scrollHeight; + } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari + myScrollWidth = document.body.offsetWidth; + myScrollHeight = document.body.offsetHeight; + } +} + +// Utility: Get Shift Key Status +// IE events don't seem to get passed through the function, so grab it from the window. + +function getShift(evt) { + var shift = false; + if (! evt && window.event) { + shift = window.event.shiftKey; + } else if (evt) { + shift = evt.shiftKey; + if (shift) evt.stopPropagation(); // Prevents Firefox from doing shifty things + } + return shift; +} + +// Utility: Find the Y position of an element on a page. Return Y and X as an array + +function findElementPos(elemFind) +{ + var elemX = 0; + var elemY = 0; + do { + elemX += elemFind.offsetLeft; + elemY += elemFind.offsetTop; + } while ( elemFind = elemFind.offsetParent ) + + return Array(elemX, elemY); +}
\ No newline at end of file diff --git a/static/js/FancyZoomHTML.js b/static/js/FancyZoomHTML.js new file mode 100755 index 0000000..e69de29 --- /dev/null +++ b/static/js/FancyZoomHTML.js diff --git a/static/js/away.js b/static/js/away.js new file mode 100755 index 0000000..cf4b19c --- /dev/null +++ b/static/js/away.js @@ -0,0 +1,28 @@ +var UnseenMsgCounter = 0; +var OrigTitle = $('title').text(); +var HasFocus = true; + +function onFocus() { + HasFocus = true; + UnseenMsgCounter = 0; + $('title').text(OrigTitle); +} + +function onBlur() { + HasFocus = false; +} + +$(window).blur(onBlur); +$(window).focus(onFocus); + +function titleUpdater() { + if (HasFocus || UnseenMsgCounter == 0 || $('title').text() != OrigTitle) { + $('title').text(OrigTitle); + } else { + var plural = UnseenMsgCounter > 1 ? 's' : ''; + $('title').text(UnseenMsgCounter + ' new dump' + plural + '! | ' + OrigTitle); + } + setTimeout(titleUpdater, 2000); +} + +setTimeout(titleUpdater, 2000);
\ No newline at end of file diff --git a/static/js/dumpsearch.js b/static/js/dumpsearch.js new file mode 100755 index 0000000..bb0bcce --- /dev/null +++ b/static/js/dumpsearch.js @@ -0,0 +1,39 @@ +if (!window['google']) { +window['google'] = {}; +} +if (!window['google']['loader']) { +window['google']['loader'] = {}; +google.loader.ServiceBase = 'http://www.google.com/uds'; +google.loader.GoogleApisBase = 'http://ajax.googleapis.com/ajax'; +google.loader.ApiKey = 'ABQIAAAA6C4bndUCBastUbawfhKGURQviNTBAztVc6-FhSQEQv6BdFn_BBRfktMUHCKH-MICXpvRmJU3x-Ly0w'; +google.loader.KeyVerified = true; +google.loader.LoadFailure = false; +google.loader.Secure = false; +google.loader.GoogleLocale = 'www.google.com'; +google.loader.ClientLocation = null; +google.loader.AdditionalParams = ''; +(function() {var d=true,e=null,g=false,h=encodeURIComponent,j=window,k=google,m=undefined,n=document;function p(a,b){return a.load=b}var q="push",s="replace",t="charAt",u="ServiceBase",v="name",w="getTime",x="length",y="prototype",z="setTimeout",A="loader",B="substring",C="join",D="toLowerCase";function E(a){if(a in F)return F[a];return F[a]=navigator.userAgent[D]().indexOf(a)!=-1}var F={};function G(a,b){var c=function(){};c.prototype=b[y];a.S=b[y];a.prototype=new c} +function H(a,b){var c=a.G||[];c=c.concat(Array[y].slice.call(arguments,2));if(typeof a.t!="undefined")b=a.t;if(typeof a.s!="undefined")a=a.s;var f=function(){var i=c.concat(Array[y].slice.call(arguments));return a.apply(b,i)};f.G=c;f.t=b;f.s=a;return f}function I(a){a=new Error(a);a.toString=function(){return this.message};return a}function J(a,b){a=a.split(/\./);for(var c=j,f=0;f<a[x]-1;f++){c[a[f]]||(c[a[f]]={});c=c[a[f]]}c[a[a[x]-1]]=b}function K(a,b,c){a[b]=c}if(!L)var L=J;if(!M)var M=K;k[A].u={};L("google.loader.callbacks",k[A].u);var N={},O={};k[A].eval={};L("google.loader.eval",k[A].eval); +p(k,function(a,b,c){function f(r){var o=r.split(".");if(o[x]>2)throw I("Module: '"+r+"' not found!");else if(typeof o[1]!="undefined"){i=o[0];c.packages=c.packages||[];c.packages[q](o[1])}}var i=a;c=c||{};if(a instanceof Array||a&&typeof a=="object"&&typeof a[C]=="function"&&typeof a.reverse=="function")for(var l=0;l<a[x];l++)f(a[l]);else f(a);if(a=N[":"+i]){if(c&&!c.language&&c.locale)c.language=c.locale;if(c&&typeof c.callback=="string"){l=c.callback;if(l.match(/^[[\]A-Za-z0-9._]+$/)){l=j.eval(l); +c.callback=l}}if((l=c&&c.callback!=e)&&!a.r(b))throw I("Module: '"+i+"' must be loaded before DOM onLoad!");else if(l)a.l(b,c)?j[z](c.callback,0):a.load(b,c);else a.l(b,c)||a.load(b,c)}else throw I("Module: '"+i+"' not found!");});L("google.load",k.load);k.R=function(a,b){b?aa(a):P(j,"load",a)};L("google.setOnLoadCallback",k.R);function P(a,b,c){if(a.addEventListener)a.addEventListener(b,c,g);else if(a.attachEvent)a.attachEvent("on"+b,c);else{var f=a["on"+b];a["on"+b]=f!=e?ba([c,f]):c}} +function ba(a){return function(){for(var b=0;b<a[x];b++)a[b]()}}var Q=[];function aa(a){if(Q[x]==0){P(j,"load",R);if(!E("msie")&&!(E("safari")||E("konqueror"))&&E("mozilla")||j.opera)j.addEventListener("DOMContentLoaded",R,g);else if(E("msie"))n.write("<script defer onreadystatechange='google.loader.domReady()' src=//:><\/script>");else(E("safari")||E("konqueror"))&&j[z](ca,10)}Q[q](a)} +k[A].M=function(){var a=j.event.srcElement;if(a.readyState=="complete"){a.onreadystatechange=e;a.parentNode.removeChild(a);R()}};L("google.loader.domReady",k[A].M);var da={loaded:d,complete:d};function ca(){if(da[n.readyState])R();else Q[x]>0&&j[z](ca,10)}function R(){for(var a=0;a<Q[x];a++)Q[a]();Q.length=0} +k[A].e=function(a,b,c){if(c){var f;if(a=="script"){f=n.createElement("script");f.type="text/javascript";f.src=b}else if(a=="css"){f=n.createElement("link");f.type="text/css";f.href=b;f.rel="stylesheet"}(a=n.getElementsByTagName("head")[0])||(a=n.body.parentNode.appendChild(n.createElement("head")));a.appendChild(f)}else if(a=="script")n.write('<script src="'+b+'" type="text/javascript"><\/script>');else a=="css"&&n.write('<link href="'+b+'" type="text/css" rel="stylesheet"></link>')}; +L("google.loader.writeLoadTag",k[A].e);k[A].O=function(a){O=a};L("google.loader.rfm",k[A].O);k[A].Q=function(a){for(var b in a)if(typeof b=="string"&&b&&b[t](0)==":"&&!N[b])N[b]=new T(b[B](1),a[b])};L("google.loader.rpl",k[A].Q);k[A].P=function(a){if((a=a.specs)&&a[x])for(var b=0;b<a[x];++b){var c=a[b];if(typeof c=="string")N[":"+c]=new U(c);else{c=new V(c[v],c.baseSpec,c.customSpecs);N[":"+c[v]]=c}}};L("google.loader.rm",k[A].P);k[A].loaded=function(a){N[":"+a.module].j(a)}; +L("google.loader.loaded",k[A].loaded);k[A].L=function(){var a=(new Date)[w](),b=Math.floor(Math.random()*1E7);return"qid="+(a.toString(16)+b.toString(16))};L("google.loader.createGuidArg_",k[A].L);J("google_exportSymbol",J);J("google_exportProperty",K);k[A].b={};L("google.loader.themes",k[A].b);k[A].b.A="http://www.google.com/cse/style/look/bubblegum.css";M(k[A].b,"BUBBLEGUM",k[A].b.A);k[A].b.C="http://www.google.com/cse/style/look/greensky.css";M(k[A].b,"GREENSKY",k[A].b.C);k[A].b.B="http://www.google.com/cse/style/look/espresso.css"; +M(k[A].b,"ESPRESSO",k[A].b.B);k[A].b.F="http://www.google.com/cse/style/look/shiny.css";M(k[A].b,"SHINY",k[A].b.F);k[A].b.D="http://www.google.com/cse/style/look/minimalist.css";M(k[A].b,"MINIMALIST",k[A].b.D);function U(a){this.a=a;this.p=[];this.o={};this.c={};this.k=d;this.d=-1} +U[y].g=function(a,b){var c="";if(b!=m){if(b.language!=m)c+="&hl="+h(b.language);if(b.nocss!=m)c+="&output="+h("nocss="+b.nocss);if(b.nooldnames!=m)c+="&nooldnames="+h(b.nooldnames);if(b.packages!=m)c+="&packages="+h(b.packages);if(b.callback!=e)c+="&async=2";if(b.style!=m)c+="&style="+h(b.style);if(b.other_params!=m)c+="&"+b.other_params}if(!this.k){if(k[this.a]&&k[this.a].JSHash)c+="&sig="+h(k[this.a].JSHash);b=[];for(var f in this.o)f[t](0)==":"&&b[q](f[B](1));for(f in this.c)f[t](0)==":"&&b[q](f[B](1)); +c+="&have="+h(b[C](","))}return k[A][u]+"/?file="+this.a+"&v="+a+k[A].AdditionalParams+c};U[y].w=function(a){var b=e;if(a)b=a.packages;var c=e;if(b)if(typeof b=="string")c=[a.packages];else if(b[x]){c=[];for(a=0;a<b[x];a++)typeof b[a]=="string"&&c[q](b[a][s](/^\s*|\s*$/,"")[D]())}c||(c=["default"]);b=[];for(a=0;a<c[x];a++)this.o[":"+c[a]]||b[q](c[a]);return b}; +p(U[y],function(a,b){var c=this.w(b),f=b&&b.callback!=e;if(f)var i=new W(b.callback);for(var l=[],r=c[x]-1;r>=0;r--){var o=c[r];f&&i.H(o);if(this.c[":"+o]){c.splice(r,1);f&&this.c[":"+o][q](i)}else l[q](o)}if(c[x]){if(b&&b.packages)b.packages=c.sort()[C](",");if(!b&&O[":"+this.a]!=e&&O[":"+this.a].versions[":"+a]!=e&&!k[A].AdditionalParams&&this.k){a=O[":"+this.a];k[this.a]=k[this.a]||{};for(var S in a.properties)if(S&&S[t](0)==":")k[this.a][S[B](1)]=a.properties[S];k[A].e("script",k[A][u]+a.path+ +a.js,f);a.css&&k[A].e("css",k[A][u]+a.path+a.css,f)}else if(!b||!b.autoloaded)k[A].e("script",this.g(a,b),f);if(this.k){this.k=g;this.d=(new Date)[w]();if(this.d%100!=1)this.d=-1}for(r=0;r<l[x];r++){o=l[r];this.c[":"+o]=[];f&&this.c[":"+o][q](i)}}}); +U[y].j=function(a){if(this.d!=-1){X("al_"+this.a,"jl."+((new Date)[w]()-this.d),d);this.d=-1}this.p=this.p.concat(a.components);k[A][this.a]||(k[A][this.a]={});k[A][this.a].packages=this.p.slice(0);for(var b=0;b<a.components[x];b++){this.o[":"+a.components[b]]=d;var c=this.c[":"+a.components[b]];if(c){for(var f=0;f<c[x];f++)c[f].K(a.components[b]);delete this.c[":"+a.components[b]]}}X("hl",this.a)};U[y].l=function(a,b){return this.w(b)[x]==0};U[y].r=function(){return d}; +function W(a){this.J=a;this.m={};this.q=0}W[y].H=function(a){this.q++;this.m[":"+a]=d};W[y].K=function(a){if(this.m[":"+a]){this.m[":"+a]=g;this.q--;this.q==0&&j[z](this.J,0)}};function V(a,b,c){this.name=a;this.I=b;this.n=c;this.v=this.h=g;this.i=[];k[A].u[this[v]]=H(this.j,this)}G(V,U);p(V[y],function(a,b){var c=b&&b.callback!=e;if(c){this.i[q](b.callback);b.callback="google.loader.callbacks."+this[v]}else this.h=d;if(!b||!b.autoloaded)k[A].e("script",this.g(a,b),c);X("el",this[v])});V[y].l=function(a,b){return b&&b.callback!=e?this.v:this.h};V[y].j=function(){this.v=d;for(var a=0;a<this.i[x];a++)j[z](this.i[a],0);this.i=[]}; +var Y=function(a,b){return a.string?h(a.string)+"="+h(b):a.regex?b[s](/(^.*$)/,a.regex):""};V[y].g=function(a,b){return this.N(this.z(a),a,b)}; +V[y].N=function(a,b,c){var f="";if(a.key)f+="&"+Y(a.key,k[A].ApiKey);if(a.version)f+="&"+Y(a.version,b);b=k[A].Secure&&a.ssl?a.ssl:a.uri;if(c!=e)for(var i in c)if(a.params[i])f+="&"+Y(a.params[i],c[i]);else if(i=="other_params")f+="&"+c[i];else if(i=="base_domain")b="http://"+c[i]+a.uri[B](a.uri.indexOf("/",7));k[this[v]]={};if(b.indexOf("?")==-1&&f)f="?"+f[B](1);return b+f};V[y].r=function(a){return this.z(a).deferred};V[y].z=function(a){if(this.n)for(var b=0;b<this.n[x];++b){var c=this.n[b];if((new RegExp(c.pattern)).test(a))return c}return this.I};function T(a,b){this.a=a;this.f=b;this.h=g}G(T,U);p(T[y],function(a,b){this.h=d;k[A].e("script",this.g(a,b),g)});T[y].l=function(){return this.h};T[y].j=function(){};T[y].g=function(a,b){if(!this.f.versions[":"+a]){if(this.f.aliases){var c=this.f.aliases[":"+a];if(c)a=c}if(!this.f.versions[":"+a])throw I("Module: '"+this.a+"' with version '"+a+"' not found!");}a=k[A].GoogleApisBase+"/libs/"+this.a+"/"+a+"/"+this.f.versions[":"+a][b&&b.uncompressed?"uncompressed":"compressed"];X("el",this.a);return a}; +T[y].r=function(){return g};var ea=g,Z=[],fa=(new Date)[w](),X=function(a,b,c){if(!ea){P(j,"unload",ga);ea=d}if(c){if(!k[A].Secure&&(!k[A].Options||k[A].Options.csi===g)){a=a[D]()[s](/[^a-z0-9_.]+/g,"_");b=b[D]()[s](/[^a-z0-9_.]+/g,"_");j[z](H($,e,"http://csi.gstatic.com/csi?s=uds&v=2&action="+h(a)+"&it="+h(b)),1E4)}}else{Z[q]("r"+Z[x]+"="+h(a+(b?"|"+b:"")));j[z](ga,Z[x]>5?0:15E3)}},ga=function(){if(Z[x]){$(k[A][u]+"/stats?"+Z[C]("&")+"&nc="+(new Date)[w]()+"_"+((new Date)[w]()-fa));Z.length=0}},$=function(a){var b=new Image, +c=ha++;ia[c]=b;b.onload=b.onerror=function(){delete ia[c]};b.src=a;b=e},ia={},ha=0;J("google.loader.recordStat",X);J("google.loader.createImageForLogging",$); + +}) ();google.loader.rm({"specs":[{"name":"books","baseSpec":{"uri":"http://books.google.com/books/api.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}}}},"feeds",{"name":"friendconnect","baseSpec":{"uri":"http://www.google.com/friendconnect/script/friendconnect.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{}}},"spreadsheets","gdata","visualization",{"name":"sharing","baseSpec":{"uri":"http://www.google.com/s2/sharing/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":false,"params":{"language":{"string":"hl"}}}},"search",{"name":"maps","baseSpec":{"uri":"http://maps.google.com/maps?file\u003dgoogleapi","ssl":"https://maps-api-ssl.google.com/maps?file\u003dgoogleapi","key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"regex":"callback\u003d$1\u0026async\u003d2"},"language":{"string":"hl"}}},"customSpecs":[{"uri":"http://maps.google.com/maps/api/js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"}},"pattern":"^(3|3..*)$"}]},"annotations_v2","orkut","language","earth",{"name":"annotations","baseSpec":{"uri":"http://www.google.com/reviews/scripts/annotations_bootstrap.js","ssl":null,"key":{"string":"key"},"version":{"string":"v"},"deferred":true,"params":{"callback":{"string":"callback"},"language":{"string":"hl"},"country":{"string":"gl"}}}},"ads","elements"]}); +google.loader.rfm({":feeds":{"versions":{":1":"1",":1.0":"1"},"path":"/api/feeds/1.0/e291a634414cb5ef1c9f3b5424b8ac4b/","js":"default+en.I.js","css":"default.css","properties":{":JSHash":"e291a634414cb5ef1c9f3b5424b8ac4b",":Version":"1.0"}},":search":{"versions":{":1":"1",":1.0":"1"},"path":"/api/search/1.0/d3863cc958afe4c6c797e1fc2d91793c/","js":"default+en.I.js","css":"default.css","properties":{":JSHash":"d3863cc958afe4c6c797e1fc2d91793c",":NoOldNames":false,":Version":"1.0"}},":language":{"versions":{":1":"1",":1.0":"1"},"path":"/api/language/1.0/cd6e6992328d3619ee31352c39a90b10/","js":"default+en.I.js","properties":{":JSHash":"cd6e6992328d3619ee31352c39a90b10",":Version":"1.0"}},":spreadsheets":{"versions":{":0":"1",":0.2":"1"},"path":"/api/spreadsheets/0.2/626554c678ff579189704ea83fe72774/","js":"default.I.js","properties":{":JSHash":"626554c678ff579189704ea83fe72774",":Version":"0.2"}},":earth":{"versions":{":1":"1",":1.0":"1"},"path":"/api/earth/1.0/abef9437280171d37dd6be81a58115d2/","js":"default.I.js","properties":{":JSHash":"abef9437280171d37dd6be81a58115d2",":Version":"1.0"}},":annotations":{"versions":{":1":"1",":1.0":"1"},"path":"/api/annotations/1.0/71b0b459463545c346b09f9e642464ae/","js":"default+en.I.js","properties":{":JSHash":"71b0b459463545c346b09f9e642464ae",":Version":"1.0"}}}); +google.loader.rpl({":scriptaculous":{"versions":{":1.8.3":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.2":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"},":1.8.1":{"uncompressed":"scriptaculous.js","compressed":"scriptaculous.js"}},"aliases":{":1.8":"1.8.3",":1":"1.8.3"}},":yui":{"versions":{":2.6.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.7.0":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"},":2.8.0r4":{"uncompressed":"build/yuiloader/yuiloader.js","compressed":"build/yuiloader/yuiloader-min.js"}},"aliases":{":2":"2.8.0r4",":2.7":"2.7.0",":2.6":"2.6.0",":2.8":"2.8.0r4",":2.8.0":"2.8.0r4"}},":swfobject":{"versions":{":2.1":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"},":2.2":{"uncompressed":"swfobject_src.js","compressed":"swfobject.js"}},"aliases":{":2":"2.2"}},":ext-core":{"versions":{":3.0.0":{"uncompressed":"ext-core-debug.js","compressed":"ext-core.js"}},"aliases":{":3":"3.0.0",":3.0":"3.0.0"}},":mootools":{"versions":{":1.2.3":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.4":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.1":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.2.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"},":1.1.2":{"uncompressed":"mootools.js","compressed":"mootools-yui-compressed.js"}},"aliases":{":1":"1.1.2",":1.11":"1.1.1",":1.2":"1.2.4",":1.1":"1.1.2"}},":jqueryui":{"versions":{":1.7.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.6.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.0":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.7.1":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.3":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"},":1.5.2":{"uncompressed":"jquery-ui.js","compressed":"jquery-ui.min.js"}},"aliases":{":1.7":"1.7.2",":1":"1.7.2",":1.6":"1.6.0",":1.5":"1.5.3"}},":chrome-frame":{"versions":{":1.0.2":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.1":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"},":1.0.0":{"uncompressed":"CFInstall.js","compressed":"CFInstall.min.js"}},"aliases":{":1":"1.0.2",":1.0":"1.0.2"}},":prototype":{"versions":{":1.6.0.2":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.1.0":{"uncompressed":"prototype.js","compressed":"prototype.js"},":1.6.0.3":{"uncompressed":"prototype.js","compressed":"prototype.js"}},"aliases":{":1.6.1":"1.6.1.0",":1":"1.6.1.0",":1.6":"1.6.1.0",":1.6.0":"1.6.0.3"}},":jquery":{"versions":{":1.2.3":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.1":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.0":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.3.2":{"uncompressed":"jquery.js","compressed":"jquery.min.js"},":1.2.6":{"uncompressed":"jquery.js","compressed":"jquery.min.js"}},"aliases":{":1":"1.3.2",":1.3":"1.3.2",":1.2":"1.2.6"}},":dojo":{"versions":{":1.2.3":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.1.1":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.3.2":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.2.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"},":1.4.0":{"uncompressed":"dojo/dojo.xd.js.uncompressed.js","compressed":"dojo/dojo.xd.js"}},"aliases":{":1":"1.4.0",":1.4":"1.4.0",":1.3":"1.3.2",":1.2":"1.2.3",":1.1":"1.1.1"}}}); +} diff --git a/static/js/jquery.editinplace.1.0.1.packed.js b/static/js/jquery.editinplace.1.0.1.packed.js new file mode 100755 index 0000000..4f505b0 --- /dev/null +++ b/static/js/jquery.editinplace.1.0.1.packed.js @@ -0,0 +1,287 @@ +/* + * Another In Place Editor - a jQuery edit in place plugin + * + * Copyright (c) 2009 Dave Hauenstein + * + * License: + * This source file is subject to the BSD license bundled with this package. + * Available online: {@link http://www.opensource.org/licenses/bsd-license.php} + * If you did not receive a copy of the license, and are unable to obtain it, + * email davehauenstein@gmail.com, + * and I will send you a copy. + * + * Project home: + * http://code.google.com/p/jquery-in-place-editor/ + * + */ + +/* + * Version 1.0.2 + * + * bg_out (string) default: transparent hex code of background color on restore from hover + * bg_over (string) default: #ffc hex code of background color on hover + * callback (function) default: null function to be called when editing is complete; cancels ajax submission to the url param + * cancel_button (string) default: <input type=”submit” class=”inplace_cancel” value=”Cancel”/> image button tag to use as “Cancel” button + * default_text (string) default: “(Click here to add text)” text to show up if the element that has this functionality is empty + * element_id (string) default: element_id name of parameter holding element_id + * error (function) this function gets called if server responds with an error + * field_type (string) “text”, “textarea”, or “select”; default: “text” The type of form field that will appear on instantiation + * on_blur (string) “save” or null; default: “save” what to do on blur; will be overridden if $param show_buttons is true + * original_html (string) default: original_html name of parameter holding original_html + * params (string) example: first_name=dave&last_name=hauenstein paramters sent via the post request to the server + * save_button (string) default: <input type=”submit” class=”inplace_save” value=”Save”/> image button tag to use as “Save” button + * saving_image (string) default: uses saving text specify an image location instead of text while server is saving + * saving_text (string) default: “Saving…” text to be used when server is saving information + * select_options (string) comma delimited list of options if field_type is set to select + * select_text (string)default text to show up in select box + * show_buttons (boolean) default: false will show the buttons: cancel or save; will automatically cancel out the onBlur functionality + * success (function) default: null this function gets called if server responds with a success + * textarea_cols (integer) default: 25 set cols attribute of textarea, if field_type is set to textarea + * textarea_rows (integer) default: 10 set rows attribute of textarea, if field_type is set to textarea + * update_value (string) default: update_value name of parameter holding update_value + * url (string) POST URL to send edited content + * value_required (string) default: false if set to true, the element will not be saved unless a value is entered + * + */ + +jQuery.fn.editInPlace = function(options) { + + /* DEFINE THE DEFAULT SETTINGS, SWITCH THEM WITH THE OPTIONS USER PROVIDES */ + var settings = { + url: "", + params: "", + field_type: "text", + select_options: "", + textarea_cols: "25", + textarea_rows: "10", + bg_over: "#ffc", + bg_out: "transparent", + saving_text: "Saving...", + saving_image: "", + default_text: "(Click here to add text)", + select_text: "Choose new value", + value_required: null, + element_id: "element_id", + update_value: "update_value", + original_html: "original_html", + save_button: '<button class="inplace_save">Save</button>', + cancel_button: '<button class="inplace_cancel">Cancel</button>', + show_buttons: false, + on_blur: "save", + callback: null, + callbackShowErrors: true, + success: null, + error: function(request){ + alert("Failed to save value: " + request.responseText || 'Unspecified Error'); + } + }; + + if(options) { + jQuery.extend(settings, options); + } + + /* preload the loading icon if it exists */ + if(settings.saving_image != ""){ + var loading_image = new Image(); + loading_image.src = settings.saving_image; + } + + /* THIS FUNCTION WILL TRIM WHITESPACE FROM BEFORE/AFTER A STRING */ + String.prototype.trim = function() { + return this.replace(/^\s+/, '') + .replace(/\s+$/, ''); + }; + + /* THIS FUNCTION WILL ESCAPE ANY HTML ENTITIES SO "Quoted Values" work */ + String.prototype.escape_html = function() { + return this.replace(/&/g, "&") + .replace(/</g, "<") + .replace(/>/g, ">") + .replace(/"/g, """); + }; + + /* CREATE THE INPLACE EDITOR */ + return this.each(function(){ + + if(jQuery(this).html() == "") jQuery(this).html(settings.default_text); + + var editing = false; + + //save the original element - for change of scope + var original_element = jQuery(this); + + var click_count = 0; + + jQuery(this) + + .mouseover(function(){ + jQuery(this).css("background", settings.bg_over); + }) + + .mouseout(function(){ + jQuery(this).css("background", settings.bg_out); + }) + + .click(function(){ + click_count++; + + if(!editing) + { + editing = true; + + //save original text - for cancellation functionality + var original_html = jQuery(this).html(); + var buttons_code = (settings.show_buttons) ? settings.save_button + ' ' + settings.cancel_button : ''; + + //if html is our default text, clear it out to prevent saving accidentally + if (original_html == settings.default_text) jQuery(this).html(''); + + if (settings.field_type == "textarea") + { + var use_field_type = '<textarea name="inplace_value" class="inplace_field">' + jQuery(this).text().trim().escape_html() + '</textarea>'; + } + else if(settings.field_type == "text") + { + var use_field_type = '<input type="text" name="inplace_value" class="inplace_field" value="' + + jQuery(this).text().trim().escape_html() + '" />'; + } + else if(settings.field_type == "select") + { + var optionsArray = settings.select_options.split(','); + var use_field_type = '<select name="inplace_value" class="inplace_field"><option value="">' + settings.select_text + '</option>'; + for(var i=0; i<optionsArray.length; i++){ + var optionsValuesArray = optionsArray[i].split(':'); + var use_value = optionsValuesArray[1] || optionsValuesArray[0]; + var selected = use_value == original_html ? 'selected="selected" ' : ''; + use_field_type += '<option ' + selected + 'value="' + use_value.trim().escape_html() + '">' + optionsValuesArray[0].trim().escape_html() + '</option>'; + } + use_field_type += '</select>'; + } + + /* insert the new in place form after the element they click, then empty out the original element */ + jQuery(this).html('<form class="inplace_form" style="display: inline; margin: 0; padding: 0;">' + use_field_type + ' ' + buttons_code + '</form>'); + + }/* END- if(!editing) -END */ + + if(click_count == 1) + { + function cancelAction() + { + editing = false; + click_count = 0; + + /* put the original background color in */ + original_element.css("background", settings.bg_out); + + /* put back the original text */ + original_element.html(original_html); + + return false; + } + + function saveAction() + { + /* put the original background color in */ + original_element.css("background", settings.bg_out); + + var this_elem = jQuery(this); + + var new_html = (this_elem.is('form')) ? this_elem.children(0).val() : this_elem.parent().children(0).val(); + + /* set saving message */ + if(settings.saving_image != ""){ + var saving_message = '<img src="' + settings.saving_image + '" alt="Saving..." />'; + } else { + var saving_message = settings.saving_text; + } + + /* place the saving text/image in the original element */ + original_element.html(saving_message); + + if(settings.params != ""){ + settings.params = "&" + settings.params; + } + + if(settings.callback) { + html = settings.callback(original_element.attr("id"), new_html, original_html, settings.params); + editing = false; + click_count = 0; + if (html == "") { + original_element.html(settings.default_text); + } else if(html) { + /* put the newly updated info into the original element */ + original_element.html(html || new_html); + } else { + /* failure; put original back */ + if(settings.callbackShowErrors) + { + alert("Failed to save value: " + new_html); + } + original_element.html(original_html); + } + } else if (settings.value_required && (new_html == "" || new_html == undefined)) { + editing = false; + click_count = 0; + original_element.html(original_html); + alert("Error: You must enter a value to save this field"); + } else { + jQuery.ajax({ + url: settings.url, + type: "POST", + data: settings.update_value + '=' + new_html + '&' + settings.element_id + '=' + original_element.attr("id") + settings.params + '&' + settings.original_html + '=' + original_html, + dataType: "html", + complete: function(request){ + editing = false; + click_count = 0; + }, + success: function(html){ + /* if the text returned by the server is empty, */ + /* put a marker as text in the original element */ + var new_text = html || settings.default_text; + + /* put the newly updated info into the original element */ + original_element.html(new_text); + if (settings.success) settings.success(html, original_element); + }, + error: function(request) { + original_element.html(original_html); + if (settings.error) settings.error(request, original_element); + } + }); + } + + return false; + } + + /* set the focus to the new input element */ + original_element.children("form").children(".inplace_field").focus().select(); + + /* CLICK CANCEL BUTTON functionality */ + original_element.children("form").children(".inplace_cancel").click(cancelAction); + + /* CLICK SAVE BUTTON functionality */ + original_element.children("form").children(".inplace_save").click(saveAction); + + /* if cancel/save buttons should be shown, cancel blur functionality */ + if(!settings.show_buttons){ + /* if on_blur is set to save, set the save funcion */ + if(settings.on_blur == "save") + original_element.children("form").children(".inplace_field").blur(saveAction); + /* if on_blur is set to cancel, set the cancel funcion */ + else + original_element.children("form").children(".inplace_field").blur(cancelAction); + } + + /* hit esc key */ + $(document).keyup(function(event){ + if (event.keyCode == 27) { + cancelAction(); + } + }); + + original_element.children("form").submit(saveAction); + + }/* END- if(click_count == 1) -END */ + }); + }); +};
\ No newline at end of file diff --git a/static/js/jquery.js b/static/js/jquery.js new file mode 100644 index 0000000..7361a61 --- /dev/null +++ b/static/js/jquery.js @@ -0,0 +1,171 @@ +/** + * @projectDescription Monitor Font Size Changes with jQuery + * + * @version 1.0 + * @author Dave Cardwell + * + * jQuery-Em - $Revision: 24 $ ($Date: 2007-08-19 11:24:56 +0100 (Sun, 19 Aug 2007) $) + * http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/ + * + * Copyright ©2007 Dave Cardwell <http://davecardwell.co.uk/> + * + * Released under the MIT licence: + * http://www.opensource.org/licenses/mit-license.php + */ + +// Upon $(document).ready()… +jQuery(function($) { + // Configuration… + var eventName = 'emchange'; + + + // Set up default options. + $.em = $.extend({ + /** + * The jQuery-Em version string. + * + * @example $.em.version; + * @desc '1.0a' + * + * @property + * @name version + * @type String + * @cat Plugins/Em + */ + version: '1.0', + + /** + * The number of milliseconds to wait when polling for changes to the + * font size. + * + * @example $.em.delay = 400; + * @desc Defaults to 200. + * + * @property + * @name delay + * @type Number + * @cat Plugins/Em + */ + delay: 200, + + /** + * The element used to detect changes to the font size. + * + * @example $.em.element = $('<div />')[0]; + * @desc Default is an empty, absolutely positioned, 100em-wide <div>. + * + * @private + * @property + * @name element + * @type Element + * @cat Plugins/Em + */ + element: $('<div />').css({ left: '-100em', + position: 'absolute', + width: '100em' }) + .prependTo('body')[0], + + /** + * The action to perform when a change in the font size is detected. + * + * @example $.em.action = function() { ... } + * @desc The default action is to trigger a global “emchange” event. + * You probably shouldn’t change this behaviour as other plugins may + * rely on it, but the option is here for completion. + * + * @example $(document).bind('emchange', function(e, cur, prev) {...}) + * @desc Any functions triggered on this event are passed the current + * font size, and last known font size as additional parameters. + * + * @private + * @property + * @name action + * @type Function + * @cat Plugins/Em + * @see current + * @see previous + */ + action: function() { + var currentWidth = $.em.element.offsetWidth / 100; + + // If the font size has changed since we last checked… + if ( currentWidth != $.em.current ) { + /** + * The previous pixel value of the user agent’s font size. See + * $.em.current for caveats. Will initially be undefined until + * the “emchange” event is triggered. + * + * @example $.em.previous; + * @result 16 + * + * @property + * @name previous + * @type Number + * @cat Plugins/Em + * @see current + */ + $.em.previous = $.em.current; + + /** + * The current pixel value of the user agent’s font size. As + * with $.em.previous, this value *may* be subject to minor + * browser rounding errors that mean you might not want to + * rely upon it as an absolute value. + * + * @example $.em.current; + * @result 14 + * + * @property + * @name current + * @type Number + * @cat Plugins/Em + * @see previous + */ + $.em.current = currentWidth; + + $.event.trigger(eventName, [$.em.current, $.em.previous]); + } + } + }, $.em ); + + + /** + * Bind a function to the emchange event of each matched element. + * + * @example $("p").emchange( function() { alert("Hello"); } ); + * + * @name emchange + * @type jQuery + * @param Function fn A function to bind to the emchange event. + * @cat Plugins/Em + */ + + /** + * Trigger the emchange event of each matched element. + * + * @example $("p").emchange() + * + * @name emchange + * @type jQuery + * @cat Plugins/Em + */ + $.fn[eventName] = function(fn) { return fn ? this.bind(eventName, fn) + : this.trigger(eventName); }; + + + // Store the initial pixel value of the user agent’s font size. + $.em.current = $.em.element.offsetWidth / 100; + + /** + * While polling for font-size changes, $.em.iid stores the intervalID in + * case you should want to cancel with clearInterval(). + * + * @example window.clearInterval( $.em.iid ); + * + * @property + * @name iid + * @type Number + * @cat Plugins/Em + */ + $.em.iid = setInterval( $.em.action, $.em.delay ); +}); diff --git a/static/js/jquery.mousewheel.js b/static/js/jquery.mousewheel.js new file mode 100644 index 0000000..f255340 --- /dev/null +++ b/static/js/jquery.mousewheel.js @@ -0,0 +1,85 @@ +/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net) + * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) + * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * + * $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $ + * $Rev: 4265 $ + * + * Version: 3.0 + * + * Requires: $ 1.2.2+ + */ + +(function($) { + +$.event.special.mousewheel = { + setup: function() { + var handler = $.event.special.mousewheel.handler; + + // Fix pageX, pageY, clientX and clientY for mozilla + if ( $.browser.mozilla ) + $(this).bind('mousemove.mousewheel', function(event) { + $.data(this, 'mwcursorposdata', { + pageX: event.pageX, + pageY: event.pageY, + clientX: event.clientX, + clientY: event.clientY + }); + }); + + if ( this.addEventListener ) + this.addEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false); + else + this.onmousewheel = handler; + }, + + teardown: function() { + var handler = $.event.special.mousewheel.handler; + + $(this).unbind('mousemove.mousewheel'); + + if ( this.removeEventListener ) + this.removeEventListener( ($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false); + else + this.onmousewheel = function(){}; + + $.removeData(this, 'mwcursorposdata'); + }, + + handler: function(event) { + var args = Array.prototype.slice.call( arguments, 1 ); + + event = $.event.fix(event || window.event); + // Get correct pageX, pageY, clientX and clientY for mozilla + $.extend( event, $.data(this, 'mwcursorposdata') || {} ); + var delta = 0, returnValue = true; + + if ( event.wheelDelta ) delta = event.wheelDelta/120; + if ( event.detail ) delta = -event.detail/3; +// if ( $.browser.opera ) delta = -event.wheelDelta; + + event.data = event.data || {}; + event.type = "mousewheel"; + + // Add delta to the front of the arguments + args.unshift(delta); + // Add event to the front of the arguments + args.unshift(event); + + return $.event.handle.apply(this, args); + } +}; + +$.fn.extend({ + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } +}); + +})(jQuery);
\ No newline at end of file |
