Commit 49cf5c74 authored by Leo Iannacone's avatar Leo Iannacone

Let's keep only files we really need

parent 24ac2c54
<public:component>
<script type="text/javascript">
// IE5.5+ PNG Alpha Fix v2.0 Alpha
// (c) 2004-2009 Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
var IEPNGFix = window.IEPNGFix || {};
IEPNGFix.data = IEPNGFix.data || {};
// CONFIG: blankImg is the path to blank.gif, *relative to the HTML document*.
// Try either:
// * An absolute path like: '/images/blank.gif'
// * A path relative to this HTC file like: thisFolder + 'blank.gif'
var thisFolder = document.URL.replace(/(\\|\/)[^\\\/]*$/, '/');
IEPNGFix.blankImg = thisFolder + 'blank.gif';
IEPNGFix.fix = function(elm, src, t) {
// Applies an image 'src' to an element 'elm' using the DirectX filter.
// If 'src' is null, filter is disabled.
// Disables the 'hook' to prevent infinite recursion on setting BG/src.
// 't' = type, where background tile = 0, background = 1, IMG SRC = 2.
var h = this.hook.enabled;
this.hook.enabled = 0;
var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
src = (src || '').replace(/\(/g, '%28').replace(/\)/g, '%29');
if (
src && !(/IMG|INPUT/.test(elm.nodeName) && (t != 2)) &&
elm.currentStyle.width == 'auto' && elm.currentStyle.height == 'auto'
) {
if (elm.offsetWidth) {
elm.style.width = elm.offsetWidth + 'px';
}
if (elm.clientHeight) {
elm.style.height = elm.clientHeight + 'px';
}
if (elm.currentStyle.display == 'inline') {
elm.style.display = 'inline-block';
}
}
if (t == 1) {
elm.style.backgroundImage = 'url("' + this.blankImg + '")';
}
if (t == 2) {
elm.src = this.blankImg;
}
if (elm.filters[f]) {
elm.filters[f].enabled = src ? true : false;
if (src) {
elm.filters[f].src = src;
}
} else if (src) {
elm.style.filter = 'progid:' + f + '(src="' + src +
'",sizingMethod="' + (t == 2 ? 'scale' : 'crop') + '")';
}
this.hook.enabled = h;
};
IEPNGFix.process = function(elm, init) {
// Checks the onpropertychange event (on first 'init' run, a fake event)
// and calls the filter-applying-functions.
if (
!/MSIE (5\.5|6)/.test(navigator.userAgent) ||
typeof elm.filters == 'unknown'
) {
return;
}
if (!this.data[elm.uniqueID]) {
this.data[elm.uniqueID] = {
className: ''
};
}
var data = this.data[elm.uniqueID],
evt = init ? { propertyName: 'src,backgroundImage' } : event,
isSrc = /src/.test(evt.propertyName),
isBg = /backgroundImage/.test(evt.propertyName),
isPos = /width|height|background(Pos|Rep)/.test(evt.propertyName),
isClass = !init && ((elm.className != data.className) &&
(elm.className || data.className));
if (!(isSrc || isBg || isPos || isClass)) {
return;
}
data.className = elm.className;
var blank = this.blankImg.match(/([^\/]+)$/)[1],
eS = elm.style,
eCS = elm.currentStyle;
// Required for Whatever:hover - erase set BG if className changes.
if (
isClass && (eS.backgroundImage.indexOf('url(') == -1 ||
eS.backgroundImage.indexOf(blank) > -1)
) {
return setTimeout(function() {
eS.backgroundImage = '';
}, 0);
}
// Foregrounds.
if (isSrc && elm.src && { IMG: 1, INPUT: 1 }[elm.nodeName]) {
if ((/\.png/i).test(elm.src)) {
if (!elm.oSrc) {
// MM rollover compat
elm.oSrc = elm.src;
}
this.fix(elm, elm.src, 2);
} else if (elm.src.indexOf(blank) == -1) {
this.fix(elm, '');
}
}
// Backgrounds.
var bgSrc = eCS.backgroundImage || eS.backgroundImage;
if ((bgSrc + elm.src).indexOf(blank) == -1) {
var bgPNG = bgSrc.match(/url[("']+(.*\.png[^\)"']*)[\)"']/i);
if (bgPNG) {
if (this.tileBG && !{ IMG: 1, INPUT: 1 }[elm.nodeName]) {
this.tileBG(elm, bgPNG[1]);
this.fix(elm, '', 1);
} else {
if (data.tiles && data.tiles.src) {
this.tileBG(elm, '');
}
this.fix(elm, bgPNG[1], 1);
this.childFix(elm);
}
} else {
if (data.tiles && data.tiles.src) {
this.tileBG(elm, '');
}
this.fix(elm, '');
}
} else if ((isPos || isClass) && data.tiles && data.tiles.src) {
this.tileBG(elm, data.tiles.src);
}
if (init) {
this.hook.enabled = 1;
elm.attachEvent('onpropertychange', this.hook);
}
};
IEPNGFix.childFix = function(elm) {
// "hasLayout" fix for unclickable children inside PNG backgrounds.
var tags = [
'a',
'input',
'select',
'textarea',
'button',
'iframe',
'object'
],
t = tags.length,
tFix = [];
while (t--) {
var pFix = elm.all.tags(tags[t]),
e = pFix.length;
while (e--) {
tFix.push(pFix[e]);
}
}
t = tFix.length;
if (t && (/relative|absolute/i).test(elm.currentStyle.position)) {
alert('IEPNGFix: Unclickable children of element:' +
'\n\n<' + elm.nodeName + (elm.id && ' id=' + elm.id) + '>');
}
while (t--) {
if (!(/relative|absolute/i).test(tFix[t].currentStyle.position)) {
tFix[t].style.position = 'relative';
}
}
};
IEPNGFix.hook = function() {
if (IEPNGFix.hook.enabled) {
IEPNGFix.process(element, 0);
}
};
IEPNGFix.process(element, 1);
</script>
</public:component>
// IE5.5+ PNG Alpha Fix v2.0 Alpha: Background Tiling Support
// (c) 2008-2009 Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later.
// For details, see: http://creativecommons.org/licenses/LGPL/2.1/
var IEPNGFix = window.IEPNGFix || {};
IEPNGFix.tileBG = function(elm, pngSrc, ready) {
// Params: A reference to a DOM element, the PNG src file pathname, and a
// hidden "ready-to-run" passed when called back after image preloading.
var data = this.data[elm.uniqueID],
elmW = Math.max(elm.clientWidth, elm.scrollWidth),
elmH = Math.max(elm.clientHeight, elm.scrollHeight),
bgX = elm.currentStyle.backgroundPositionX,
bgY = elm.currentStyle.backgroundPositionY,
bgR = elm.currentStyle.backgroundRepeat;
// Cache of DIVs created per element, and image preloader/data.
if (!data.tiles) {
data.tiles = {
elm: elm,
src: '',
cache: [],
img: new Image(),
old: {}
};
}
var tiles = data.tiles,
pngW = tiles.img.width,
pngH = tiles.img.height;
if (pngSrc) {
if (!ready && pngSrc != tiles.src) {
// New image? Preload it with a callback to detect dimensions.
tiles.img.onload = function() {
this.onload = null;
IEPNGFix.tileBG(elm, pngSrc, 1);
};
return tiles.img.src = pngSrc;
}
} else {
// No image?
if (tiles.src) ready = 1;
pngW = pngH = 0;
}
tiles.src = pngSrc;
if (!ready && elmW == tiles.old.w && elmH == tiles.old.h &&
bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) {
return;
}
// Convert English and percentage positions to pixels.
var pos = {
top: '0%',
left: '0%',
center: '50%',
bottom: '100%',
right: '100%'
},
x,
y,
pc;
x = pos[bgX] || bgX;
y = pos[bgY] || bgY;
if (pc = x.match(/(\d+)%/)) {
x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100));
}
if (pc = y.match(/(\d+)%/)) {
y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100));
}
x = parseInt(x);
y = parseInt(y);
// Handle backgroundRepeat.
var repeatX = { 'repeat': 1, 'repeat-x': 1 }[bgR],
repeatY = { 'repeat': 1, 'repeat-y': 1 }[bgR];
if (repeatX) {
x %= pngW;
if (x > 0) x -= pngW;
}
if (repeatY) {
y %= pngH;
if (y > 0) y -= pngH;
}
// Go!
this.hook.enabled = 0;
if (!({ relative: 1, absolute: 1 }[elm.currentStyle.position])) {
elm.style.position = 'relative';
}
var count = 0,
xPos,
maxX = repeatX ? elmW : x + 0.1,
yPos,
maxY = repeatY ? elmH : y + 0.1,
d,
s,
isNew;
if (pngW && pngH) {
for (xPos = x; xPos < maxX; xPos += pngW) {
for (yPos = y; yPos < maxY; yPos += pngH) {
isNew = 0;
if (!tiles.cache[count]) {
tiles.cache[count] = document.createElement('div');
isNew = 1;
}
var clipR = Math.max(0, xPos + pngW > elmW ? elmW - xPos : pngW),
clipB = Math.max(0, yPos + pngH > elmH ? elmH - yPos : pngH);
d = tiles.cache[count];
s = d.style;
s.behavior = 'none';
s.left = (xPos - parseInt(elm.currentStyle.paddingLeft)) + 'px';
s.top = yPos + 'px';
s.width = clipR + 'px';
s.height = clipB + 'px';
s.clip = 'rect(' +
(yPos < 0 ? 0 - yPos : 0) + 'px,' +
clipR + 'px,' +
clipB + 'px,' +
(xPos < 0 ? 0 - xPos : 0) + 'px)';
s.display = 'block';
if (isNew) {
s.position = 'absolute';
s.zIndex = -999;
if (elm.firstChild) {
elm.insertBefore(d, elm.firstChild);
} else {
elm.appendChild(d);
}
}
this.fix(d, pngSrc, 0);
count++;
}
}
}
while (count < tiles.cache.length) {
this.fix(tiles.cache[count], '', 0);
tiles.cache[count++].style.display = 'none';
}
this.hook.enabled = 1;
// Cache so updates are infrequent.
tiles.old = {
w: elmW,
h: elmH,
x: bgX,
y: bgY,
r: bgR
};
};
IEPNGFix.update = function() {
// Update all PNG backgrounds.
for (var i in IEPNGFix.data) {
var t = IEPNGFix.data[i].tiles;
if (t && t.elm && t.src) {
IEPNGFix.tileBG(t.elm, t.src);
}
}
};
IEPNGFix.update.timer = 0;
if (window.attachEvent && !window.opera) {
window.attachEvent('onresize', function() {
clearTimeout(IEPNGFix.update.timer);
IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100);
});
}
// Simple Set Clipboard System
// Author: Joseph Huckaby
var ZeroClipboard = {
version: "1.0.7",
clients: {}, // registered upload clients on page, indexed by id
moviePath: 'ZeroClipboard.swf', // URL to movie
nextId: 1, // ID of next movie
$: function(thingy) {
// simple DOM lookup utility function
if (typeof(thingy) == 'string') thingy = document.getElementById(thingy);
if (!thingy.addClass) {
// extend element with a few useful methods
thingy.hide = function() { this.style.display = 'none'; };
thingy.show = function() { this.style.display = ''; };
thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
thingy.removeClass = function(name) {
var classes = this.className.split(/\s+/);
var idx = -1;
for (var k = 0; k < classes.length; k++) {
if (classes[k] == name) { idx = k; k = classes.length; }
}
if (idx > -1) {
classes.splice( idx, 1 );
this.className = classes.join(' ');
}
return this;
};
thingy.hasClass = function(name) {
return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
};
}
return thingy;
},
setMoviePath: function(path) {
// set path to ZeroClipboard.swf
this.moviePath = path;
},
dispatch: function(id, eventName, args) {
// receive event from flash movie, send to client
var client = this.clients[id];
if (client) {
client.receiveEvent(eventName, args);
}
},
register: function(id, client) {
// register new client to receive events
this.clients[id] = client;
},
getDOMObjectPosition: function(obj, stopObj) {
// get absolute coordinates for dom element
var info = {
left: 0,
top: 0,
width: obj.width ? obj.width : obj.offsetWidth,
height: obj.height ? obj.height : obj.offsetHeight
};
while (obj && (obj != stopObj)) {
info.left += obj.offsetLeft;
info.top += obj.offsetTop;
obj = obj.offsetParent;
}
return info;
},
Client: function(elem) {
// constructor for new simple upload client
this.handlers = {};
// unique ID
this.id = ZeroClipboard.nextId++;
this.movieId = 'ZeroClipboardMovie_' + this.id;
// register client with singleton to receive flash events
ZeroClipboard.register(this.id, this);
// create movie
if (elem) this.glue(elem);
}
};
ZeroClipboard.Client.prototype = {
id: 0, // unique ID for us
ready: false, // whether movie is ready to receive events or not
movie: null, // reference to movie object
clipText: '', // text to copy to clipboard
handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
cssEffects: true, // enable CSS mouse effects on dom container
handlers: null, // user event handlers
glue: function(elem, appendElem, stylesToAdd) {
// glue to DOM element
// elem can be ID or actual DOM element object
this.domElement = ZeroClipboard.$(elem);
// float just above object, or zIndex 99 if dom element isn't set
var zIndex = 99;
if (this.domElement.style.zIndex) {
zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
}
if (typeof(appendElem) == 'string') {
appendElem = ZeroClipboard.$(appendElem);
}
else if (typeof(appendElem) == 'undefined') {
appendElem = document.getElementsByTagName('body')[0];
}
// find X/Y position of domElement
var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem);
// create floating DIV above element
this.div = document.createElement('div');
var style = this.div.style;
style.position = 'absolute';
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
style.width = '' + box.width + 'px';
style.height = '' + box.height + 'px';
style.zIndex = zIndex;
if (typeof(stylesToAdd) == 'object') {
for (addedStyle in stylesToAdd) {
style[addedStyle] = stylesToAdd[addedStyle];
}
}
// style.backgroundColor = '#f00'; // debug
appendElem.appendChild(this.div);
this.div.innerHTML = this.getHTML( box.width, box.height );
},
getHTML: function(width, height) {
// return HTML for movie
var html = '';
var flashvars = 'id=' + this.id +
'&width=' + width +
'&height=' + height;
if (navigator.userAgent.match(/MSIE/)) {
// IE gets an OBJECT tag
var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
}
else {
// all other browsers get an EMBED tag
html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
}
return html;
},
hide: function() {
// temporarily hide floater offscreen
if (this.div) {
this.div.style.left = '-2000px';
}
},
show: function() {
// show ourselves after a call to hide()
this.reposition();
},
destroy: function() {
// destroy control and floater
if (this.domElement && this.div) {
this.hide();
this.div.innerHTML = '';
var body = document.getElementsByTagName('body')[0];
try { body.removeChild( this.div ); } catch(e) {;}
this.domElement = null;
this.div = null;
}
},
reposition: function(elem) {
// reposition our floating div, optionally to new container
// warning: container CANNOT change size, only position
if (elem) {
this.domElement = ZeroClipboard.$(elem);
if (!this.domElement) this.hide();
}
if (this.domElement && this.div) {
var box = ZeroClipboard.getDOMObjectPosition(this.domElement);
var style = this.div.style;
style.left = '' + box.left + 'px';
style.top = '' + box.top + 'px';
}
},
setText: function(newText) {
// set text to be copied to clipboard
this.clipText = newText;
if (this.ready) this.movie.setText(newText);
},
addEventListener: function(eventName, func) {
// add user event listener for event
// event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
if (!this.handlers[eventName]) this.handlers[eventName] = [];
this.handlers[eventName].push(func);
},
setHandCursor: function(enabled) {
// enable hand cursor (true), or default arrow cursor (false)
this.handCursorEnabled = enabled;
if (this.ready) this.movie.setHandCursor(enabled);
},
setCSSEffects: function(enabled) {
// enable or disable CSS effects on DOM container
this.cssEffects = !!enabled;
},
receiveEvent: function(eventName, args) {
// receive event from flash
eventName = eventName.toString().toLowerCase().replace(/^on/, '');
// special behavior for certain events
switch (eventName) {
case 'load':
// movie claims it is ready, but in IE this isn't always the case...
// bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
this.movie = document.getElementById(this.movieId);
if (!this.movie) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 1 );
return;
}
// firefox on pc needs a "kick" in order to set these in certain cases
if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
var self = this;
setTimeout( function() { self.receiveEvent('load', null); }, 100 );
this.ready = true;
return;
}
this.ready = true;
this.movie.setText( this.clipText );
this.movie.setHandCursor( this.handCursorEnabled );
break;
case 'mouseover':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('hover');
if (this.recoverActive) this.domElement.addClass('active');
}
break;
case 'mouseout':
if (this.domElement && this.cssEffects) {
this.recoverActive = false;
if (this.domElement.hasClass('active')) {
this.domElement.removeClass('active');
this.recoverActive = true;
}
this.domElement.removeClass('hover');
}
break;
case 'mousedown':
if (this.domElement && this.cssEffects) {
this.domElement.addClass('active');
}
break;
case 'mouseup':
if (this.domElement && this.cssEffects) {
this.domElement.removeClass('active');
this.recoverActive = false;
}
break;
} // switch eventName
if (this.handlers[eventName]) {
for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
var func = this.handlers[eventName][idx];
if (typeof(func) == 'function') {
// actual function reference
func(this, args);
}
else if ((typeof(func) == 'object') && (func.length == 2)) {
// PHP style object + method, i.e. [myObject, 'myMethod']
func[0][ func[1] ](this, args);
}
else if (typeof(func) == 'string') {
// name of function
window[func](this, args);
}
} // foreach event handler defined
} // user defined handler for event
}
};
/*
** This file contains function to enable and
** disable Accessibility stylesheet in ubuntu-it
*/
//ACCESSIBILITY_CSS_THEME_DIR = 'light-drupal-theme/styles';
//ACCESSIBILITY_CSS_FILE_NAME = 'accessibility.css' ;
ACCESSIBILITY_CSS_ABSPATH = ['http://ubuntu-it.org/sites/all/themes/light-drupal-theme/styles/accessibility.css'];
ACCESSIBILITY_COOKIE_VALUE_ON = 'on';
ACCESSIBILITY_COOKIE_VALUE_OFF = 'off';
// This function adds the accessibility css into the Head section
// and set the cookie value ON
function accessibility_set_on () {
head = document.getElementsByTagName('head')[0];
for (i = 0; i < ACCESSIBILITY_CSS_ABSPATH.length ; i++) {
link = document.createElement('link');
link.setAttribute('type','text/css');
link.setAttribute('rel', 'stylesheet');
link.setAttribute('media', 'screen');
link.setAttribute('href', ACCESSIBILITY_CSS_ABSPATH[i]);
head.appendChild(link);
}
set_cookie_accessibility( ACCESSIBILITY_COOKIE_VALUE_ON );
}
// This function removes the accessibility css from the Head section
// and set the cookie value OFF
function accessibility_set_off() {
head = document.getElementsByTagName('head')[0];
links = head.getElementsByTagName('link');
links_to_remove = []
for (i = 0 ; i < links.length ; i++) {
link = links[i];
if (link.getAttribute('type') == 'text/css') {
for (j = 0 ; j < ACCESSIBILITY_CSS_ABSPATH.length ; j++) {
if (link.getAttribute('href').indexOf(ACCESSIBILITY_CSS_ABSPATH[j]) >= 0 ) {
links_to_remove.push(link);
}
}
}
}
for (i = 0; i < links_to_remove.length; i++) {
head.removeChild(links_to_remove[i]);
}
set_cookie_accessibility( ACCESSIBILITY_COOKIE_VALUE_OFF );
}
function accessibility_toggle () {
value = get_cookie_accessibility();
// If accessibility is ON, remove the css stylesheet
if (value == ACCESSIBILITY_COOKIE_VALUE_ON)
accessibility_set_off();
else
accessibility_set_on();
}
// The main function
function accessibility () {
value = get_cookie_accessibility();
// If accessibility is ON, add the css stylesheet
if (value == ACCESSIBILITY_COOKIE_VALUE_ON)
accessibility_set_on();
}
/*
* Title: jQuery subscriptions string replace
* Description: remove capitalization in "impostazioni" word using javascript.
*
* Copyright (c) 2012 Ubuntu-it Ask Team - https://launchpad.net/~ubuntu-it-ask
* GNU GPL 3 LICENSE
*/
var subscriptionDiv = $('#navBar a#subscriptions_settings_button');
subscriptionDiv.text('impostazioni');
java -jar yuicompressor-2.4.2.jar --type js --charset utf-8 osqa.main.js -o osqa.main.min.js
// Common variabiles
COOKIE_DOMAIN = "ubuntu-it.org";
COOKIE_PREFIX = "ubuntu-it_custom_";
COOKIE_ACCESIBILITY_NAME = "accessibility";
// Start Cookie in browser functions
function set_cookie ( name, value, expires, path, domain, secure )
{
name = COOKIE_PREFIX + name;
var cookie_string = name + "=" + escape ( value );
if ( expires ) {
cookie_string += "; expires=" + expires.toGMTString();
}
else {
var expires = new Date ( 2100, 1, 1); // never expires
cookie_string += "; expires=" + expires.toGMTString();
}
if ( path )
cookie_string += "; path=" + escape ( path );
else
cookie_string += "; path=" + escape ("/")
if ( domain )
cookie_string += "; domain=" + escape ( domain );
else
// cookie_string += "; domain=" + escape (location.host)
cookie_string += "; domain=" + escape (COOKIE_DOMAIN);
if ( secure )
cookie_string += "; secure";
document.cookie = cookie_string;
}
function delete_cookie ( cookie_name ) {
cookie_name = COOKIE_PREFIX + cookie_name;
var cookie_date = new Date ( ); // current date & time
cookie_date.setTime ( cookie_date.getTime() - 1 );
document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function get_cookie ( cookie_name ) {
cookie_name = COOKIE_PREFIX + cookie_name;
var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
if ( results )
return ( unescape ( results[2] ) );
else
return null;
}
// End Cookie in browser functions
// Accessibility
function set_cookie_accessibility (cookie_value) {
cookie_name = COOKIE_ACCESIBILITY_NAME;
set_cookie (cookie_name, cookie_value);
}
function get_cookie_accessibility () {
cookie_name = COOKIE_ACCESIBILITY_NAME;
return get_cookie (cookie_name);
}
This diff is collapsed.
This diff is collapsed.
java -jar yuicompressor-2.4.2.jar --type js --charset utf-8 jquery.flot.js -o jquery.flot.pack.js
pause
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
jQuery.extend({
createUploadIframe: function(id, uri){
//create frame
var frameId = 'jUploadFrame' + id;
if(window.ActiveXObject) {
var io = document.createElement('<iframe id="' + frameId + '" name="' + frameId + '" />');
if(typeof uri== 'boolean'){
io.src = 'javascript:false';
}
else if(typeof uri== 'string'){
io.src = uri;
}
}
else {
var io = document.createElement('iframe');
io.id = frameId;
io.name = frameId;
}
io.style.position = 'absolute';
io.style.top = '-1000px';
io.style.left = '-1000px';
document.body.appendChild(io);
return io;
},
createUploadForm: function(id, fileElementId)
{
//create form
var formId = 'jUploadForm' + id;
var fileId = 'jUploadFile' + id;
var form = $('<form action="" method="POST" name="' + formId + '" id="' + formId
+ '" enctype="multipart/form-data"></form>');
var oldElement = $('#' + fileElementId);
var newElement = $(oldElement).clone();
$(oldElement).attr('id', fileId);
$(oldElement).before(newElement);
$(oldElement).appendTo(form);
//set attributes
$(form).css('position', 'absolute');
$(form).css('top', '-1200px');
$(form).css('left', '-1200px');
$(form).appendTo('body');
return form;
},
ajaxFileUpload: function(s) {
// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
s = jQuery.extend({}, jQuery.ajaxSettings, s);
var id = new Date().getTime()
var form = jQuery.createUploadForm(id, s.fileElementId);
var io = jQuery.createUploadIframe(id, s.secureuri);
var frameId = 'jUploadFrame' + id;
var formId = 'jUploadForm' + id;
// Watch for a new set of requests
if ( s.global && ! jQuery.active++ )
{
jQuery.event.trigger( "ajaxStart" );
}
var requestDone = false;
// Create the request object
var xml = {}
if ( s.global )
jQuery.event.trigger("ajaxSend", [xml, s]);
// Wait for a response to come back
var uploadCallback = function(isTimeout)
{
var io = document.getElementById(frameId);
try {
if(io.contentWindow){
xml.responseText = io.contentWindow.document.body ?
io.contentWindow.document.body.innerText : null;
xml.responseXML = io.contentWindow.document.XMLDocument ?
io.contentWindow.document.XMLDocument : io.contentWindow.document;
}
else if(io.contentDocument)
{
xml.responseText = io.contentDocument.document.body ?
io.contentDocument.document.body.textContent || document.body.innerText : null;
xml.responseXML = io.contentDocument.document.XMLDocument ?
io.contentDocument.document.XMLDocument : io.contentDocument.document;
}
}
catch(e)
{
jQuery.handleError(s, xml, null, e);
}
if ( xml || isTimeout == "timeout")
{
requestDone = true;
var status;
try {
status = isTimeout != "timeout" ? "success" : "error";
// Make sure that the request was successful or notmodified
if ( status != "error" )
{
// process the data (runs the xml through httpData regardless of callback)
var data = jQuery.uploadHttpData( xml, s.dataType );
// If a local callback was specified, fire it and pass it the data
if ( s.success )
s.success( data, status );
// Fire the global callback
if( s.global )
jQuery.event.trigger( "ajaxSuccess", [xml, s] );
} else
jQuery.handleError(s, xml, status);
} catch(e)
{
status = "error";
jQuery.handleError(s, xml, status, e);
}
// The request was completed
if( s.global )
jQuery.event.trigger( "ajaxComplete", [xml, s] );
// Handle the global AJAX counter
if ( s.global && ! --jQuery.active )
jQuery.event.trigger( "ajaxStop" );
// Process result
if ( s.complete )
s.complete(xml, status);
jQuery(io).unbind();
setTimeout(function()
{ try
{
$(io).remove();
$(form).remove();
} catch(e) {
jQuery.handleError(s, xml, null, e);
}
}, 100)
xml = null;
}
}
// Timeout checker
if ( s.timeout > 0 ) {
setTimeout(function(){
// Check to see if the request is still happening
if( !requestDone ) uploadCallback( "timeout" );
}, s.timeout);
}
try
{
// var io = $('#' + frameId);
var form = $('#' + formId);
$(form).attr('action', s.url);
$(form).attr('method', 'POST');
$(form).attr('target', frameId);
if(form.encoding)
{
form.encoding = 'multipart/form-data';
}
else
{
form.enctype = 'multipart/form-data';
}
$(form).submit();
} catch(e)
{
jQuery.handleError(s, xml, null, e);
}
if(window.attachEvent){
document.getElementById(frameId).attachEvent('onload', uploadCallback);
}
else{
document.getElementById(frameId).addEventListener('load', uploadCallback, false);
}
return {abort: function () {}};
},
uploadHttpData: function( r, type ) {
var data = !type;
data = type == "xml" || data ? r.responseXML : r.responseText;
// If the type is "script", eval it in global context
if ( type == "script" )
jQuery.globalEval( data );
// Get the JavaScript object, if JSON is used.
if ( type == "json" )
eval( "data = " + data );
// evaluate scripts within html
if ( type == "html" )
jQuery("<div>").html(data).evalScripts();
//alert($('param', data).each(function(){alert($(this).attr('value'));}));
return data;
}
})
/*
*
* Copyright (c) 2010 C. F., Wong (<a href="http://cloudgen.w0ng.hk">Cloudgen Examplet Store</a>)
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*/
(function(k,e,i,j){k.fn.caret=function(b,l){var a,c,f=this[0],d=k.browser.msie;if(typeof b==="object"&&typeof b.start==="number"&&typeof b.end==="number"){a=b.start;c=b.end}else if(typeof b==="number"&&typeof l==="number"){a=b;c=l}else if(typeof b==="string")if((a=f.value.indexOf(b))>-1)c=a+b[e];else a=null;else if(Object.prototype.toString.call(b)==="[object RegExp]"){b=b.exec(f.value);if(b!=null){a=b.index;c=a+b[0][e]}}if(typeof a!="undefined"){if(d){d=this[0].createTextRange();d.collapse(true);
d.moveStart("character",a);d.moveEnd("character",c-a);d.select()}else{this[0].selectionStart=a;this[0].selectionEnd=c}this[0].focus();return this}else{if(d){c=document.selection;if(this[0].tagName.toLowerCase()!="textarea"){d=this.val();a=c[i]()[j]();a.moveEnd("character",d[e]);var g=a.text==""?d[e]:d.lastIndexOf(a.text);a=c[i]()[j]();a.moveStart("character",-d[e]);var h=a.text[e]}else{a=c[i]();c=a[j]();c.moveToElementText(this[0]);c.setEndPoint("EndToEnd",a);g=c.text[e]-a.text[e];h=g+a.text[e]}}else{g=
f.selectionStart;h=f.selectionEnd}a=f.value.substring(g,h);return{start:g,end:h,text:a,replace:function(m){return f.value.substring(0,g)+m+f.value.substring(h,f.value[e])}}}}})(jQuery,"length","createRange","duplicate");
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* jQuery i18n plugin
* @requires jQuery v1.1 or later
*
* Examples at: http://recurser.com/articles/2008/02/21/jquery-i18n-translation-plugin/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Based on 'javascript i18n that almost doesn't suck' by markos
* http://markos.gaivo.net/blog/?p=100
*
* Revision: $Id$
* Version: 1.0.0 Feb-10-2008
*/
(function($) {
/**
* i18n provides a mechanism for translating strings using a jscript dictionary.
*
*/
/*
* i18n property list
*/
$.i18n = {
/**
* setDictionary()
* Initialise the dictionary and translate nodes
*
* @param property_list i18n_dict : The dictionary to use for translation
*/
setDictionary: function(i18n_dict) {
i18n_dict = i18n_dict;
},
/**
* _()
* The actual translation function. Looks the given string up in the
* dictionary and returns the translation if one exists. If a translation
* is not found, returns the original word
*
* @param string str : The string to translate
* @param property_list params : params for using printf() on the string
* @return string : Translated word
*
*/
_: function (str, params) {
var transl = str;
if (i18n_dict&& i18n_dict[str]) {
transl = i18n_dict[str];
}
return this.printf(transl, params);
},
/**
* toEntity()
* Change non-ASCII characters to entity representation
*
* @param string str : The string to transform
* @return string result : Original string with non-ASCII content converted to entities
*
*/
toEntity: function (str) {
var result = '';
for (var i=0;i<str.length; i++) {
if (str.charCodeAt(i) > 128)
result += "&#"+str.charCodeAt(i)+";";
else
result += str.charAt(i);
}
return result;
},
/**
* stripStr()
*
* @param string str : The string to strip
* @return string result : Stripped string
*
*/
stripStr: function(str) {
return str.replace(/^\s*/, "").replace(/\s*$/, "");
},
/**
* stripStrML()
*
* @param string str : The multi-line string to strip
* @return string result : Stripped string
*
*/
stripStrML: function(str) {
// Split because m flag doesn't exist before JS1.5 and we need to
// strip newlines anyway
var parts = str.split('\n');
for (var i=0; i<parts.length; i++)
parts[i] = stripStr(parts[i]);
// Don't join with empty strings, because it "concats" words
// And strip again
return stripStr(parts.join(" "));
},
/*
* printf()
* C-printf like function, which substitutes %s with parameters
* given in list. %%s is used to escape %s.
*
* Doesn't work in IE5.0 (splice)
*
* @param string S : string to perform printf on.
* @param string L : Array of arguments for printf()
*/
printf: function(S, L) {
if (!L) return S;
var nS = "";
var tS = S.split("%s");
for(var i=0; i<L.length; i++) {
if (tS[i].lastIndexOf('%') == tS[i].length-1 && i != L.length-1)
tS[i] += "s"+tS.splice(i+1,1)[0];
nS += tS[i] + L[i];
}
return nS + tS[tS.length-1];
}
};
})(jQuery);
/*
openid login boxes
*/
var providers_large = {
google: {
name: 'Google',
url: 'https://www.google.com/accounts/o8/id'
},
yahoo: {
name: 'Yahoo',
url: 'http://yahoo.com/'
},
aol: {
name: 'AOL',
label: 'Enter your AOL screenname.',
url: 'http://openid.aol.com/{username}'
},
openid: {
name: 'OpenID',
label: 'Enter your OpenID.',
url: 'http://'
}
};
var providers_small = {
myopenid: {
name: 'MyOpenID',
label: 'Enter your MyOpenID username.',
url: 'http://{username}.myopenid.com/'
},
livejournal: {
name: 'LiveJournal',
label: 'Enter your Livejournal username.',
url: 'http://{username}.livejournal.com/'
},
flickr: {
name: 'Flickr',
label: 'Enter your Flickr username.',
url: 'http://flickr.com/{username}/'
},
technorati: {
name: 'Technorati',
label: 'Enter your Technorati username.',
url: 'http://technorati.com/people/technorati/{username}/'
},
wordpress: {
name: 'Wordpress',
label: 'Enter your Wordpress.com username.',
url: 'http://{username}.wordpress.com/'
},
blogger: {
name: 'Blogger',
label: 'Your Blogger account',
url: 'http://{username}.blogspot.com/'
},
verisign: {
name: 'Verisign',
label: 'Your Verisign username',
url: 'http://{username}.pip.verisignlabs.com/'
},
verisign: {
name: 'Verisign',
label: 'Your Verisign username',
url: 'http://{username}.pip.verisignlabs.com/'
},
claimid: {
name: 'ClaimID',
label: 'Your ClaimID username',
url: 'http://claimid.com/{username}'
}
};
var providers = $.extend({}, providers_large, providers_small);
var openid = {
cookie_expires: 6*30, // 6 months.
cookie_name: 'openid_provider',
cookie_path: '/',
img_path: '/media/images/openid/',
input_id: null,
provider_url: null,
init: function(input_id) {
var openid_btns = $('#openid_btns');
this.input_id = input_id;
$('#openid_choice').show();
//$('#openid_input_area').empty();
// add box for each provider
for (id in providers_large) {
openid_btns.append(this.getBoxHTML(providers_large[id], 'large', '.gif'));
}
if (providers_small) {
openid_btns.append('<br/>');
for (id in providers_small) {
openid_btns.append(this.getBoxHTML(providers_small[id], 'small', '.png'));
}
}
var box_id = this.readCookie();
if (box_id) {
this.signin(box_id, true);
}
},
getBoxHTML: function(provider, box_size, image_ext) {
var box_id = provider["name"].toLowerCase();
return '<a title="'+provider["name"]+'" href="javascript: openid.signin(\''+ box_id +'\');"' +
' style="background: #FFF url(' + this.img_path + box_id + image_ext+') no-repeat center center" ' + 'class="' + box_id + ' openid_' + box_size + '_btn"></a>';
},
/* Provider image click */
signin: function(box_id, onload) {
var provider = providers[box_id];
if (! provider) {
return;
}
this.highlight(box_id);
this.setCookie(box_id);
$('#'+this.input_id).val(provider['url']);
var input = $('#'+this.input_id);
if(document.selection){
var r = document.all.openid_url.createTextRange();
var res = r.findText("{username}");
if(res)
r.select();
}
else {
var text = input.val();
var searchText = "{username}";
var posStart = text.indexOf(searchText);
if(posStart > -1){
input.focus();
document.getElementById(this.input_id).setSelectionRange(posStart, posStart + searchText.length);
}
}
},
highlight: function (box_id) {
// remove previous highlight.
var highlight = $('#openid_highlight');
if (highlight) {
highlight.replaceWith($('#openid_highlight a')[0]);
}
// add new highlight.
$('.'+box_id).wrap('<div id="openid_highlight"></div>');
},
setCookie: function (value) {
var date = new Date();
date.setTime(date.getTime()+(this.cookie_expires*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
document.cookie = this.cookie_name+"="+value+expires+"; path=" + this.cookie_path;
},
readCookie: function () {
var nameEQ = this.cookie_name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
};
This diff is collapsed.
This diff is collapsed.
var currentSideBar = 'div#title_side_bar';
function changeSideBar(enabled_bar) {
if (enabled_bar != currentSideBar) {
$(currentSideBar).hide();
currentSideBar = enabled_bar;
$(currentSideBar).fadeIn('slow');
}
}
$(function () {
$('div#editor_side_bar').hide();
$('div#tags_side_bar').hide();
$('#id_title').focus(function(){changeSideBar('div#title_side_bar')});
$('#editor').focus(function(){changeSideBar('div#editor_side_bar')});
$('#id_tags').focus(function(){changeSideBar('div#tags_side_bar')});
});
$(function() {
var $input = $('#id_title');
var $box = $('#ask-related-questions');
var template = $('#question-summary-template').html();
var $editor = $('#editor');
var results_cache = {};
function reload_suggestions_box(e) {
var relatedQuestionsDiv = $('#ask-related-questions');
var q = $input.val().replace(/^\s+|\s+$/g,"");
if(q.length == 0) {
close_suggestions_box();
relatedQuestionsDiv.html('');
return false;
} else if(relatedQuestionsDiv[0].style.height == 0 || relatedQuestionsDiv[0].style.height == '0px') {
relatedQuestionsDiv.animate({'height':'150'}, 350);
}
if (results_cache[q] && results_cache[q] != '') {
relatedQuestionsDiv.html(results_cache[q]);
return false;
}
$.post(related_questions_url, {title: q}, function(data) {
if (data) {
var c = $input.val().replace(/^\s+|\s+$/g,"");
if (c != q) {
return;
}
if(data.length == 0) {
relatedQuestionsDiv.html('<br /><br /><div align="center">Non &egrave; stata trovata alcuna domanda simile.</div>');
return;
}
var html = '';
for (var i = 0; i < data.length; i++) {
var item = template.replace(new RegExp('%URL%', 'g'), data[i].url)
.replace(new RegExp('%SCORE%', 'g'), data[i].score)
.replace(new RegExp('%TITLE%', 'g'), data[i].title)
.replace(new RegExp('%SUMMARY%', 'g'), data[i].summary);
html += item;
}
results_cache[q] = html;
relatedQuestionsDiv.html(html);
}
}, 'json');
return false;
}
function close_suggestions_box() {
$('#ask-related-questions').animate({'height':'0'},350, function() {
$('#ask-related-questions').html('');
});
}
$input.keyup(reload_suggestions_box);
$input.focus(reload_suggestions_box);
$editor.change(function() {
if ($editor.html().length > 10) {
close_suggestions_box();
}
});
// for chrome
$input.keydown(focus_on_question);
function focus_on_question(e) {
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
if(e.keyCode == 9 && is_chrome) {
$('#editor')[0].focus();
}
}
});
This diff is collapsed.
This diff is collapsed.
$(function () {
$('div#editor_side_bar').hide();
$('#editor').focus(function(){ $('div#editor_side_bar').fadeIn('slow') });
$('#editor').blur(function(){ $('div#editor_side_bar').fadeOut('slow') });
});
Hilite={elementid:"content",exact:true,max_nodes:1000,onload:true,style_name:"hilite",style_name_suffix:true,debug_referrer:""};Hilite.search_engines=[["google\\.","q"],["search\\.yahoo\\.","p"],["search\\.msn\\.","q"],["search\\.live\\.","query"],["search\\.aol\\.","userQuery"],["ask\\.com","q"],["altavista\\.","q"],["feedster\\.","q"],["search\\.lycos\\.","q"],["alltheweb\\.","q"],["technorati\\.com/search/([^\\?/]+)",1],["dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)",1,true]];Hilite.decodeReferrer=function(d){var g=null;var e=new RegExp("");for(var c=0;c<Hilite.search_engines.length;c++){var f=Hilite.search_engines[c];e.compile("^http://(www\\.)?"+f[0],"i");var b=d.match(e);if(b){var a;if(isNaN(f[1])){a=Hilite.decodeReferrerQS(d,f[1])}else{a=b[f[1]+1]}if(a){a=decodeURIComponent(a);if(f.length>2&&f[2]){a=decodeURIComponent(a)}a=a.replace(/\'|"/g,"");a=a.split(/[\s,\+\.]+/);return a}break}}return null};Hilite.decodeReferrerQS=function(f,d){var b=f.indexOf("?");var c;if(b>=0){var a=new String(f.substring(b+1));b=0;c=0;while((b>=0)&&((c=a.indexOf("=",b))>=0)){var e,g;e=a.substring(b,c);b=a.indexOf("&",c)+1;if(e==d){if(b<=0){return a.substring(c+1)}else{return a.substring(c+1,b-1)}}else{if(b<=0){return null}}}}return null};Hilite.hiliteElement=function(f,e){if(!e||f.childNodes.length==0){return}var c=new Array();for(var b=0;b<e.length;b++){e[b]=e[b].toLowerCase();if(Hilite.exact){c.push("\\b"+e[b]+"\\b")}else{c.push(e[b])}}c=new RegExp(c.join("|"),"i");var a={};for(var b=0;b<e.length;b++){if(Hilite.style_name_suffix){a[e[b]]=Hilite.style_name+(b+1)}else{a[e[b]]=Hilite.style_name}}var d=function(m){var j=c.exec(m.data);if(j){var n=j[0];var i="";var h=m.splitText(j.index);var g=h.splitText(n.length);var l=m.ownerDocument.createElement("SPAN");m.parentNode.replaceChild(l,h);l.className=a[n.toLowerCase()];l.appendChild(h);return l}else{return m}};Hilite.walkElements(f.childNodes[0],1,d)};Hilite.hilite=function(){var a=Hilite.debug_referrer?Hilite.debug_referrer:document.referrer;var b=null;a=Hilite.decodeReferrer(a);if(a&&((Hilite.elementid&&(b=document.getElementById(Hilite.elementid)))||(b=document.body))){Hilite.hiliteElement(b,a)}};Hilite.walkElements=function(d,f,e){var a=/^(script|style|textarea)/i;var c=0;while(d&&f>0){c++;if(c>=Hilite.max_nodes){var b=function(){Hilite.walkElements(d,f,e)};setTimeout(b,50);return}if(d.nodeType==1){if(!a.test(d.tagName)&&d.childNodes.length>0){d=d.childNodes[0];f++;continue}}else{if(d.nodeType==3){d=e(d)}}if(d.nextSibling){d=d.nextSibling}else{while(f>0){d=d.parentNode;f--;if(d.nextSibling){d=d.nextSibling;break}}}}};if(Hilite.onload){if(window.attachEvent){window.attachEvent("onload",Hilite.hilite)}else{if(window.addEventListener){window.addEventListener("load",Hilite.hilite,false)}else{var __onload=window.onload;window.onload=function(){Hilite.hilite();__onload()}}}};
\ No newline at end of file
/**
* Search Engine Keyword Highlight (http://fucoder.com/code/se-hilite/)
*
* This module can be imported by any HTML page, and it would analyse the
* referrer for search engine keywords, and then highlight those keywords on
* the page, by wrapping them around <span class="hilite">...</span> tags.
* Document can then define styles else where to provide visual feedbacks.
*
* Usage:
*
* In HTML. Add the following line towards the end of the document.
*
* <script type="text/javascript" src="se_hilite.js"></script>
*
* In CSS, define the following style:
*
* .hilite { background-color: #ff0; }
*
* If Hilite.style_name_suffix is true, then define the follow styles:
*
* .hilite1 { background-color: #ff0; }
* .hilite2 { background-color: #f0f; }
* .hilite3 { background-color: #0ff; }
* .hilite4 ...
*
* @author Scott Yang <http://scott.yang.id.au/>
* @version 1.5
*/
// Configuration:
Hilite = {
/**
* Element ID to be highlighted. If set, then only content inside this DOM
* element will be highlighted, otherwise everything inside document.body
* will be searched.
*/
elementid: 'content',
/**
* Whether we are matching an exact word. For example, searching for
* "highlight" will only match "highlight" but not "highlighting" if exact
* is set to true.
*/
exact: true,
/**
* Maximum number of DOM nodes to test, before handing the control back to
* the GUI thread. This prevents locking up the UI when parsing and
* replacing inside a large document.
*/
max_nodes: 1000,
/**
* Whether to automatically hilite a section of the HTML document, by
* binding the "Hilite.hilite()" to window.onload() event. If this
* attribute is set to false, you can still manually trigger the hilite by
* calling Hilite.hilite() in Javascript after document has been fully
* loaded.
*/
onload: true,
/**
* Name of the style to be used. Default to 'hilite'.
*/
style_name: 'hilite',
/**
* Whether to use different style names for different search keywords by
* appending a number starting from 1, i.e. hilite1, hilite2, etc.
*/
style_name_suffix: true,
/**
* Set it to override the document.referrer string. Used for debugging
* only.
*/
debug_referrer: ''
};
Hilite.search_engines = [
['google\\.', 'q'], // Google
['search\\.yahoo\\.', 'p'], // Yahoo
['search\\.msn\\.', 'q'], // MSN
['search\\.live\\.', 'query'], // MSN Live
['search\\.aol\\.', 'userQuery'], // AOL
['ask\\.com', 'q'], // Ask.com
['altavista\\.', 'q'], // AltaVista
['feedster\\.', 'q'], // Feedster
['search\\.lycos\\.', 'q'], // Lycos
['alltheweb\\.', 'q'], // AllTheWeb
['technorati\\.com/search/([^\\?/]+)', 1], // Technorati
['dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)', 1, true] // DogPile
];
/**
* Decode the referrer string and return a list of search keywords.
*/
Hilite.decodeReferrer = function(referrer) {
var query = null;
var regex = new RegExp('');
for (var i = 0; i < Hilite.search_engines.length; i ++) {
var se = Hilite.search_engines[i];
regex.compile('^http://(www\\.)?' + se[0], 'i');
var match = referrer.match(regex);
if (match) {
var result;
if (isNaN(se[1])) {
result = Hilite.decodeReferrerQS(referrer, se[1]);
} else {
result = match[se[1] + 1];
}
if (result) {
result = decodeURIComponent(result);
// XXX: DogPile's URI requires decoding twice.
if (se.length > 2 && se[2])
result = decodeURIComponent(result);
result = result.replace(/\'|"/g, '');
result = result.split(/[\s,\+\.]+/);
return result;
}
break;
}
}
return null;
};
Hilite.decodeReferrerQS = function(referrer, match) {
var idx = referrer.indexOf('?');
var idx2;
if (idx >= 0) {
var qs = new String(referrer.substring(idx + 1));
idx = 0;
idx2 = 0;
while ((idx >= 0) && ((idx2 = qs.indexOf('=', idx)) >= 0)) {
var key, val;
key = qs.substring(idx, idx2);
idx = qs.indexOf('&', idx2) + 1;
if (key == match) {
if (idx <= 0) {
return qs.substring(idx2+1);
} else {
return qs.substring(idx2+1, idx - 1);
}
}
else if (idx <=0) {
return null;
}
}
}
return null;
};
/**
* Highlight a DOM element with a list of keywords.
*/
Hilite.hiliteElement = function(elm, query) {
if (!query || elm.childNodes.length == 0)
return;
var qre = new Array();
for (var i = 0; i < query.length; i ++) {
query[i] = query[i].toLowerCase();
if (Hilite.exact)
qre.push('\\b'+query[i]+'\\b');
else
qre.push(query[i]);
}
qre = new RegExp(qre.join("|"), "i");
var stylemapper = {};
for (var i = 0; i < query.length; i ++) {
if (Hilite.style_name_suffix)
stylemapper[query[i]] = Hilite.style_name+(i+1);
else
stylemapper[query[i]] = Hilite.style_name;
}
var textproc = function(node) {
var match = qre.exec(node.data);
if (match) {
var val = match[0];
var k = '';
var node2 = node.splitText(match.index);
var node3 = node2.splitText(val.length);
var span = node.ownerDocument.createElement('SPAN');
node.parentNode.replaceChild(span, node2);
span.className = stylemapper[val.toLowerCase()];
span.appendChild(node2);
return span;
} else {
return node;
}
};
Hilite.walkElements(elm.childNodes[0], 1, textproc);
};
/**
* Highlight a HTML document using keywords extracted from document.referrer.
* This is the main function to be called to perform search engine highlight
* on a document.
*
* Currently it would check for DOM element 'content', element 'container' and
* then document.body in that order, so it only highlights appropriate section
* on WordPress and Movable Type pages.
*/
Hilite.hilite = function() {
// If 'debug_referrer' then we will use that as our referrer string
// instead.
var q = Hilite.debug_referrer ? Hilite.debug_referrer : document.referrer;
var e = null;
q = Hilite.decodeReferrer(q);
if (q && ((Hilite.elementid &&
(e = document.getElementById(Hilite.elementid))) ||
(e = document.body)))
{
Hilite.hiliteElement(e, q);
}
};
Hilite.walkElements = function(node, depth, textproc) {
var skipre = /^(script|style|textarea)/i;
var count = 0;
while (node && depth > 0) {
count ++;
if (count >= Hilite.max_nodes) {
var handler = function() {
Hilite.walkElements(node, depth, textproc);
};
setTimeout(handler, 50);
return;
}
if (node.nodeType == 1) { // ELEMENT_NODE
if (!skipre.test(node.tagName) && node.childNodes.length > 0) {
node = node.childNodes[0];
depth ++;
continue;
}
} else if (node.nodeType == 3) { // TEXT_NODE
node = textproc(node);
}
if (node.nextSibling) {
node = node.nextSibling;
} else {
while (depth > 0) {
node = node.parentNode;
depth --;
if (node.nextSibling) {
node = node.nextSibling;
break;
}
}
}
}
};
// Trigger the highlight using the onload handler.
if (Hilite.onload) {
if (window.attachEvent) {
window.attachEvent('onload', Hilite.hilite);
} else if (window.addEventListener) {
window.addEventListener('load', Hilite.hilite, false);
} else {
var __onload = window.onload;
window.onload = function() {
Hilite.hilite();
__onload();
};
}
}
This diff is collapsed.
/*
* jQuery UI 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment