Skip to content

Instantly share code, notes, and snippets.

@01-Scripts
Created October 12, 2010 20:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 01-Scripts/622911 to your computer and use it in GitHub Desktop.
Save 01-Scripts/622911 to your computer and use it in GitHub Desktop.
Unkomprimierte JavaScript-Dateien des 01ACP (01acp/system/js) www.01-scripts.de/01acp.php
// Ajax-Meldungsboxen ausblenden
var ajaxboxes = $$('div.ajax_box');
ajaxboxes.fade('hide');
ajaxboxes.setStyle('display','block');
// Elemente der Klasse moo_hide ausblenden
var moo_hiddenelements = $$('div.moo_hide');
moo_hiddenelements.fade('hide');
moo_hiddenelements.setStyle('display','block');
// Elemente der Klasse moo_inlinehide ausblenden
var moo_hiddeninlineelements = $$('div.moo_inlinehide');
moo_hiddeninlineelements.fade('hide');
moo_hiddeninlineelements.setStyle('display','inline');
/**
* FancyUpload - Flash meets Ajax for powerful and elegant uploads.
*
* Updated to latest 3.0 API. Hopefully 100% compat!
*
* @version 3.0
*
* @license MIT License
*
* @author Harald Kirschner <http://digitarald.de>
* @copyright Authors
*
* translation2german: 100514 by 01-Scripts.de - Michael Lorer
*/
var FancyUpload2 = new Class({
Extends: Swiff.Uploader,
options: {
queued: 1,
// compat
limitSize: 0,
limitFiles: 0,
validateFile: $lambda(true)
},
initialize: function(status, list, options) {
this.status = $(status);
this.list = $(list);
// compat
options.fileClass = options.fileClass || FancyUpload2.File;
options.fileSizeMax = options.limitSize || options.fileSizeMax;
options.fileListMax = options.limitFiles || options.fileListMax;
this.parent(options);
this.addEvents({
'load': this.render,
'select': this.onSelect,
'cancel': this.onCancel,
'start': this.onStart,
'queue': this.onQueue,
'complete': this.onComplete
});
},
render: function() {
this.overallTitle = this.status.getElement('.overall-title');
this.currentTitle = this.status.getElement('.current-title');
this.currentText = this.status.getElement('.current-text');
var progress = this.status.getElement('.overall-progress');
this.overallProgress = new Fx.ProgressBar(progress, {
text: new Element('span', {'class': 'progress-text'}).inject(progress, 'after')
});
progress = this.status.getElement('.current-progress')
this.currentProgress = new Fx.ProgressBar(progress, {
text: new Element('span', {'class': 'progress-text'}).inject(progress, 'after')
});
this.updateOverall();
},
onSelect: function() {
this.status.removeClass('status-browsing');
},
onCancel: function() {
this.status.removeClass('file-browsing');
},
onStart: function() {
this.status.addClass('file-uploading');
this.overallProgress.set(0);
},
onQueue: function() {
this.updateOverall();
},
onComplete: function() {
this.status.removeClass('file-uploading');
if (this.size) {
this.overallProgress.start(100);
} else {
this.overallProgress.set(0);
this.currentProgress.set(0);
}
},
updateOverall: function() {
this.overallTitle.set('html', MooTools.lang.get('FancyUpload', 'progressOverall').substitute({
total: Swiff.Uploader.formatUnit(this.size, 'b')
}));
if (!this.size) {
this.currentTitle.set('html', MooTools.lang.get('FancyUpload', 'currentTitle'));
this.currentText.set('html', '');
}
},
/**
* compat
*/
upload: function() {
this.start();
},
removeFile: function() {
return this.remove();
}
});
FancyUpload2.File = new Class({
Extends: Swiff.Uploader.File,
render: function() {
if (this.invalid) {
if (this.validationError) {
var msg = MooTools.lang.get('FancyUpload', 'validationErrors')[this.validationError] || this.validationError;
this.validationErrorMessage = msg.substitute({
name: this.name,
size: Swiff.Uploader.formatUnit(this.size, 'b'),
fileSizeMin: Swiff.Uploader.formatUnit(this.base.options.fileSizeMin || 0, 'b'),
fileSizeMax: Swiff.Uploader.formatUnit(this.base.options.fileSizeMax || 0, 'b'),
fileListMax: this.base.options.fileListMax || 0,
fileListSizeMax: Swiff.Uploader.formatUnit(this.base.options.fileListSizeMax || 0, 'b')
});
}
this.remove();
return;
}
this.addEvents({
'start': this.onStart,
'progress': this.onProgress,
'complete': this.onComplete,
'error': this.onError,
'remove': this.onRemove
});
this.info = new Element('span', {'class': 'file-info'});
this.element = new Element('li', {'class': 'file'}).adopt(
new Element('span', {'class': 'file-size', 'html': Swiff.Uploader.formatUnit(this.size, 'b')}),
new Element('a', {
'class': 'file-remove',
href: '#',
html: MooTools.lang.get('FancyUpload', 'remove'),
title: MooTools.lang.get('FancyUpload', 'removeTitle'),
events: {
click: function() {
this.remove();
return false;
}.bind(this)
}
}),
new Element('span', {'class': 'file-name', 'html': MooTools.lang.get('FancyUpload', 'fileName').substitute(this)}),
this.info
).inject(this.base.list);
},
validate: function() {
return (this.parent() && this.base.options.validateFile(this));
},
onStart: function() {
this.element.addClass('file-uploading');
this.base.currentProgress.cancel().set(0);
this.base.currentTitle.set('html', MooTools.lang.get('FancyUpload', 'currentFile').substitute(this));
},
onProgress: function() {
this.base.overallProgress.start(this.base.percentLoaded);
this.base.currentText.set('html', MooTools.lang.get('FancyUpload', 'currentProgress').substitute({
rate: (this.progress.rate) ? Swiff.Uploader.formatUnit(this.progress.rate, 'bps') : '- B',
bytesLoaded: Swiff.Uploader.formatUnit(this.progress.bytesLoaded, 'b'),
timeRemaining: (this.progress.timeRemaining) ? Swiff.Uploader.formatUnit(this.progress.timeRemaining, 's') : '-'
}));
this.base.currentProgress.start(this.progress.percentLoaded);
},
onComplete: function() {
this.element.removeClass('file-uploading');
this.base.currentText.set('html', 'Upload komplett');
this.base.currentProgress.start(100);
if (this.response.error) {
var msg = MooTools.lang.get('FancyUpload', 'errors')[this.response.error] || '{error} #{code}';
this.errorMessage = msg.substitute($extend({
name: this.name,
size: Swiff.Uploader.formatUnit(this.size, 'b')
}, this.response));
var args = [this, this.errorMessage, this.response];
this.fireEvent('error', args).base.fireEvent('fileError', args);
} else {
this.base.fireEvent('fileSuccess', [this, this.response.text || '']);
}
},
onError: function() {
this.element.addClass('file-failed');
var error = MooTools.lang.get('FancyUpload', 'fileError').substitute(this);
this.info.set('html', '<strong>' + error + ':</strong> ' + this.errorMessage);
},
onRemove: function() {
this.element.getElements('a').setStyle('visibility', 'hidden');
this.element.fade('out').retrieve('tween').chain(Element.destroy.bind(Element, this.element));
}
});
// Avoiding MooTools.lang dependency
(function() {
var phrases = {
'progressOverall': 'Fortschritt (gesamt): {total}',
'currentTitle': 'Aktuelle Datei',
'currentFile': 'Upload...: "{name}"',
'currentProgress': 'Upload: {bytesLoaded} mit {rate}, {timeRemaining} verbleibend.',
'fileName': '{name}',
'remove': 'Entfernen',
'removeTitle': 'Klicken Sie hier um diese Datei zu entfernen',
'fileError': 'Upload fehlgeschlagen',
'validationErrors': {
'duplicate': 'Datei <em>{name}</em> ist bereits in der Warteschlange. Doppelte Dateien sind nicht erlaubt.',
'sizeLimitMin': 'Datei <em>{name}</em> (<em>{size}</em>) ist zu klein, minimale Dateigr&ouml;&szlig;e: {fileSizeMin}.',
'sizeLimitMax': 'Datei <em>{name}</em> (<em>{size}</em>) ist zu gro&szlig;, maximale Dateigr&ouml;&szlig;e: <em>{fileSizeMax}</em>.',
'fileListMax': 'Datei <em>{name}</em> konnte nicht hinzugef&uuml;gt werden. Maximale Listengr&ouml;&szlig;e von <em>{fileListMax} Dateien</em> erreicht.',
'fileListSizeMax': 'Datei <em>{name}</em> (<em>{size}</em>) ist zu gro&szlig;. Gesamtdateigr&ouml;&szlig;e von <em>{fileListSizeMax}</em> erreicht.'
},
'errors': {
'httpStatus': 'Server returned HTTP-Status <code>#{code}</code>',
'securityError': 'Security error occured ({text})',
'ioError': 'Error caused a send or load operation to fail ({text})'
}
};
if (MooTools.lang) {
MooTools.lang.set('en-US', 'FancyUpload', phrases);
} else {
MooTools.lang = {
get: function(from, key) {
return phrases[key];
}
};
}
})();
/**
* Fx.ProgressBar
*
* @version 1.1
*
* @license MIT License
*
* @author Harald Kirschner <mail [at] digitarald [dot] de>
* @copyright Authors
*/
Fx.ProgressBar = new Class({
Extends: Fx,
options: {
text: null,
url: null,
transition: Fx.Transitions.Circ.easeOut,
fit: true,
link: 'cancel'
},
initialize: function(element, options) {
this.element = $(element);
this.parent(options);
var url = this.options.url;
if (url) {
this.element.setStyles({
'background-image': 'url(' + url + ')',
'background-repeat': 'no-repeat'
});
}
if (this.options.fit) {
url = url || this.element.getStyle('background-image').replace(/^url\(["']?|["']?\)$/g, '');
if (url) {
var fill = new Image();
fill.onload = function() {
this.fill = fill.width;
fill = fill.onload = null;
this.set(this.now || 0);
}.bind(this);
fill.src = url;
if (!this.fill && fill.width) fill.onload();
}
} else {
this.set(0);
}
},
start: function(to, total) {
return this.parent(this.now, (arguments.length == 1) ? to.limit(0, 100) : to / total * 100);
},
set: function(to) {
this.now = to;
var css = (this.fill)
? (((this.fill / -2) + (to / 100) * (this.element.width || 1) || 0).round() + 'px')
: ((100 - to) + '%');
this.element.setStyle('backgroundPosition', css + ' 0px').title = Math.round(to) + '%';
var text = $(this.options.text);
if (text) text.set('text', Math.round(to) + '%');
return this;
}
});
/*
01ACP - Copyright 2008-2009 by Michael Lorer - 01-Scripts.de
Lizenz: Creative-Commons: Namensnennung-Keine kommerzielle Nutzung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland
Weitere Lizenzinformationen unter: http://www.01-scripts.de/lizenz.php
Modul: 01ACP
Dateiinfo: Globale Java-Script-Funktionen
#fv.1101#
*/
function redirect(url){
window.location.href = url;
}
function popup(action,var1,var2,var3,w,h) {
window.open('popups.php?action='+action+'&var1='+var1+'&var2='+var2+'&var3='+var3+'','_blank','width='+w+',height='+h+',scrollbars=yes,resizable=yes,status=no,toolbar=no,left=400,top=150');
}
function modulpopup(modul,action,var1,var2,var3,w,h) {
window.open('popups.php?action='+action+'&modul='+modul+'&var1='+var1+'&var2='+var2+'&var3='+var3+'','_blank','width='+w+',height='+h+',scrollbars=yes,resizable=yes,status=no,toolbar=no,left=400,top=150');
}
/* Überprüfen ob ein in ein Formularfeld eingegebener Wert eine Zahl ist */
function IsZahl(feldname){
var field = document.getElementsByName(feldname)[0];
var Wert = field.value;
if(isNaN(Wert)){
alert(Wert + " ist keine Zahl!");
field.value = "";
return false;
}
else{
return true;
}
}
//JS-Funktion mit freundlicher Unterstützung von "Berni*" (http://www.bernis-board.de/)
function clearField(field){
if(field.value == field.defaultValue){
field.value = "";
}
}
//JS-Funktion mit freundlicher Unterstützung von "Berni*" (http://www.bernis-board.de/)
function checkField(field){
if(field.value == ""){
field.value = field.defaultValue;
}
}
function fade_element(elementId){
var temp = document.getElementById(elementId);
temp.fade('toggle');
}
function hide_unhide(elementId){
var temp = document.getElementById(elementId);
temp.style.display = (temp.style.display == 'block') ? 'none' : 'block';
}
function hide_always(elementId){
var temp = document.getElementById(elementId);
temp.style.display = 'none';
}
function show_always(elementId){
var temp = document.getElementById(elementId);
temp.style.display = 'block';
}
function hide_unhide_inline(elementId){
var temp = document.getElementById(elementId);
temp.style.display = (temp.style.display == 'inline') ? 'none' : 'inline';
}
function hide_unhide_tr(elementId){
var temp = document.getElementById(elementId);
if(temp.style.display == 'none'){
try { temp.style.display = 'table-row'; } catch(e) {
temp.style.display = 'inline'; };
}
else{
temp.style.display = 'none';
}
}
function hide_unhide_tr_byclass(elementClass){
var allElems = document.getElementsByTagName('tr');
for(var i = 0; i < allElems.length; i++){
var thisElem = allElems[i];
if(thisElem.className && thisElem.className == elementClass){
if(thisElem.style.display == 'none'){
try { thisElem.style.display = 'table-row'; } catch(e) {
thisElem.style.display = 'inline'; };
}
else{
thisElem.style.display = 'none';
}
}
}
}
function moo_hide_unhide_tr(elementClass){
var temp = $$('tr.'+elementClass);
//var test = temp.getStyle('display')[0];
//alert(test);
if(temp.getStyle('display')[0] == 'none'){
try { temp.setStyle('display','table-row'); } catch(e) {
temp.setStyle('display','inline'); };
}
else{
temp.setStyle('display','none');
}
}
/*BB-Code-Funktion (c) by http://aktuell.de.selfhtml.org/artikel/javascript/bbcode/index.htm */
function bbcinsert(aTag, eTag) {
var input = document.forms['post'].elements['newsfeld'];
input.focus();
/* für Internet Explorer */
if(typeof document.selection != 'undefined') {
/* Einfügen des Formatierungscodes */
var range = document.selection.createRange();
var insText = range.text;
range.text = aTag + insText + eTag;
/* Anpassen der Cursorposition */
range = document.selection.createRange();
if (insText.length == 0) {
range.move('character', -eTag.length);
} else {
range.moveStart('character', aTag.length + insText.length + eTag.length);
}
range.select();
}
/* für neuere auf Gecko basierende Browser */
else if(typeof input.selectionStart != 'undefined')
{
/* Einfügen des Formatierungscodes */
var start = input.selectionStart;
var end = input.selectionEnd;
var insText = input.value.substring(start, end);
input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
/* Anpassen der Cursorposition */
var pos;
if (insText.length == 0) {
pos = start + aTag.length;
} else {
pos = start + aTag.length + insText.length + eTag.length;
}
input.selectionStart = pos;
input.selectionEnd = pos;
}
/* für die übrigen Browser */
else
{
/* Abfrage der Einfügeposition */
var pos;
var re = new RegExp('^[0-9]{0,3}$');
while(!re.test(pos)) {
pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
}
if(pos > input.value.length) {
pos = input.value.length;
}
/* Einfügen des Formatierungscodes */
var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
}
}
/* 01ACP Copyright 2008-2009 by Michael Lorer - 01-Scripts.de */
Die folgenden bestandteile des 01ACP oder der Module sind unter der
MIT Style License
lizensiert:
- MooTools 1.2 (Core & More) http://www.mootools.net/
- MooTools Date Picker (Plugin) http://www.aryweb.nl/voorbeelden/datepicker/
- MooTools ReMooz (v1.0) (Plugin) http://digitarald.de/project/remooz/
http://www.opensource.org/licenses/mit-license.php
The MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
/***
* MooRainbow
*
* @version 1.2b2
* @license MIT-style license
* @author Djamil Legato - < djamil [at] djamil.it >
* @infos http://moorainbow.woolly-sheep.net
* @copyright Author
*
*
*/
var Rainbows = [];
var MooRainbow = new Class({
options: {
id: 'mooRainbow',
prefix: 'moor-',
imgPath: 'images/moo/rainbow/',
startColor: [255, 0, 0],
wheel: false,
onComplete: $empty,
onChange: $empty
},
initialize: function(el, options) {
this.element = $(el); if (!this.element) return;
this.setOptions(options);
this.sliderPos = 0;
this.pickerPos = {x: 0, y: 0};
this.backupColor = this.options.startColor;
this.currentColor = this.options.startColor;
this.sets = {
rgb: [],
hsb: [],
hex: []
};
this.pickerClick = this.sliderClick = false;
if (!this.layout) this.doLayout();
this.OverlayEvents();
this.sliderEvents();
this.backupEvent();
if (this.options.wheel) this.wheelEvents();
this.element.addEvent('click', function(e) { this.closeAll().toggle(e); }.bind(this));
this.layout.overlay.setStyle('background-color', this.options.startColor.rgbToHex());
this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
this.manualSet(this.options.startColor);
this.pickerPos.x = this.snippet('curPos').l + this.snippet('curSize', 'int').w;
this.pickerPos.y = this.snippet('curPos').t + this.snippet('curSize', 'int').h;
this.sliderPos = this.snippet('arrPos') - this.snippet('arrSize', 'int');
if (window.khtml) this.hide();
},
toggle: function() {
this[this.visible ? 'hide' : 'show']();
},
show: function() {
this.rePosition();
this.layout.setStyle('display', 'block');
this.visible = true;
},
hide: function() {
this.layout.setStyles({'display': 'none'});
this.visible = false;
},
closeAll: function() {
Rainbows.each(function(obj) { obj.hide(); });
return this;
},
manualSet: function(color, type) {
if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
var rgb, hsb, hex;
if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); }
else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); }
else { hex = color; rgb = color.hexToRgb(true); hsb = rgb.rgbToHsb(); }
this.setMooRainbow(rgb);
this.autoSet(hsb);
},
autoSet: function(hsb) {
var curH = this.snippet('curSize', 'int').h;
var curW = this.snippet('curSize', 'int').w;
var oveH = this.layout.overlay.height;
var oveW = this.layout.overlay.width;
var sliH = this.layout.slider.height;
var arwH = this.snippet('arrSize', 'int');
var hue;
var posx = Math.round(((oveW * hsb[1]) / 100) - curW);
var posy = Math.round(- ((oveH * hsb[2]) / 100) + oveH - curH);
var c = Math.round(((sliH * hsb[0]) / 360)); c = (c == 360) ? 0 : c;
var position = sliH - c + this.snippet('slider') - arwH;
hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
this.layout.cursor.setStyles({'top': posy, 'left': posx});
this.layout.arrows.setStyle('top', position);
this.layout.overlay.setStyle('background-color', hue);
this.sliderPos = this.snippet('arrPos') - arwH;
this.pickerPos.x = this.snippet('curPos').l + curW;
this.pickerPos.y = this.snippet('curPos').t + curH;
},
setMooRainbow: function(color, type) {
if (!type || (type != 'hsb' && type != 'hex')) type = 'rgb';
var rgb, hsb, hex;
if (type == 'rgb') { rgb = color; hsb = color.rgbToHsb(); hex = color.rgbToHex(); }
else if (type == 'hsb') { hsb = color; rgb = color.hsbToRgb(); hex = rgb.rgbToHex(); }
else { hex = color; rgb = color.hexToRgb(); hsb = rgb.rgbToHsb(); }
this.sets = {
rgb: rgb,
hsb: hsb,
hex: hex
};
if (!$chk(this.pickerPos.x))
this.autoSet(hsb);
this.RedInput.value = rgb[0];
this.GreenInput.value = rgb[1];
this.BlueInput.value = rgb[2];
this.HueInput.value = hsb[0];
this.SatuInput.value = hsb[1];
this.BrighInput.value = hsb[2];
this.hexInput.value = hex;
this.currentColor = rgb;
this.chooseColor.setStyle('background-color', rgb.rgbToHex());
},
parseColors: function(x, y, z) {
var s = Math.round((x * 100) / this.layout.overlay.width);
var b = 100 - Math.round((y * 100) / this.layout.overlay.height);
var h = 360 - Math.round((z * 360) / this.layout.slider.height) + this.snippet('slider') - this.snippet('arrSize', 'int');
h -= this.snippet('arrSize', 'int');
h = (h >= 360) ? 0 : (h < 0) ? 0 : h;
s = (s > 100) ? 100 : (s < 0) ? 0 : s;
b = (b > 100) ? 100 : (b < 0) ? 0 : b;
return [h, s, b];
},
OverlayEvents: function() {
var lim, curH, curW, inputs;
curH = this.snippet('curSize', 'int').h;
curW = this.snippet('curSize', 'int').w;
inputs = $A(this.arrRGB).concat(this.arrHSB, this.hexInput);
document.addEvent('click', function() {
if(this.visible) this.hide(this.layout);
}.bind(this));
inputs.each(function(el) {
el.addEvent('keydown', this.eventKeydown.bindWithEvent(this, el));
el.addEvent('keyup', this.eventKeyup.bindWithEvent(this, el));
}, this);
[this.element, this.layout].each(function(el) {
el.addEvents({
'click': function(e) { new Event(e).stop(); },
'keyup': function(e) {
e = new Event(e);
if(e.key == 'esc' && this.visible) this.hide(this.layout);
}.bind(this)
}, this);
}, this);
lim = {
x: [0 - curW, (this.layout.overlay.width - curW)],
y: [0 - curH, (this.layout.overlay.height - curH)]
};
this.layout.drag = new Drag(this.layout.cursor, {
limit: lim,
onBeforeStart: this.overlayDrag.bind(this),
onStart: this.overlayDrag.bind(this),
onDrag: this.overlayDrag.bind(this),
snap: 0
});
this.layout.overlay2.addEvent('mousedown', function(e){
e = new Event(e);
this.layout.cursor.setStyles({
'top': e.page.y - this.layout.overlay.getTop() - curH,
'left': e.page.x - this.layout.overlay.getLeft() - curW
});
this.layout.drag.start(e);
}.bind(this));
this.okButton.addEvent('click', function() {
if (this.currentColor == this.options.startColor) {
this.hide();
this.fireEvent('onComplete', [this.sets, this]);
}
else {
this.backupColor = this.currentColor;
this.layout.backup.setStyle('background-color', this.backupColor.rgbToHex());
this.hide();
this.fireEvent('onComplete', [this.sets, this]);
}
}.bind(this));
this.transp.addEvent('click', function () {
this.hide();
this.fireEvent('onComplete', ['transparent', this]);
}.bind(this));
},
overlayDrag: function() {
var curH = this.snippet('curSize', 'int').h;
var curW = this.snippet('curSize', 'int').w;
this.pickerPos.x = this.snippet('curPos').l + curW;
this.pickerPos.y = this.snippet('curPos').t + curH;
this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
this.fireEvent('onChange', [this.sets, this]);
},
sliderEvents: function() {
var arwH = this.snippet('arrSize', 'int'), lim;
lim = [0 + this.snippet('slider') - arwH, this.layout.slider.height - arwH + this.snippet('slider')];
this.layout.sliderDrag = new Drag(this.layout.arrows, {
limit: {y: lim},
modifiers: {x: false},
onBeforeStart: this.sliderDrag.bind(this),
onStart: this.sliderDrag.bind(this),
onDrag: this.sliderDrag.bind(this),
snap: 0
});
this.layout.slider.addEvent('mousedown', function(e){
e = new Event(e);
this.layout.arrows.setStyle(
'top', e.page.y - this.layout.slider.getTop() + this.snippet('slider') - arwH
);
this.layout.sliderDrag.start(e);
}.bind(this));
},
sliderDrag: function() {
var arwH = this.snippet('arrSize', 'int'), hue;
this.sliderPos = this.snippet('arrPos') - arwH;
this.setMooRainbow(this.parseColors(this.pickerPos.x, this.pickerPos.y, this.sliderPos), 'hsb');
hue = [this.sets.hsb[0], 100, 100].hsbToRgb().rgbToHex();
this.layout.overlay.setStyle('background-color', hue);
this.fireEvent('onChange', [this.sets, this]);
},
backupEvent: function() {
this.layout.backup.addEvent('click', function() {
this.manualSet(this.backupColor);
this.fireEvent('onChange', [this.sets, this]);
}.bind(this));
},
wheelEvents: function() {
var arrColors = $A(this.arrRGB).extend(this.arrHSB);
arrColors.each(function(el) {
el.addEvents({
'mousewheel': this.eventKeys.bindWithEvent(this, el),
'keydown': this.eventKeys.bindWithEvent(this, el)
});
}, this);
[this.layout.arrows, this.layout.slider].each(function(el) {
el.addEvents({
'mousewheel': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider']),
'keydown': this.eventKeys.bindWithEvent(this, [this.arrHSB[0], 'slider'])
});
}, this);
},
eventKeys: function(e, el, id) {
var wheel, type;
id = (!id) ? el.id : this.arrHSB[0];
if (e.type == 'keydown') {
if (e.key == 'up') wheel = 1;
else if (e.key == 'down') wheel = -1;
else return;
} else if (e.type == Element.Events.mousewheel.base) wheel = (e.wheel > 0) ? 1 : -1;
if (this.arrRGB.contains(el)) type = 'rgb';
else if (this.arrHSB.contains(el)) type = 'hsb';
else type = 'hsb';
if (type == 'rgb') {
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
var value = (el.value.toInt() || 0) + wheel;
value = (value > 255) ? 255 : (value < 0) ? 0 : value;
switch(el.className) {
case prefix + 'rInput': pass = [value, rgb[1], rgb[2]]; break;
case prefix + 'gInput': pass = [rgb[0], value, rgb[2]]; break;
case prefix + 'bInput': pass = [rgb[0], rgb[1], value]; break;
default : pass = rgb;
}
this.manualSet(pass);
this.fireEvent('onChange', [this.sets, this]);
} else {
var rgb = this.sets.rgb, hsb = this.sets.hsb, prefix = this.options.prefix, pass;
var value = (el.value.toInt() || 0) + wheel;
if (el.className.test(/(HueInput)/)) value = (value > 359) ? 0 : (value < 0) ? 0 : value;
else value = (value > 100) ? 100 : (value < 0) ? 0 : value;
switch(el.className) {
case prefix + 'HueInput': pass = [value, hsb[1], hsb[2]]; break;
case prefix + 'SatuInput': pass = [hsb[0], value, hsb[2]]; break;
case prefix + 'BrighInput': pass = [hsb[0], hsb[1], value]; break;
default : pass = hsb;
}
this.manualSet(pass, 'hsb');
this.fireEvent('onChange', [this.sets, this]);
}
e.stop();
},
eventKeydown: function(e, el) {
var n = e.code, k = e.key;
if ((!el.className.test(/hexInput/) && !(n >= 48 && n <= 57)) &&
(k!='backspace' && k!='tab' && k !='delete' && k!='left' && k!='right'))
e.stop();
},
eventKeyup: function(e, el) {
var n = e.code, k = e.key, pass, prefix, chr = el.value.charAt(0);
if (!$chk(el.value)) return;
if (el.className.test(/hexInput/)) {
if (chr != "#" && el.value.length != 6) return;
if (chr == '#' && el.value.length != 7) return;
} else {
if (!(n >= 48 && n <= 57) && (!['backspace', 'tab', 'delete', 'left', 'right'].contains(k)) && el.value.length > 3) return;
}
prefix = this.options.prefix;
if (el.className.test(/(rInput|gInput|bInput)/)) {
if (el.value < 0 || el.value > 255) return;
switch(el.className){
case prefix + 'rInput': pass = [el.value, this.sets.rgb[1], this.sets.rgb[2]]; break;
case prefix + 'gInput': pass = [this.sets.rgb[0], el.value, this.sets.rgb[2]]; break;
case prefix + 'bInput': pass = [this.sets.rgb[0], this.sets.rgb[1], el.value]; break;
default : pass = this.sets.rgb;
}
this.manualSet(pass);
this.fireEvent('onChange', [this.sets, this]);
}
else if (!el.className.test(/hexInput/)) {
if (el.className.test(/HueInput/) && el.value < 0 || el.value > 360) return;
else if (el.className.test(/HueInput/) && el.value == 360) el.value = 0;
else if (el.className.test(/(SatuInput|BrighInput)/) && el.value < 0 || el.value > 100) return;
switch(el.className){
case prefix + 'HueInput': pass = [el.value, this.sets.hsb[1], this.sets.hsb[2]]; break;
case prefix + 'SatuInput': pass = [this.sets.hsb[0], el.value, this.sets.hsb[2]]; break;
case prefix + 'BrighInput': pass = [this.sets.hsb[0], this.sets.hsb[1], el.value]; break;
default : pass = this.sets.hsb;
}
this.manualSet(pass, 'hsb');
this.fireEvent('onChange', [this.sets, this]);
} else {
pass = el.value.hexToRgb(true);
if (isNaN(pass[0])||isNaN(pass[1])||isNaN(pass[2])) return;
if ($chk(pass)) {
this.manualSet(pass);
this.fireEvent('onChange', [this.sets, this]);
}
}
},
doLayout: function() {
var id = this.options.id, prefix = this.options.prefix;
var idPrefix = id + ' .' + prefix;
this.layout = new Element('div', {
'styles': {'display': 'block', 'position': 'absolute'},
'id': id
}).inject(document.body);
Rainbows.push(this);
var box = new Element('div', {
'styles': {'position': 'relative'},
'class': prefix + 'box'
}).inject(this.layout);
var div = new Element('div', {
'styles': {'position': 'absolute', 'overflow': 'hidden'},
'class': prefix + 'overlayBox'
}).inject(box);
var ar = new Element('div', {
'styles': {'position': 'absolute', 'zIndex': 1},
'class': prefix + 'arrows'
}).inject(box);
ar.width = ar.getStyle('width').toInt();
ar.height = ar.getStyle('height').toInt();
var ov = new Element('img', {
'styles': {'background-color': '#fff', 'position': 'relative', 'zIndex': 2},
'src': this.options.imgPath + 'moor_woverlay.png',
'class': prefix + 'overlay'
}).inject(div);
var ov2 = new Element('img', {
'styles': {'position': 'absolute', 'top': 0, 'left': 0, 'zIndex': 2},
'src': this.options.imgPath + 'moor_boverlay.png',
'class': prefix + 'overlay'
}).inject(div);
if (window.ie6) {
div.setStyle('overflow', '');
var src = ov.src;
ov.src = this.options.imgPath + 'blank.gif';
ov.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
src = ov2.src;
ov2.src = this.options.imgPath + 'blank.gif';
ov2.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
}
ov.width = ov2.width = div.getStyle('width').toInt();
ov.height = ov2.height = div.getStyle('height').toInt();
var cr = new Element('div', {
'styles': {'overflow': 'hidden', 'position': 'absolute', 'zIndex': 2},
'class': prefix + 'cursor'
}).inject(div);
cr.width = cr.getStyle('width').toInt();
cr.height = cr.getStyle('height').toInt();
var sl = new Element('img', {
'styles': {'position': 'absolute', 'z-index': 2},
'src': this.options.imgPath + 'moor_slider.png',
'class': prefix + 'slider'
}).inject(box);
this.layout.slider = document.getElement('#' + idPrefix + 'slider');
sl.width = sl.getStyle('width').toInt();
sl.height = sl.getStyle('height').toInt();
new Element('div', {
'styles': {'position': 'absolute'},
'class': prefix + 'colorBox'
}).inject(box);
new Element('div', {
'styles': {'zIndex': 2, 'position': 'absolute'},
'class': prefix + 'chooseColor'
}).inject(box);
this.layout.backup = new Element('div', {
'styles': {'zIndex': 2, 'position': 'absolute', 'cursor': 'pointer'},
'class': prefix + 'currentColor'
}).inject(box);
var R = new Element('label').inject(box).setStyle('position', 'absolute');
var G = R.clone().inject(box).addClass(prefix + 'gLabel').appendText('G: ');
var B = R.clone().inject(box).addClass(prefix + 'bLabel').appendText('B: ');
R.appendText('R: ').addClass(prefix + 'rLabel');
var inputR = new Element('input');
var inputG = inputR.clone().inject(G).addClass(prefix + 'gInput');
var inputB = inputR.clone().inject(B).addClass(prefix + 'bInput');
inputR.inject(R).addClass(prefix + 'rInput');
var HU = new Element('label').inject(box).setStyle('position', 'absolute');
var SA = HU.clone().inject(box).addClass(prefix + 'SatuLabel').appendText('S: ');
var BR = HU.clone().inject(box).addClass(prefix + 'BrighLabel').appendText('B: ');
HU.appendText('H: ').addClass(prefix + 'HueLabel');
var inputHU = new Element('input');
var inputSA = inputHU.clone().inject(SA).addClass(prefix + 'SatuInput');
var inputBR = inputHU.clone().inject(BR).addClass(prefix + 'BrighInput');
inputHU.inject(HU).addClass(prefix + 'HueInput');
SA.appendText(' %'); BR.appendText(' %');
new Element('span', {'styles': {'position': 'absolute'}, 'class': prefix + 'ballino'}).set('html', " &deg;").injectAfter(HU);
var hex = new Element('label').inject(box).setStyle('position', 'absolute').addClass(prefix + 'hexLabel').appendText('#hex: ').adopt(new Element('input').addClass(prefix + 'hexInput'));
var ok = new Element('input', {
'styles': {'position': 'absolute'},
'type': 'button',
'value': 'Select',
'class': prefix + 'okButton'
}).inject(box);
var transp = new Element('a', {'style': {'position': 'absolute'}, 'href': '#', 'class': prefix + 'transp'}).inject(box);
this.rePosition();
var overlays = $$('#' + idPrefix + 'overlay');
this.layout.overlay = overlays[0];
this.layout.overlay2 = overlays[1];
this.layout.cursor = document.getElement('#' + idPrefix + 'cursor');
this.layout.arrows = document.getElement('#' + idPrefix + 'arrows');
this.chooseColor = document.getElement('#' + idPrefix + 'chooseColor');
this.layout.backup = document.getElement('#' + idPrefix + 'currentColor');
this.RedInput = document.getElement('#' + idPrefix + 'rInput');
this.GreenInput = document.getElement('#' + idPrefix + 'gInput');
this.BlueInput = document.getElement('#' + idPrefix + 'bInput');
this.HueInput = document.getElement('#' + idPrefix + 'HueInput');
this.SatuInput = document.getElement('#' + idPrefix + 'SatuInput');
this.BrighInput = document.getElement('#' + idPrefix + 'BrighInput');
this.hexInput = document.getElement('#' + idPrefix + 'hexInput');
this.arrRGB = [this.RedInput, this.GreenInput, this.BlueInput];
this.arrHSB = [this.HueInput, this.SatuInput, this.BrighInput];
this.okButton = document.getElement('#' + idPrefix + 'okButton');
this.transp = box.getElement('.' + prefix + 'transp');
if (!window.khtml) this.hide();
},
rePosition: function() {
var coords = this.element.getCoordinates();
this.layout.setStyles({
'left': coords.left,
'top': coords.top + coords.height + 1
});
},
snippet: function(mode, type) {
var size; type = (type) ? type : 'none';
switch(mode) {
case 'arrPos':
var t = this.layout.arrows.getStyle('top').toInt();
size = t;
break;
case 'arrSize':
var h = this.layout.arrows.height;
h = (type == 'int') ? (h/2).toInt() : h;
size = h;
break;
case 'curPos':
var l = this.layout.cursor.getStyle('left').toInt();
var t = this.layout.cursor.getStyle('top').toInt();
size = {'l': l, 't': t};
break;
case 'slider':
var t = this.layout.slider.getStyle('marginTop').toInt();
size = t;
break;
default :
var h = this.layout.cursor.height;
var w = this.layout.cursor.width;
h = (type == 'int') ? (h/2).toInt() : h;
w = (type == 'int') ? (w/2).toInt() : w;
size = {w: w, h: h};
};
return size;
}
});
MooRainbow.implement(new Options);
MooRainbow.implement(new Events);
input.DatePicker{
cursor: pointer;
}
.dp_container{
position: relative;
padding: 0;
z-index: 500;
}
.dp_cal{
background-color: #fff;
border: 1px solid #F8A000;
position: absolute;
width: 177px;
top: 24px;
left: 0;
margin: 0px 0px 3px 0px;
}
.dp_cal table{
width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.dp_cal select{
margin: 2px 3px;
font-size: 11px;
}
.dp_cal select option{
padding: 1px 3px;
}
.dp_cal th, .dp_cal td{
width: 14.2857%;
text-align: center;
font-size: 11px;
padding: 2px 0;
}
.dp_cal th{
border: solid #aad4f2;
border-width: 1px 0;
color: #484848;
background: #EEE;
font-weight: bold;
}
.dp_cal td{
cursor: pointer;
}
.dp_cal thead th{
background: #FFF;
}
.dp_cal td.dp_roll{
color: #FFF;
background: #282858;
}
/* must have this for the IE6 select box hiding */
.dp_hide{
visibility: hidden;
}
.dp_empty{
background: #eee;
}
.dp_today{
background: #F8A000;
}
.dp_selected{
color: #fff;
background: #282858;
}
/*
* DatePicker
* @author Rick Hopkins (http://www.styledisplay.com/mootoolsdatepicker/)
* @modified by Micah Nolte and Martin Vasina
* @modified again by Arian Stolwijk (version 0.4) (http://www.aryweb.nl/voorbeelden/datepicker/, http://www.mooforum.net/scripts12/mootools-date-picker-t666.html)
* @version 0.4
* @classDescription A date picker object. Created with the help of MooTools v1.2.1
* MIT-style License - http://www.opensource.org/licenses/mit-license.php
-- start it up by doing this in your domready:
$$('input.DatePicker').each( function(el){
new DatePicker(el);
});
*/
var DatePicker = new Class({
Implements: [Options],
options: {
dayChars: 2,
dayNames: ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag'],
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
format: 'dd.mm.yyyy',
monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
startDay: 7,
yearOrder: 'asc',
yearRange: 2,
yearStart: (new Date().getFullYear())
},
/* set and create the date picker text box */
initialize: function(dp,options){
this.setOptions(options);
// Finds the entered date, or uses the current date
if(dp.get('value') != '') {
this.then = new Date(dp.value);
this.today = new Date();
} else {
this.then = this.today = new Date();
}
// Set beginning time and today, remember the original
this.oldYear = this.year = this.then.getFullYear();
this.oldMonth = this.month = this.then.getMonth();
this.oldDay = this.then.getDate();
this.nowYear = this.today.getFullYear();
this.nowMonth = this.today.getMonth();
this.nowDay = this.today.getDate();
this.options.monthNames = (this.options.monthNames && this.options.monthNames.length == 12 ? this.options.monthNames : this.options.monthNames) || this.options.monthNames;
this.options.daysInMonth = (this.options.daysInMonth && this.options.daysInMonth.length == 12 ? this.options.daysInMonth : this.options.daysInMonth) || this.options.daysInMonth;
this.options.dayNames = (this.options.dayNames && this.options.dayNames.length == 7 ? this.options.dayNames : this.options.dayNames) || this.options.dayNames;
this.dp = dp;
this.dp.set('id',dp.get('name'));
this.container = this.calendar = this.active = false;
this.dp.addEvents({
'click': function(){this.create()}.bind(this),
'focus': function(){this.create()}.bind(this)
});
},
/* create the calendar */
create: function(fade){
if (this.calendar) return false;
fade = ($type(fade) == 'boolean') ? fade : true;
// IE does not want to fade :S
if(Browser.Engine.trident && Browser.Engine.version <= 5){
fade = false;
}
// Hide select boxes while calendar is up
if(Browser.Engine.trident && Browser.Engine.version <= 4){
$$('select').addClass('dp_hide');
}
/* create the outer container */
this.container = new Element('div', {'class':'dp_container'}).injectBefore(this.dp);
if (fade) {
this.container.fade('hide');
}
/* create the calendar */
this.calendar = new Element('div', {'class':'dp_cal'}).injectInside(this.container);
/* create the date object */
var date = new Date();
/* create the date object */
if (this.month && this.year) {
date.setFullYear(this.year, this.month, 1);
} else {
this.month = date.getMonth();
this.year = date.getFullYear();
date.setDate(1);
}
this.year % 4 == 0 ? this.options.daysInMonth[1] = 29 : this.options.daysInMonth[1] = 28;
/* set the day to first of the month */
var firstDay = (1-(7+date.getDay()-this.options.startDay)%7);
/* create the month select box */
monthSel = new Element('select', {'id':this.dp.get('id') + '_monthSelect'});
this.options.monthNames.each(function(item,index){
monthSel.options[index] = new Element('option', {value: index});
monthSel.options[index].set('text',item);
if (this.month == index) monthSel.options[index].set('selected','selected');
}.bind(this));
/* create the year select box */
yearSel = new Element('select', {'id':this.dp.get('id') + '_yearSelect'});
var years = new Array();
if (this.options.yearOrder == 'desc'){
for (var y = this.options.yearStart; y > (this.options.yearStart - this.options.yearRange - 1); y--){
years.include(y);
}
} else {
for (var y = this.options.yearStart; y < (this.options.yearStart + this.options.yearRange + 1); y++){
years.include(y);
}
}
years.each(function(y,i){
yearSel.options[i] = new Element('option',{value: y});
yearSel.options[i].set('text',y);
if (this.year == y) yearSel.options[i].set('selected','selected');
}.bind(this));
/* start creating calendar */
calTable = new Element('table');
calTableThead = new Element('thead');
calSelRow = new Element('tr');
calSelCell = new Element('th', {'colspan':'7'});
monthSel.injectInside(calSelCell);
yearSel.injectInside(calSelCell);
calSelCell.injectInside(calSelRow);
calSelRow.injectInside(calTableThead);
calTableTbody = new Element('tbody');
/* create day names */
calDayNameRow = new Element('tr');
for (var i = 0; i < this.options.dayNames.length; i++) {
calDayNameCell = new Element('th');
calDayNameCell.appendText(this.options.dayNames[(this.options.startDay+i)%7].substr(0, this.options.dayChars));
calDayNameCell.injectInside(calDayNameRow);
}
calDayNameRow.injectInside(calTableTbody);
/* create the day cells */
while (firstDay <= this.options.daysInMonth[this.month]){
calDayRow = new Element('tr');
for (i = 0; i < 7; i++){
if ((firstDay <= this.options.daysInMonth[this.month]) && (firstDay > 0)){
calDayCell = new Element('td', {'class':this.dp.get('id') + '_calDay', 'axis':this.year + '|' + (parseInt(this.month) + 1) + '|' + firstDay}).appendText(firstDay).injectInside(calDayRow);
} else {
calDayCell = new Element('td', {'class':'dp_empty'}).appendText(' ').injectInside(calDayRow);
}
// Show the previous day
if ( (firstDay == this.oldDay) && (this.month == this.oldMonth ) && (this.year == this.oldYear) ) {
calDayCell.addClass('dp_selected');
}
// Show today
if ( (firstDay == this.nowDay) && (this.month == this.nowMonth ) && (this.year == this.nowYear) ) {
calDayCell.addClass('dp_today');
}
firstDay++;
}
calDayRow.injectInside(calTableTbody);
}
/* table into the calendar div */
calTableThead.injectInside(calTable);
calTableTbody.injectInside(calTable);
calTable.injectInside(this.calendar);
if (fade) {
this.container.fade('in');
}
/* set the onmouseover events for all calendar days */
$$('td.' + this.dp.get('id') + '_calDay').each(function(el){
el.addEvents({
'mouseover': function(){
el.addClass('dp_roll');
},
'mouseout': function(){
el.removeClass('dp_roll');
},
'click': function(){
ds = el.axis.split('|');
this.dp.value = this.formatValue(ds[0], ds[1], ds[2]);
this.remove();
}.bind(this)
});
}.bind(this));
/* set the onchange event for the month & year select boxes */
[monthSel,yearSel].each(function(elmt){
elmt.addEvents({
'focus': function(){
this.active = true;
}.bind(this),
'change': function(){
this.month = monthSel.value;
this.year = yearSel.value;
this.remove(false);
this.create(false);
this.active = false;
this.dp.focus();
}.bind(this)
});
}.bind(this));
this.dp.addEvent('blur',function(){
(function(){
if (!this.active) {
this.remove();
}
}.bind(this)).delay(500);
}.bind(this))
},
/* Format the returning date value according to the selected formation */
formatValue: function(year, month, day){
/* setup the date string variable */
var dateStr = '';
/* check the length of day */
if (day < 10) day = '0' + day;
if (month < 10) month = '0' + month;
/* check the format & replace parts // thanks O'Rey */
dateStr = this.options.format.replace( /dd/i, day ).replace( /mm/i, month ).replace( /yyyy/i, year );
this.month = this.oldMonth = '' + (month - 1) + '';
this.year = this.oldYear = year;
this.oldDay = day;
/* return the date string value */
return dateStr;
},
/* Remove the calendar from the page */
remove: function(fade){
fade = ($type(fade) == 'boolean') ? fade : true;
if(Browser.Engine.trident && Browser.Engine.version <= 5){
fade = false;
}
if ($type(this.container) == 'element') {
if (fade != false) {
this.container.fade('out');
}else{
this.container.dispose();
}
}
this.active = this.container = this.calendar = false;
$$('select.dp_hide').removeClass('dp_hide');
}
});
Element.implement({
DatePicker: function (options){
new DatePicker(this,options);
return this;
}
});
$$('input.DatePicker').DatePicker();
/* Drag & Drop-Funktion based on http://davidwalsh.name/mootools-drag-drop-lock */
document.ondragstart = function () { return false; }; //IE drag hack
//for every dragable image...
$$('.dragable').each(function(drag) {
//this is where we'll save the initial spot of the image
var position = drag.getPosition();
//make it dragable, and set the destination divs
new Drag.Move(drag, {
droppables: '.droppable',
onDrop: function(el,droppable) {
if(droppable){
AjaxRequest.send('modul=01acp&ajaxaction=file_changedir&fileid='+el.id+'&dirid='+droppable.id+'');
droppable.removeClass('dropzone_entered');
this.detach();
}
else{
el.setStyles({'left':0,'top':0,'position':'relative','margin':0}); //hack -- wtf?
}
},
onEnter: function(el,droppable) {
droppable.addClass('dropzone_entered');
},
onLeave: function(el,droppable) {
droppable.removeClass('dropzone_entered');
}
});
});
// our uploader instance
var up = new FancyUpload2($('fancy-status'), $('fancy-list'), { // options object
// we console.log infos, remove that in production!!
verbose: false,
// url is read from the form, so you just have to change one place
url: $('fancy-form').action,
// path to the SWF file
path: 'system/js/Swiff.Uploader.swf',
// remove that line to select all files, or edit it, add more items
typeFilter: {
'Images (*.jpg, *.jpeg, *.gif, *.png)': '*.jpg; *.jpeg; *.gif; *.png'
},
// this is our browse button, *target* is overlayed with the Flash movie
target: 'fancy-browse',
data: {
'ajaxaction': 'fancyupload'
},
// graceful degradation, onLoad is only called if all went well with Flash
onLoad: function() {
$('fancy-status').removeClass('hide'); // we show the actual UI
$('fancy-fallback').destroy(); // ... and hide the plain form
// We relay the interactions with the overlayed flash to the link
this.target.addEvents({
click: function() {
return false;
},
mouseenter: function() {
this.addClass('hover');
},
mouseleave: function() {
this.removeClass('hover');
this.blur();
},
mousedown: function() {
this.focus();
}
});
// Interactions for the 2 other buttons
$('fancy-clear').addEvent('click', function() {
up.remove(); // remove all files
return false;
});
$('fancy-upload').addEvent('click', function() {
up.start(); // start upload
return false;
});
},
// Edit the following lines, it is your custom event handling
/**
* Is called when files were not added, "files" is an array of invalid File classes.
*
* This example creates a list of error elements directly in the file list, which
* hide on click.
*/
onSelectFail: function(files) {
files.each(function(file) {
new Element('li', {
'class': 'validation-error',
html: file.validationErrorMessage || file.validationError,
title: MooTools.lang.get('FancyUpload', 'removeTitle'),
events: {
click: function() {
this.destroy();
}
}
}).inject(this.list, 'top');
}, this);
},
/**
* This one was directly in FancyUpload2 before, the event makes it
* easier for you, to add your own response handling (you probably want
* to send something else than JSON or different items).
*/
onFileSuccess: function(file, response) {
var json = new Hash(JSON.decode(response, true) || {});
if (json.get('status') == '1') {
file.element.addClass('file-success');
file.info.set('html', 'Bild wurde hochgeladen (' + json.get('width') + ' x ' + json.get('height') + 'px)');
} else {
file.element.addClass('file-failed');
file.info.set('html', 'Es trat ein Fehler auf ' + (json.get('error') ? (json.get('error') + ' #' + json.get('code')) : response));
}
},
/**
* onFail is called when the Flash movie got bashed by some browser plugin
* like Adblock or Flashblock.
*/
onFail: function(error) {
switch (error) {
case 'hidden': // works after enabling the movie and clicking refresh
ShowAjaxError('Bitte setzen Sie den Multiuploader auf eine Whitlist in Ihrem Browser, um ihn zu nutzen (Adblock)');
break;
case 'blocked': // This no *full* fail, it works after the user clicks the button
ShowAjaxError('Bitte heben Sie die Blockade des Flash-Plugins auf, um den Multiuploader zu nutzen (Flashblock)');
break;
case 'empty': // Oh oh, wrong path
ShowAjaxError('Systemfehler: Eine Datei konnte nicht gefunden werden');
break;
case 'flash': // no flash 9+ :(
$('fancy-status').destroy();
ShowAjaxError('Um den Multiuploader nutzen zu können muss ein Adobe Flash-Plugin V9 oder höher installiert werden')
}
}
});
// our uploader instance
up = new FancyUpload2($('fancy-status'), $('fancy-list'), { // options object
// we console.log infos, remove that in production!!
verbose: true,
// url is read from the form, so you just have to change one place
url: $('fancy-form').action,
// path to the SWF file
path: 'system/js/Swiff.Uploader.swf',
// this is our browse button, *target* is overlayed with the Flash movie
target: 'fancy-browse',
data: {
'ajaxaction': 'fancyupload'
},
// graceful degradation, onLoad is only called if all went well with Flash
onLoad: function() {
$('fancy-status').removeClass('hide'); // we show the actual UI
$('fancy-fallback').destroy(); // ... and hide the plain form
// We relay the interactions with the overlayed flash to the link
this.target.addEvents({
click: function() {
return false;
},
mouseenter: function() {
this.addClass('hover');
},
mouseleave: function() {
this.removeClass('hover');
this.blur();
},
mousedown: function() {
this.focus();
}
});
// Interactions for the 2 other buttons
$('fancy-clear').addEvent('click', function() {
up.remove(); // remove all files
return false;
});
$('fancy-upload').addEvent('click', function() {
up.start(); // start upload
return false;
});
},
// Edit the following lines, it is your custom event handling
/**
* Is called when files were not added, "files" is an array of invalid File classes.
*
* This example creates a list of error elements directly in the file list, which
* hide on click.
*/
onSelectFail: function(files) {
files.each(function(file) {
new Element('li', {
'class': 'validation-error',
html: file.validationErrorMessage || file.validationError,
title: MooTools.lang.get('FancyUpload', 'removeTitle'),
events: {
click: function() {
this.destroy();
}
}
}).inject(this.list, 'top');
}, this);
},
/**
* This one was directly in FancyUpload2 before, the event makes it
* easier for you, to add your own response handling (you probably want
* to send something else than JSON or different items).
*/
onFileSuccess: function(file, response) {
var json = new Hash(JSON.decode(response, true) || {});
if (json.get('status') == '1') {
file.element.addClass('file-success');
file.info.set('html', 'Datei wurde erfolgreich hochgeladen');
} else {
file.element.addClass('file-failed');
file.info.set('html', 'Es trat ein Fehler auf ' + (json.get('error') ? (json.get('error')) : response));
}
},
/**
* onFail is called when the Flash movie got bashed by some browser plugin
* like Adblock or Flashblock.
*/
onFail: function(error) {
switch (error) {
case 'hidden': // works after enabling the movie and clicking refresh
ShowAjaxError('Bitte setzen Sie den Multiuploader auf eine Whitlist in Ihrem Browser, um ihn zu nutzen (Adblock)');
break;
case 'blocked': // This no *full* fail, it works after the user clicks the button
ShowAjaxError('Bitte heben Sie die Blockade des Flash-Plugins auf, um den Multiuploader zu nutzen (Flashblock)');
break;
case 'empty': // Oh oh, wrong path
ShowAjaxError('Systemfehler: Eine Datei konnte nicht gefunden werden');
break;
case 'flash': // no flash 9+ :(
$('fancy-status').destroy();
ShowAjaxError('Um den Multiuploader nutzen zu können muss ein Adobe Flash-Plugin V9 oder höher installiert werden')
}
}
});
var r = new MooRainbow('myRainbow', {
'startColor': [58, 142, 246],
'onChange': function(color) {
$('HEXColorCode').value = color.hex;
}
});
ReMooz.assign('a.lightbox', {
'origin': 'img',
'shadow': 'onOpenEnd', // fx is faster because shadow appears after resize animation
'resizeFactor': 0.8, // resize to maximum 80% of screen size
'cutOut': false, // don't hide the original
'opacityResize': 0.4, // opaque resize
'dragging': false, // disable dragging
'centered': true // resize to center of the screen, not relative to the source element
});
var links = $$('img.fx_opener,div.fx_opener,td.fx_opener,tr.fx_opener');
var contents = $$('div.fx_content');
contents.set('slide',{
duration:600,
mode: 'horizontal'
});
contents.slide('hide');
contents.setStyle('display','block');
links.addEvent('click',function(e){
e.stop();
var index = links.indexOf(this);
if(!contents.some(function(content,i){
var slide = content.get('slide');
if(slide.open && i != index){
slide.slideOut().chain(function(){links[index].fade(0); setTimeout(function(){ links[index].setStyle('display','none') },300); contents[index].slide('in'); setTimeout(function(){ links[i].setStyle('display','block') },600); setTimeout(function(){ links[i].fade(1) },400); });
return true;
}
})){
links[index].fade(0);
setTimeout(function(){ links[index].setStyle('display','none') },300);
setTimeout(function(){ contents[index].slide('in') },400);
}
});
contents.addEvent('click',function(e){
var index = contents.indexOf(this);
contents[index].slide('toggle');
setTimeout(function(){ links[index].setStyle('display','block') },600);
setTimeout(function(){ links[index].fade(1) },400);
});
var links = $$('tr.fx_opener');
var contents = $$('tr.fx_content');
contents.set('slide',{
duration:600
});
contents.slide('hide');
//contents.setStyle('display','none');
links.addEvent('click',function(e){
e.stop();
var index = links.indexOf(this);
if(!contents.some(function(content,i){
var slide = content.get('slide');
if(slide.open && i != index){
slide.slideOut().chain(function(){contents[index].slide('in')});
return true;
}
})){
contents[index].slide('toggle');
}
contents[index].setStyle('display','table-row');
});
var mySortables = new Sortables('sortliste', {
revert: { duration: 500, transition: 'elastic:out' },
onComplete: function(){
$('sortdatafield' ).value = this.serialize(); }
});
/*
Script: MooTools.Lang.js
Provides methods for localization.
License:
MIT-style license.
Authors:
Aaron Newton
*/
(function(){
var data = {
language: 'en-US',
languages: {
'en-US': {}
},
cascades: ['en-US']
};
var cascaded;
MooTools.lang = new Events();
$extend(MooTools.lang, {
setLanguage: function(lang){
if (!data.languages[lang]) return this;
data.language = lang;
this.load();
this.fireEvent('langChange', lang);
return this;
},
load: function() {
var langs = this.cascade(this.getCurrentLanguage());
cascaded = {};
$each(langs, function(set, setName){
cascaded[setName] = this.lambda(set);
}, this);
},
getCurrentLanguage: function(){
return data.language;
},
addLanguage: function(lang){
data.languages[lang] = data.languages[lang] || {};
return this;
},
cascade: function(lang){
var cascades = (data.languages[lang] || {}).cascades || [];
cascades.combine(data.cascades);
cascades.erase(lang).push(lang);
var langs = cascades.map(function(lng){
return data.languages[lng];
}, this);
return $merge.apply(this, langs);
},
lambda: function(set) {
(set || {}).get = function(key, args){
return $lambda(set[key]).apply(this, $splat(args));
};
return set;
},
get: function(set, key, args){
if (cascaded && cascaded[set]) return (key ? cascaded[set].get(key, args) : cascaded[set]);
},
set: function(lang, set, members){
this.addLanguage(lang);
langData = data.languages[lang];
if (!langData[set]) langData[set] = {};
$extend(langData[set], members);
if (lang == this.getCurrentLanguage()){
this.load();
this.fireEvent('langChange', lang);
}
return this;
},
list: function(){
return Hash.getKeys(data.languages);
}
});
})();
/***
* - mooRainbow: defaultCSS
* author: w00fz <w00fzIT@gmail.com>
*/
#mooRainbow { font-size: 11px; color: #000; }
.moor-box {
width: 390px;
height: 310px;
border: 1px solid #636163;
background-color: #f9f9f9;
}
.moor-overlayBox {
width: 256px; /* Width and Height of the overlay must be setted here: default 256x256 */
height: 256px;
margin-top: 9px;
margin-left: 9px;
border: 1px solid #000;
}
.moor-slider {
border: 1px solid #000;
margin-top: 9px;
margin-left: 280px;
width: 19px; /* if you want a bigger or smaller slider... */
height: 256px;
}
.moor-colorBox {
border: 1px solid #000;
width: 59px;
height: 68px;
margin-top: 20px;
margin-left: 315px;
}
.moor-currentColor { /* Bottom Box Color, the backup one */
margin-top: 55px;
margin-left: 316px;
width: 59px;
height: 34px;
}
.moor-okButton {
font-family: Tahoma;
font-weight: bold;
font-size: 11px;
margin-top: 278px;
margin-left: 8px;
background: #e6e6e6;
height: 23px;
border: 1px solid #d6d6d6;
border-left-color: #f5f5f5;
border-top-color: #f5f5f5;
}
#mooRainbow label {
font-family: mono;
}
/* Following are just <label> */
.moor-rLabel {
margin-top: 100px;
margin-left: 315px;
}
.moor-gLabel {
margin-top: 125px;
margin-left: 315px;
}
.moor-bLabel {
margin-top: 150px;
margin-left: 315px;
}
.moor-HueLabel {
margin-top: 190px;
margin-left: 315px;
}
span.moor-ballino { /* Style hue ° (degree) !! */
margin-top: 190px;
margin-left: 370px;
}
.moor-SatuLabel {
margin-top: 215px;
margin-left: 315px;
}
.moor-BrighLabel {
margin-top: 240px;
margin-left: 315px;
}
.moor-hexLabel {
margin-top: 275px;
margin-left: 280px;
}
/* <input> */
.moor-rInput, .moor-gInput, .moor-bInput, .moor-HueInput, .moor-SatuInput, .moor-BrighInput {
width: 30px;
}
.moor-hexInput {
width: 55px;
}
.moor-cursor {
background-image: url(images/moo/rainbow/moor_cursor.gif);
width: 12px;
height: 12px;
}
.moor-arrows {
background-image: url(images/moo/rainbow/moor_arrows.gif);
top: 9px;
left: 270px;
width: 41px;
height: 9px;
}
.moor-chooseColor { /* Top Box Color, the choosen one */
margin-top: 21px;
margin-left: 316px;
width: 59px;
height: 34px;
}
.remooz-element
{
cursor: -moz-zoom-in;
}
/**
* Box layout
*/
.remooz-box
{
position: absolute;
top: 0;
left: 0;
background: #fff no-repeat center;
z-index: 100;
}
.remooz-loading
{
background-image: url(../../images/moo/remooz/spinner.gif);
}
.remooz-body
{
width: 100%;
height: 100%;
}
.remooz-box-focus.remooz-type-image .remooz-body
{
cursor: -moz-zoom-out;
}
.remooz-box-dragging .remooz-body
{
cursor: move;
}
/**
* Close button
*/
.remooz-btn-close
{
position: absolute;
left: -15px;
top: -15px;
width: 30px;
height: 30px;
text-decoration: none;
border: 0;
background: url(../../images/moo/remooz/closebox.png) no-repeat center;
visibility: hidden;
cursor: pointer;
}
.remooz-engine-trident4 .remooz-btn-close
{
background-image: url(../../images/moo/remooz/closebox.gif);
}
/**
* Caption title
*/
.remooz-title
{
position: relative;
left: 0;
top: 15px;
text-align: left;
}
.remooz-title-bg
{
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
z-index: 99;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
/* shadow opacity differs from box shadow because its default set to opacity 0.8 */
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
}
.remooz-title-content
{
position: relative;
padding: 5px 15px;
color: #fff;
z-index: 101;
font: 11px/1.5 Verdana, Geneva, Arial, Helvetica, sans-serif;
}
.remooz-engine-trident4 .remooz-title-bg
{
display: none;
}
.remooz-engine-trident4 .remooz-title-content
{
background-color: #333;
}
.remooz-title-content h6
{
padding: 0;
font-size: 1.2em;
font-weight: bold;
color: #eee;
}
.remooz-title-content p
{
padding: 0;
color: #eee;
}
/**
* Type specific
*/
.remooz-type-image img
{
display: block;
border: 0;
width: 100%;
height: 100%;
}
/**
* Shadow
*/
.remooz-bg
{
position: absolute;
width: 33px;
height: 40px;
}
.remooz-bg-n
{
left: 0;
top: -40px;
width: 100%;
background: url(../../images/moo/remooz/remo_bg_n.png) repeat-x;
}
.remooz-bg-ne
{
right: -33px;
top: -40px;
background: url(../../images/moo/remooz/remo_bg_ne.png) no-repeat;
}
.remooz-bg-e
{
right: -33px;
top: 0;
height: 100%;
background: url(../../images/moo/remooz/remo_bg_e.png) repeat-y;
}
.remooz-bg-se
{
right: -33px;
bottom: -40px;
background: url(../../images/moo/remooz/remo_bg_se.png) no-repeat;
}
.remooz-bg-s
{
left: 0;
bottom: -40px;
width: 100%;
background: url(../../images/moo/remooz/remo_bg_s.png) repeat-x;
}
.remooz-bg-sw
{
left: -33px;
bottom: -40px;
background: url(../../images/moo/remooz/remo_bg_sw.png) no-repeat;
}
.remooz-bg-w
{
left: -33px;
top: 0;
height: 100%;
background: url(../../images/moo/remooz/remo_bg_w.png) repeat-y;
}
.remooz-bg-nw
{
left: -33px;
top: -40px;
background: url(../../images/moo/remooz/remo_bg_nw.png) no-repeat;
}
/**
* ReMooz - Zoomer
*
* Inspired by so many boxes and zooms
*
* @version 1.0
*
* @license MIT-style license
* @author Harald Kirschner <mail [at] digitarald.de>
* @copyright Author
*/
var ReMooz = new Class({
Implements: [Events, Options, Chain],
options: {
link: null,
type: 'image',
container: null,
className: null,
centered: false,
dragging: true,
closeOnClick: true,
shadow: (Browser.Engine.trident) ? 'onOpenEnd' : 'onOpen', // performance
resize: true,
margin: 20,
resizeFactor: 0.95,
resizeLimit: false, // {x: 640, y: 640}
fixedSize: false,
cutOut: true,
addClick: true,
opacityLoad: 0.6,
opacityResize: 1,
opacityTitle: 0.9,
resizeOptions: {},
fxOptions: {},
closer: true,
parse: false, // 'rel'
parseSecure: false,
temporary: false,
onBuild: $empty,
onLoad: $empty,
onOpen: $empty,
onOpenEnd: $empty,
onClose: $empty,
onCloseEnd: $empty,
generateTitle: function(el) {
var text = el.get('title');
if (!text) return false;
var title = text.split(' :: ');
var head = new Element('h6', {'html': title[0]});
return (title[1]) ? [head, new Element('p', {'html': title[1]})] : head;
}
},
initialize: function(element, options) {
this.element = $(element);
this.setOptions(options);
if (this.options.parse) {
var obj = this.element.getProperty(this.options.parse);
if (obj && (obj = JSON.decode(obj, this.options.parseSecure))) this.setOptions(obj);
}
var origin = this.options.origin;
this.origin = ((origin) ? $(origin) || this.element.getElement(origin) : null) || this.element;
this.link = this.options.link || this.element.get('href') || this.element.get('src');
this.container = $(this.options.container) || this.element.getDocument();
this.bound = {
'click': function(e) {
this.open.delay(1, this);
return false;
}.bind(this),
'close': this.close.bind(this),
'dragClose': function(e) {
if (e.rightClick) return;
this.close();
}.bind(this)
};
if (this.options.addClick) this.bindToElement();
},
destroy: function() {
if (this.box) this.box.destroy();
this.box = this.tweens = this.body = this.content = null;
},
bindToElement: function(element) {
($(element) || this.element).addClass('remooz-element').addEvent('click', this.bound.click);
return this;
},
getOriginCoordinates: function() {
var coords = this.origin.getCoordinates();
delete coords.right;
delete coords.bottom;
return coords;
},
open: function(e) {
if (this.opened) return (e) ? this.close() : this;
this.opened = this.loading = true;
if (!this.box) this.build();
this.coords = this.getOriginCoordinates();
this.coords.opacity = this.options.opacityLoad;
this.coords.display = '';
this.tweens.box.set(this.coords);
this.box.addClass('remooz-loading');
ReMooz.open(this.fireEvent('onLoad'));
this['open' + this.options.type.capitalize()]();
return this;
},
finishOpen: function() {
this.tweens.fade.start(0, 1);
this.drag.attach();
this.fireEvent('onOpenEnd').callChain();
},
close: function() {
if (!this.opened) return this;
this.opened = false;
ReMooz.close(this.fireEvent('onClose'));
if (this.loading) {
this.box.setStyle('display', 'none');
return this;
}
this.drag.detach();
this.tweens.fade.cancel().set(0).fireEvent('onComplete');
if (this.tweens.box.timer) this.tweens.box.clearChain();
var vars = this.getOriginCoordinates();
if (this.options.opacityResize != 1) vars.opacity = this.options.opacityResize;
this.tweens.box.start(vars).chain(this.closeEnd.bind(this));
return this;
},
closeEnd: function() {
if (this.options.cutOut) this.element.setStyle('visibility', 'visible');
this.box.setStyle('display', 'none');
this.fireEvent('onCloseEnd').callChain();
if (this.options.temporary) this.destroy();
},
openImage: function() {
var tmp = new Image();
tmp.onload = tmp.onabort = tmp.onerror = function(fast) {
this.loading = tmp.onload = tmp.onabort = tmp.onerror = null;
if (!tmp.width || !this.opened) {
this.fireEvent('onError').close();
return;
}
var to = {x: tmp.width, y: tmp.height};
if (!this.content) this.content = $(tmp).inject(this.body);
else tmp = null;
this[(this.options.resize) ? 'zoomRelativeTo' : 'zoomTo'].create({
'delay': (tmp && fast !== true) ? 1 : null,
'arguments': [to],
'bind': this
})();
}.bind(this);
tmp.src = this.link;
if (tmp && tmp.complete && tmp.onload) tmp.onload(true);
},
/**
* @todo Test implementation
*/
openElement: function() {
this.content = this.content || $(this.link) || $E(this.link);
if (!this.content) {
this.fireEvent('onError').close();
return;
}
this.content.inject(this.body);
this.zoomTo({x: this.content.scrollWidth, y: this.content.scrollHeight});
},
zoomRelativeTo: function(to) {
var scale = this.options.resizeLimit;
if (!scale) {
scale = this.container.getSize();
scale.x *= this.options.resizeFactor;
scale.y *= this.options.resizeFactor;
}
for (var i = 2; i--;) {
if (to.x > scale.x) {
to.y *= scale.x / to.x;
to.x = scale.x;
} else if (to.y > scale.y) {
to.x *= scale.y / to.y;
to.y = scale.y;
}
}
return this.zoomTo({x: to.x.toInt(), y: to.y.toInt()});
},
zoomTo: function(to) {
to = this.options.fixedSize || to;
var box = this.container.getSize(), scroll = this.container.getScroll();
var pos = (!this.options.centered) ? {
x: (this.coords.left + (this.coords.width / 2) - to.x / 2).toInt()
.limit(scroll.x + this.options.margin, scroll.x + box.x - this.options.margin - to.x),
y: (this.coords.top + (this.coords.height / 2) - to.y / 2).toInt()
.limit(scroll.y + this.options.margin, scroll.y + box.y - this.options.margin - to.y)
} : {
x: scroll.x + ((box.x - to.x) / 2).toInt(),
y: scroll.y + ((box.y - to.y) / 2).toInt()
};
if (this.options.cutOut) this.element.setStyle('visibility', 'hidden');
this.box.removeClass('remooz-loading');
var vars = {left: pos.x, top: pos.y, width: to.x, height: to.y};
if (this.options.opacityResize != 1) vars.opacity = [this.options.opacityResize, 1];
else this.box.set('opacity', 1);
this.tweens.box.start(vars).chain(this.finishOpen.bind(this));
this.fireEvent('onOpen');
},
build: function() {
this.addEvent('onBlur', function() {
this.focused = false;
this.box.removeClass('remooz-box-focus').setStyle('z-index', ReMooz.options.zIndex);
}, true);
this.addEvent('onFocus', function() {
this.focused = true;
this.box.addClass('remooz-box-focus').setStyle('z-index', ReMooz.options.zIndexFocus);
}, true);
var classes = ['remooz-box', 'remooz-type-' + this.options.type, 'remooz-engine-' + Browser.Engine.name + Browser.Engine.version];
if (this.options.className) classes.push(this.options.className);
this.box = new Element('div', {
'class': classes.join(' '),
'styles': {
'display': 'none',
'top': 0,
'left': 0,
'zIndex': ReMooz.options.zIndex
}
});
this.tweens = {
'box': new Fx.Morph(this.box, $merge({
'duration': 400,
'unit': 'px',
'transition': Fx.Transitions.Quart.easeOut,
'chain': 'cancel'
}, this.options.resizeOptions)
),
'fade': new Fx.Tween(null, $merge({
'property': 'opacity',
'duration': (Browser.Engine.trident) ? 0 : 300,
'chain': 'cancel'
}, this.options.fxOptions)).addEvents({
'onComplete': function() {
if (!this.element.get('opacity')) this.element.setStyle('display', 'none');
},
'onStart': function() {
if (!this.element.get('opacity')) this.element.setStyle('display', '');
}
}
)
};
this.tweens.fade.element = $$();
if (this.options.shadow) {
if (Browser.Engine.webkit420) {
this.box.setStyle('-webkit-box-shadow', '0 0 10px rgba(0, 0, 0, 0.7)');
} else if (!Browser.Engine.trident4) {
var shadow = new Element('div', {'class': 'remooz-bg-wrap'}).inject(this.box);
['n', 'ne', 'e', 'se', 's', 'sw', 'w', 'nw'].each(function(dir) {
new Element('div', {'class': 'remooz-bg remooz-bg-' + dir}).inject(shadow);
});
this.tweens.bg = new Fx.Tween(shadow, {
'property': 'opacity',
'chain': 'cancel'
}).set(0);
this.addEvent(this.options.shadow, this.tweens.bg.set.bind(this.tweens.bg, 1), true);
this.addEvent('onClose', this.tweens.bg.set.bind(this.tweens.bg, 0), true);
}
}
if (this.options.closer) {
var closer = new Element('a', {
'class': 'remooz-btn-close',
'events': {'click': this.bound.close}
}).inject(this.box);
this.tweens.fade.element.push(closer);
}
this.body = new Element('div', {'class': 'remooz-body'}).inject(this.box);
var title = this.options.title || this.options.generateTitle.call(this, this.element);
if (title) { // thx ie6
var title = new Element('div', {'class': 'remooz-title'}).adopt(
new Element('div', {'class': 'remooz-title-bg', 'opacity': this.options.opacityTitle}),
new Element('div', {'class': 'remooz-title-content'}).adopt(title)
).inject(this.box);
this.tweens.fade.element.push(title);
}
this.tweens.fade.set(0).fireEvent('onComplete');
this.drag = new Drag.Move(this.box, {
'snap': 15,
'preventDefault': true,
'onBeforeStart': function() {
if (!this.focused && !this.loading) ReMooz.focus(this);
else if (this.loading || this.options.closeOnClick) this.box.addEvent('mouseup', this.bound.dragClose);
}.bind(this),
'onSnap': function() {
this.box.removeEvent('mouseup', this.bound.dragClose);
if (!this.options.dragging) this.drag.stop();
else this.box.addClass('remooz-box-dragging');
}.bind(this),
'onComplete': function() {
this.box.removeClass('remooz-box-dragging');
}.bind(this)
});
this.drag.detach();
this.fireEvent('onBuild', this.box, this.element);
this.box.inject(this.element.getDocument().body);
}
});
ReMooz.factory = function(extended) {
return $extend(this, extended);
};
ReMooz.factory(new Options).factory({
options: {
zIndex: 41,
zIndexFocus: 42,
query: 'a.remooz',
modal: false
},
assign: function(elements, options) {
return $$(elements).map(function(element) {
return new ReMooz(element, options);
}, this);
},
stack: [],
open: function(obj) {
var last = this.stack.getLast();
this.focus(obj);
if (last && this.options.modal) last.close();
},
close: function(obj) {
var length = this.stack.length - 1;
if (length > 1 && this.stack[length] == obj) this.focus(this.stack[length - 1]);
this.stack.erase(obj);
},
focus: function(obj) {
var last = this.stack.getLast();
obj.fireEvent('onFocus', [obj]);
if (last == obj) return;
if (last) last.fireEvent('onBlur', [last]);
this.stack.erase(obj).push(obj);
}
});
/*
01ACP - Copyright 2009 by Michael Lorer - 01-Scripts.de
Lizenz: Creative-Commons: Namensnennung-Keine kommerzielle Nutzung-Weitergabe unter gleichen Bedingungen 3.0 Deutschland
Weitere Lizenzinformationen unter: http://www.01-scripts.de/lizenz.php
Modul: 01ACP
Dateiinfo: JS-Funktionen für Ajax-MooTools-Requests
#fv.1101#
*/
// Überprüfen ob eine Funktion existiert
function function_exists(fName, pObj) {
if(!pObj) pObj = window;
return (typeof pObj[fName] == 'function') ? true : false;
}
// Standard Ladeanimation (Animation einblenden) (für Ajax-Requests)
function Start_Loading_standard() {
$$('div.ajax_loading').fade(1);
}
// Standard Ladeanimation (Animation ausblenden) (für Ajax-Requests)
function Stop_Loading_standard() {
$$('div.ajax_loading').fade(0);
}
// Standard Erfolgsmeldung (für Ajax-Requests)
function Success_standard() {
$$('div.ajax_erfolg').fade(1);
setTimeout(function(){ $$('div.ajax_erfolg').fade(0); },2000);
}
// Löschen erfolgreich + TR ausblenden
function Success_delfade(rowid) {
temp = document.getElementById(rowid);
$$('div.ajax_erfolg').fade(1);
//temp.fade(0);
//setTimeout(function(){ temp.setStyle('display','none'); },600);
setTimeout(function(){ temp.style.display = 'none'; },600);
setTimeout(function(){ $$('div.ajax_erfolg').fade(0); },2000);
}
// Löschen nicht erfolgreich / andere Standardfehlermeldung
function Failed_delfade() {
$$('div.ajax_error').fade(1);
setTimeout(function(){ $$('div.ajax_error').fade(0); },5000);
}
// Ajax Fehlertext anzeigen
function ShowAjaxError(message) {
$$('div.ajax_meldung').fade(1);
$$('div.ajax_meldung').set('html', message);
setTimeout(function(){ $$('div.ajax_meldung').fade(0); },5000);
}
// Kommentar erfolgreich freigeschaltet
function Success_CFree(id) {
//document.getElementById(id).fade(0);
document.getElementById(id).style.display = 'none';
$$('div.ajax_erfolg').fade(1);
setTimeout(function(){ $$('div.ajax_erfolg').fade(0); },2000);
}
// Einfacher Ajax-Request
var AjaxRequest = new Request({
method: 'post',
url: '_ajaxloader.php',
evalScripts: true,
onSuccess: function(response) {
}
});
@01-Scripts
Copy link
Author

Es handelt sich hierbei um die unkomprimierten JavaScript-Dateien aus dem Download von 01-Scripts.de
Alle hier aufgeführten Dateien befinden sich im Verzeichnis
01scripts/01acp/system/js/*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment