or null or undefined
* @cat Plugins/Form
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (typeof successful == 'undefined') successful = true;
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1))
return null;
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) return null;
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
// extra pain for IE...
var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
if (one) return v;
a.push(v);
}
}
return a;
}
return el.value;
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*
* @example $('form').clearForm();
* @desc Clears all forms on the page.
*
* @name clearForm
* @type jQuery
* @cat Plugins/Form
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements. Takes the following actions on the matched elements:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*
* @example $('.myInputs').clearFields();
* @desc Clears all inputs with class myInputs
*
* @name clearFields
* @type jQuery
* @cat Plugins/Form
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea')
this.value = '';
else if (t == 'checkbox' || t == 'radio')
this.checked = false;
else if (tag == 'select')
this.selectedIndex = -1;
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*
* @example $('form').resetForm();
* @desc Resets all forms on the page.
*
* @name resetForm
* @type jQuery
* @cat Plugins/Form
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
this.reset();
});
};
/**
* Enables or disables any matching elements.
*
* @example $(':radio').enabled(false);
* @desc Disables all radio buttons
*
* @name select
* @type jQuery
* @cat Plugins/Form
*/
$.fn.enable = function(b) {
if (b == undefined) b = true;
return this.each(function() {
this.disabled = !b
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*
* @example $(':checkbox').selected();
* @desc Checks all checkboxes
*
* @name select
* @type jQuery
* @cat Plugins/Form
*/
$.fn.select = function(select) {
if (select == undefined) select = true;
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio')
this.checked = select;
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').select(false);
}
this.selected = select;
}
});
};
})(jQuery);
(function($) {
//If the UI scope is not available, add it
$.ui = $.ui || {};
//Add methods that are vital for all mouse interaction stuff (plugin registering)
$.extend($.ui, {
plugin: {
add: function(module, option, set) {
var proto = $.ui[module].prototype;
for(var i in set) {
proto.plugins[i] = proto.plugins[i] || [];
proto.plugins[i].push([option, set[i]]);
}
},
call: function(instance, name, arguments) {
var set = instance.plugins[name]; if(!set) return;
for (var i = 0; i < set.length; i++) {
if (instance.options[set[i][0]]) set[i][1].apply(instance.element, arguments);
}
}
},
cssCache: {},
css: function(name) {
if ($.ui.cssCache[name]) return $.ui.cssCache[name];
var tmp = $('').addClass(name).css(
{position:'absolute', top:'-5000px', left:'-5000px', display:'block'}
).appendTo('body');
//Opera and Safari set width and height to 0px instead of auto
//Safari returns rgba(0,0,0,0) when bgcolor is not set
$.ui.cssCache[name] = !!(
((/^[1-9]/).test(tmp.css('height')) || (/^[1-9]/).test(tmp.css('width')) ||
!(/none/).test(tmp.css('backgroundImage')) || !(/transparent|rgba\(0, 0, 0, 0\)/).test(tmp.css('backgroundColor')))
);
try { $('body').get(0).removeChild(tmp.get(0)); } catch(e){}
return $.ui.cssCache[name];
},
disableSelection: function(e) {
if (!e) return;
e.unselectable = "on";
e.onselectstart = function() { return false; };
if (e.style) e.style.MozUserSelect = "none";
},
enableSelection: function(e) {
if (!e) return;
e.unselectable = "off";
e.onselectstart = function() { return true; };
if (e.style) e.style.MozUserSelect = "";
}
});
/********************************************************************************************************/
$.fn.extend({
mouseInteraction: function(o) {
return this.each(function() {
new $.ui.mouseInteraction(this, o);
});
},
removeMouseInteraction: function(o) {
return this.each(function() {
if($.data(this, "ui-mouse"))
$.data(this, "ui-mouse").destroy();
});
}
});
/********************************************************************************************************/
$.ui.mouseInteraction = function(element, options) {
var self = this;
this.element = element;
$.data(this.element, "ui-mouse", this);
this.options = $.extend({}, options);
$(element).bind('mousedown.draggable', function() { return self.click.apply(self, arguments); });
if($.browser.msie) $(element).attr('unselectable', 'on'); //Prevent text selection in IE
};
$.extend($.ui.mouseInteraction.prototype, {
destroy: function() { $(this.element).unbind('mousedown.draggable'); },
trigger: function() { return this.click.apply(this, arguments); },
click: function(e) {
if(
e.which != 1 //only left click starts dragging
|| $.inArray(e.target.nodeName.toLowerCase(), this.options.dragPrevention) != -1 // Prevent execution on defined elements
|| (this.options.condition && !this.options.condition.apply(this.options.executor || this, [e, this.element])) //Prevent execution on condition
) return true;
var self = this;
var initialize = function() {
self._MP = { left: e.pageX, top: e.pageY }; // Store the click mouse position
$(document).bind('mouseup.draggable', function() { return self.stop.apply(self, arguments); });
$(document).bind('mousemove.draggable', function() { return self.drag.apply(self, arguments); });
};
if(this.options.delay) {
if(this.timer) clearInterval(this.timer);
this.timer = setTimeout(initialize, this.options.delay);
} else {
initialize();
}
return false;
},
stop: function(e) {
var o = this.options;
if(!this.initialized) return $(document).unbind('mouseup.draggable').unbind('mousemove.draggable');
if(this.options.stop) this.options.stop.call(this.options.executor || this, e, this.element);
$(document).unbind('mouseup.draggable').unbind('mousemove.draggable');
this.initialized = false;
return false;
},
drag: function(e) {
var o = this.options;
if ($.browser.msie && !e.button) return this.stop.apply(this, [e]); // IE mouseup check
if(!this.initialized && (Math.abs(this._MP.left-e.pageX) >= o.distance || Math.abs(this._MP.top-e.pageY) >= o.distance)) {
if(this.options.start) this.options.start.call(this.options.executor || this, e, this.element);
this.initialized = true;
} else {
if(!this.initialized) return false;
}
if(o.drag) o.drag.call(this.options.executor || this, e, this.element);
return false;
}
});
})(jQuery);(function($) {
$.fn.extend({
draggable: function(options) {
var args = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
if (typeof options == "string") {
var drag = $.data(this, "ui-draggable");
drag[options].apply(drag, args);
} else if(!$.data(this, "ui-draggable"))
new $.ui.draggable(this, options);
});
}
});
$.ui.draggable = function(element, options) {
//Initialize needed constants
var self = this;
this.element = $(element);
$.data(element, "ui-draggable", this);
this.element.addClass("ui-draggable");
//Prepare the passed options
this.options = $.extend({}, options);
var o = this.options;
$.extend(o, {
helper: o.ghosting == true ? 'clone' : (o.helper || 'original'),
handle : o.handle ? ($(o.handle, element)[0] ? $(o.handle, element) : this.element) : this.element,
appendTo: o.appendTo || 'parent'
});
$(element).bind("setData.draggable", function(event, key, value){
self.options[key] = value;
}).bind("getData.draggable", function(event, key){
return self.options[key];
});
//Initialize mouse events for interaction
$(o.handle).mouseInteraction({
executor: this,
delay: o.delay,
distance: o.distance || 0,
dragPrevention: o.prevention ? o.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],
start: this.start,
stop: this.stop,
drag: this.drag,
condition: function(e) { return !(e.target.className.indexOf("ui-resizable-handle") != -1 || this.disabled); }
});
//Position the node
if(o.helper == 'original' && (this.element.css('position') == 'static' || this.element.css('position') == ''))
this.element.css('position', 'relative');
};
$.extend($.ui.draggable.prototype, {
plugins: {},
ui: function(e) {
return {
helper: this.helper,
position: this.position,
absolutePosition: this.positionAbs,
instance: this,
options: this.options
};
},
propagate: function(n,e) {
$.ui.plugin.call(this, n, [e, this.ui()]);
return this.element.triggerHandler(n == "drag" ? n : "drag"+n, [e, this.ui()], this.options[n]);
},
destroy: function() {
this.handle.removeMouseInteraction();
this.element
.removeClass("ui-draggable ui-draggable-disabled")
.removeData("ui-draggable")
.unbind(".draggable");
},
enable: function() {
this.element.removeClass("ui-draggable-disabled");
this.disabled = false;
},
disable: function() {
this.element.addClass("ui-draggable-disabled");
this.disabled = true;
},
recallOffset: function(e) {
var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top };
var r = this.helper.css('position') == 'relative';
//Generate the original position
this.originalPosition = {
left: (r ? parseInt(this.helper.css('left'),10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)),
top: (r ? parseInt(this.helper.css('top'),10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop))
};
//Generate a flexible offset that will later be subtracted from e.pageX/Y
this.offset = {left: this._pageX - this.originalPosition.left, top: this._pageY - this.originalPosition.top };
},
start: function(e) {
var o = this.options;
if($.ui.ddmanager) $.ui.ddmanager.current = this;
//Create and append the visible helper
this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e])) : (o.helper == 'clone' ? this.element.clone().appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo)) : this.element);
if(this.helper[0] != this.element[0]) this.helper.css('position', 'absolute');
if(!this.helper.parents('body').length) this.helper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));
//Find out the next positioned parent
this.offsetParent = (function(cp) {
while(cp) {
if(cp.style && (/(absolute|relative|fixed)/).test($.css(cp,'position'))) return $(cp);
cp = cp.parentNode ? cp.parentNode : null;
}; return $("body");
})(this.helper[0].parentNode);
//Prepare variables for position generation
this.elementOffset = this.element.offset();
this.offsetParentOffset = this.offsetParent.offset();
var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top };
this._pageX = e.pageX; this._pageY = e.pageY;
this.clickOffset = { left: e.pageX - this.elementOffset.left, top: e.pageY - this.elementOffset.top };
var r = this.helper.css('position') == 'relative';
//Generate the original position
this.originalPosition = {
left: (r ? parseInt(this.helper.css('left'),10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)),
top: (r ? parseInt(this.helper.css('top'),10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop))
};
//If we have a fixed element, we must subtract the scroll offset again
if(this.element.css('position') == 'fixed') {
this.originalPosition.top -= this.offsetParent[0] == document.body ? $(document).scrollTop() : this.offsetParent[0].scrollTop;
this.originalPosition.left -= this.offsetParent[0] == document.body ? $(document).scrollLeft() : this.offsetParent[0].scrollLeft;
}
//Generate a flexible offset that will later be subtracted from e.pageX/Y
this.offset = {left: e.pageX - this.originalPosition.left, top: e.pageY - this.originalPosition.top };
//Call plugins and callbacks
this.propagate("start", e);
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };
if ($.ui.ddmanager && !o.dropBehaviour) $.ui.ddmanager.prepareOffsets(this, e);
//If we have something in cursorAt, we'll use it
if(o.cursorAt) {
if(o.cursorAt.top != undefined || o.cursorAt.bottom != undefined) {
this.offset.top -= this.clickOffset.top - (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom));
this.clickOffset.top = (o.cursorAt.top != undefined ? o.cursorAt.top : (this.helperProportions.height - o.cursorAt.bottom));
}
if(o.cursorAt.left != undefined || o.cursorAt.right != undefined) {
this.offset.left -= this.clickOffset.left - (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right));
this.clickOffset.left = (o.cursorAt.left != undefined ? o.cursorAt.left : (this.helperProportions.width - o.cursorAt.right));
}
}
return false;
},
clear: function() {
if($.ui.ddmanager) $.ui.ddmanager.current = null;
this.helper = null;
},
stop: function(e) {
//If we are using droppables, inform the manager about the drop
if ($.ui.ddmanager && !this.options.dropBehaviour)
$.ui.ddmanager.drop(this, e);
//Call plugins and trigger callbacks
this.propagate("stop", e);
if(this.cancelHelperRemoval) return false;
if(this.options.helper != 'original') this.helper.remove();
this.clear();
return false;
},
drag: function(e) {
//Compute the helpers position
this.position = { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left };
this.positionAbs = { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top };
//Call plugins and callbacks
this.position = this.propagate("drag", e) || this.position;
this.helper.css({ left: this.position.left+'px', top: this.position.top+'px' }); // Stick the helper to the cursor
if($.ui.ddmanager) $.ui.ddmanager.drag(this, e);
return false;
}
});
})(jQuery);
/*
* 'this' -> original element
* 1. argument: browser event
* 2.argument: ui object
*/
(function($) {
$.ui.plugin.add("draggable", "cursor", {
start: function(e,ui) {
var t = $('body');
if (t.css("cursor")) ui.options._cursor = t.css("cursor");
t.css("cursor", ui.options.cursor);
},
stop: function(e,ui) {
if (ui.options._cursor) $('body').css("cursor", ui.options._cursor);
}
});
$.ui.plugin.add("draggable", "zIndex", {
start: function(e,ui) {
var t = $(ui.helper);
if(t.css("zIndex")) ui.options._zIndex = t.css("zIndex");
t.css('zIndex', ui.options.zIndex);
},
stop: function(e,ui) {
if(ui.options._zIndex) $(ui.helper).css('zIndex', ui.options._zIndex);
}
});
$.ui.plugin.add("draggable", "opacity", {
start: function(e,ui) {
var t = $(ui.helper);
if(t.css("opacity")) ui.options._opacity = t.css("opacity");
t.css('opacity', ui.options.opacity);
},
stop: function(e,ui) {
if(ui.options._opacity) $(ui.helper).css('opacity', ui.options._opacity);
}
});
$.ui.plugin.add("draggable", "revert", {
stop: function(e,ui) {
var self = ui.instance;
self.cancelHelperRemoval = true;
$(ui.helper).animate({ left: self.originalPosition.left, top: self.originalPosition.top }, parseInt(ui.options.revert, 10) || 500, function() {
if(ui.options.helper != 'original') self.helper.remove();
self.clear();
});
}
});
$.ui.plugin.add("draggable", "iframeFix", {
start: function(e,ui) {
var o = ui.options;
if(ui.instance.slowMode) return; // Make clones on top of iframes (only if we are not in slowMode)
if(o.iframeFix.constructor == Array) {
for(var i=0;i
').css("width", $(o.iframeFix[i])[0].offsetWidth+"px").css("height", $(o.iframeFix[i])[0].offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body");
}
} else {
$("iframe").each(function() {
var co = $(this).offset({ border: false });
$('
').css("width", this.offsetWidth+"px").css("height", this.offsetHeight+"px").css("position", "absolute").css("opacity", "0.001").css("z-index", "1000").css("top", co.top+"px").css("left", co.left+"px").appendTo("body");
});
}
},
stop: function(e,ui) {
if(ui.options.iframeFix) $("div.DragDropIframeFix").each(function() { this.parentNode.removeChild(this); }); //Remove frame helpers
}
});
$.ui.plugin.add("draggable", "containment", {
start: function(e,ui) {
var o = ui.options;
if((o.containment.left != undefined || o.containment.constructor == Array) && !o._containment) return;
if(!o._containment) o._containment = o.containment;
if(o._containment == 'parent') o._containment = this[0].parentNode;
if(o._containment == 'document') {
o.containment = [
0,
0,
$(document).width(),
($(document).height() || document.body.parentNode.scrollHeight)
];
} else { //I'm a node, so compute top/left/right/bottom
var ce = $(o._containment)[0];
var co = $(o._containment).offset();
o.containment = [
co.left,
co.top,
co.left+(ce.offsetWidth || ce.scrollWidth),
co.top+(ce.offsetHeight || ce.scrollHeight)
];
}
},
drag: function(e,ui) {
var o = ui.options;
var h = ui.helper;
var c = o.containment;
var self = ui.instance;
if(c.constructor == Array) {
if((ui.absolutePosition.left < c[0])) self.position.left = c[0] - (self.offset.left - self.clickOffset.left);
if((ui.absolutePosition.top < c[1])) self.position.top = c[1] - (self.offset.top - self.clickOffset.top);
if(ui.absolutePosition.left - c[2] + self.helperProportions.width >= 0) self.position.left = c[2] - (self.offset.left - self.clickOffset.left) - self.helperProportions.width;
if(ui.absolutePosition.top - c[3] + self.helperProportions.height >= 0) self.position.top = c[3] - (self.offset.top - self.clickOffset.top) - self.helperProportions.height;
} else {
if((ui.position.left < c.left)) self.position.left = c.left;
if((ui.position.top < c.top)) self.position.top = c.top;
if(ui.position.left - self.offsetParent.innerWidth() + self.helperProportions.width + c.right + (parseInt(self.offsetParent.css("borderLeftWidth"), 10) || 0) + (parseInt(self.offsetParent.css("borderRightWidth"), 10) || 0) >= 0) self.position.left = self.offsetParent.innerWidth() - self.helperProportions.width - c.right - (parseInt(self.offsetParent.css("borderLeftWidth"), 10) || 0) - (parseInt(self.offsetParent.css("borderRightWidth"), 10) || 0);
if(ui.position.top - self.offsetParent.innerHeight() + self.helperProportions.height + c.bottom + (parseInt(self.offsetParent.css("borderTopWidth"), 10) || 0) + (parseInt(self.offsetParent.css("borderBottomWidth"), 10) || 0) >= 0) self.position.top = self.offsetParent.innerHeight() - self.helperProportions.height - c.bottom - (parseInt(self.offsetParent.css("borderTopWidth"), 10) || 0) - (parseInt(self.offsetParent.css("borderBottomWidth"), 10) || 0);
}
}
});
$.ui.plugin.add("draggable", "grid", {
drag: function(e,ui) {
var o = ui.options;
ui.instance.position.left = ui.instance.originalPosition.left + Math.round((e.pageX - ui.instance._pageX) / o.grid[0]) * o.grid[0];
ui.instance.position.top = ui.instance.originalPosition.top + Math.round((e.pageY - ui.instance._pageY) / o.grid[1]) * o.grid[1];
}
});
$.ui.plugin.add("draggable", "axis", {
drag: function(e,ui) {
var o = ui.options;
if(o.constraint) o.axis = o.constraint; //Legacy check
o.axis == 'x' ? ui.instance.position.top = ui.instance.originalPosition.top : ui.instance.position.left = ui.instance.originalPosition.left;
}
});
$.ui.plugin.add("draggable", "scroll", {
start: function(e,ui) {
var o = ui.options;
o.scrollSensitivity = o.scrollSensitivity || 20;
o.scrollSpeed = o.scrollSpeed || 20;
ui.instance.overflowY = function(el) {
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-y'))) return el; el = el.parent(); } while (el[0].parentNode);
return $(document);
}(this);
ui.instance.overflowX = function(el) {
do { if(/auto|scroll/.test(el.css('overflow')) || (/auto|scroll/).test(el.css('overflow-x'))) return el; el = el.parent(); } while (el[0].parentNode);
return $(document);
}(this);
},
drag: function(e,ui) {
var o = ui.options;
var i = ui.instance;
if(i.overflowY[0] != document && i.overflowY[0].tagName != 'HTML') {
if(i.overflowY[0].offsetHeight - (ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity)
i.overflowY[0].scrollTop = i.overflowY[0].scrollTop + o.scrollSpeed;
if((ui.position.top - i.overflowY[0].scrollTop + i.clickOffset.top) < o.scrollSensitivity)
i.overflowY[0].scrollTop = i.overflowY[0].scrollTop - o.scrollSpeed;
} else {
//$(document.body).append(''+(e.pageY - $(document).scrollTop())+'
');
if(e.pageY - $(document).scrollTop() < o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
if($(window).height() - (e.pageY - $(document).scrollTop()) < o.scrollSensitivity)
$(document).scrollTop($(document).scrollTop() + o.scrollSpeed);
}
if(i.overflowX[0] != document && i.overflowX[0].tagName != 'HTML') {
if(i.overflowX[0].offsetWidth - (ui.position.left - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity)
i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft + o.scrollSpeed;
if((ui.position.top - i.overflowX[0].scrollLeft + i.clickOffset.left) < o.scrollSensitivity)
i.overflowX[0].scrollLeft = i.overflowX[0].scrollLeft - o.scrollSpeed;
} else {
if(e.pageX - $(document).scrollLeft() < o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
if($(window).width() - (e.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
$(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
}
ui.instance.recallOffset(e);
}
});
$.ui.plugin.add("draggable", "snap", {
start: function(e,ui) {
ui.instance.snapElements = [];
$(ui.options.snap === true ? '.ui-draggable' : ui.options.snap).each(function() {
var $t = $(this); var $o = $t.offset();
if(this != ui.instance.element[0]) ui.instance.snapElements.push({
item: this,
width: $t.outerWidth(),
height: $t.outerHeight(),
top: $o.top,
left: $o.left
});
});
},
drag: function(e,ui) {
var d = ui.options.snapTolerance || 20;
var x1 = ui.absolutePosition.left, x2 = x1 + ui.instance.helperProportions.width,
y1 = ui.absolutePosition.top, y2 = y1 + ui.instance.helperProportions.height;
for (var i = ui.instance.snapElements.length - 1; i >= 0; i--){
var l = ui.instance.snapElements[i].left, r = l + ui.instance.snapElements[i].width,
t = ui.instance.snapElements[i].top, b = t + ui.instance.snapElements[i].height;
//Yes, I know, this is insane ;)
if(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) continue;
if(ui.options.snapMode != 'inner') {
var ts = Math.abs(t - y2) <= 20;
var bs = Math.abs(b - y1) <= 20;
var ls = Math.abs(l - x2) <= 20;
var rs = Math.abs(r - x1) <= 20;
if(ts) ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height;
if(bs) ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top;
if(ls) ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width;
if(rs) ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left;
}
if(ui.options.snapMode != 'outer') {
var ts = Math.abs(t - y1) <= 20;
var bs = Math.abs(b - y2) <= 20;
var ls = Math.abs(l - x1) <= 20;
var rs = Math.abs(r - x2) <= 20;
if(ts) ui.position.top = t - ui.instance.offset.top + ui.instance.clickOffset.top;
if(bs) ui.position.top = b - ui.instance.offset.top + ui.instance.clickOffset.top - ui.instance.helperProportions.height;
if(ls) ui.position.left = l - ui.instance.offset.left + ui.instance.clickOffset.left;
if(rs) ui.position.left = r - ui.instance.offset.left + ui.instance.clickOffset.left - ui.instance.helperProportions.width;
}
};
}
});
//TODO: wrapHelper, snap
})(jQuery);
(function($) {
$.fn.extend({
droppable: function(options) {
var args = Array.prototype.slice.call(arguments, 1);
return this.each(function() {
if (typeof options == "string") {
var drop = $.data(this, "ui-droppable");
drop[options].apply(drop, args);
} else if(!$.data(this, "ui-droppable"))
new $.ui.droppable(this, options);
});
}
});
$.ui.droppable = function(element, options) {
//Initialize needed constants
this.element = $(element);
$.data(element, "ui-droppable", this);
this.element.addClass("ui-droppable");
//Prepare the passed options
this.options = $.extend({}, options);
var o = this.options; var accept = o.accept;
$.extend(o, {
accept: o.accept && o.accept.constructor == Function ? o.accept : function(d) {
return $(d).is(accept);
},
tolerance: o.tolerance || 'intersect'
});
$(element).bind("setData.draggable", function(event, key, value){
o[key] = value;
}).bind("getData.draggable", function(event, key){
return o[key];
});
//Store the droppable's proportions
this.proportions = { width: this.element.outerWidth(), height: this.element.outerHeight() };
// Add the reference and positions to the manager
$.ui.ddmanager.droppables.push({ item: this, over: 0, out: 1 });
};
$.extend($.ui.droppable.prototype, {
plugins: {},
ui: function(c) {
return {
instance: this,
draggable: c.element,
helper: c.helper,
position: c.position,
absolutePosition: c.positionAbs,
options: this.options
};
},
destroy: function() {
var drop = $.ui.ddmanager.droppables;
for ( var i = 0; i < drop.length; i++ )
if ( drop[i].item == this )
drop.splice(i, 1);
this.element
.removeClass("ui-droppable ui-droppable-disabled")
.removeData("ui-droppable")
.unbind(".droppable");
},
enable: function() {
this.element.removeClass("ui-droppable-disabled");
this.disabled = false;
},
disable: function() {
this.element.addClass("ui-droppable-disabled");
this.disabled = true;
},
over: function(e) {
var draggable = $.ui.ddmanager.current;
if (!draggable || draggable.element[0] == this.element[0]) return; // Bail if draggable and droppable are same element
if (this.options.accept.call(this.element,draggable.element)) {
$.ui.plugin.call(this, 'over', [e, this.ui(draggable)]);
this.element.triggerHandler("dropover", [e, this.ui(draggable)], this.options.over);
}
},
out: function(e) {
var draggable = $.ui.ddmanager.current;
if (!draggable || draggable.element[0] == this.element[0]) return; // Bail if draggable and droppable are same element
if (this.options.accept.call(this.element,draggable.element)) {
$.ui.plugin.call(this, 'out', [e, this.ui(draggable)]);
this.element.triggerHandler("dropout", [e, this.ui(draggable)], this.options.out);
}
},
drop: function(e) {
var draggable = $.ui.ddmanager.current;
if (!draggable || draggable.element[0] == this.element[0]) return; // Bail if draggable and droppable are same element
if(this.options.accept.call(this.element,draggable.element)) {
$.ui.plugin.call(this, 'drop', [e, this.ui(draggable)]);
this.element.triggerHandler("drop", [e, this.ui(draggable)], this.options.drop);
}
},
activate: function(e) {
var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'activate', [e, this.ui(draggable)]);
if(draggable) this.element.triggerHandler("dropactivate", [e, this.ui(draggable)], this.options.activate);
},
deactivate: function(e) {
var draggable = $.ui.ddmanager.current;
$.ui.plugin.call(this, 'deactivate', [e, this.ui(draggable)]);
if(draggable) this.element.triggerHandler("dropdeactivate", [e, this.ui(draggable)], this.options.deactivate);
}
});
$.ui.intersect = function(draggable, droppable, toleranceMode) {
if (!droppable.offset) return false;
var x1 = draggable.positionAbs.left, x2 = x1 + draggable.helperProportions.width,
y1 = draggable.positionAbs.top, y2 = y1 + draggable.helperProportions.height;
var l = droppable.offset.left, r = l + droppable.item.proportions.width,
t = droppable.offset.top, b = t + droppable.item.proportions.height;
switch (toleranceMode) {
case 'fit':
return ( l < x1 && x2 < r
&& t < y1 && y2 < b);
break;
case 'intersect':
return ( l < x1 + (draggable.helperProportions.width / 2) // Right Half
&& x2 - (draggable.helperProportions.width / 2) < r // Left Half
&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half
&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half
break;
case 'pointer':
return ( l < (draggable.positionAbs.left + draggable.clickOffset.left) && (draggable.positionAbs.left + draggable.clickOffset.left) < r
&& t < (draggable.positionAbs.top + draggable.clickOffset.top) && (draggable.positionAbs.top + draggable.clickOffset.top) < b);
break;
case 'touch':
return ( (l < x1 && x1 < r && t < y1 && y1 < b) // Top-Left Corner
|| (l < x1 && x1 < r && t < y2 && y2 < b) // Bottom-Left Corner
|| (l < x2 && x2 < r && t < y1 && y1 < b) // Top-Right Corner
|| (l < x2 && x2 < r && t < y2 && y2 < b) ); // Bottom-Right Corner
break;
default:
return false;
break;
}
};
/*
This manager tracks offsets of draggables and droppables
*/
$.ui.ddmanager = {
current: null,
droppables: [],
prepareOffsets: function(t, e) {
var m = $.ui.ddmanager.droppables;
for (var i = 0; i < m.length; i++) {
if(m[i].item.disabled || (t && !m[i].item.options.accept.call(m[i].item.element,t.element))) continue;
m[i].offset = $(m[i].item.element).offset();
if(t) m[i].item.activate.call(m[i].item, e); //Activate the droppable if used directly from draggables
}
},
drop: function(draggable, e) {
$.each($.ui.ddmanager.droppables, function() {
if (!this.item.disabled && $.ui.intersect(draggable, this, this.item.options.tolerance))
this.item.drop.call(this.item, e);
if (!this.item.disabled && this.item.options.accept.call(this.item.element,draggable.element)) {
this.out = 1; this.over = 0;
this.item.deactivate.call(this.item, e);
}
});
},
drag: function(draggable, e) {
//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets();
//Run through all draggables and check their positions based on specific tolerance options
$.each($.ui.ddmanager.droppables, function() {
if(this.item.disabled) return false;
var intersects = $.ui.intersect(draggable, this, this.item.options.tolerance);
var c = !intersects && this.over == 1 ? 'out' : (intersects && this.over == 0 ? 'over' : null);
if(!c) return;
this[c] = 1; this[c == 'out' ? 'over' : 'out'] = 0;
this.item[c].call(this.item, e);
});
}
};
})(jQuery);
(function($) {
if (window.Node && Node.prototype && !Node.prototype.contains) {
Node.prototype.contains = function (arg) {
return !!(this.compareDocumentPosition(arg) & 16);
};
}
$.fn.extend({
sortable: function(options) {
var args = Array.prototype.slice.call(arguments, 1);
if ( options == "serialize" )
return $.data(this[0], "ui-sortable").serialize(arguments[1]);
return this.each(function() {
if (typeof options == "string") {
var sort = $.data(this, "ui-sortable");
sort[options].apply(sort, args);
} else if(!$.data(this, "ui-sortable"))
new $.ui.sortable(this, options);
});
}
});
$.ui.sortable = function(element, options) {
//Initialize needed constants
var self = this;
this.element = $(element);
$.data(element, "ui-sortable", this);
this.element.addClass("ui-sortable");
//Prepare the passed options
this.options = $.extend({}, options);
var o = this.options;
$.extend(o, {
items: this.options.items || '> *',
zIndex: this.options.zIndex || 1000,
startCondition: function() {
return !self.disabled;
}
});
$(element).bind("setData.sortable", function(event, key, value){
self.options[key] = value;
}).bind("getData.sortable", function(event, key){
return self.options[key];
});
//Get the items
this.refresh();
//Let's determine if the items are floating
this.floating = /left|right/.test(this.items[0].item.css('float'));
//Let's determine the parent's offset
if(!(/(relative|absolute|fixed)/).test(this.element.css('position'))) this.element.css('position', 'relative');
this.offset = this.element.offset({ border: false });
//Initialize mouse events for interaction
this.element.mouseInteraction({
executor: this,
delay: o.delay,
distance: o.distance || 0,
dragPrevention: o.prevention ? o.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],
start: this.start,
stop: this.stop,
drag: this.drag,
condition: function(e) {
if(this.disabled) return false;
//Find out if the clicked node (or one of its parents) is a actual item in this.items
var currentItem = null, nodes = $(e.target).parents().andSelf().each(function() {
if($.data(this, 'ui-sortable-item')) currentItem = $(this);
});
if(currentItem && (!this.options.handle || $(e.target).parents().andSelf().is(this.options.handle))) {
this.currentItem = currentItem;
return true;
} else return false;
}
});
};
$.extend($.ui.sortable.prototype, {
plugins: {},
ui: function() {
return {
helper: this.helper,
placeholder: this.placeholder || $([]),
position: this.position,
absolutePosition: this.positionAbs,
instance: this,
options: this.options
};
},
propagate: function(n,e) {
$.ui.plugin.call(this, n, [e, this.ui()]);
this.element.triggerHandler(n == "sort" ? n : "sort"+n, [e, this.ui()], this.options[n]);
},
serialize: function(o) {
var items = $(this.options.items, this.element).not('.ui-sortable-helper'); //Only the items of the sortable itself
var str = [];
o = o || {};
items.each(function() {
var res = (this.getAttribute(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));
if(res) str.push((o.key || res[1])+'[]='+(o.key ? res[1] : res[2]));
});
return str.join('&');
},
intersectsWith: function(item) {
var x1 = this.positionAbs.left, x2 = x1 + this.helperProportions.width,
y1 = this.positionAbs.top, y2 = y1 + this.helperProportions.height;
var l = item.left, r = l + item.width,
t = item.top, b = t + item.height;
return ( l < x1 + (this.helperProportions.width / 2) // Right Half
&& x2 - (this.helperProportions.width / 2) < r // Left Half
&& t < y1 + (this.helperProportions.height / 2) // Bottom Half
&& y2 - (this.helperProportions.height / 2) < b ); // Top Half
},
refresh: function() {
this.items = [];
var items = this.items;
var queries = [$(this.options.items, this.element)];
if(this.options.connectWith) {
for (var i = this.options.connectWith.length - 1; i >= 0; i--){
var inst = $.data($(this.options.connectWith[i])[0], 'ui-sortable');
if(inst && !inst.disabled) queries.push($(inst.options.items, inst.element));
};
}
for (var i = queries.length - 1; i >= 0; i--){
queries[i].each(function() {
$.data(this, 'ui-sortable-item', true); // Data for target checking (mouse manager)
items.push({
item: $(this),
width: 0, height: 0,
left: 0, top: 0
});
});
};
},
refreshPositions: function(fast) {
for (var i = this.items.length - 1; i >= 0; i--){
if(!fast) this.items[i].width = this.items[i].item.outerWidth();
if(!fast) this.items[i].height = this.items[i].item.outerHeight();
var p = this.items[i].item.offset();
this.items[i].left = p.left;
this.items[i].top = p.top;
};
},
destroy: function() {
this.element
.removeClass("ui-sortable ui-sortable-disabled")
.removeData("ui-sortable")
.unbind(".sortable")
.removeMouseInteraction();
for ( var i = this.items.length - 1; i >= 0; i-- )
this.items[i].item.removeData("ui-sortable-item");
},
enable: function() {
this.element.removeClass("ui-sortable-disabled");
this.disabled = false;
},
disable: function() {
this.element.addClass("ui-sortable-disabled");
this.disabled = true;
},
createPlaceholder: function() {
this.placeholderElement = this.options.placeholderElement ? $(this.options.placeholderElement, this.currentItem) : this.currentItem;
this.placeholder = $('
')
.addClass(this.options.placeholder)
.appendTo('body')
.css({ position: 'absolute' })
.css(this.placeholderElement.offset())
.css({ width: this.placeholderElement.outerWidth(), height: this.placeholderElement.outerHeight() })
;
},
recallOffset: function(e) {
var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top };
var r = this.helper.css('position') == 'relative';
//Generate the original position
this.originalPosition = {
left: (r ? parseInt(this.helper.css('left'),10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)),
top: (r ? parseInt(this.helper.css('top'),10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop))
};
//Generate a flexible offset that will later be subtracted from e.pageX/Y
this.offset = {
left: this._pageX - this.originalPosition.left + (parseInt(this.currentItem.css('marginLeft'),10) || 0),
top: this._pageY - this.originalPosition.top + (parseInt(this.currentItem.css('marginTop'),10) || 0)
};
},
start: function(e) {
var o = this.options;
//Refresh the droppable items
this.refresh(); this.refreshPositions();
//Create and append the visible helper
this.helper = typeof o.helper == 'function' ? $(o.helper.apply(this.element[0], [e, this.currentItem])) : this.currentItem.clone();
this.helper.appendTo(this.currentItem[0].parentNode).css({ position: 'absolute', clear: 'both' }).addClass('ui-sortable-helper');
//Find out the next positioned parent
this.offsetParent = (function(cp) {
while(cp) {
if(cp.style && (/(absolute|relative|fixed)/).test($.css(cp,'position'))) return $(cp);
cp = cp.parentNode ? cp.parentNode : null;
}; return $("body");
})(this.helper[0].parentNode);
//Prepare variables for position generation
this.elementOffset = this.currentItem.offset();
this.offsetParentOffset = this.offsetParent.offset();
var elementPosition = { left: this.elementOffset.left - this.offsetParentOffset.left, top: this.elementOffset.top - this.offsetParentOffset.top };
this._pageX = e.pageX; this._pageY = e.pageY;
this.clickOffset = { left: e.pageX - this.elementOffset.left, top: e.pageY - this.elementOffset.top };
var r = this.helper.css('position') == 'relative';
//Generate the original position
this.originalPosition = {
left: (r ? parseInt(this.helper.css('left'),10) || 0 : elementPosition.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft)),
top: (r ? parseInt(this.helper.css('top'),10) || 0 : elementPosition.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop))
};
//Generate a flexible offset that will later be subtracted from e.pageX/Y
//I hate margins - they need to be removed before positioning the element absolutely..
this.offset = {
left: e.pageX - this.originalPosition.left + (parseInt(this.currentItem.css('marginLeft'),10) || 0),
top: e.pageY - this.originalPosition.top + (parseInt(this.currentItem.css('marginTop'),10) || 0)
};
//Save the first time position
this.position = { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left };
this.positionAbs = { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top };
this.positionDOM = this.currentItem.prev()[0];
//If o.placeholder is used, create a new element at the given position with the class
if(o.placeholder) this.createPlaceholder();
//Call plugins and callbacks
this.propagate("start", e);
//Save and store the helper proportions
this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() };
//Set the original element visibility to hidden to still fill out the white space
$(this.currentItem).css('visibility', 'hidden');
return false;
},
stop: function(e) {
this.propagate("stop", e); //Call plugins and trigger callbacks
if(this.positionDOM != this.currentItem.prev()[0]) this.propagate("update", e);
if(this.cancelHelperRemoval) return false;
$(this.currentItem).css('visibility', '');
if(this.placeholder) this.placeholder.remove();
this.helper.remove();
return false;
},
drag: function(e) {
//Compute the helpers position
this.direction = (this.floating && this.positionAbs.left > e.pageX - this.clickOffset.left) || (this.positionAbs.top > e.pageY - this.clickOffset.top) ? 'down' : 'up';
this.position = { top: e.pageY - this.offset.top, left: e.pageX - this.offset.left };
this.positionAbs = { left: e.pageX - this.clickOffset.left, top: e.pageY - this.clickOffset.top };
//Rearrange
for (var i = this.items.length - 1; i >= 0; i--) {
if(this.intersectsWith(this.items[i]) && this.items[i].item[0] != this.currentItem[0] && (this.options.tree ? !this.currentItem[0].contains(this.items[i].item[0]) : true)) {
//Rearrange the DOM
this.items[i].item[this.direction == 'down' ? 'before' : 'after'](this.currentItem);
this.refreshPositions(true); //Precompute after each DOM insertion, NOT on mousemove
if(this.placeholderElement) this.placeholder.css(this.placeholderElement.offset());
this.propagate("change", e); //Call plugins and callbacks
break;
}
}
this.propagate("sort", e); //Call plugins and callbacks
this.helper.css({ left: this.position.left+'px', top: this.position.top+'px' }); // Stick the helper to the cursor
return false;
}
});
})(jQuery);(function($) {
$.fn.extend({
slider: function(options) {
var args = Array.prototype.slice.call(arguments, 1);
if ( options == "value" )
return $.data(this[0], "ui-slider").value(arguments[1]);
return this.each(function() {
if (typeof options == "string") {
var slider = $.data(this, "ui-slider");
slider[options].apply(slider, args);
} else if(!$.data(this, "ui-slider"))
new $.ui.slider(this, options);
});
}
});
$.ui.slider = function(element, options) {
//Initialize needed constants
var self = this;
this.element = $(element);
$.data(element, "ui-slider", this);
this.element.addClass("ui-slider");
//Prepare the passed options
this.options = $.extend({}, options);
var o = this.options;
$.extend(o, {
axis: o.axis || (element.offsetWidth < element.offsetHeight ? 'vertical' : 'horizontal'),
maxValue: !isNaN(parseInt(o.maxValue,10)) ? parseInt(o.maxValue,10) : 100,
minValue: parseInt(o.minValue,10) || 0,
startValue: parseInt(o.startValue,10) || 'none'
});
//Prepare the real maxValue
o.realMaxValue = o.maxValue - o.minValue;
//Calculate stepping based on steps
o.stepping = parseInt(o.stepping,10) || (o.steps ? o.realMaxValue/o.steps : 0);
$(element).bind("setData.slider", function(event, key, value){
self.options[key] = value;
}).bind("getData.slider", function(event, key){
return self.options[key];
});
//Initialize mouse and key events for interaction
this.handle = o.handle ? $(o.handle, element) : $('> *', element);
$(this.handle)
.mouseInteraction({
executor: this,
delay: o.delay,
distance: o.distance || 0,
dragPrevention: o.prevention ? o.prevention.toLowerCase().split(',') : ['input','textarea','button','select','option'],
start: this.start,
stop: this.stop,
drag: this.drag,
condition: function(e, handle) {
if(!this.disabled) {
if(this.currentHandle) this.blur(this.currentHandle);
this.focus(handle,1);
return !this.disabled;
}
}
})
.wrap(' ')
.parent()
.bind('focus', function(e) { self.focus(this.firstChild); })
.bind('blur', function(e) { self.blur(this.firstChild); })
.bind('keydown', function(e) {
if(/(37|39)/.test(e.keyCode))
self.moveTo((e.keyCode == 37 ? '-' : '+')+'='+(self.options.stepping ? self.options.stepping : (self.options.realMaxValue / self.size)*5),this.firstChild);
})
;
//Position the node
if(o.helper == 'original' && (this.element.css('position') == 'static' || this.element.css('position') == '')) this.element.css('position', 'relative');
//Prepare dynamic properties for later use
if(o.axis == 'horizontal') {
this.size = this.element.outerWidth();
this.properties = ['left', 'width'];
} else {
this.size = this.element.outerHeight();
this.properties = ['top', 'height'];
}
//Bind the click to the slider itself
this.element.bind('click', function(e) { self.click.apply(self, [e]); });
//Move the first handle to the startValue
if(!isNaN(o.startValue)) this.moveTo(o.startValue, 0);
//If we only have one handle, set the previous handle to this one to allow clicking before selecting the handle
if(this.handle.length == 1) this.previousHandle = this.handle;
if(this.handle.length == 2 && o.range) this.createRange();
};
$.extend($.ui.slider.prototype, {
plugins: {},
createRange: function() {
this.rangeElement = $('
')
.addClass('ui-slider-range')
.css({ position: 'absolute' })
.css(this.properties[0], parseInt($(this.handle[0]).css(this.properties[0]),10) + this.handleSize(0)/2)
.css(this.properties[1], parseInt($(this.handle[1]).css(this.properties[0]),10) - parseInt($(this.handle[0]).css(this.properties[0]),10))
.appendTo(this.element);
},
updateRange: function() {
this.rangeElement.css(this.properties[0], parseInt($(this.handle[0]).css(this.properties[0]),10) + this.handleSize(0)/2);
this.rangeElement.css(this.properties[1], parseInt($(this.handle[1]).css(this.properties[0]),10) - parseInt($(this.handle[0]).css(this.properties[0]),10));
},
getRange: function() {
return this.rangeElement ? this.convertValue(parseInt(this.rangeElement.css(this.properties[1]),10)) : null;
},
ui: function(e) {
return {
instance: this,
options: this.options,
handle: this.currentHandle,
value: this.value(),
range: this.getRange()
};
},
propagate: function(n,e) {
$.ui.plugin.call(this, n, [e, this.ui()]);
this.element.triggerHandler(n == "slide" ? n : "slide"+n, [e, this.ui()], this.options[n]);
},
destroy: function() {
this.element
.removeClass("ui-slider ui-slider-disabled")
.removeData("ul-slider")
.unbind(".slider");
this.handles.removeMouseInteraction();
},
enable: function() {
this.element.removeClass("ui-slider-disabled");
this.disabled = false;
},
disable: function() {
this.element.addClass("ui-slider-disabled");
this.disabled = true;
},
focus: function(handle,hard) {
this.currentHandle = $(handle).addClass('ui-slider-handle-active');
if(hard) this.currentHandle.parent()[0].focus();
},
blur: function(handle) {
$(handle).removeClass('ui-slider-handle-active');
if(this.currentHandle && this.currentHandle[0] == handle) { this.previousHandle = this.currentHandle; this.currentHandle = null; };
},
value: function(handle) {
if(this.handle.length == 1) this.currentHandle = this.handle;
return ((parseInt($(handle != undefined ? this.handle[handle] || handle : this.currentHandle).css(this.properties[0]),10) / (this.size - this.handleSize())) * this.options.realMaxValue) + this.options.minValue;
},
convertValue: function(value) {
return (value / (this.size - this.handleSize())) * this.options.realMaxValue;
},
translateValue: function(value) {
return ((value - this.options.minValue) / this.options.realMaxValue) * (this.size - this.handleSize());
},
handleSize: function(handle) {
return $(handle != undefined ? this.handle[handle] : this.currentHandle)['outer'+this.properties[1].substr(0,1).toUpperCase()+this.properties[1].substr(1)]();
},
click: function(e) {
// This method is only used if:
// - The user didn't click a handle
// - The Slider is not disabled
// - There is a current, or previous selected handle (otherwise we wouldn't know which one to move)
var pointer = [e.pageX,e.pageY];
var clickedHandle = false; this.handle.each(function() { if(this == e.target) clickedHandle = true; });
if(clickedHandle || this.disabled || !(this.currentHandle || this.previousHandle)) return;
//If a previous handle was focussed, focus it again
if(this.previousHandle) this.focus(this.previousHandle, 1);
//Move focussed handle to the clicked position
this.offset = this.element.offset();
this.moveTo(this.convertValue(e[this.properties[0] == 'top' ? 'pageY' : 'pageX'] - this.offset[this.properties[0]] - this.handleSize()/2));
},
start: function(e, handle) {
var o = this.options;
this.offset = this.element.offset();
this.handleOffset = this.currentHandle.offset();
this.clickOffset = { top: e.pageY - this.handleOffset.top, left: e.pageX - this.handleOffset.left };
this.firstValue = this.value();
this.propagate('start', e);
return false;
},
stop: function(e) {
this.propagate('stop', e);
if(this.firstValue != this.value()) this.propagate('change', e);
return false;
},
drag: function(e, handle) {
var o = this.options;
var position = { top: e.pageY - this.offset.top - this.clickOffset.top, left: e.pageX - this.offset.left - this.clickOffset.left};
var modifier = position[this.properties[0]];
if(modifier >= this.size - this.handleSize()) modifier = this.size - this.handleSize();
if(modifier <= 0) modifier = 0;
if(o.stepping) {
var value = this.convertValue(modifier);
value = Math.round(value / o.stepping) * o.stepping;
modifier = this.translateValue(value);
}
if(this.rangeElement) {
if(this.currentHandle[0] == this.handle[0] && modifier >= this.translateValue(this.value(1))) modifier = this.translateValue(this.value(1));
if(this.currentHandle[0] == this.handle[1] && modifier <= this.translateValue(this.value(0))) modifier = this.translateValue(this.value(0));
}
this.currentHandle.css(this.properties[0], modifier);
if(this.rangeElement) this.updateRange();
this.propagate('slide', e);
return false;
},
moveTo: function(value, handle) {
var o = this.options;
if(handle == undefined && !this.currentHandle && this.handle.length != 1) return false; //If no handle has been passed, no current handle is available and we have multiple handles, return false
if(handle == undefined && !this.currentHandle) handle = 0; //If only one handle is available, use it
if(handle != undefined) this.currentHandle = this.previousHandle = $(this.handle[handle] || handle);
if(value.constructor == String) value = /\-\=/.test(value) ? this.value() - parseInt(value.replace('-=', ''),10) : this.value() + parseInt(value.replace('+=', ''),10);
if(o.stepping) value = Math.round(value / o.stepping) * o.stepping;
value = this.translateValue(value);
if(value >= this.size - this.handleSize()) value = this.size - this.handleSize();
if(value <= 0) value = 0;
if(this.rangeElement) {
if(this.currentHandle[0] == this.handle[0] && value >= this.translateValue(this.value(1))) value = this.translateValue(this.value(1));
if(this.currentHandle[0] == this.handle[1] && value <= this.translateValue(this.value(0))) value = this.translateValue(this.value(0));
}
this.currentHandle.css(this.properties[0], value);
if(this.rangeElement) this.updateRange();
this.propagate('start', null);
this.propagate('stop', null);
this.propagate('change', null);
}
});
})(jQuery);/**
* Confirm plugin 1.0
*
* Copyright (c) 2007 Nadia Alramli (https://webarchive.library.unt.edu/web/20090117002407/http://nadiaspot.com/)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*/
/**
* For more docs and examples visit:
* https://webarchive.library.unt.edu/web/20090117002407/http://nadiaspot.com/jquery/confirm
* For comments, suggestions or bug reporting,
* email me at: jquery@nadiaspot.com
*/
jQuery.fn.confirm = function(options) {
options = jQuery.extend({
msg: 'Are you sure?',
stopAfter: 'never',
wrapper: ' ',
eventType: 'click',
dialogShow: 'show',
dialogSpeed: 'fast',
timeout: 0
}, options);
options.stopAfter = options.stopAfter.toLowerCase();
if (!options.stopAfter in ['never', 'once', 'ok', 'cancel']) {
options.stopAfter = 'never';
}
options.buttons = jQuery.extend({
ok: 'Yes',
cancel: 'No',
wrapper:' ',
separator: '/'
}, options.buttons);
// Shortcut to eventType.
var type = options.eventType;
return this.each(function() {
var target = this;
var $target = jQuery(target);
var timer;
var saveHandlers = function() {
var events = jQuery.data(target, 'events');
if (!events) {
// There are no handlers to save.
return;
}
target._handlers = new Array();
for (var i in events[type]) {
target._handlers.push(events[type][i]);
}
}
// Create ok button, and bind in to a click handler.
var $ok = jQuery(options.buttons.wrapper)
.append(options.buttons.ok)
.click(function() {
// Check if timeout is set.
if (options.timeout != 0) {
clearTimeout(timer);
}
$target.unbind(type, handler);
$target.show();
$dialog.remove();
// Rebind the saved handlers.
for (i in target._handlers) {
$target.click(target._handlers[i]);
}
// Trigger click event.
$target.click();
if (options.stopAfter != 'ok' && options.stopAfter != 'once') {
$target.unbind(type);
// Rebind the confirmation handler.
$target.one(type, handler);
}
return false;
})
var $cancel = jQuery(options.buttons.wrapper).append(options.buttons.cancel).click(function() {
// Check if timeout is set.
if (options.timeout != 0) {
clearTimeout(timer);
}
if (options.stopAfter != 'cancel' && options.stopAfter != 'once') {
$target.one(type, handler);
}
$target.show();
$dialog.remove();
return false;
});
if (options.buttons.cls) {
$ok.addClass(options.buttons.cls);
$cancel.addClass(options.buttons.cls);
}
var $dialog = jQuery(options.wrapper)
.append(options.msg)
.append($ok)
.append(options.buttons.separator)
.append($cancel);
var handler = function() {
jQuery(this).hide();
// Do this check because of a jQuery bug
if (options.dialogShow!='show') {
$dialog.hide();
}
$dialog.insertBefore(this);
// Display the dialog.
$dialog[options.dialogShow](options.dialogSpeed);
if (options.timeout != 0) {
// Set timeout
clearTimeout(timer);
timer = setTimeout(function() {$cancel.click(); $target.one(type, handler);}, options.timeout);
}
return false;
};
saveHandlers();
$target.unbind(type);
$target.one(type, handler);
});
}
/*
* TextLimit - jQuery plugin for counting and limiting characters for input and textarea fields
*
* pass '-1' as speed if you don't want slow char deletion effect. (don't just put 0)
* Example: jQuery("Textarea").textlimit('span.counter',256)
*
* $Version: 2007.10.24 +r1
* Copyright (c) 2007 Yair Even-Or
* vsync.design@gmail.com
*/
jQuery.fn.textlimit=function(counter_el, thelimit, speed) {
var charDelSpeed = speed || 15;
var toggleCharDel = speed != -1;
var toggleTrim = true;
var that = this[0];
updateCounter();
function updateCounter(){
if (thelimit - that.value.length < 100)
jQuery(counter_el).text((thelimit - that.value.length) + ' characters left');
else
jQuery(counter_el).text('');
};
this.keypress (function(e){ if( this.value.length >= thelimit && e.charCode != '0' ) e.preventDefault() })
.keyup (function(e){
updateCounter();
if( this.value.length >= thelimit && toggleTrim ){
if(toggleCharDel){
// first, trim the text a bit so the char trimming won't take forever
that.value = that.value.substr(0,thelimit+100);
var init = setInterval
(
function(){
if( that.value.length <= thelimit){ init = clearInterval(init); updateCounter() }
else{ that.value = that.value.substring(0,that.value.length-1); jQuery(counter_el).text('trimming... '+(thelimit - that.value.length)); };
} ,charDelSpeed
);
}
else this.value = that.value.substr(0,thelimit);
}
});
};/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* https://webarchive.library.unt.edu/web/20090117002407/http://www.opensource.org/licenses/mit-license.php
* https://webarchive.library.unt.edu/web/20090117002407/http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};/*
* Metadata - jQuery plugin for parsing metadata from elements
*
* Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
*
* Dual licensed under the MIT and GPL licenses:
* https://webarchive.library.unt.edu/web/20090117002407/http://www.opensource.org/licenses/mit-license.php
* https://webarchive.library.unt.edu/web/20090117002407/http://www.gnu.org/licenses/gpl.html
*
* Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $
*
*/
(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr;}if(data.indexOf('{')<0)data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery);// vertical positioning in the viewport
function screenTop() {
return window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
}
function wHeight() {
return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.clientHeight;
}
var slider_init = false;
var global_data = null;
var global_last_function = null;
var prev_next_dir = null;
var hot_pick_array = new Array;
var mouseX, mouseY;
function showReviewForm() {
if (window.event) window.event.returnValue = false;
document.getElementById('reviewFormRow').style.display = "";
$('#btnreview').css({display:'none'});
$('#btnreviewoff').css({display:''});
var startValue = $('#ratingnumberdet').text() * 10;
if (!slider_init) {
initSlider(startValue);
}
$('#commentreview').focus();
return false;
}
function initSlider(startValue) {
if (!startValue) startValue = 0;
$("#rating_slider").slider({
stepping:1,
minValue: 0,
startValue: startValue,
maxValue: 100,
slide: function(e,ui) {
ui.value = Math.round(ui.value);
$('#ratingnumberdet').text((ui.value/10).toFixed(1));
$('#rating_input').val(ui.value/10);
var rate_bar_imgs = $('#rate_bars img');
for (var i = 0; i < 20; i++) {
var suffix = "";
if (i == 0)
suffix += "_left";
if (i == 19)
suffix += "_right";
if (i*5 < ui.value)
suffix += "_on";
rate_bar_imgs.eq(i).attr("src","/images/big_rate"+suffix+".gif");
}
},
change: function(e,ui) {
ui.value = Math.round(ui.value);
$('#ratingnumberdet').text((ui.value/10).toFixed(1));
$('#rating_input').val(ui.value/10);
var rate_bar_imgs = $('#rate_bars img');
for (var i = 0; i < 20; i++) {
var suffix = "";
if (i == 0)
suffix += "_left";
if (i == 19)
suffix += "_right";
if (i*5 < ui.value)
suffix += "_on";
rate_bar_imgs.eq(i).attr("src","/images/big_rate"+suffix+".gif");
}
}
});
slider_init = true;
}
function hideReviewForm() {
document.getElementById('reviewFormRow').style.display = "none";
$('#btnreview').css({display:''});
$('#btnreviewoff').css({display:'none'});
}
function showMiniForm(form_type, alt_title) {
if (!alt_title) alt_title = 'to share your reviews';
$('#miniform_div .error').html("");
if (form_type == "signup") {
$('#subjoin').val('1');
$('#sublogin').val('');
$('#subforgot').val('');
$('#miniform_title').html('Sign up to '+alt_title);
$('#miniform_firstname').css({display:''});
$('#miniform_lastname').css({display:''});
$('#miniform_forgotemailmsg').css({display:'none'});
$('#miniform_email').css({display:''});
$('#miniform_email2').css({display:''});
$('#miniform_password').css({display:''});
$('#miniform_agree_terms').css({display:''});
$('#miniform_bottommsg').html('Already a member? Click Here login ');
}
if (form_type == "login") {
$('#subjoin').val('');
$('#sublogin').val('1');
$('#subforgot').val('');
$('#miniform_title').html('Login to '+alt_title);
$('#miniform_firstname').css({display:'none'});
$('#miniform_lastname').css({display:'none'});
$('#miniform_forgotemailmsg').css({display:'none'});
$('#miniform_email').css({display:''});
$('#miniform_email2').css({display:'none'});
$('#miniform_password').css({display:''});
$('#miniform_agree_terms').css({display:'none'});
$('#miniform_bottommsg').html('Forgot Password | Not Registered? Sign Up! ');
}
if (form_type == "forgotpass") {
$('#subjoin').val('');
$('#sublogin').val('');
$('#subforgot').val('1');
$('#miniform_title').html('Forgot your password?');
$('#miniform_firstname').css({display:'none'});
$('#miniform_lastname').css({display:'none'});
$('#miniform_forgotemailmsg').css({display:''});
$('#miniform_email').css({display:''});
$('#miniform_email2').css({display:'none'});
$('#miniform_password').css({display:'none'});
$('#miniform_agree_terms').css({display:'none'});
$('#miniform_bottommsg').html('Log in | Not Registered? Sign Up! ');
}
$('#miniform_div').fadeIn("medium");
if (window.event) window.event.returnValue = false;
return false;
}
function hideMiniForm() {
$('#miniform_div').fadeOut("medium");
if (window.event) window.event.returnValue = false;
return false;
}
function submitMiniForm() {
var params = $('#miniform').formSerialize();
$.ajax({
type: "POST",
url: "/process.php",
data: params,
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.retval == true) {
if (global_data) {
$.ajax({
type: "POST",
url: "/process.php",
data: global_data,
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(null, retarr['msg']);
location.href = location.href;
}});
hideMiniForm();
} else if (global_last_function) {
global_last_function.func.apply(this, global_last_function.args);
global_last_function = null;
hideMiniForm();
} else {
$('#submitreview').submit();
}
} else {
$('#miniform_div .error').html("");
for (var field in retarr.errors) {
$('#miniform_'+field+'_error').html(' '+retarr.errors[field]);
}
}
if (retarr.msg && retarr.msg != "") {
showMessage(null, retarr.msg);
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function AddBlogToFavorites(el, id) {
var data = {'subfav':1,
id:id};
global_data = data;
$.ajax({
type: "POST",
url: "/process.php",
data: data,
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr['msg']);
if (retarr.retval) {
if ($('#addToFavoritesDiv'+id)) $('#addToFavoritesDiv'+id).html('Added to Your Favorites');//css({display:'none'});
} else {
if (retarr.errors.login)
showMiniForm('signup');
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function RemoveBlogFromFavorites(el, id) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'subremfav':1,
id:id},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr['msg']);
$('#blogListItem_'+id).fadeOut();
$('#blogListItem_'+id).queue(function () {
var rank_list = $('.fblogListItem:visible');
for (var i = 0; i < rank_list.length; i++) {
$(rank_list[i]).find('.fblogRank').html((i+1)+'. ');
}
$(this).dequeue();
});
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function AddFriend(el, userid) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'subfriend':1,
userid:userid},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr['msg']);
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function DeleteReview(el, id) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'subdelreview':1,
id:id},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr['msg']);
$('#reviewListItem'+id).fadeOut();
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function SubmitReviewVote(review_id, rating, el) {
if (!el)
var el = $('#review_votes_'+rating+'_'+review_id);
$.ajax({
type: "POST",
url: "/process.php",
data: {'subvote':1,
review_id:review_id,
vote_type:rating},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.data[0]) {
var reviews = retarr.data;
var review = reviews["0"];
if (review.total_votes > 0) {
$('#review_vote_summary_'+review.review_id).html(review.num_useful + ' of ' + review.total_votes + ' users found this review helpful');
} else {
$('#review_vote_summary_'+review.review_id).html('Was this review helpful to you?');
}
}
if (retarr['msg'] != '' && el != null)
showMessage(null, retarr['msg']);
if (retarr.errors.login)
showMiniForm('signup');
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function ReportAbuse(report_type, review_id) {
var top = mouseY-5;
var left = mouseX-10;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=reportabuse&review_id='+review_id+'&report_type='+report_type, {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function fetchVotesForReviews(review_ids) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'getvotes':1,
review_ids:review_ids},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr == null) return false;
var reviews = retarr.data;
for (var i = 0; i < reviews.length; i++) {
var review = reviews[i];
if (review.total_votes > 0) {
$('#review_vote_summary_'+review.review_id).html(review.num_useful + ' of ' + review.total_votes + ' users found this review helpful');
} else {
$('#review_vote_summary_'+review.review_id).html('Was this review helpful to you?');
}
}
}
});
return false;
}
function showMessage(el, msg) {
$('#popup_div').html(msg);
if (el != null) {
var pos = $(el).offset();
$("#popup_div").css({top:pos.top-5, left:pos.left-5});
} else {
// use mouse position
$("#popup_div").css({top:mouseY-5, left:mouseX-10});
}
$("#popup_div").fadeIn("medium").fadeTo(2000,1).fadeOut(1000);
}
function favoritesListSort(e, ui) {
var new_list = $('#favoritesList').sortable('serialize');
new_list = new_list.replace(/&/g, ',');
new_list = new_list.replace(/blogListItem\[\]=/g, '');
var blog_ids = new_list;
var userid = $('#favoritesList').attr("alt");
$.ajax({
type: "POST",
url: "/process.php",
data: {'subrerank':1,
listtype:"blogfavorites",
userid:userid,
rerank_ids:blog_ids
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(null, retarr['msg']);
var rank_list = $('.fblogRank');
for (var i = 0; i < rank_list.length; i++) {
$(rank_list[i]).html((i+1)+'. ');
}
}
});
}
function friendsListSort(e, ui) {
}
function handleNextHomepageBlog(msg) {
var blog = eval('('+msg+')');
var url = "/blogs/"+blog.blog_url_name;
$('#view_cat'+blog.parent_category_id).queue(function () {
$('#thumbnail_cat'+blog.parent_category_id).attr({src: blog.thumbnail, alt:blog.position, title:blog.title});
$('#thumbnailurl_cat'+blog.parent_category_id).attr({href: url});
$('#title_cat'+blog.parent_category_id).html(blog.title);
$('#title_cat'+blog.parent_category_id).attr({href:url});
$('#summary_cat'+blog.parent_category_id).html(blog.summary);
$(this).dequeue();
});
}
function SearchTabClick() {
var id = $(this).attr("id");
var tab = id.replace('search_tab_link_', '');
$('a.search_tab').parent().removeClass( 'searchcaton' );
$(this).parent().addClass( 'searchcaton' );
$('#search_type').val( tab );
// if (window.event) window.event.returnValue = false;
// return false;
}
function SubmitSearch() {
if ( $('#search_textfield').val() == "") {
showMessage($('#search_textfield'), "Please enter a search term");
if (window.event) window.event.returnValue = false;
return false;
}
return true;
}
function SubmitUserComment() {
var params = $('#user_comment_form').formSerialize();
$.ajax({
type: "POST",
url: "/process.php",
data: params,
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage($('#user_comment_form'), retarr['msg']);
if (retarr['retval'] == 1) location.href = location.href;
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function SubmitUserMessage() {
var params = $('#user_message_form').formSerialize();
$.ajax({
type: "POST",
url: "/process.php",
data: params,
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage($('#user_message_send'), retarr['msg']);
if (retarr['retval'] == 1) {
$('#popupform_div').css({display:'none'});
if ($('#message')) $('#message').val('');
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function SendVerification(el) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'verifyuser':1},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function showMenu() {
var menu = $(this).siblings("ul.innerMenu");
if (menu.css("display") == "none") {
hideMenu();
menu.css("display", "");
} else {
menu.css("display","none");
}
var pos = $(this).parent().position();
var height = $(this).parent().height();
var width = $(this).parent().width();
menu.css({top:pos.top+height+5, left:pos.left-5});
if (window.event) window.event.returnValue = false;
return false;
}
function hideMenu() {
$('ul.innerMenu').css("display","none");
}
function showInfo() {
hideInfo();
var popup = $(this).siblings("div.info_popup");
var pos = $(this).offset();
popup.css({top:pos.top+15, left:pos.left-100});
if (popup.css("display") == "none")
popup.css("display","");
else
popup.css("display","none");
if (window.event) window.event.returnValue = false;
return false;
}
function hideInfo() {
$('div.info_popup').css("display","none");
}
function deleteThread() {
// check the id to find out the thread id
var id = $(this).attr("id");
var thread_id = id.replace('delete_thread_', '');
var el = $(this);
$.ajax({
type: "POST",
url: "/process.php",
data: {'markthreads':1,
'mark_type':'deleted',
'thread_type':'inbox',
'thread_ids':thread_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
$('#thread_row_'+thread_id).fadeOut();
$('#thread_divider_row_'+thread_id).fadeOut();
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function deleteSentThread() {
// check the id to find out the thread id
var id = $(this).attr("id");
var thread_id = id.replace('delete_sent_thread_', '');
var el = $(this);
$.ajax({
type: "POST",
url: "/process.php",
data: {'markthreads':1,
'mark_type':'deleted',
'thread_type':'sentbox',
'thread_ids':thread_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
$('#thread_row_'+thread_id).fadeOut();
$('#thread_divider_row_'+thread_id).fadeOut();
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function MarkChecked(event) {
var mark_type = event.data.mark_type;
var thread_type = event.data.thread_type;
var el = $(this);
var checkboxes = $('input.thread_checkbox');
var thread_ids = new Array;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) {
var thread_id = checkboxes[i].id.replace('thread_checkbox_', '');
thread_ids.push(thread_id);
}
}
thread_ids = thread_ids.join(",");
if (thread_ids == '') {
showMessage(el, "Please check the messages you wish to change");
} else {
$.ajax({
type: "POST",
url: "/process.php",
data: {'markthreads':1,
'mark_type':mark_type,
'thread_type':thread_type,
'thread_ids':thread_ids
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
location.href = location.href;
}
});
}
if (window.event) window.event.returnValue = false;
return false;
}
function deleteComment(event) {
var id = $(this).attr("id");
var comment_id = id.replace('delete_comment_', '');
var el = $(this);
$.ajax({
type: "POST",
url: "/process.php",
data: {'deletecomment':1,
'comment_id':comment_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
if (retarr.retval) {
$('#comment_row_'+comment_id).fadeOut();
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function deleteShared(event) {
var id = $(this).attr("id");
var shared_id = id.replace('delete_shared_', '');
var el = $(this);
$.ajax({
type: "POST",
url: "/process.php",
data: {'deleteshared':1,
'shared_id':shared_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(el, retarr.msg);
if (retarr.retval) {
$('#shared_row_'+shared_id).fadeOut();
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowMailForm() {
var id = this.id;
var rid = '';
if (id.indexOf('writeemail_rid_') == 0) {
rid = id.replace('writeemail_rid_', '');
}
var pos = $(this).offset();
var top = pos.top + 10;
var left = pos.left - 450;
if (left < 100) left = 100;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=writemessage&rid='+rid, {}, function () {
// jQuery(function() {
// jQuery("#recipient").suggest("friends.php",{
// minchars: -1,
// onSelect: function() {
// var selected_val = this.value;
// var userinfo = selected_val.split(',');
// var html = " "+userinfo[0];
// html += " ";
// $("#recipients_list").html($("#recipients_list").html() + html);
// $("#recipient").val("");
// $("#recipient").css({display:'none'});
// $("#subject").focus();
// }}); });
});
if (window.event) window.event.returnValue = false;
return false;
}
function HideMailForm() {
$('#popupform_div').css({display:'none'});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowShareForm() {
var id = this.id;
var blog_id = '';
if (id.indexOf('shareblog_link_') == 0) {
blog_id = id.replace('shareblog_link_', '');
}
var article_id = '';
if (id.indexOf('sharearticle_link_') == 0) {
article_id = id.replace('sharearticle_link_', '');
}
if (id.indexOf('sharearticle_img_') == 0) {
article_id = id.replace('sharearticle_img_', '');
}
var link = this.href;
var pos = $(this).offset();
var top = pos.top - 150;
var left = pos.left + 100;
if (left < 100) left = 100;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=shareblog&blog_id='+blog_id+'&article_id='+article_id+'&link='+link, {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowWidgetForm() {
var id = this.id;
var blog_id = '';
if (id.indexOf('widget_link_') == 0) {
blog_id = id.replace('widget_link_', '');
}
var pos = $(this).offset();
var top = pos.top + 10;
var left = pos.left - 450;
if (left < 100) left = 100;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=widget&blog_id='+blog_id, {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowReviewsWidget(blog_id) {
var left = $(document).width()/2 - 300;
var top = screenTop() + 20;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=widget_reviews&blog_id='+blog_id, {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowFavoritesWidgetForm() {
var left = $(document).width()/2 - 300;
var top = screenTop() + 20;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=widget_favorites', {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowWidgetChooseBlogForm(widget_type) {
var left = $(document).width()/2 - 300;
var top = screenTop() + 20;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=widget_choose_blog&widget_type='+widget_type, {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowReviewRequestForm() {
var id = this.id;
var blog_id = '';
if (id.indexOf('request_review_link_') == 0) {
blog_id = id.replace('request_review_link_', '');
}
var pos = $(this).offset();
var top = pos.top + 10;
var left = pos.left - 450;
if (left < 100) left = 100;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:top, left:left});
$('#popupform_div').load('/popup_form.php?type=reviewrequest&blog_id='+blog_id, {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function ArticleReadMore(link) {
$('%readmore_anim').css({'visibility':'visible'});
$('#readmore_div').load('/article_readmore.php?link='+encodeURIComponent(link), function() {
$('#blogexcerpt').hide();
});
if (window.event) window.event.returnValue = false;
return false;
}
function ExpandRSS() {
var id = $(this).attr('id');
var blog_id = id.replace('expandRSS', '');
$('#RSSdiv'+blog_id).slideToggle(function() {
if ($('#expandRSSIMG'+blog_id).attr('src') == '/images/btn_recent_posts.gif')
$('#expandRSSIMG'+blog_id).attr({src:'/images/btn_recent_posts_on.gif'});
else
$('#expandRSSIMG'+blog_id).attr({src:'/images/btn_recent_posts.gif'});
});
if ($('#RSSdiv'+blog_id).html().indexOf('RSSarticle') === -1) {
$('#RSSdiv'+blog_id).load('/getrss.php?blog_id='+blog_id);
}
if (window.event) window.event.returnValue = false;
return false;
}
function ExpandRSSExcerpt() {
var id = $(this).attr('id');
var article_id = id.replace('RSSarticleTitle', '');
var unread = $('#RSSarticle'+article_id).hasClass('unread');
$('#RSSarticleExcerpt'+article_id).slideToggle("fast");
$('#RSSarticle'+article_id).addClass("read");
if (unread) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'markarticle':1,
'article_id':article_id,
'mark':'read'
},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.msg)
showMessage($(this), retarr.msg);
if (retarr.retval) {
var data = retarr.data;
if (data.num_unread > 0)
$('#unreadRSS'+data.blog_id).html('unread('+data.num_unread+')');
else
$('#unreadRSS'+data.blog_id).html('');
}
}
});
}
if (window.event) window.event.returnValue = false;
return false;
}
function SaveArticle() {
var id = $(this).attr('id');
var article_id = id.replace('saveArticle', '');
$.ajax({
type: "POST",
url: "/process.php",
data: {'savearticle':1,
'article_id':article_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.msg)
showMessage(null, retarr.msg);
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function DeleteSavedArticle(article_id) {
$.ajax({
type: "POST",
url: "/process.php",
data: {'deletesavedarticle':1,
'article_id':article_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.msg)
showMessage(null, retarr.msg);
$('#RSSarticle'+article_id).fadeOut();
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowSavedArticles() {
var winW = $(window).width();
var left = winW/2 - 547/2;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:'200px'});
$('#popupform_div').load('/popup_form.php?type=savedarticles', {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function ClaimOwnedBlog(el, blog_id) {
var args = arguments;
$.ajax({
type: "POST",
url: "/process.php",
data: {'checkloggedin':1},
success: function(msg) {
var retarr = eval('('+msg+')');
if (retarr.retval == 1) {
var pos = $(el).offset();
var left = pos.left;
var top = pos.top;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:top});
$('#popupform_div').load('/popup_form.php?type=claimownedblog&blog_id='+blog_id, {}, function () {});
} else {
showMessage(null, 'You must be logged in to claim authorship of a blog');
global_last_function = {'func':ClaimOwnedBlog, 'args':args};
showMiniForm('signup', 'claim this blog');
}
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function AddOwnedBlog() {
var pos = $(this).offset();
var left = pos.left;
var top = pos.top;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:top});
$('#popupform_div').load('/popup_form.php?type=addownedblog', {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function VerifyOwnedBlog() {
var id = $(this).attr('id');
var blog_id = id.replace('verifyblog_link', '');
var pos = $(this).offset();
var left = pos.left;
var top = pos.top;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:top});
$('#popupform_div').load('/popup_form.php?type=verifyownedblog&blog_id='+blog_id, {}, function () {
});
if (window.event) window.event.returnValue = false;
return false;
}
function DeleteOwnedBlog() {
var id = $(this).attr('id');
var user_ownedblog_id = id.replace('deleteblog_link', '');
$.ajax({
type: "POST",
url: "/process.php",
data: {'deleteownedblog':1,
'id':user_ownedblog_id
},
success: function(msg) {
var retarr = eval('('+msg+')');
updateOwnedBlogs();
}
})
if (window.event) window.event.returnValue = false;
return false;
}
function updateOwnedBlogs() {
$('#ownedblogsDiv').load('/process.php', {type: "POST", 'getownedblogs':1}, function() {
$('#ownedblogsDiv').find('a.verifyblog_link').bind("click", VerifyOwnedBlog);
$('a.deleteblog_link').bind("click", DeleteOwnedBlog);
$('a.deleteblog_link').confirm();
} );
}
function UpdateBlogDetails(el, blog_id) {
var pos = $(el).offset();
var left = pos.left;
var top = pos.top;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:top});
$('#popupform_div').load('/popup_form.php?type=updateblogdetails&blog_id='+blog_id, {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function ShowXangaThankYou(thankyou_type, blog_id) {
var left = $(document).width()/2 - 150;//200;
var top = 300;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', left:left, top:top});
$('#popupform_div').load('/popup_form.php?type='+thankyou_type+'thankyou&blog_id='+blog_id, {}, function () {});
}
function RequestRssRecrawl(id) {
var data = {'subrssrecrawl':1,
id:id};
$.ajax({
type: "POST",
url: "/process.php",
data: data,
success: function(msg) {
var retarr = eval('('+msg+')');
showMessage(null, retarr['msg']);
}
});
if (window.event) window.event.returnValue = false;
return false;
}
function handleSlideRelatedBlogs(msg) {
var retarr = eval('('+msg+')');
var offset = 344;
var dir = retarr.data.dir;
$('#relatedblogpane').queue(function () {
var related_blogs = retarr.data.related_blogs;
var rb_thumbnails = $(this).find('img.rb_thumbnail');
var rb_thumbnail_links = $(this).find('a.rb_thumbnail_link');
var rb_titles = $(this).find('a.rb_title');
var rb_ratings = $(this).find('span.rbrating');
for (var i = 0; i < 3; i++) {
if (related_blogs[i]) {
$(rb_thumbnails[i]).attr({'src':related_blogs[i].thumbnail});
$(rb_thumbnail_links[i]).attr({'href':related_blogs[i].blog_url});
$(rb_titles[i]).html(related_blogs[i].title);
$(rb_titles[i]).attr({'href':related_blogs[i].blog_url});
if (rb_ratings[i]) {
if (related_blogs[i].rating == 0) related_blogs[i].rating = "n/a";
$(rb_ratings[i]).html(related_blogs[i].rating);
}
$(rb_thumbnails[i]).attr({'alt':related_blogs[i].title});
} else {
}
}
$('#related_blog_pos').val(retarr.data.pos);
if (dir == "left") {
$(this).animate({"left": "-="+offset+"px"}, "slow");
} else {
$(this).animate({"left": "+="+offset+"px"}, "slow");
}
$(this).dequeue();
});
}
function SlideRelatedBlogs(event) {
var offset = 344;
var blog_id = $('#related_blog_id').val();
var pos = $('#related_blog_pos').val();
var num = $('#related_blog_num').val();
$.ajax({
type: "POST",
url: "/process.php",
data: {'getrelatedblogs':1,
blog_id:blog_id,
dir:event.data.dir,
pos:pos,
num:num},
success: handleSlideRelatedBlogs
});
if (event.data.dir == 'left') {
$('#relatedblogpane').animate({"left": "-="+offset+"px"}, "slow");
$('#relatedblogpane').queue(function () {
$(this).css({"left": "+"+offset+"px"});
$(this).dequeue();
});
} else {
$('#relatedblogpane').animate({"left": "+="+offset+"px"}, "slow");
$('#relatedblogpane').queue(function () {
$(this).css({"left": "-"+offset+"px"});
$(this).dequeue();
});
}
if (window.event) window.event.returnValue = false;
return false;
}
function HotPickHover() {
var id = $(this).attr('id');
var blog_id = id.replace('hot_pick_hover_link_', '');
var data = hot_pick_array[blog_id];
if (!data) return;
$('a.hot_pick_hover_link').removeClass('hot_pick_selected');
$(this).addClass('hot_pick_selected');
$('#hot_pick_thumbnail').attr({'src':data.thumbnail});
$('#hot_pick_thumbnail_link').attr({'href':data.url});
$('#hot_pick_title').html(''+data.title+' ');
$('#hot_pick_title').attr({'href':data.url});
$('#hot_pick_summary').html(data.summary);
$('#hot_pick_url').html(data.display_url);
$('#hot_pick_url').attr({'href':data.url});
$('#hot_pick_rating').html(data.rating);
var rate_bar_imgs = $('#hot_pick_rating_img img');
for (var i = 0; i < 20; i++) {
var suffix = "";
if (i*5 < data.rating*10)
suffix += "_green";
else
suffix += "_grey";
if (i == 0)
suffix += "_l";
if (i == 19)
suffix += "_r";
rate_bar_imgs.eq(i).attr("src","/images/rate"+suffix+".gif");
}
$('#hot_pick_favorites_icon_link').attr({'name':blog_id})
$('#hot_pick_favorites_text_link').attr({'name':blog_id})
}
function checkBlogUrl() {
var blogurl = $(this).val();
if (blogurl != "" && blogurl != "http://") {
var pos = $(this).offset();
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:pos.top, left:pos.left + $(this).width()});
$('#popupform_div').load('/popup_form.php?type=blogcheck&blogurl='+escape(blogurl), {}, function () {});
}
}
function loadErrorImg() {
$(this).attr("src", '/images/default_thumbnail.jpg');
}
function loadErrorImgSm() {
$(this).attr("src", '/images/default_thumbnail_sm.jpg');
}
function adultLinkClick() {
var blog_id = $('#blog_id').val();
var url = $(this)[0].href;
var pos = $(this).offset();
var left = pos.left;
var top = pos.top;
$('#popupform_div').html('');
$('#popupform_div').css({display:'', top:pos.top, left:pos.left});
$('#popupform_div').load('/popup_form.php?type=adultlink&url='+escape(url), {}, function () {});
if (window.event) window.event.returnValue = false;
return false;
}
function track() {
var trImg = new Image();
var now = new Date();
var blog_id = $('#blog_id').val();
trImg.src = "/tracking.php?blog_id="+blog_id+"&"+now.getTime();
}
function trackArticle() {
var data = $(this).metadata();
var trImg = new Image();
var now = new Date();
var link_id = data.link_id
trImg.src = "/tracking.php?link_id="+link_id+"&"+now.getTime();
}
function trackMakeHomepage() {
var trImg = new Image();
var now = new Date();
trImg.src = "/tracking.php?selected=make_homepage&"+now.getTime();
}
$(document).ready(function(){
$('a.homepageleft').click(function() {
prev_next_dir = 'left';
var category_id = $(this).attr("id");
category_id = category_id.replace('homepageleft_cat', '');
$('#view_cat'+category_id).animate({"left": "-=228px"}, "slow");
$('#view_cat'+category_id).queue(function () {
$(this).css({"left": "+228px"});
$(this).dequeue();
});
var pos = $('#thumbnail_cat'+category_id).attr("alt");//$(this).attr("alt");
var dir = "left";
$.ajax({
type: "POST",
url: "/process.php",
data: {'getnextblog':1,
category_id:category_id,
direction:dir,
position:pos},
success: handleNextHomepageBlog
});
if (window.event) window.event.returnValue = false;
return false;
});
$('a.homepageright').click(function() {
prev_next_dir = 'right';
var category_id = $(this).attr("id");
category_id = category_id.replace('homepageright_cat', '');
$('#view_cat'+category_id).animate({"left": "+=228px"}, "slow");
$('#view_cat'+category_id).queue(function () {
$(this).css({"left": "-228px"});
$(this).dequeue();
});
var pos = $('#thumbnail_cat'+category_id).attr("alt");//var pos = $(this).attr("alt");
var dir = "right";
$.ajax({
type: "POST",
url: "/process.php",
data: {'getnextblog':1,
category_id:category_id,
direction:dir,
position:pos},
success: handleNextHomepageBlog
});
if (window.event) window.event.returnValue = false;
return false;
});
$('a.clickMenu').bind("click",showMenu);
$('a.mouseMenu').bind("mouseover",showMenu);
$('body').click(hideMenu);
$('a.info_popup_link').click(showInfo);
$('body').click(hideInfo);
$('info_popup_close').click(hideInfo);
$('img.homepagethumbimg').bind("load", function(e) {
if (!prev_next_dir) return;
var category_id = $(this).attr("id");
category_id = category_id.replace('thumbnail_cat', '');
if (prev_next_dir == 'left')
$('#view_cat'+category_id).animate({"left": "-=228px"}, "slow");
else
$('#view_cat'+category_id).animate({"left": "+=228px"}, "slow");
});
if ($('#reviewFormRow:visible').length > 0) {
var startValue = $('#ratingnumberdet').text() * 10;
if (!slider_init) {
initSlider(startValue);
}
}
$('a.delete_thread').click(deleteThread);
$('a.delete_sent_thread').click(deleteSentThread);
$('a.MarkCheckedAsUnreadLink').bind("click", {mark_type:"unread", thread_type:"inbox"}, MarkChecked);
$('a.MarkCheckedAsReadLink').bind("click", {mark_type:"read", thread_type:"inbox"}, MarkChecked);
$('a.MarkCheckedAsDeletedLink').bind("click", {mark_type:"deleted", thread_type:"inbox"}, MarkChecked);
$('a.MarkCheckedAsSentboxDeletedLink').bind("click", {mark_type:"deleted", thread_type:"sentbox"}, MarkChecked);
$('a.delete_comment').bind("click", deleteComment);
$('a.delete_shared').bind("click", deleteShared);
$('a.writeemail_link').bind("click", ShowMailForm);
$('a.shareblog_link').bind("click", ShowShareForm);
$('a.widget_link').bind("click", ShowWidgetForm);
$('a.widget_favorites_link').bind("click", ShowFavoritesWidgetForm);
$('a.request_review_link').bind("click", ShowReviewRequestForm);
$('div.expandRSS').bind("click", ExpandRSS);
$('a.expandRSS').bind("click", ExpandRSS);
$('div.expandRSS').bind("mouseover", function() { $(this).css({'backgroundColor':'#EAEAEA'}); });
$('div.expandRSS').bind("mouseout", function() { $(this).css({'backgroundColor':'white'}); });
$('div.RSSarticleTitle').bind("click", ExpandRSSExcerpt);
$('div.RSSarticleTitle').bind("mouseover", function() { $(this).css({'backgroundColor':'#EAEAEA'}); });
$('div.RSSarticleTitle').bind("mouseout", function() { $(this).css({'backgroundColor':'white'}); });
$('a.saveArticle').bind("click", SaveArticle);
$('a.showSavedArticles').bind("click", ShowSavedArticles);
$('a.related_blog_prev').bind("click", {'dir':'left'}, SlideRelatedBlogs);
$('a.related_blog_next').bind("click", {'dir':'right'}, SlideRelatedBlogs);
$('#add_owned_blog').bind("click", AddOwnedBlog);
$('a.verifyblog_link').bind("click", VerifyOwnedBlog);
$("#popupform_div").draggable();
$('img.site_thumbnail').bind("error", loadErrorImg);
$('img.site_thumbnail_sm').bind("error", loadErrorImgSm);
$('#submitblogurl').bind("blur", checkBlogUrl);
$('a.search_tab').bind("click", SearchTabClick);
$('a.adult_link').bind("click", adultLinkClick);
$('a.blog_link').bind("click", track);
$('a.article_link').bind("mousedown", trackArticle);
$('a.makehomepage_link').bind("mousedown", trackMakeHomepage);
if ($('#submitdesc_count').length > 0)
$("#submitdesc").textlimit('#submitdesc_count',255);
if ($('#commentreview_count').length > 0)
$("#commentreview").textlimit('#commentreview_count',800);
// handle the submit review form
$('#submitreview').ajaxForm(function(msg) {
var retarr = eval('('+msg+')');
if (retarr.retval != 1) {
if (retarr.errors && retarr.errors.not_logged_in) {
global_data = null;
showMiniForm('signup');
} else {
hideMiniForm();
alert(retarr.msg);
}
}
if (retarr.retval == 1) location.href = location.href.replace('&action=edit', '');
});
if ($('a.hot_pick_hover_link').length > 0) {
var blog_ids = new Array;
var links = $('a.hot_pick_hover_link');
for (var i = 0; i < links.length; i++) {
var blog_id = links[i].id.replace('hot_pick_hover_link_','');
blog_ids.push(blog_id);
}
var blog_ids_str = blog_ids.join();
$.ajax({
type: "POST",
url: "/process.php",
data: {'bloginfo':1,
'blog_ids':blog_ids_str},
success: function(msg) {
hot_pick_array = eval('('+msg+')');
}
});
}
$('a.hot_pick_hover_link').bind("mouseover", HotPickHover);
$().mousemove(function(e){
mouseX = e.pageX;
mouseY = e.pageY;
});
});