Removing unused thirdparty dependency - greybox.
378
thirdparty/greybox/AmiJS.js
vendored
@ -1,378 +0,0 @@
|
||||
//AJS JavaScript library (minify'ed version)
|
||||
//Copyright (c) 2006 Amir Salihefendic. All rights reserved.
|
||||
//Copyright (c) 2005 Bob Ippolito. All rights reserved.
|
||||
//License: http://www.opensource.org/licenses/mit-license.php
|
||||
//Visit http://orangoo.com/AmiNation/AJS for full version.
|
||||
AJS = {
|
||||
BASE_URL: "",
|
||||
drag_obj: null,
|
||||
drag_elm: null,
|
||||
_drop_zones: [],
|
||||
_cur_pos: null,
|
||||
|
||||
_unloadListeners: function() {
|
||||
if(AJS.listeners)
|
||||
AJS.map(AJS.listeners, function(elm, type, fn) {AJS.removeEventListener(elm, type, fn)});
|
||||
AJS.listeners = [];
|
||||
},
|
||||
getElement: function(id) {
|
||||
if(AJS.isString(id) || AJS.isNumber(id))
|
||||
return document.getElementById(id);
|
||||
else
|
||||
return id;
|
||||
},
|
||||
getScrollTop: function() {
|
||||
//From: http://www.quirksmode.org/js/doctypes.html
|
||||
var t;
|
||||
if (document.documentElement && document.documentElement.scrollTop)
|
||||
t = document.documentElement.scrollTop;
|
||||
else if (document.body)
|
||||
t = document.body.scrollTop;
|
||||
return t;
|
||||
},
|
||||
isArray: function(obj) {
|
||||
return obj instanceof Array;
|
||||
},
|
||||
removeElement: function(/*elm1, elm2...*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
AJS.map(args, function(elm) { AJS.swapDOM(elm, null); });
|
||||
},
|
||||
isDict: function(o) {
|
||||
var str_repr = String(o);
|
||||
return str_repr.indexOf(" Object") != -1;
|
||||
},
|
||||
isString: function(obj) {
|
||||
return (typeof obj == 'string');
|
||||
},
|
||||
getIndex: function(elm, list/*optional*/, eval_fn) {
|
||||
for(var i=0; i < list.length; i++)
|
||||
if(eval_fn && eval_fn(list[i]) || elm == list[i])
|
||||
return i;
|
||||
return -1;
|
||||
},
|
||||
createDOM: function(name, attrs) {
|
||||
var i=0, attr;
|
||||
elm = document.createElement(name);
|
||||
if(AJS.isDict(attrs[i])) {
|
||||
for(k in attrs[0]) {
|
||||
attr = attrs[0][k];
|
||||
if(k == "style")
|
||||
elm.style.cssText = attr;
|
||||
else if(k == "class" || k == 'className')
|
||||
elm.className = attr;
|
||||
else {
|
||||
elm.setAttribute(k, attr);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(attrs[0] == null)
|
||||
i = 1;
|
||||
AJS.map(attrs, function(n) {
|
||||
if(n) {
|
||||
if(AJS.isString(n) || AJS.isNumber(n))
|
||||
n = AJS.TN(n);
|
||||
elm.appendChild(n);
|
||||
}
|
||||
}, i);
|
||||
return elm;
|
||||
},
|
||||
isIe: function() {
|
||||
return (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1);
|
||||
},
|
||||
addEventListener: function(elm, type, fn, /*optional*/listen_once, cancle_bubble) {
|
||||
if(!cancle_bubble)
|
||||
cancle_bubble = false;
|
||||
var elms = AJS.$A(elm);
|
||||
AJS.map(elms, function(elmz) {
|
||||
if(listen_once)
|
||||
fn = AJS._listenOnce(elmz, type, fn);
|
||||
if(AJS.isIn(type, ['submit', 'load', 'scroll', 'resize'])) {
|
||||
var old = elm['on' + type];
|
||||
elm['on' + type] = function() {
|
||||
if(old) {
|
||||
fn(arguments);
|
||||
return old(arguments);
|
||||
}
|
||||
else
|
||||
return fn(arguments);
|
||||
};
|
||||
return;
|
||||
}
|
||||
if (elmz.attachEvent) {
|
||||
//FIXME: We ignore cancle_bubble for IE... hmmz
|
||||
elmz.attachEvent("on" + type, fn);
|
||||
}
|
||||
else if(elmz.addEventListener)
|
||||
elmz.addEventListener(type, fn, cancle_bubble);
|
||||
AJS.listeners = AJS.$A(AJS.listeners);
|
||||
AJS.listeners.push([elmz, type, fn]);
|
||||
});
|
||||
},
|
||||
swapDOM: function(dest, src) {
|
||||
dest = AJS.getElement(dest);
|
||||
var parent = dest.parentNode;
|
||||
if (src) {
|
||||
src = AJS.getElement(src);
|
||||
parent.replaceChild(src, dest);
|
||||
} else {
|
||||
parent.removeChild(dest);
|
||||
}
|
||||
return src;
|
||||
},
|
||||
getLast: function(list) {
|
||||
if(list.length > 0)
|
||||
return list[list.length-1];
|
||||
else
|
||||
return null;
|
||||
},
|
||||
map: function(list, fn,/*optional*/ start_index, end_index) {
|
||||
var i = 0, l = list.length;
|
||||
if(start_index)
|
||||
i = start_index;
|
||||
if(end_index)
|
||||
l = end_index;
|
||||
for(i; i < l; i++)
|
||||
fn.apply(null, [list[i]]);
|
||||
},
|
||||
getElementsByTagAndClassName: function(tag_name, class_name, /*optional*/ parent) {
|
||||
var class_elements = [];
|
||||
if(!AJS.isDefined(parent))
|
||||
parent = document;
|
||||
if(!AJS.isDefined(tag_name))
|
||||
tag_name = '*';
|
||||
var els = parent.getElementsByTagName(tag_name);
|
||||
var els_len = els.length;
|
||||
var pattern = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
|
||||
for (i = 0, j = 0; i < els_len; i++) {
|
||||
if ( pattern.test(els[i].className) || class_name == null ) {
|
||||
class_elements[j] = els[i];
|
||||
j++;
|
||||
}
|
||||
}
|
||||
return class_elements;
|
||||
},
|
||||
isOpera: function() {
|
||||
return (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
|
||||
},
|
||||
setLeft: function(/*elm1, elm2..., left*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
var l = AJS.getLast(args);
|
||||
AJS.map(args, function(elm) { elm.style.left = AJS.getCssDim(l)}, 0, args.length-1);
|
||||
},
|
||||
getBody: function() {
|
||||
return AJS.$bytc('body')[0]
|
||||
},
|
||||
getWindowSize: function() {
|
||||
var win_w, win_h;
|
||||
if (self.innerHeight) {
|
||||
win_w = self.innerWidth;
|
||||
win_h = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientHeight) {
|
||||
win_w = document.documentElement.clientWidth;
|
||||
win_h = document.documentElement.clientHeight;
|
||||
} else if (document.body) {
|
||||
win_w = document.body.clientWidth;
|
||||
win_h = document.body.clientHeight;
|
||||
}
|
||||
return {'w': win_w, 'h': win_h};
|
||||
},
|
||||
showElement: function(/*elms...*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
AJS.map(args, function(elm) { elm.style.display = ''});
|
||||
},
|
||||
removeEventListener: function(elm, type, fn, /*optional*/cancle_bubble) {
|
||||
if(!cancle_bubble)
|
||||
cancle_bubble = false;
|
||||
if(elm.removeEventListener) {
|
||||
elm.removeEventListener(type, fn, cancle_bubble);
|
||||
if(AJS.isOpera())
|
||||
elm.removeEventListener(type, fn, !cancle_bubble);
|
||||
}
|
||||
else if(elm.detachEvent)
|
||||
elm.detachEvent("on" + type, fn);
|
||||
},
|
||||
_getRealScope: function(fn, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
|
||||
var scope = window;
|
||||
extra_args = AJS.$A(extra_args);
|
||||
if(fn._cscope)
|
||||
scope = fn._cscope;
|
||||
return function() {
|
||||
//Append all the orginal arguments + extra_args
|
||||
var args = [];
|
||||
var i = 0;
|
||||
if(dont_send_event)
|
||||
i = 1;
|
||||
AJS.map(arguments, function(arg) { args.push(arg) }, i);
|
||||
args = args.concat(extra_args);
|
||||
if(rev_extra_args)
|
||||
args = args.reverse();
|
||||
return fn.apply(scope, args);
|
||||
};
|
||||
},
|
||||
_createDomShortcuts: function() {
|
||||
var elms = [
|
||||
"ul", "li", "td", "tr", "th",
|
||||
"tbody", "table", "input", "span", "b",
|
||||
"a", "div", "img", "button", "h1",
|
||||
"h2", "h3", "br", "textarea", "form",
|
||||
"p", "select", "option", "iframe", "script",
|
||||
"center", "dl", "dt", "dd", "small",
|
||||
"pre"
|
||||
];
|
||||
var createDOM = AJS.createDOM;
|
||||
var extends_ajs = function(elm) {
|
||||
var c_dom = "return createDOM.apply(null, ['" + elm + "', arguments]);";
|
||||
var c_fun_dom = 'function() { ' + c_dom + ' }';
|
||||
eval("AJS." + elm.toUpperCase() + "=" + c_fun_dom);
|
||||
}
|
||||
AJS.map(elms, extends_ajs);
|
||||
AJS.TN = function(text) { return document.createTextNode(text) };
|
||||
},
|
||||
isNumber: function(obj) {
|
||||
return (typeof obj == 'number');
|
||||
},
|
||||
bind: function(fn, scope, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
|
||||
fn._cscope = scope;
|
||||
return AJS._getRealScope(fn, extra_args, dont_send_event, rev_extra_args);
|
||||
},
|
||||
setTop: function(/*elm1, elm2..., top*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
var t = AJS.getLast(args);
|
||||
AJS.map(args, function(elm) { elm.style.top = AJS.getCssDim(t)}, 0, args.length-1);
|
||||
},
|
||||
appendChildNodes: function(elm/*, elms...*/) {
|
||||
if(arguments.length >= 2) {
|
||||
AJS.map(arguments, function(n) {
|
||||
if(AJS.isString(n))
|
||||
n = AJS.TN(n);
|
||||
if(AJS.isDefined(n))
|
||||
elm.appendChild(n);
|
||||
}, 1);
|
||||
}
|
||||
return elm;
|
||||
},
|
||||
isDefined: function(o) {
|
||||
return (o != "undefined" && o != null)
|
||||
},
|
||||
isIn: function(elm, list) {
|
||||
var i = AJS.getIndex(elm, list);
|
||||
if(i != -1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
setHeight: function(/*elm1, elm2..., height*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
var h = AJS.getLast(args);
|
||||
AJS.map(args, function(elm) { elm.style.height = AJS.getCssDim(h)}, 0, args.length-1);
|
||||
},
|
||||
hideElement: function(elm) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
AJS.map(args, function(elm) { elm.style.display = 'none'});
|
||||
},
|
||||
createArray: function(v) {
|
||||
if(AJS.isArray(v) && !AJS.isString(v))
|
||||
return v;
|
||||
else if(!v)
|
||||
return [];
|
||||
else
|
||||
return [v];
|
||||
},
|
||||
setWidth: function(/*elm1, elm2..., width*/) {
|
||||
var args = AJS.flattenList(arguments);
|
||||
var w = AJS.getLast(args);
|
||||
AJS.map(args, function(elm) { elm.style.width = AJS.getCssDim(w)}, 0, args.length-1);
|
||||
},
|
||||
getCssDim: function(dim) {
|
||||
if(AJS.isString(dim))
|
||||
return dim;
|
||||
else
|
||||
return dim + "px";
|
||||
},
|
||||
_listenOnce: function(elm, type, fn) {
|
||||
var r_fn = function() {
|
||||
AJS.removeEventListener(elm, type, r_fn);
|
||||
fn(arguments);
|
||||
}
|
||||
return r_fn;
|
||||
},
|
||||
flattenList: function(list) {
|
||||
var r = [];
|
||||
var _flatten = function(r, l) {
|
||||
AJS.map(l, function(o) {
|
||||
if (AJS.isArray(o))
|
||||
_flatten(r, o);
|
||||
else
|
||||
r.push(o);
|
||||
});
|
||||
}
|
||||
_flatten(r, list);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
AJS.$ = AJS.getElement;
|
||||
AJS.$$ = AJS.getElements;
|
||||
AJS.$f = AJS.getFormElement;
|
||||
AJS.$b = AJS.bind;
|
||||
AJS.$A = AJS.createArray;
|
||||
AJS.DI = AJS.documentInsert;
|
||||
AJS.ACN = AJS.appendChildNodes;
|
||||
AJS.RCN = AJS.replaceChildNodes;
|
||||
AJS.AEV = AJS.addEventListener;
|
||||
AJS.REV = AJS.removeEventListener;
|
||||
AJS.$bytc = AJS.getElementsByTagAndClassName;
|
||||
|
||||
AJS.addEventListener(window, 'unload', AJS._unloadListeners);
|
||||
AJS._createDomShortcuts()
|
||||
|
||||
AJSDeferred = function(req) {
|
||||
this.callbacks = [];
|
||||
this.errbacks = [];
|
||||
this.req = req;
|
||||
};
|
||||
AJSDeferred.prototype = {
|
||||
excCallbackSeq: function(req, list) {
|
||||
var data = req.responseText;
|
||||
while (list.length > 0) {
|
||||
var fn = list.pop();
|
||||
var new_data = fn(data, req);
|
||||
if(new_data)
|
||||
data = new_data;
|
||||
}
|
||||
},
|
||||
callback: function () {
|
||||
this.excCallbackSeq(this.req, this.callbacks);
|
||||
},
|
||||
errback: function() {
|
||||
if(this.errbacks.length == 0)
|
||||
alert("Error encountered:\n" + this.req.responseText);
|
||||
this.excCallbackSeq(this.req, this.errbacks);
|
||||
},
|
||||
addErrback: function(fn) {
|
||||
this.errbacks.unshift(fn);
|
||||
},
|
||||
addCallback: function(fn) {
|
||||
this.callbacks.unshift(fn);
|
||||
},
|
||||
addCallbacks: function(fn1, fn2) {
|
||||
this.addCallback(fn1);
|
||||
this.addErrback(fn2);
|
||||
},
|
||||
sendReq: function(data) {
|
||||
if(AJS.isObject(data)) {
|
||||
var post_data = [];
|
||||
for(k in data) {
|
||||
post_data.push(k + "=" + AJS.urlencode(data[k]));
|
||||
}
|
||||
post_data = post_data.join("&");
|
||||
this.req.send(post_data);
|
||||
}
|
||||
else if(AJS.isDefined(data))
|
||||
this.req.send(data);
|
||||
else {
|
||||
this.req.send("");
|
||||
}
|
||||
}
|
||||
}
|
BIN
thirdparty/greybox/blank.gif
vendored
Before Width: | Height: | Size: 49 B |
8
thirdparty/greybox/blank.html
vendored
@ -1,8 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<title>Blank</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
BIN
thirdparty/greybox/close.gif
vendored
Before Width: | Height: | Size: 74 B |
125
thirdparty/greybox/greybox.css
vendored
@ -1,125 +0,0 @@
|
||||
/* Last-Modified: 28/06/06 00:08:22 */
|
||||
|
||||
/**
|
||||
* Current style
|
||||
*/
|
||||
.GB_t_frame {
|
||||
/*color: #444;*/
|
||||
color: #CCDEF3;
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
}
|
||||
|
||||
.GB_content {
|
||||
background-color: #fff;
|
||||
/*border: 3px solid #666;*/
|
||||
border: 3px solid #CCDEF3;
|
||||
}
|
||||
|
||||
.GB_loader {
|
||||
color: #616161;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.GB_header {
|
||||
border-bottom: 3px solid #CCDEF3;
|
||||
background: #ccdef3 url(../../admin/images/mainmenu/current.gif) repeat-x;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.GB_caption {
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base stuff
|
||||
*/
|
||||
#GB_overlay {
|
||||
position: absolute;
|
||||
margin: auto;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#GB_window {
|
||||
font-family: helvetica, verdana, sans-serif;
|
||||
left: 0;
|
||||
top: 0;
|
||||
font-size: 1px;
|
||||
position: absolute;
|
||||
overflow: visible;
|
||||
z-index: 150;
|
||||
}
|
||||
|
||||
#GB_frame {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Content
|
||||
*/
|
||||
.GB_t_frame {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.GB_content {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
margin-bottom: 25px;
|
||||
z-index: 155;
|
||||
}
|
||||
|
||||
.GB_loader {
|
||||
z-index: 500;
|
||||
left: 6px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Header
|
||||
*/
|
||||
.GB_caption {
|
||||
}
|
||||
|
||||
.GB_header {
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
padding: 2px 1px 2px 1px;
|
||||
margin: 0;
|
||||
/*border-bottom: 1px solid #aaa;*/
|
||||
}
|
||||
|
||||
.GB_close {
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
width: 10%;
|
||||
top: 0;
|
||||
z-index: 200;
|
||||
cursor: pointer;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.GB_close img {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
padding: 0;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
.GB_container {
|
||||
margin: 0;
|
||||
padding: 0 0 10px 0;
|
||||
}
|
455
thirdparty/greybox/greybox.js
vendored
@ -1,455 +0,0 @@
|
||||
/****
|
||||
Last Modified: 25/08/06 20:52:59
|
||||
|
||||
CAUTION: Modified Version to suit Silverstripe CMS (silverstripe.com).
|
||||
Original at http://orangoo.com/labs/uploads/GreyBox_v3_46.zip
|
||||
|
||||
GreyBox - Smart pop-up window
|
||||
Copyright Amir Salihefendic 2006
|
||||
AUTHOR
|
||||
4mir Salihefendic (http://amix.dk) - amix@amix.dk
|
||||
VERSION
|
||||
3.46
|
||||
LICENSE
|
||||
GPL (read more in GPL.txt)
|
||||
SITE
|
||||
http://orangoo.com/labs/GreyBox/
|
||||
****/
|
||||
var GB_CURRENT = null;
|
||||
var GB_ONLY_ONE = null;
|
||||
// modified 2006-01-06 by Silverstripe Ltd.
|
||||
try {
|
||||
var theBaseHref = document.getElementsByTagName("base")[0].href;
|
||||
var GB_IMG_DIR = theBaseHref + "framework/thirdparty/greybox/";
|
||||
} catch(err) {
|
||||
var GB_IMG_DIR = "framework/thirdparty/greybox/";
|
||||
}
|
||||
|
||||
function GreyBox() {
|
||||
//Use mutator functions (since the internal stuff may change in the future)
|
||||
this.type = "page";
|
||||
this.overlay_click_close = true;
|
||||
|
||||
if(GB_IMG_DIR)
|
||||
this.img_dir = GB_IMG_DIR;
|
||||
else
|
||||
this.img_dir = "greybox/";
|
||||
|
||||
this.overlay_color = "dark";
|
||||
|
||||
this.center_window = false;
|
||||
|
||||
this.g_window = null;
|
||||
this.g_container = null;
|
||||
this.iframe = null;
|
||||
this.overlay = null;
|
||||
this.timeout = null;
|
||||
|
||||
this.defaultSize();
|
||||
this.showCloseImage(true);
|
||||
|
||||
this.url = "";
|
||||
this.caption = "";
|
||||
|
||||
this.callback_fn = [];
|
||||
this.reload_on_close = false;
|
||||
}
|
||||
|
||||
////
|
||||
// Configuration functions (the functions you can call)
|
||||
//
|
||||
/**
|
||||
Set the width and height of the GreyBox window.
|
||||
Images and notifications are auto-set.
|
||||
**/
|
||||
GreyBox.prototype.setDimension = function(width, height) {
|
||||
this.height = height;
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
GreyBox.prototype.setFullScreen = function(bool) {
|
||||
this.full_screen = bool;
|
||||
}
|
||||
|
||||
/**
|
||||
Type can be: page, image
|
||||
**/
|
||||
GreyBox.prototype.setType = function(type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
If bool is true the window will be centered vertically also
|
||||
**/
|
||||
GreyBox.prototype.setCenterWindow = function(bool) {
|
||||
this.center_window = bool;
|
||||
}
|
||||
|
||||
/**
|
||||
Set the path where images can be found.
|
||||
Can be relative: greybox/
|
||||
Or absolute: http://yoursite.com/greybox/
|
||||
**/
|
||||
GreyBox.prototype.setImageDir = function(dir) {
|
||||
this.img_dir = dir;
|
||||
}
|
||||
|
||||
GreyBox.prototype.showCloseImage = function(bool) {
|
||||
this.show_close_img = bool;
|
||||
}
|
||||
|
||||
/**
|
||||
If bool is true the grey overlay click will close greybox.
|
||||
**/
|
||||
GreyBox.prototype.setOverlayCloseClick = function(bool) {
|
||||
this.overlay_click_close = bool;
|
||||
}
|
||||
|
||||
/**
|
||||
Overlay can either be "light" or "dark".
|
||||
**/
|
||||
GreyBox.prototype.setOverlayColor = function(color) {
|
||||
this.overlay_color = color;
|
||||
}
|
||||
|
||||
/**
|
||||
Set a function that will be called when GreyBox closes
|
||||
**/
|
||||
GreyBox.prototype.setCallback = function(fn) {
|
||||
if(fn)
|
||||
this.callback_fn.push(fn);
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
// Show hide functions
|
||||
//
|
||||
/**
|
||||
Show the GreyBox with a caption and an url
|
||||
**/
|
||||
GreyBox.prototype.show = function(caption, url) {
|
||||
GB_CURRENT = this;
|
||||
|
||||
this.url = url;
|
||||
this.caption = caption;
|
||||
|
||||
//Be sure that the old loader and dummy_holder are removed
|
||||
AJS.map(AJS.$bytc("div", "GB_dummy"), function(elm) { AJS.removeElement(elm) });
|
||||
AJS.map(AJS.$bytc("div", "GB_loader"), function(elm) { AJS.removeElement(elm) });
|
||||
|
||||
//If ie, hide select, in others hide flash
|
||||
if(AJS.isIe())
|
||||
AJS.map(AJS.$bytc("select"), function(elm) {elm.style.visibility = "hidden"});
|
||||
AJS.map(AJS.$bytc("object"), function(elm) {elm.style.visibility = "hidden"});
|
||||
|
||||
this.initOverlayIfNeeded();
|
||||
|
||||
this.setOverlayDimension();
|
||||
AJS.showElement(this.overlay);
|
||||
this.setFullScreenOption();
|
||||
|
||||
this.initIfNeeded();
|
||||
|
||||
AJS.hideElement(this.g_window);
|
||||
|
||||
AJS.ACN(this.g_container, this.iframe);
|
||||
|
||||
if(caption == "")
|
||||
caption = " ";
|
||||
this.div_caption.innerHTML = caption;
|
||||
|
||||
AJS.showElement(this.g_window)
|
||||
|
||||
this.setVerticalPosition();
|
||||
this.setWidthNHeight();
|
||||
this.setTopNLeft();
|
||||
|
||||
GB_CURRENT.startLoading();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
GreyBox.prototype.hide = function() {
|
||||
AJS.hideElement(this.g_window, this.overlay);
|
||||
|
||||
try{ AJS.removeElement(this.iframe); }
|
||||
catch(e) {}
|
||||
|
||||
this.iframe = null;
|
||||
|
||||
if(this.type == "image") {
|
||||
this.width = 200;
|
||||
this.height = 200;
|
||||
}
|
||||
|
||||
if(AJS.isIe())
|
||||
AJS.map(AJS.$bytc("select"), function(elm) {elm.style.visibility = "visible"});
|
||||
AJS.map(AJS.$bytc("object"), function(elm) {elm.style.visibility = "visible"});
|
||||
|
||||
var c_bs = GB_CURRENT.callback_fn;
|
||||
if(c_bs != []) {
|
||||
AJS.map(c_bs, function(fn) {
|
||||
fn();
|
||||
});
|
||||
}
|
||||
|
||||
GB_CURRENT = null;
|
||||
|
||||
if(this.reload_on_close)
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
/**
|
||||
If you only use one instance of GreyBox
|
||||
**/
|
||||
GB_initOneIfNeeded = function() {
|
||||
if(!GB_ONLY_ONE) {
|
||||
GB_ONLY_ONE = new GreyBox();
|
||||
}
|
||||
}
|
||||
|
||||
GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
|
||||
GB_initOneIfNeeded();
|
||||
GB_ONLY_ONE.defaultSize();
|
||||
GB_ONLY_ONE.setFullScreen(false);
|
||||
GB_ONLY_ONE.setType("page");
|
||||
GB_ONLY_ONE.setCallback(callback_fn);
|
||||
GB_ONLY_ONE.setDimension(width, height);
|
||||
GB_ONLY_ONE.show(caption, url);
|
||||
return false;
|
||||
}
|
||||
|
||||
GB_showFullScreen = function(caption, url, /* optional */ callback_fn) {
|
||||
GB_initOneIfNeeded();
|
||||
GB_ONLY_ONE.defaultSize();
|
||||
GB_ONLY_ONE.setType("page");
|
||||
|
||||
GB_ONLY_ONE.setCallback(callback_fn);
|
||||
GB_ONLY_ONE.setFullScreen(true);
|
||||
GB_ONLY_ONE.show(caption, url);
|
||||
return false;
|
||||
}
|
||||
|
||||
GB_showImage = function(caption, url) {
|
||||
GB_initOneIfNeeded();
|
||||
GB_ONLY_ONE.defaultSize();
|
||||
GB_ONLY_ONE.setFullScreen(false);
|
||||
GB_ONLY_ONE.setType("image");
|
||||
|
||||
GB_ONLY_ONE.show(caption, url);
|
||||
return false;
|
||||
}
|
||||
|
||||
GB_hide = function() {
|
||||
GB_CURRENT.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
Preload all the images used by GreyBox. Static function
|
||||
**/
|
||||
GreyBox.preloadGreyBoxImages = function(img_dir) {
|
||||
var pics = [];
|
||||
|
||||
if(!img_dir)
|
||||
img_dir = GB_IMG_DIR;
|
||||
|
||||
var fn = function(path) {
|
||||
var pic = new Image();
|
||||
pic.src = GB_IMG_DIR + path;
|
||||
pics.push(pic);
|
||||
};
|
||||
AJS.map(['indicator.gif', 'blank.gif', 'close.gif', 'header_bg.gif', 'overlay_light.png', 'overlay_dark.png'], AJS.$b(fn, this));
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
// Internal functions
|
||||
//
|
||||
GreyBox.prototype.getOverlayImage = function() {
|
||||
return "overlay_" + this.overlay_color + ".png";
|
||||
};
|
||||
|
||||
/**
|
||||
Init functions
|
||||
**/
|
||||
GreyBox.prototype.initOverlayIfNeeded = function() {
|
||||
//Create the overlay
|
||||
this.overlay = AJS.DIV({'id': 'GB_overlay'});
|
||||
if(AJS.isIe()) {
|
||||
this.overlay.style.backgroundColor = "#000000";
|
||||
this.overlay.style.backgroundColor = "transparent";
|
||||
this.overlay.style.backgroundImage = "url("+ this.img_dir +"blank.gif)";
|
||||
this.overlay.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.img_dir + this.getOverlayImage() + "',sizingMethod='scale')";
|
||||
}
|
||||
else
|
||||
this.overlay.style.backgroundImage = "url("+ this.img_dir + this.getOverlayImage() +")";
|
||||
|
||||
if(this.overlay_click_close)
|
||||
AJS.AEV(this.overlay, "click", GB_hide);
|
||||
|
||||
AJS.getBody().insertBefore(this.overlay, AJS.getBody().firstChild);
|
||||
};
|
||||
|
||||
GreyBox.prototype.initIfNeeded = function() {
|
||||
this.init();
|
||||
this.setWidthNHeight = AJS.$b(this.setWidthNHeight, this);
|
||||
this.setTopNLeft = AJS.$b(this.setTopNLeft, this);
|
||||
this.setFullScreenOption = AJS.$b(this.setFullScreenOption, this);
|
||||
this.setOverlayDimension = AJS.$b(this.setOverlayDimension, this);
|
||||
|
||||
GreyBox.addOnWinResize(this.setWidthNHeight, this.setTopNLeft, this.setFullScreenOption, this.setOverlayDimension);
|
||||
|
||||
this.g_container.style.marginBottom = "-3px";
|
||||
|
||||
var fn = function() {
|
||||
this.setOverlayDimension();
|
||||
this.setVerticalPosition();
|
||||
this.setTopNLeft();
|
||||
this.setWidthNHeight();
|
||||
};
|
||||
AJS.AEV(window, "scroll", AJS.$b(fn, this));
|
||||
|
||||
if(!this.iframe) {
|
||||
var new_frame;
|
||||
var d = {'name': 'GB_frame', 'class': 'GB_frame', 'frameBorder': 0};
|
||||
new_frame = AJS.IFRAME(d);
|
||||
this.iframe = new_frame;
|
||||
AJS.hideElement(this.iframe);
|
||||
}
|
||||
}
|
||||
|
||||
GreyBox.prototype.init = function() {
|
||||
//Create the window
|
||||
this.g_window = AJS.DIV({'id': 'GB_window'});
|
||||
|
||||
//Create the table structure
|
||||
var table = AJS.TABLE({'class': 'GB_t_frame', 'frameborder': 0});
|
||||
var tbody = AJS.TBODY();
|
||||
AJS.ACN(table, tbody);
|
||||
|
||||
//Midlle
|
||||
var td_middle_m = AJS.TD({'class': 'GB_content'});
|
||||
this.td_middle_m = td_middle_m;
|
||||
|
||||
AJS.ACN(tbody, AJS.TR(td_middle_m));
|
||||
|
||||
//Append caption and close
|
||||
var header = AJS.TABLE({'class': 'GB_header'});
|
||||
this.header = header;
|
||||
|
||||
var caption = AJS.TD({'class': 'GB_caption'});
|
||||
this.div_caption = caption;
|
||||
|
||||
/*header.style.backgroundImage = "url("+ this.img_dir +"header_bg.gif)";*/
|
||||
|
||||
tbody_header = AJS.TBODY();
|
||||
var close = AJS.TD({'class': 'GB_close'});
|
||||
|
||||
if(this.show_close_img) {
|
||||
var img_close = AJS.IMG({'src': this.img_dir + 'close.gif'});
|
||||
AJS.ACN(close, img_close, "Close");
|
||||
AJS.AEV(close, "click", GB_hide);
|
||||
}
|
||||
AJS.ACN(tbody_header, AJS.TR(caption, close));
|
||||
|
||||
AJS.ACN(header, tbody_header);
|
||||
|
||||
AJS.ACN(td_middle_m, header);
|
||||
|
||||
//Container
|
||||
this.g_container = AJS.DIV({'class': 'GB_container'});
|
||||
AJS.ACN(td_middle_m, this.g_container);
|
||||
|
||||
AJS.ACN(this.g_window, table);
|
||||
|
||||
AJS.getBody().insertBefore(this.g_window, this.overlay.nextSibling);
|
||||
}
|
||||
|
||||
GreyBox.prototype.startLoading = function() {
|
||||
//Start preloading the object
|
||||
this.iframe.src = this.img_dir + 'loader_frame.html';
|
||||
AJS.showElement(this.iframe);
|
||||
}
|
||||
|
||||
/**
|
||||
Set dimension functions
|
||||
**/
|
||||
GreyBox.prototype.setIframeWidthNHeight = function() {
|
||||
try{
|
||||
AJS.setWidth(this.iframe, this.width);
|
||||
AJS.setHeight(this.iframe, this.height);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
}
|
||||
|
||||
GreyBox.prototype.setOverlayDimension = function() {
|
||||
var page_size = AJS.getWindowSize();
|
||||
if((navigator.userAgent.toLowerCase().indexOf("firefox") != -1))
|
||||
AJS.setWidth(this.overlay, "100%");
|
||||
else
|
||||
AJS.setWidth(this.overlay, page_size.w);
|
||||
|
||||
var max_height = Math.max(AJS.getScrollTop()+page_size.h, AJS.getScrollTop()+this.height);
|
||||
if(max_height < AJS.getScrollTop())
|
||||
AJS.setHeight(this.overlay, max_height);
|
||||
else
|
||||
AJS.setHeight(this.overlay, AJS.getScrollTop()+page_size.h);
|
||||
}
|
||||
|
||||
GreyBox.prototype.setWidthNHeight = function() {
|
||||
//Set size
|
||||
AJS.setWidth(this.g_window, this.width);
|
||||
AJS.setHeight(this.g_window, this.height);
|
||||
|
||||
AJS.setWidth(this.g_container, this.width);
|
||||
AJS.setHeight(this.g_container, this.height);
|
||||
|
||||
this.setIframeWidthNHeight();
|
||||
|
||||
//Set size on components
|
||||
AJS.setWidth(this.td_middle_m, this.width+10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Modified 2006-10-08 by Silverstripe
|
||||
*/
|
||||
GreyBox.prototype.setTopNLeft = function() {
|
||||
var page_size = AJS.getWindowSize();
|
||||
AJS.setLeft(this.g_window, ((page_size.w - this.width)/2)-13);
|
||||
|
||||
var fl = ((page_size.h - this.height) /2) - 15 + AJS.getScrollTop();
|
||||
AJS.setTop(this.g_window, fl);
|
||||
}
|
||||
|
||||
GreyBox.prototype.setVerticalPosition = function() {
|
||||
var page_size = AJS.getWindowSize();
|
||||
var st = AJS.getScrollTop();
|
||||
if(this.g_window.offsetWidth <= page_size.h || st <= this.g_window.offsetTop) {
|
||||
AJS.setTop(this.g_window, st);
|
||||
}
|
||||
}
|
||||
|
||||
GreyBox.prototype.setFullScreenOption = function() {
|
||||
if(this.full_screen) {
|
||||
var page_size = AJS.getWindowSize();
|
||||
|
||||
overlay_h = page_size.h;
|
||||
|
||||
this.width = Math.round(this.overlay.offsetWidth - (this.overlay.offsetWidth/100)*10);
|
||||
this.height = Math.round(overlay_h - (overlay_h/100)*10);
|
||||
}
|
||||
}
|
||||
|
||||
GreyBox.prototype.defaultSize = function() {
|
||||
this.width = 300;
|
||||
this.height = 300;
|
||||
}
|
||||
|
||||
////
|
||||
// Misc.
|
||||
//
|
||||
GreyBox.addOnWinResize = function(funcs) {
|
||||
funcs = AJS.$A(funcs);
|
||||
AJS.map(funcs, function(fn) { AJS.AEV(window, "resize", fn); });
|
||||
}
|
BIN
thirdparty/greybox/header_bg.gif
vendored
Before Width: | Height: | Size: 1.2 KiB |
BIN
thirdparty/greybox/indicator.gif
vendored
Before Width: | Height: | Size: 2.7 KiB |
74
thirdparty/greybox/loader_frame.html
vendored
@ -1,74 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Helvetica, Verdana, sans-serif;
|
||||
}
|
||||
#GB_frame {
|
||||
visibility: hidden;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#loading {
|
||||
padding-top: 10px;
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
font-size: 25px;
|
||||
text-align: center;
|
||||
color: #616161;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="loading">
|
||||
<img src="indicator.gif" style="padding-bottom: 10px"><br />
|
||||
LOADING
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var GB = parent.GB_CURRENT;
|
||||
|
||||
var gb_type = GB.type;
|
||||
var gb_url = GB.url;
|
||||
|
||||
//Start loading in the iframe
|
||||
if(gb_type == "page") {
|
||||
document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
|
||||
}
|
||||
else {
|
||||
var img_holder;
|
||||
img_holder = new Image();
|
||||
img_holder.src = gb_url;
|
||||
document.write('<img id="GB_frame" src="' + gb_url + '">');
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
<script>
|
||||
document.getElementsByTagName('body')[0].focus();
|
||||
var old_onload = window.onload;
|
||||
window.onload = function (e) {
|
||||
var frame = document.getElementById('GB_frame');
|
||||
var loading = document.getElementById('loading');
|
||||
|
||||
loading.style.display = "none";
|
||||
frame.style.visibility = "visible";
|
||||
|
||||
if(gb_type == "image") {
|
||||
if(img_holder.width != 0 && img_holder.height != 0) {
|
||||
GB.setDimension(img_holder.width, img_holder.height);
|
||||
GB.setTopNLeft();
|
||||
//Safari render bug fix
|
||||
GB.overlay.innerHTML = GB.overlay.innerHTML + " ";
|
||||
GB.setWidthNHeight();
|
||||
}
|
||||
}
|
||||
if(old_onload)
|
||||
old_onload(e);
|
||||
};
|
||||
</script>
|
||||
</html>
|
BIN
thirdparty/greybox/logo.gif
vendored
Before Width: | Height: | Size: 4.4 KiB |
BIN
thirdparty/greybox/logo.png
vendored
Before Width: | Height: | Size: 6.2 KiB |
BIN
thirdparty/greybox/overlay.png
vendored
Before Width: | Height: | Size: 2.9 KiB |
BIN
thirdparty/greybox/overlay_dark.png
vendored
Before Width: | Height: | Size: 279 B |
BIN
thirdparty/greybox/overlay_light.png
vendored
Before Width: | Height: | Size: 272 B |