// ==UserScript==
// @name ROBO Sticky
// @author ROBO Design
// @namespace http://www.robodesign.ro
// @version 1.0.7
// @description Add sticky-notes to HTML and XHTML pages.
// @date 2005-11-15
// License: http://creativecommons.org/licenses/by-nc-sa/2.0/
// ==/UserScript==
/*
Creative License Attribution-NonCommercial-ShareAlike 2.0
http://creativecommons.org/licenses/by-nc-sa/2.0/
This User JavaScript is based on another UserJS made by Antonio Orlando and Brian McAllister.
http://digilander.libero.it/odnalro/coding/sticky_notes/
To check for updates and to read more about this User JavaScript go to:
http://www.robodesign.ro/opera/userjs/stickies
Thanks to Mark Wilton-Jones (TarquinWJ) for suggestions, help and testing.
http://www.howtocreate.co.uk
*/
/* ONLY EDIT THE CONFIGURATION SECTION (unless you really know what you are doing) */
document.addEventListener('load', function ()
{
if(window.ujs_stickies)
return false;
window.ujs_stickies = new (function()
{
var manager = this;
/**************
**************/
/* Allow double click on the page to create a new sticky? */
manager.post_2click = true;
/* Allow one click to edit the content? If false, double click is required. */
manager.edit_1click = true;
/* In editing mode: allow one click outside of the sticky to save. */
manager.click_to_save = true;
/* Confirm sticky removal */
manager.remove_confirm = true;
/* Allow XHTML in sticky content.
Values: 1 - always ; 2 - never ; 3 - configurable per sticky */
manager.allow_xhtml = 3;
/* Default minimized state for stickies.
Values: 1 - always minimized ; 2 - never minimized ; 3 - remember last time for each sticky */
manager.minimize_stickies = 3;
/* Minimize/restore the sticky on double-click on the title. */
manager.minimize_2click = true;
/* Allow parameters in URL
If this is true:
/index.php?page=a
/index.php?page=b
... will be considered two unique pages.
If false, both pages are treated as: /index.php (identical). */
manager.params_in_url = true;
/* If you allow parameters in URL, you can also specify which parameters to remove from the URL (these can contain random values)
You must seperate each parameter with a vertical bar. */
manager.remove_params_in_url = 'tmp|sessionid|sessid|temp|phpsessid|jsessionid|aspsessionid|cfid|cftoken';
/* Turbo mode. If this is enabled, then there won't be any check for size and position constrains while resizing and dragging. */
manager.turbo_mode = false;
/* Show (or not) "nice" background image. Disable for faster rendering in Opera. */
manager.bgrImage = true;
/* Minimum X and Y position for all stickies. */
manager.min_x = 5;
manager.min_y = 5;
/* Minimum and maximum width and height for all stickies. */
manager.max_width = 600;
manager.max_height = 400;
manager.min_width = 250;
manager.min_height = 130;
/* Background color of the sticky. */
manager.bgrColor = '#ffef59';
/* Title background color. */
manager.ttlBgrColor = '#ffef59';
/* Title height (only allowed in pixels). */
manager.ttlHeight = 14;
/* Resize handler color, width and height (in pixels). */
manager.resizerColor = '#ddcd37';
manager.resizer_w = 8;
manager.resizer_h = 8;
/* Border color. */
manager.borderColor = '#990';
/* Close button color. */
manager.closeColor = '#f00';
/* Font size/line-height and family for sticky text. */
manager.cssFont = '11px/11px sans-serif';
/* Text color. */
manager.textColor = '#000';
/* Content padding (pixels). */
manager.contentPadding = 5;
// To further customize the sticky appearence just scroll to the end of this document to directly edit the CSS.
// Messages
manager.messages = new Array(
// 0 The default content of a new sticky
'New sticky.',
// 1 Confirmation message when trying to delete a sticky
'Are you sure you want to delete this sticky?',
// 2
'Sticky posted on ',
// 3 Tool tip message shown over the drag area
'Click and drag to reposition sticky.',
// 4 Tool tip for the resizer
'Click and drag to resize sticky.',
// 5 The tool tip for delete button
'Delete this sticky.',
// 6 The delete button
'X',
// 7 The "Allow XHTML" checkbox label
'XHTML',
// 8 The "Per domain" checkbox label
'Domain',
// 9 The Save button
'[ Save ]',
// 10 The tool tip for Save button
'Click to exit the editing mode.',
// 11 The tool tip of the entire sticky, when only one click is required
'. Click to edit the sticky content.',
// 12 .. or when a double-click is required to edit the sticky content
'. Double click to edit the sticky content.',
// 13 Tool tip for the "Allow XHTML" checkbox
'Allow XHTML code in the content of the sticky.',
// 14 Tool tip for the "Per domain" checkbox
'Show this sticky on all pages of this domain.',
// 15 Tool tip for the title input
'Click to edit the title of this sticky.',
// 16 The Minimize button
'M',
// 17 The tool tip for Minimize button
'Click to minimize the sticky.',
// 18 The Maximize/Restore button
'R',
// 19 The tool tip for Maximize/Restore button
'Click to restore and show the entire sticky.',
// 20 The "Fixed positioning" button
'F',
// 21 The tool tip for "Fixed positioning" button
'Click to make this sticky use fixed positioning. This will allow you to position the sticky in relation to the viewport, no matter where you scroll.',
// 22 The "Absolute positioning" button
'A',
// 23 The tool tip for "Absolute positioning" button
'Click to make this sticky use absolute positioning. This will allow you to position the sticky in relation to the content of the page.',
// 24 The error message when the initialization failed
'You cannot add a sticky to this document. Initialization failed. Most likely the document you are viewing is not (X)HTML.',
// 25 The error message when the user tries to use fixed positioning in Opera 8
'Fixed positioning is not working properly in Opera 8. Please upgrade to Opera 9.',
// 26 Part of the tool tip when the sticky is not minimized and not in editing mode. This informs the user s/he can double-click to minimize the sticky.
'Double-click to minimize the sticky.',
// 27 Part of the tool tip when the sticky is minimized and not in editing mode. This informs the user s/he can double-click to restore the sticky.
'Double-click to restore the sticky.',
// 28 The tool tip of the textarea in editing mode.
'Click to edit the content of the sticky.'
);
/***************
***************/
manager.z = 0;
manager.init_failed = false;
manager.bag = new Array();
manager.sub_x = manager.sub_y = 5;
manager.DOM3LS_parser = document.implementation.createLSParser(document.implementation.MODE_SYNCHRONOUS, 'http://www.w3.org/TR/REC-xml');
manager.DOM3LS_input = document.implementation.createLSInput();
// regular expression for the niceURL function
manager.niceURLre = new RegExp('(\\?|&)(' + manager.remove_params_in_url + ')=([^&]*)&?', 'ig');
// call this function to post a sticky
manager.post = function (e)
{
if(manager.init_failed)
{
alert(manager.messages[24]);
return;
}
if(document.getSelection())
return false;
if(e)
{
if(e.target)
{
if(manager.isTargetSticky(e.target))
return false;
var targetTag = e.target.tagName;
if(targetTag)
{
targetTag = targetTag.toLowerCase();
if(targetTag == 'input' || targetTag == 'a' || targetTag == 'textarea'
|| targetTag == 'img' || targetTag == 'label' || targetTag == 'button'
|| targetTag == 'select')
return false;
}
}
e.preventDefault();
}
if(e && e.clientX)
var x = window.pageXOffset+e.clientX;
else
var x = 100 + Math.floor(Math.random()*501);
if(e && e.clientY)
var y = window.pageYOffset+e.clientY;
else
var y = window.pageYOffset + 100 + Math.floor(Math.random()*201);
var date = new Date();
var params = new Array(x, y, manager.min_width, manager.min_height, document.URL, 0, date.toUTCString(), 0, 0, 0);
manager.bag.push(new manager.sticky(manager.bag.length, date.getTime(), manager.messages[0], params));
return true;
}
manager.init = function ()
{
var dochead = document.getElementsByTagName('head')[0];
// check if the page is (X)HTML
if(!document.body || !document.getElementsByTagName("html"))
manager.init_failed = true;
if(!dochead && !manager.init_failed)
{
// thanks to Mark Wilton-Jones (TarquinWJ)
// http://www.howtocreate.co.uk
var allBodyParts = document.body.getElementsByTagName('*');
var nrBodyParts = allBodyParts.length;
// empty documents
if(!nrBodyParts)
manager.init_failed = true;
else
var firstTagName = document.body.firstChild.tagName;
if(firstTagName)
firstTagName = firstTagName.toLowerCase();
// text documents and plugins
if(nrBodyParts == 1 && (firstTagName == 'pre' || firstTagName == 'embed'))
manager.init_failed = true;
// images
if(nrBodyParts == 5 && firstTagName == 'table' && allBodyParts[4].tagName && allBodyParts[4].tagName.toLowerCase() == 'img')
manager.init_failed = true;
if(!manager.init_failed)
dochead = document.body;
}
if(manager.init_failed)
return false;
// add the CSS
if(!document.getElementById('ujs_sticky_css'))
{
var css_txt_node = document.createTextNode(manager.css);
var style_elem = document.createElement("style");
style_elem.type = "text/css";
style_elem.id = "ujs_sticky_css";
style_elem.appendChild(css_txt_node);
dochead.appendChild(style_elem);
}
// if the user wants to double-click anywhere on the page just to post a sticky
if(manager.post_2click)
document.documentElement.addEventListener('dblclick', manager.post, false);
// get ready to read the stickies
var cname, tmp, content, cvalue, time, params, cookie, cookies = document.cookie.split(';');
var nr_cookies = cookies.length;
for(var i=0; i < nr_cookies; i++)
{
cookie = manager.trim(cookies[i]);
tmp = cookie.indexOf('=');
// get the cookie name
cname = manager.trim(cookie.substr(0, tmp));
// check if it's something for this script
if(cname.indexOf('ujs_sticky_') != 0)
continue;
// get the time when the sticky was posted
time = parseInt(cname.substr(11));
// if it's not a number, then this is a bogus cookie
if(isNaN(time))
continue;
// get the value of the cookie
cvalue = unescape(cookie.substr(tmp+1));
tmp = cvalue.indexOf("]");
// get the [p,a,r,a,m,e,t,er,s]
params = cvalue.substr(1, tmp-1).split("\n");
// unescape the URL
params[4] = unescape(params[4]);
// if the cookie is not for the entire domain and if the URL doesn't match the current URL
// just skip the sticky
if(params[5] != 1 && manager.niceURL(params[4]) != manager.url)
continue;
// get the content of the sticky
content = cvalue.substr(tmp+1);
// parse the numbers from the sticky
params[0] = parseInt(params[0]);
params[1] = parseInt(params[1]);
params[2] = parseInt(params[2]);
params[3] = parseInt(params[3]);
params[6] = unescape(params[6]);
params[8] = parseInt(params[8]);
params[9] = parseInt(params[9]);
// force the Allow XHTML setting based on user configuration
if(manager.allow_xhtml == 1)
params[7] = 1;
else if(manager.allow_xhtml == 2)
params[7] = 0;
// force minimization based on user configuration
if(manager.minimize_stickies == 1)
params[8] = 1;
else if(manager.minimize_stickies == 2)
params[8] = 0;
// add the sticky
manager.bag.push(new manager.sticky(manager.bag.length, time, content, params));
}
}
// generally used function :)
manager.trim = function (s)
{
return s.replace(/^\s+/, '').replace(/\s+$/, '');
}
// function to do a small clean-up in the URL
manager.niceURL = function (url)
{
if(url)
var pos = url.indexOf("?");
else
return url;
// eliminate the parameters, if the user wants so
if(pos != -1)
{
// all parameters
if(!manager.params_in_url)
return url.substr(0, pos);
// only some parameters
url = url.replace(manager.niceURLre, '\\1');
}
// eliminate the #fragment identifier
pos = url.lastIndexOf("#");
if(pos != -1)
return url.substr(0, pos);
return url;
}
// function to create a cookie
manager.createCookie = function (name, value, days)
{
if (days)
{
var date = new Date();
date.setTime(date.getTime()+days*24*60*60*1000);
var expires = "; expires="+date.toGMTString();
} else var expires = "";
document.cookie = name+"="+escape(value)+expires+"; path=/";
}
// function that adds a string to a node
// if html = true, then the string is treated as XHTML code
// parsing of the string is done with DOM 3 Load and Save and it doesn't make use of .innerHTML
manager.stringToNode = function (str, toNode, html)
{
if (html)
{
// differences between strict mode and quirks mode
if(document.compatMode == 'CSS1Compat')
str = str.replace(/\n/g, "
");
// I use error handling because if the string is not valid XHTML the DOM 3 LS parser will throw an exception
try
{
manager.DOM3LS_input.stringData = '
'+str+'
';
var doc = manager.DOM3LS_parser.parse(manager.DOM3LS_input);
doc = doc.documentElement;
var nodes = doc.childNodes.length;
for(var i=0; i/g, "\n");
}
}
// just insert the string AS IS
var linesArray = str.split("\n");
var lines = linesArray.length;
for(var i=0; i 0 && e.clientX >= min_x && e.clientX <= max_x)
return;
}
if(e && e.clientY)
{
var scroll_h = obj.content.offsetHeight-obj.content.clientHeight-1;
var max_y = obj.y+obj.content.offsetHeight+manager.ttlHeight-window.pageYOffset;
var min_y = max_y-scroll_h;
if(scroll_h > 0 && e.clientY >= min_y && e.clientY <= max_y)
return;
}
obj.editMode = true;
if(manager.click_to_save)
document.documentElement.addEventListener('click', obj.stopEdit, false);
if(obj.textarea.value == manager.messages[0] || manager.trim(obj.textarea.value) == '')
obj.textarea.value = '';
// bring to top
obj.node.style.zIndex = ++manager.z;
// visual stuff
obj.editGroup.style.display = 'block !important';
obj.content.style.display = 'none !important';
obj.titleBar.style.display = 'none !important';
obj.textarea.focus();
e.preventDefault();
}
// the function that stops editing and saves
obj.stopEdit = function(e)
{
if(!obj.editMode)
return false;
// don't stop editing if the clicked target is a sticky
// except for the case when the target is the Save button of this specific sticky
if(e && e.target && e.target.id != obj.saveLink.id && manager.isTargetSticky(e.target))
return false;
if(e)
e.preventDefault();
if(manager.click_to_save)
document.documentElement.removeEventListener('click', obj.stopEdit, false);
// content cleanup
obj.textarea.value = manager.trim(obj.textarea.value);
if(obj.textarea.value == '')
obj.textarea.value = manager.messages[0];
obj.textarea.value.replace("\r", '');
// title cleanup
obj.titleInput.value = manager.trim(obj.titleInput.value);
if(obj.titleInput.value == '')
obj.titleInput.value = obj.date.toUTCString();
// visual stuff
obj.editGroup.style.display = 'none !important';
obj.content.style.display = 'block !important';
obj.titleBar.style.display = 'block !important';
// update the sticky content and title
obj.titleBar.removeChild(obj.titleBar.firstChild);
obj.titleBar.appendChild(document.createTextNode(obj.titleInput.value));
while(obj.content.hasChildNodes())
obj.content.removeChild(obj.content.childNodes.item(0));
manager.stringToNode(obj.textarea.value, obj.content, obj.xhtmlInput.checked);
obj.editMode = false;
obj.save();
return true;
}
// the function that saves the sticky in a cookie
obj.save = function()
{
if(obj.deleted)
return false;
manager.createCookie(
'ujs_sticky_' + obj.time,
'[' +
obj.x + "\n" +
obj.y + "\n" +
obj.width + "\n" +
obj.height + "\n" +
escape(obj.url) + "\n"+
(obj.domainInput.checked ? "1" : "0") + "\n" +
escape(obj.titleInput.value) + "\n" +
(obj.xhtmlInput.checked ? "1" : "0") + "\n" +
obj.minimized + "\n" +
obj.fixedpos +
']' +
obj.textarea.value,
3650
);
}
// the function that starts the drag
obj.startDrag = function(e)
{
obj._mx = e.clientX;
obj._my = e.clientY;
obj._px = window.pageXOffset;
obj._py = window.pageYOffset;
// bring to top
obj.node.style.zIndex = ++manager.z;
document.addEventListener('mousemove', obj.trackDrag, false);
document.addEventListener('mouseup', obj.stopDrag, false);
e.preventDefault();
obj.redraw();
}
// keep tracking while dragging
obj.trackDrag = function(e)
{
// update position
obj.x += e.clientX - obj._mx;
obj.y += e.clientY - obj._my;
// store the new position for comparision after redraw (in case it's out of bounds)
if(!manager.turbo_mode)
var ox = obj.x, oy = obj.y;
obj.redraw(1);
// if not in turbo mode, make some checks, to try to keep the mouse in sync with the sticky
if(!manager.turbo_mode)
{
// if the position calculated by this function has been accepted, then update mouse position
if(obj.x == ox)
obj._mx = e.clientX;
if(obj.y == oy)
obj._my = e.clientY;
// page scrolling
var px = window.pageXOffset, py = window.pageYOffset;
// in case of scrolling
if(px != obj._px)
{
if(px < obj._px)
obj._mx -= px-obj._px;
else
obj._mx += obj._px-px;
obj._px = px;
}
if(py != obj._py)
{
if(py < obj._py)
obj._my -= py-obj._py;
else
obj._my += obj._py-py;
obj._py = py;
}
} else
{
obj._mx = e.clientX;
obj._my = e.clientY;
}
}
obj.stopDrag = function(e)
{
document.removeEventListener('mousemove', obj.trackDrag, false);
document.removeEventListener('mouseup', obj.stopDrag, false);
obj.redraw();
obj.save();
}
obj.startResize = function(e)
{
// stop editing, if needed
obj.stopEdit();
obj._mx = e.clientX;
obj._my = e.clientY;
obj._px = window.pageXOffset;
obj._py = window.pageYOffset;
// bring to top
obj.node.style.zIndex = ++manager.z;
document.addEventListener('mousemove', obj.trackResize, false);
document.addEventListener('mouseup', obj.stopResize, false);
e.preventDefault();
obj.redraw();
}
obj.trackResize = function(e)
{
obj.width += e.clientX - obj._mx;
obj.height += e.clientY - obj._my;
// store the new size for comparision after redraw (in case it's out of bounds)
if(!manager.turbo_mode)
var ow = obj.width, oh = obj.height;
obj.redraw(2);
// if not in turbo mode, make some checks, to try to keep the mouse in sync with the sticky
if(!manager.turbo_mode)
{
// if the size calculated by this function has been accepted, then update mouse position
if(obj.width == ow)
obj._mx = e.clientX;
if(obj.height == oh)
obj._my = e.clientY;
// page scrolling
var px = window.pageXOffset, py = window.pageYOffset;
// in case of scrolling
if(px != obj._px)
{
if(px < obj._px)
obj._mx -= px-obj._px;
else
obj._mx += obj._px-px;
obj._px = px;
}
if(py != obj._py)
{
if(py < obj._py)
obj._my -= py-obj._py;
else
obj._my += obj._py-py;
obj._py = py;
}
} else
{
obj._mx = e.clientX;
obj._my = e.clientY;
}
}
obj.stopResize = function(e)
{
document.removeEventListener('mousemove', obj.trackResize, false);
document.removeEventListener('mouseup', obj.stopResize, false);
obj.redraw();
obj.save();
}
// Redraw the sticky
// The function makes sure the sticky won't be too small, too big or out of the view
obj.redraw = function(fast)
{
// update the sticky node without any checks while dragging and resizing
// only if allowed by user
if(fast && manager.turbo_mode)
{
if(fast == 1)
{
obj.node.style.left = obj.x + 'px !important';
obj.node.style.top = obj.y + 'px !important';
} else
{
obj.content.style.width = obj.width + 'px !important';
obj.content.style.height = obj.height + 'px !important';
}
return true;
}
// if no need to be fast, then update max_x and max_y
if(!fast)
{
// i need to know the full width and height of the entire page
// due to a bug in Opera, scroll/offset Width is not reporting the full width
if(document.compatMode == 'CSS1Compat')
{
manager.max_x = document.body.offsetWidth;
manager.max_y = document.body.offsetHeight;
} else
{
manager.max_x = document.documentElement.scrollWidth;
manager.max_y = document.documentElement.scrollHeight;
}
// the page might be smaller than the full window
if(manager.max_x < window.innerWidth || obj.fixedpos == 1)
manager.max_x = window.innerWidth;
if(manager.max_y < window.innerHeight || obj.fixedpos == 1)
manager.max_y = window.innerHeight;
// substract scroll bars and the width/height of the resize handler
manager.max_x -= window.innerWidth-document.body.clientWidth+manager.resizer_w+manager.sub_x+manager.contentPadding*2;
manager.max_y -= window.innerHeight-document.body.clientHeight+manager.resizer_h+manager.sub_y+manager.contentPadding*2;
}
// check width
if(obj.width < manager.min_width)
obj.width = manager.min_width;
if(obj.width > manager.max_width)
obj.width = manager.max_width;
// check height
if(obj.height < manager.min_height)
obj.height = manager.min_height;
if(obj.height > manager.max_height)
obj.height = manager.max_height;
// check positioning
if(obj.x < manager.min_x)
obj.x = manager.min_x;
if(obj.y < manager.min_y)
obj.y = manager.min_y;
// check if it won't be outside the view
var sumx = obj.x+obj.width;
if(sumx > manager.max_x)
{
// making the sticky smaller
if(obj.width > manager.min_width)
{
obj.width -= sumx-manager.max_x;
if(obj.width < manager.min_width)
obj.width = manager.min_width;
}
// if it's not enough, move the sticky
sumx = obj.x+obj.width;
if(sumx > manager.max_x)
obj.x -= sumx-manager.max_x;
}
// like above, but for Y :)
var sumy = obj.y+obj.height+manager.ttlHeight;
if(sumy > manager.max_y)
{
if(obj.height > manager.min_height)
{
obj.height -= sumy-manager.max_y;
if(obj.height < manager.min_height)
obj.height = manager.min_height;
}
sumy = obj.y+obj.height+manager.ttlHeight;
if(sumy > manager.max_y)
obj.y -= sumy-manager.max_y;
}
// finally update the sticky node
if(fast != 1 || obj.minimized != 1)
{
// update obj.content only if *not* redrawing while dragging *and* the sticky is minimized
// because it's useless and would only slow down the dragging
obj.content.style.width = obj.width + 'px !important';
obj.content.style.height = obj.height + 'px !important';
}
// if minimized, we gotta set the width of the node
if(obj.minimized == 1)
{
if(document.compatMode == 'CSS1Compat' || (opera && opera.version() >= 9))
obj.node.style.width = (obj.width+manager.contentPadding*2) + 'px !important';
else
obj.node.style.width = obj.width + 'px !important';
}
// update .x and .y position of the sticky only while *not* resizing
if(fast != 2)
{
obj.node.style.left = obj.x + 'px !important';
obj.node.style.top = obj.y + 'px !important';
}
// update the textarea size only if in 'slow mode'
if(!fast)
{
obj.textarea.style.width = obj.width + 'px !important';
obj.textarea.style.height = obj.height + 'px !important';
}
}
obj.remove = function(e)
{
obj.stopEdit();
// bring to top
obj.node.style.zIndex = ++manager.z;
// ask for confirmation, if the user wants so, or directly remove it if the sticky has no content
if(obj.textarea.value != manager.messages[0] && manager.trim(obj.textarea.value) != '' && manager.remove_confirm && !confirm(manager.messages[1]))
return false;
// remove the sticky from the document
document.body.removeChild(obj.node);
// tell this sticky it has been deleted :), sometimes the sticky can kick back due to other event listeners that do save()
obj.deleted = true;
// remove the sticky cookie
manager.createCookie('ujs_sticky_' + obj.time, "", -1);
// delete the sticky object
delete manager.bag[obj.bag_id];
}
// the function that switches from/to minimize
obj.switchMinimize = function ()
{
obj.stopEdit();
if(obj.minimized == 1)
{
obj.minimized = 0;
obj.content.style.display = 'block !important';
obj.resize.style.display = 'block !important';
obj.node.style.width = 'auto !important';
} else
{
obj.minimized = 1;
obj.content.style.display = 'none !important';
obj.resize.style.display = 'none !important';
}
// bring to top
obj.node.style.zIndex = ++manager.z;
// update the tool tip of the sticky title (in view mode, not editing mode)
if(manager.minimize_2click)
obj.titleBar.title = manager.messages[3] + " " + manager.messages[(26+obj.minimized)];
// update the link
obj.minimizeLink.removeChild(obj.minimizeLink.firstChild);
obj.minimizeLink.appendChild(document.createTextNode(manager.messages[(16+obj.minimized*2)]));
obj.minimizeLink.title = manager.messages[(17+obj.minimized*2)];
obj.redraw();
obj.save();
}
// the function that switches from/to absolute or fixed positioning
obj.changePosition = function ()
{
// this is not allowed in Opera 8, due to many bugs
if(opera && opera.version() < 9)
{
alert(manager.messages[25]);
return false;
}
obj.stopEdit();
if(obj.fixedpos == 1)
{
obj.fixedpos = 0;
obj.node.style.position = 'absolute !important';
obj.x += window.pageXOffset;
obj.y += window.pageYOffset;
} else
{
obj.fixedpos = 1;
obj.node.style.position = 'fixed !important';
obj.x -= window.pageXOffset;
obj.y -= window.pageYOffset;
}
// bring to top
obj.node.style.zIndex = ++manager.z;
// update the link
obj.positionLink.removeChild(obj.positionLink.firstChild);
obj.positionLink.appendChild(document.createTextNode(manager.messages[(20+obj.fixedpos*2)]));
obj.positionLink.title = manager.messages[(21+obj.fixedpos*2)];
obj.redraw();
obj.save();
}
// add all the required event listeners
obj.minimizeLink.addEventListener('click', obj.switchMinimize, false);
obj.positionLink.addEventListener('click', obj.changePosition, false);
obj.removeLink.addEventListener('click', obj.remove, false);
obj.titleBar.addEventListener('mousedown', obj.startDrag, false);
if(manager.minimize_2click)
obj.titleBar.addEventListener('dblclick', obj.switchMinimize, false);
if(manager.edit_1click)
obj.content.addEventListener('click', obj.startEdit, false);
else
obj.content.addEventListener('dblclick', obj.startEdit, false);
obj.saveLink.addEventListener('click', obj.stopEdit, false);
if(manager.allow_xhtml == 3)
obj.xhtmlInput.addEventListener('change', obj.save, false);
obj.domainInput.addEventListener('change', obj.save, false);
obj.textarea.addEventListener('blur', obj.save, false);
obj.resize.addEventListener('mousedown', obj.startResize, false);
obj.redraw();
// bring to top
obj.node.style.zIndex = ++manager.z;
return obj;
}
manager.url = manager.niceURL(document.URL);
manager.css = ".ujs_sticky " +
"{ " +
" display:block !important; " +
" color:" + manager.textColor + " !important; " +
" position:absolute !important; " +
" font-weight:normal !important; " +
" border:1px solid " + manager.borderColor + " !important; " +
" background:" + manager.bgrColor;
if(manager.bgrImage)
{
manager.css +=
" url('data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%01%2C%00%00"
+ "%01%2C%08%06%00%00%00y%7D%8Eu%00%00%00%04gAMA%00%00%C4v%9D%D5%A6%0E%00%0"
+ "0%00%20cHRM%00%00o%40%00%00r%87%00%00%F6%18%00%00%84%CE%00%00y%16%00%00%"
+ "E8m%00%00%3C%8B%00%00%1BW%BE%03s%EB%00%00%00%09pHYs%00%00.%23%00%00.%23%"
+ "01x%A5%3Fv%00%00%09%01IDATx%DA%ED%DD%CB%AE%DB0%0CEQ7%A3%B6%FF%FF%BDI%A7E"
+ "P%A0%81%23J%7C%AC%03%EC%E1%BD%B1%E5%E8%84%A4(%F9%F1z%BD~%22%8C_%03%F9%FD"
+ "%C6%C41%F0%DD%0F%E2q%5D%D7%0F%8C%E2%11%CC%E9%CFCc%1E%17%11Q%11%F9%85%9A%"
+ "17%3D%B9g%94%8E%B0%0CD%9F%89j%5C%8C%95%94%90%88HJ%E8W%5C%84%E0yA%84ED%22"
+ "%2C%00Pt%C7%7FR%8A%8E%FDZ%19W%F6%A4qRB%22%22)!b%23%27%D7%09)!%B6%AF(Mk%1"
+ "C%D5%BF%25%25%24%22%92%12BD%60%0C%20%2541a%AC%18%16%E6N%1C%C7%C40%3F5%2C"
+ "%22%225%2C%91Y%B5%23Zv_%83HIJ%08%E6%E7%DA!%25%24%22%F2%0BU%24%92%D08j%AC"
+ "%20%25%94%9A%C0w%86a%E1%D4%2Fv%86I%91%ED%F3%1F%03%EE%99a%C1%CA%E1u%F65_%"
+ "A2%1B0%2C%A9B%99%09m%5C%60%95%90%88%AC%12BD%E7%DA!%25%C4%D7%13U%5B%03%F3"
+ "cX%00%C0%B0%B0%9Awu%BA%97%EB%C3%FB%A3F5%2C%EA%A3U%93%FE%EE%FF%3EaF%10a%E1p-"
+ "j%E2%2B%AF%AA%DC%B3%DA%17%C3%C2%E1%15%B3%EE%7DXL%86a%81%D1%B9v0%2C%00%60"
+ "XC%7F%FD%2B%EC7%EC%B6%F1X%24hk%0E%11ik%E0%DA%15~%8D%BB%9D%B1%9E%F5%0Cy%9"
+ "1%92%94%10%05R%91N%AB%84L%86a%01%00%C3%82%82%B0b6%14%DD%89H%D1%1Dg%8E%3E"
+ "%D1F%91%7BK%94%A8OJ%88d%06%12%7D%A6%7B%27%83%04%C3B%F3H%89%F1%80a%0Dk%3B"
+ "%D0%D60s%AC%18%16%000%2Ch%0D%D0%D6%00%86%C5%40%92%5C%7B%86m7%9E%0D%C3B%1"
+ "0%FFR%E5k%FFD%91c%F5%E9%E7Q%D1%3E%2C%3A%AB%BB%93i%E5%84%CEh%9A%95%8D%1C%"
+ "22%2C%00%0C%CB%20%E8%81%EA%7F%A6%BB%5E0%86%05Ebc%00%86%85%D8I%B8%FB%20%B"
+ "EJ%D7%EE%BB%C6%B0%C04%99%05%18%16%CE%9F%181%F1%3A%E1%3C%2C%22%A2%CF%FA%B"
+ "08%B7%14%CDXAJ%882%DBT%B45%F4%7B%A6%0C%0B~%FD%87%D5%94%98%11%C3b%3C%1B%0"
+ "B%D0%2B%DF%B5%97%E1%C4%D1%E8w%09Z%05eX%00%C0%B0Do%DA%1A%A2%A3Q0%2C%A8%D5"
+ "0%140%2C%26cL%8C%15%C3%02%D2%EC%25%04%C3%22%22%D2%E9%8E%9C%A9O%86%D7%5Be"
+ "mk%80%94%10%1A%40mb%C6%3A%C3%02V6%80F~%5Et%5BC%95%B3%BC%D4%B0%E8%98%3EyP"
+ "%2B%FF%FF%89kX5%0E%2B%D9%7D%0D%19%EEYJ(%5D%DA%F2kYy%23%B0%0D%DF%22%2C%86"
+ "%C5%E8%B6%17%CF%5D%3B%E3aX%00%C0%B0Dp%A7N%8C8%FDy%22%20%86%05K%F5%F0%9C%"
+ "19%16rL%A6%8C%91Yt%5B%03%B45%10%11%C5%C9%2F%12%B2n%05%02%A4%84%18%D9%D6%"
+ "00%86%85%E6%0D%99%9D%F6%12%3A%06%87a%A1Q3%A9%F14%9E%0C%0B%B6%1A1%0B0%2CH"
+ "%B5%B450%2C%40%AA%05%86eBg%9A%A8%95%CD%A2%CA%F81d%86%85F%A9%A4%D4%0E%3A%"
+ "DD%89H%A7%3B%EA%F4e%19%2B%E3%27%25%84.%F6%03%AB%84%BA%E1%C1%B0%06%D6%8F2"
+ "%AE%ECe%3D%B7%8B%D11%2C%00Pt%27%22Ew%14%A9%3Bu%3B%18o%F7A%83%EAaRB%A8%89"
+ "x%CE%C6%83a%C1%E4%05%18%96T2%BC%85%C0%BB%04%C1%B0%98%D3%ED%BE%A8%EEm%0D%"
+ "DF%8C%95%EF%9AUB%22%22%AB%84%00%A4%84h%DER%A0%AD%A1Vk%05%A4%84D%24%25%04"
+ "%00)!%92%B6Hd%3C%AD%01%0C%0B%D0%17%055%2C%22%225%AC%A1%11%8F%C8%C5%B8H%0"
+ "9Q%FAD%80%BB%FF%BB%CAK(2%B4%80%80aA%FD%C88%40%0D%8B%88%D4%B0%00%C7%CB%40"
+ "J%88Z%7DX%19%8F%97%81%94%90%88HJ%88%9C%91%C5%84%82%B7%88NJ%08%00RB%22%92"
+ "%12ba%9As%BA%F9%F2%9Bk%A8%DA8Z%7D%DC!%25%D4%F8%B8%B1~%94%B1%F3%5C%C3%A9%"
+ "94%90%88HJ%88%5E%11%A3%88%04%22%2C%22%12a%C1%89%0E%3B%22%A5%0C%91%99%C8O"
+ "%D1%1D%26%8Eg%03)!%11%91_%0C%94%EF%C3%82%08%8B%88H%84%05%1D%D7%EE%19%22%"
+ "2C%22%12a%A1_%FD(%BA%3D!2%E2%A9%BC%AD%08%22%2C%22%12a%A1B%7FN%F7%0D%BD%D"
+ "D%EEOmM%E3(%18%08%A4%84DDRB%00%10a%11%D1%90%08%8B%88HJ%88%D2%2BL%D3%3E%C"
+ "F%5C%90%12%12%11I%09%89HJ%88%01%E9%A4%CF%83%94%90%88HJHD%F4%97a%BD%D0%9A"
+ "%E7%1B%3E%0Fe%11a%11%91%94%90%88HJ(%AD%93%DA%D5%1DSH%09%89HJHD%24%25%04%"
+ "00)!%11%89%B0%80%E5Ej%05o%DC%8E%B0%0CD%CD%09%D7%DD%40%BA%DD%1F%93%96%12%"
+ "12%91%94%10%9D%B7%D3DG.%9F%905J%11%01%89%B0%88%88DX%B8%17%F1%B8g%88%B0%8"
+ "8%88DXp%2C%0D%20%C2%22%22%11%16%F4%E7x6%D08j%E2%5Cg%5B%1Dv%B7%27d%B8gH%0"
+ "9%89%88%A4%84%C8%19%F9%89d%20%C2%22%22%11%16%FAo%E8%AD%BC%BD%25%C3%3D%8B"
+ "%18EXDD%22%ACi%5BDV%5EC%95%C6%D1n%E3%0Em%0D%00%18%16%26mS%99P%07%12%15%A"
+ "9a%11%11%A9a%A1%C6%EA%5B%D6%D5L%88%B0%88%88DXP%7F%03%14%DD%9B%A7l%DDR-"
+ "%E3%C0%B0%0CB%A3I%18%D9%DFT%A5%0F%CB%89%0E%0C%0BE%8C%CE%043.%8A%EEDD%8A%"
+ "EEPG%13%F1%40J%88M%06%12%F9%22U%A6%06)!%11I%09%01%40J84%F5%CA%B0T%9F%B1%"
+ "AD!C%0B%88T%95a%01%80%1A%16%11%A9a%A1H*%99%B5%15!%FA%7FI%ED%A4%84h%D2%8A"
+ "0%F1x%19%E6%C4%B0%00%A75%80a%99%BC%F0%9C%C1%B0%06%A4v%DA%1A%9C%D6%60%95%"
+ "90%88%C8*!%00H%09%D5D%02%FEW%95%B6%06%B5(%86%85%E6%F5%B0N%A75%A8%3B1%2C%"
+ "244%22%13%D3%F8)%BA%13%11)%BACo%91%FA%11%A4%84%A5%EAG%19%D2%10%AF%F9%9A%"
+ "F1%9C%19%16%18%F2eo%1F%18%16%8A%A6Z%91%AB%84RI0%2C%94%89xDa%60XR-"
+ "%E3i%3C%19%16%A4ZRW0%2C%94%EF%86%D7%C5%0E%86%05%AD%1C%D0%E9ND%A4%D3%1D%A"
+ "9%DB%1A2%9E%9E%90%F5%A0AH%09%F5%40%C1s%06%C3RS%9A%B7J%A8f%C6%B0%00%80a%8"
+ "9%80%EA%B4%06%B8v%11%9CUB%22%22%AB%84%BD%F6%B9e%FDU%AF%DCA%EE%19J%09%114"
+ "%E9%2B%B55%EC%9E%E0%91c%C5d%18%16%000%2C%D8%FC%0C%86%85f%B5%B5%EE%AB%84%"
+ "D28%86%058%B6%05%0C%0BV%9D%8C%15%18%16%CAOh%26%03%865%D0Pv%FF%DD%EE%A2%F"
+ "B%AA%BFc%88%3A%DD%89%88t%BA%03%90%12%22I%CD%252%CDY%D9Rp%F7%F3%B2%B65%D8"
+ "%20%CD%B00%EC%CB%DD%F9%5E%18%0F%C3%B2O%D0%C4l%B7%E1%DBw%9Fa%C1%AF%BF%B1b"
+ "X%06%C1%9E%C0%99m%0D%60X%10%A5%88x%C0%B0%98EN%B3%D8%BD%97%90i2%2C%83%C0%"
+ "D8%8C%01t%BA%13%11%E9tW(%D7%D6%A0%87LJ%08%00%0C%0BG%23%90%95%DB%7Cv%16%E"
+ "BWFE%EAZ%0C%0B%8A%C4%EDO%1Cet%0C%0B%26!%03%01%C3%02%C0%B0%90%20B%B8%5B%A"
+ "Fz%16%8E%5C%8C%15%18%16%DA%ED%25%04%C3%02%E3%B9%5D%60_%F5w%8C%0E%0C%AB%8"
+ "8YT%5E%AA%AF%7C%DE%97%13%23l%CD!%22Z%23%11%96%A8O%5B%03%A4%84%00%C0%B0p%"
+ "B2%15%C0%BD%80a1%99%D0WWe%D8%EF%B7%F3%7FW%1Fw(%BA%13%91%A2%3B%A6%B7%19d%"
+ "D8%FC%EC%B5iRB%00%60X%F0%EB%2Fr%01%C3b%3C%ED%DE%20%E3%0D9%60XE%26a%86%C9"
+ "5q%F3%B3%D3K%AD%12%12%11Y%25%C4%DE_%FFg0%EA%5C%90%12%02%60X%A8%139u%8F6V"
+ "%BE%15%C8w%8DaAk%80k%87%A2%3B%11)%BAc%60%D4%E0U%F5%22%3A)!JO%A6U%AB%7D%1"
+ "9%F7%1B2%1E%86%85%04%05%EF%8CQ%C9%84%A8%88%192%2Ci%1C%7Cg%C0%B0%A6Ef%DA%"
+ "1A%8C%95UB%22%22%AB%84%90%9AH%AB%20%25d2_%AE%08%9E%B8G%2B%87%90%12%12%91"
+ "%94%10%F3%D2%B1%8C%A75x%86RB%988%C6%0A%0C%0B%26%A61%80%1A%16%11%A9a%A1%F"
+ "E%0A%A0%C6Q%D1%9A%08%8B%88H%84%85S%AB%7D%AE%13%8A%EE(%93%C6%3D%0F3u%DC%C"
+ "1%B0%00%A8a%11%11%A9aY%ED%B3Z%E5yA%84ED%22%2C4%8B%10%8C%15%14%DD%D1%EE%8"
+ "8%16%F7%0C)!%11%91%94%10%27%8E%89q%2C%0D%A4%84%B8M%B4v%7F%5E%06M%BC%E7c%"
+ "11%16%CD%FA%223m%A8a%11%11%A9aY%5E%87g%08%11%16%11%89%B0%E0%17%DB%B3%81%"
+ "08%8B%88DX%5C%DByX0%EE%FA%B0%10%9C%9Ah%B446RB%22%A2%CC)!%11%91%1A%16F%EE"
+ "%25%9Cp%F6%3B%A4%84DDRB%22%92%12%02%C0%5E%FE%00q%7F0%08%7D*%FA%FE%00%00%"
+ "00%00IEND%AEB%60%82')";
}
manager.css += " !important; " +
" margin:0 !important; " +
" padding:0 !important; " +
" width:auto !important; " +
" height:auto !important; " +
" font: " + manager.cssFont + " !important; " +
" text-align:left !important; " +
"} " +
".ujs_sticky_resize " +
"{ " +
" border:1px solid " + manager.borderColor + " !important; " +
" background:" + manager.resizerColor + " !important; " +
" display:block !important; " +
" position:absolute !important; " +
" right:-" + (manager.resizer_w+2) + "px !important; " +
" bottom:-" + (manager.resizer_h+2) + "px !important; " +
" width:" + manager.resizer_w + "px !important; " +
" height:" + manager.resizer_h + "px !important; " +
" cursor:se-resize !important; " +
"} " +
".ujs_sticky_titlebar " +
"{ " +
" font: " + manager.cssFont + " !important; " +
" color:" + manager.textColor + " !important; " +
" display:block !important; " +
" height:" + manager.ttlHeight + "px !important; " +
" width:100% !important; " +
" background:" + manager.ttlBgrColor + " !important; " +
" margin:0 !important; " +
" padding:0 !important; " +
" text-align:center !important; " +
" cursor:move !important; " +
"} " +
".ujs_sticky_titleinput " +
"{ " +
" font: " + manager.cssFont + " !important; " +
" color:" + manager.textColor + " !important; " +
" display:block !important; " +
" height:" + manager.ttlHeight + "px !important; " +
" width:100% !important; " +
" background:" + manager.ttlBgrColor + " !important; " +
" border:0 !important; " +
" padding:0 !important; " +
" margin:0 !important; " +
" text-align:center !important; " +
"} " +
".ujs_sticky_remove " +
"{ " +
" position:absolute !important; " +
" top:0 !important; " +
" left:4px !important; " +
" cursor:hand !important; " +
" text-decoration:none !important; " +
" color:" + manager.closeColor + " !important; " +
" background:transparent !important; " +
"} " +
".ujs_sticky_position " +
"{ " +
" position:absolute !important; " +
" top:0 !important; " +
" right:4px !important; " +
" cursor:hand !important; " +
" text-decoration:none !important; " +
" color:" + manager.textColor + " !important; " +
" background:transparent !important; " +
"} " +
".ujs_sticky_minimize " +
"{ " +
" position:absolute !important; " +
" top:0 !important; " +
" right:16px !important; " +
" cursor:hand !important; " +
" text-decoration:none !important; " +
" color:" + manager.textColor + " !important; " +
" background:transparent !important; " +
"} " +
".ujs_sticky_editgroup textarea " +
"{ " +
" font: " + manager.cssFont + " !important; " +
" padding:5px !important; " +
" margin:0 0 2px 0 !important; " +
" border:0 !important; " +
" color:" + manager.textColor + " !important; " +
" background:transparent !important; " +
" display:block !important; " +
" border:1px solid " + manager.borderColor + " !important; " +
" border-left:0 !important; " +
" border-right:0 !important; " +
" overflow:auto !important; " +
"} " +
".ujs_sticky_content " +
"{ " +
" display:block; " +
" font: " + manager.cssFont + " !important; " +
" color:" + manager.textColor + " !important; " +
" padding:" + manager.contentPadding + "px !important; " +
" border:0 !important; " +
" margin:0 !important; " +
" background:transparent !important; " +
" border-top:1px solid " + manager.borderColor + " !important; " +
" overflow:auto !important; " +
"} " +
".ujs_sticky_content a" +
"{ " +
" color:" + manager.textColor + " !important; " +
" background:transparent !important; " +
" font-weight:normal !important; " +
" text-decoration:underline !important; " +
"} " +
".ujs_sticky_editgroup " +
"{ " +
" color:" + manager.textColor + " !important; " +
" font: " + manager.cssFont + " !important; " +
"} " +
".ujs_sticky_editgroup label, .ujs_sticky_editgroup input[type=checkbox] " +
"{ " +
" cursor:hand !important; " +
"} " +
".ujs_sticky_save " +
"{ " +
" position:absolute !important; " +
" cursor:hand !important; " +
" background:transparent !important; " +
" color:" + manager.textColor + " !important; " +
" right:5px !important; " +
" text-decoration:none !important; " +
"} ";
// initialize the stickies
manager.init();
})();}, false);