Skip to content
Code-Schnipsel Gruppen Projekte

Revisionen vergleichen

Änderungen werden so angezeigt, als ob die Quellrevision mit der Zielrevision zusammengeführt würde. Erfahre mehr über den Vergleich von Revisionen.

Quelle

Zielprojekt auswählen
No results found

Ziel

Zielprojekt auswählen
  • quiqqer/qui
1 Ergebnis
Änderungen anzeigen
Commits auf Quelle (180)
werden angezeigt mit 685 Ergänzungen und 619 Löschungen
# Ignore developer files when exporting
.gitattributes export-ignore
.gitignore export-ignore
.gitlab-ci.yml export-ignore
.phive export-ignore
captainhook.json export-ignore
# Explicitly set file type and line endings for PHP files, improves git diff output
*.php text eol=lf diff=php
include:
- project: 'quiqqer/stabilization/semantic-release'
file: '/ci-templates/.gitlab-ci.yml'
- component: dev.quiqqer.com/quiqqer/stabilization/ci-cd-components/quiqqer-package-bundle/quiqqer-package-bundle@2
phpcs:
rules:
- when: never
phpstan:
rules:
- when: never
php-syntax-check-8.1:
rules:
- when: never
php-syntax-check-8.2:
rules:
- when: never
php-syntax-check-8.3:
rules:
- when: never
# Remove the entire phpunit-php8.1 block, to allow PHPUnit to run on PHP 8.1 in your pipeline
phpunit-php8.1:
rules:
- when: never
# Remove the entire phpunit-php8.2 block, to allow PHPUnit to run on PHP 8.2 in your pipeline
phpunit-php8.2:
rules:
- when: never
# Remove the entire phpunit-php8.3 block, to allow PHPUnit to run on PHP 8.3 in your pipeline
phpunit-php8.3:
rules:
- when: never
# Contributing
This package follows the [QUIQQER contribution guidelines](https://dev.quiqqer.com/quiqqer/stabilization/documentation/-/wikis/home).
\ No newline at end of file
......@@ -7,8 +7,8 @@
* @require qui/classes/Locale
*/
define('qui/Locale', ['qui/classes/Locale'], function (QUILocale) {
"use strict";
define('qui/Locale', ['qui/classes/Locale'], function(QUILocale) {
'use strict';
if (typeof window.QUILocale === 'undefined') {
window.QUILocale = new QUILocale();
......
......@@ -6,8 +6,8 @@
* @author www.pcsg.de (Henning Leutz)
*/
define('qui/QUI', ['qui/classes/QUI'], function (QUIClass) {
"use strict";
define('qui/QUI', ['qui/classes/QUI'], function(QUIClass) {
'use strict';
if (typeof window.QUI === 'undefined') {
window.QUI = new QUIClass();
......@@ -15,7 +15,7 @@ define('qui/QUI', ['qui/classes/QUI'], function (QUIClass) {
document.fireEvent('qui-loaded');
document.addEvent('domready', function () {
document.addEvent('domready', function() {
window.QUI.parse(document.body);
});
......
......@@ -12,8 +12,8 @@
* @event onSetAttribute [key, value]
*/
define('qui/classes/DOM', function () {
"use strict";
define('qui/classes/DOM', function() {
'use strict';
window.$quistorage = {};
......@@ -31,12 +31,12 @@ define('qui/classes/DOM', function () {
return new Class({
Implements: [Options, Events],
Type : 'qui/classes/DOM',
Type: 'qui/classes/DOM',
options: {},
$uid : null,
$uid: null,
initialize: function (options) {
initialize: function(options) {
options = options || {};
if (options.events) {
......@@ -59,7 +59,7 @@ define('qui/classes/DOM', function () {
* @method qui/classes/DOM#getId
* @return {String} Object ID
*/
getId: function () {
getId: function() {
if (!this.$uid) {
this.$uid = String.uniqueID();
}
......@@ -73,7 +73,7 @@ define('qui/classes/DOM', function () {
* @method qui/classes/DOM#getType
* @return {String} The type of the object
*/
getType: function () {
getType: function() {
if (typeof this.Type !== 'undefined') {
return this.Type;
}
......@@ -93,7 +93,7 @@ define('qui/classes/DOM', function () {
*
* @return {Object} this (qui/classes/DOM)
*/
setAttribute: function (k, v) {
setAttribute: function(k, v) {
this.fireEvent('setAttribute', [k, v]);
if (typeof this.options[k] !== 'undefined') {
......@@ -121,7 +121,7 @@ define('qui/classes/DOM', function () {
*
* @method qui/classes/DOM#destroy
*/
destroy: function () {
destroy: function() {
this.fireEvent('destroy', [this]);
// storage clear
......@@ -140,7 +140,7 @@ define('qui/classes/DOM', function () {
* @see qui/classes/DOM#setAttributes()
* @method qui/classes/DOM#setOptions
*/
setOptions: function (options) {
setOptions: function(options) {
this.setAttributes(options);
},
......@@ -157,7 +157,7 @@ define('qui/classes/DOM', function () {
* attr2 : []
* })
*/
setAttributes: function (attributes) {
setAttributes: function(attributes) {
attributes = attributes || {};
for (var k in attributes) {
......@@ -177,7 +177,7 @@ define('qui/classes/DOM', function () {
* @param {String} k - name of the attribute
* @return {String|Boolean|Array|Object} attribute
*/
getAttribute: function (k) {
getAttribute: function(k) {
if (k in this.options) {
return this.options[k];
}
......@@ -202,7 +202,7 @@ define('qui/classes/DOM', function () {
* @see qui/classes/DOM#getAttributes()
* @deprecated
*/
getAllAttributes: function () {
getAllAttributes: function() {
return this.getAttributes();
},
......@@ -212,7 +212,7 @@ define('qui/classes/DOM', function () {
* @method qui/classes/DOM#getAttributes
* @return {Object} attributes
*/
getAttributes: function () {
getAttributes: function() {
return this.options;
},
......@@ -221,7 +221,7 @@ define('qui/classes/DOM', function () {
*
* @return {Object}
*/
getStorageAttributes: function () {
getStorageAttributes: function() {
var oid = Slick.uidOf(this);
if (oid in window.$quistorage) {
......@@ -238,7 +238,7 @@ define('qui/classes/DOM', function () {
* @param {String} k - wanted attribute
* @return {Boolean} true or false
*/
existAttribute: function (k) {
existAttribute: function(k) {
if (typeof this.options[k] !== 'undefined') {
return true;
}
......@@ -255,7 +255,7 @@ define('qui/classes/DOM', function () {
* @param {String} eventname - wanted event
* @return {Array|Boolean} Event list
*/
getEvents: function (eventname) {
getEvents: function(eventname) {
if (typeof this.$events === 'undefined') {
return false;
}
......
......@@ -7,8 +7,8 @@
* @event onError [ {String}, {this} ] - triggered if no_translation === false and no translation exist
*/
define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
"use strict";
define('qui/classes/Locale', ['qui/classes/DOM'], function(DOM) {
'use strict';
/**
* @class qui/classes/Locale
......@@ -18,7 +18,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
return new Class({
Extends: DOM,
Type : 'qui/classes/Locale',
Type: 'qui/classes/Locale',
/**
* Current lang, use getCurrent() to get the lang
......@@ -42,7 +42,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
*
* @param options - dom options
*/
initialize: function (options) {
initialize: function(options) {
this.parent(options);
},
......@@ -52,7 +52,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
* @method qui/classes/Locale#setCurrent
* @param {String} lang
*/
setCurrent: function (lang) {
setCurrent: function(lang) {
this.current = lang;
},
......@@ -62,7 +62,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
* @method qui/classes/Locale#getCurrent
* @return {String}
*/
getCurrent: function () {
getCurrent: function() {
return this.current;
},
......@@ -71,7 +71,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
*
* @returns {Array}
*/
getGroups: function () {
getGroups: function() {
if (!(this.current in this.langs)) {
return [];
}
......@@ -92,7 +92,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
* @example Locale.set("en", "my/group", "my.translation.variable", "Some text is translated")
* @example Locale.set("de", "my/group", "my.translation.variable", "Ein Text der übersetzt wird")
*/
set: function (lang, group, values, value) {
set: function(lang, group, values, value) {
if (!this.langs[lang]) {
this.langs[lang] = {};
}
......@@ -132,7 +132,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
* placeholder : 'my replace'
* })
*/
get: function (group, value, repl) {
get: function(group, value, repl) {
if (typeof repl === 'undefined') {
return this.$get(group, value);
}
......@@ -142,7 +142,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
for (group in repl) {
if (repl.hasOwnProperty(group)) {
result = result.replace(
new RegExp('\\[' + group + '\\]', "g"),
new RegExp('\\[' + group + '\\]', 'g'),
repl[group]
);
}
......@@ -160,7 +160,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
* @param {String} value - Translation value / name
* @return {String}
*/
$get: function (key, value) {
$get: function(key, value) {
if (this.no_translation) {
return '[' + key + '] ' + value;
}
......@@ -193,7 +193,7 @@ define('qui/classes/Locale', ['qui/classes/DOM'], function (DOM) {
*
* @returns {Boolean}
*/
exists: function (group, value) {
exists: function(group, value) {
if (this.langs[this.current] &&
this.langs[this.current][group] &&
this.langs[this.current][group][value]) {
......
......@@ -15,11 +15,11 @@
*/
// workaround for typeof() function because of mootools 1.4 / 1.5 to 1.6
window.typeOf = function (i) {
"use strict";
window.typeOf = function(i) {
'use strict';
if (i === null || i === undefined) {
return "null";
return 'null';
}
if (typeof i.getType === 'function') {
......@@ -32,19 +32,19 @@ window.typeOf = function (i) {
if (i.nodeName) {
if (i.nodeType === 1) {
return "element";
return 'element';
}
if (i.nodeType === 3) {
return (/\S/).test(i.nodeValue) ? "textnode" : "whitespace";
return (/\S/).test(i.nodeValue) ? 'textnode' : 'whitespace';
}
} else {
if (typeof i.length == "number") {
if (typeof i.length == 'number') {
if (i.callee) {
return "arguments";
return 'arguments';
}
if ("item" in i) {
return "collection";
if ('item' in i) {
return 'collection';
}
}
}
......@@ -64,8 +64,8 @@ define('qui/classes/QUI', [
'qui/lib/polyfills/Promise',
'qui/lib/polyfills/AnimationFrame'
], function (require, DOM, Controls, Windows, Storage, Animate, QUIFunctionUtils) {
"use strict";
], function(require, DOM, Controls, Windows, Storage, Animate, QUIFunctionUtils) {
'use strict';
/**
* The QUIQQER main object
......@@ -77,14 +77,14 @@ define('qui/classes/QUI', [
return new Class({
Extends: DOM,
Type : 'qui/classes/QUI',
Type: 'qui/classes/QUI',
initialize: function (options) {
initialize: function(options) {
/**
* defaults
*/
this.setAttributes({
'debug' : false,
'debug': false,
'fetchErrors': true
});
......@@ -120,25 +120,25 @@ define('qui/classes/QUI', [
}
this.Controls = new Controls();
this.Windows = new Windows();
this.Storage = new Storage();
this.Windows = new Windows();
this.Storage = new Storage();
const Ghost = new Element('div', {
styles: {
background: 'transparent',
display : 'none',
height : '100%',
left : 0,
position : 'fixed',
top : 0,
width : '100%',
zIndex : 1
display: 'none',
height: '100%',
left: 0,
position: 'fixed',
top: 0,
width: '100%',
zIndex: 1
}
});
// global resize event
if (typeof window !== 'undefined') {
let win = document.id(window);
let win = document.id(window);
let body = document.id(document.body);
win.requestAnimationFrame(() => {
......@@ -149,7 +149,7 @@ define('qui/classes/QUI', [
this.$winScroll = win.getScroll();
if (typeof body !== 'undefined' && body) {
this.$bodySize = body.getSize();
this.$bodySize = body.getSize();
this.$bodyScroll = body.getScrollSize();
}
......@@ -159,7 +159,7 @@ define('qui/classes/QUI', [
});
win.addEvent('resize', QUIFunctionUtils.debounce(() => {
win.requestAnimationFrame(function () {
win.requestAnimationFrame(function() {
if (typeof body === 'undefined' || !body) {
body = document.id(document.body);
}
......@@ -168,8 +168,8 @@ define('qui/classes/QUI', [
this.$winSize = Ghost.getSize();
Ghost.setStyle('display', 'none');
this.$winScroll = win.getScroll();
this.$bodySize = body.getSize();
this.$winScroll = win.getScroll();
this.$bodySize = body.getSize();
this.$bodyScroll = body.getScrollSize();
if (this.$winSize.x === 0 || this.$winSize.y === 0) {
......@@ -192,7 +192,7 @@ define('qui/classes/QUI', [
body = document.id(document.body);
}
this.$bodySize = body.getSize();
this.$bodySize = body.getSize();
this.$bodyScroll = body.getScrollSize();
if (this.$winSize.x === 0 || this.$winSize.y === 0) {
......@@ -201,14 +201,14 @@ define('qui/classes/QUI', [
});
// scroll events
let scrollDelay = 200;
let scrollDelay = 200;
let isScrollingTimeout = null;
if ("addEventListener" in win) {
if ('addEventListener' in win) {
win.addEventListener('scroll', () => {
win.requestAnimationFrame(() => {
this.$isScrolling = true;
this.$winScroll = win.getScroll();
this.$winScroll = win.getScroll();
this.fireEvent('scroll');
// isScrolls Flag
......@@ -225,27 +225,48 @@ define('qui/classes/QUI', [
}, {
passive: true,
capture: true,
once : false
once: false
});
} else if ("attachEvent" in win) {
win.attachEvent('scroll', () => {
win.requestAnimationFrame(() => {
this.$isScrolling = true;
this.$winScroll = win.getScroll();
this.fireEvent('scroll');
// isScrolls Flag
if (isScrollingTimeout) {
clearTimeout(isScrollingTimeout);
}
isScrollingTimeout = (() => {
this.$isScrolling = false;
this.fireEvent('scrollEnd');
}).delay(scrollDelay, this);
} else {
if ('attachEvent' in win) {
win.attachEvent('scroll', () => {
win.requestAnimationFrame(() => {
this.$isScrolling = true;
this.$winScroll = win.getScroll();
this.fireEvent('scroll');
// isScrolls Flag
if (isScrollingTimeout) {
clearTimeout(isScrollingTimeout);
}
isScrollingTimeout = (() => {
this.$isScrolling = false;
this.fireEvent('scrollEnd');
}).delay(scrollDelay, this);
});
});
});
}
}
body.addEventListener('click', (e) => {
if (
e.target.nodeName === 'BUTTON'
|| e.target.hasClass('.qui-contextmenu-baritem')
|| e.target.hasClass('.qui-contextmenu')
|| e.target.getParent('button')
|| e.target.getParent('.qui-contextmenu-baritem')
|| e.target.getParent('.qui-contextmenu')
) {
return;
}
if (e.target.getParent('.qui-button-multiple')) {
return;
}
this.hideContextMenus();
});
}
this.MessageHandler = null;
......@@ -255,10 +276,9 @@ define('qui/classes/QUI', [
* Return the current win size
* Please use QUI.getWinSize() and make not 1000 document.getSize() calls
*
* @method qui/classes/QUI#getWindowSize
* @returns {{x: number, y: number}|*}
*/
getWindowSize: function () {
getWindowSize: function() {
return this.$winSize;
},
......@@ -266,10 +286,9 @@ define('qui/classes/QUI', [
* Return the current body size
* Please use QUI.getBodySize() and make not 1000 document.body.getSize() calls
*
* @method qui/classes/QUI#getBodySize
* @returns {{x: number, y: number}|*}
*/
getBodySize: function () {
getBodySize: function() {
return this.$bodySize;
},
......@@ -277,10 +296,9 @@ define('qui/classes/QUI', [
* Return the current body scrll size
* Please use QUI.getBodyScrollSize() and make not 1000 document.body.getSize() calls
*
* @method qui/classes/QUI#getBodySize
* @returns {{x: number, y: number}|*}
*/
getBodyScrollSize: function () {
getBodyScrollSize: function() {
return this.$bodyScroll;
},
......@@ -288,10 +306,9 @@ define('qui/classes/QUI', [
* Return the current scroll position
* Please use QUI.getScroll() and make not 1000 window.getScroll() calls
*
* @method qui/classes/QUI#getScroll
* @returns {{x: number, y: number}|*}
*/
getScroll: function () {
getScroll: function() {
return this.$winScroll;
},
......@@ -300,7 +317,7 @@ define('qui/classes/QUI', [
*
* @returns {boolean}
*/
isScrolling: function () {
isScrolling: function() {
return this.$isScrolling;
},
......@@ -308,32 +325,31 @@ define('qui/classes/QUI', [
* Creates Namespaces
* based on YAHOO code - nice solution!!
*
* @method qui/classes/QUI#namespace
* @example QUI.namespace('my.name.space'); -> QUI.my.name.space
* @deprecated
*/
namespace: function () {
namespace: function() {
let tlen;
let a = arguments,
o = this,
i = 0,
j = 0,
let a = arguments,
o = this,
i = 0,
j = 0,
len = a.length,
tok = null,
len = a.length,
tok = null,
name = null;
// iterate on the arguments
for (; i < len; i = i + 1) {
tok = a[i].split(".");
tok = a[i].split('.');
tlen = tok.length;
// iterate on the object tokens
for (j = 0; j < tlen; j = j + 1) {
name = tok[j];
name = tok[j];
o[name] = o[name] || {};
o = o[name];
o = o[name];
}
}
......@@ -347,7 +363,7 @@ define('qui/classes/QUI', [
* @param {Function} [callback] - optional
* @return Promise
*/
parse: function (Parent, callback) {
parse: function(Parent, callback) {
this.fireEvent('parseBegin', [this, Parent]);
return new Promise((resolve, reject) => {
......@@ -371,8 +387,8 @@ define('qui/classes/QUI', [
let nodes = [];
if (typeOf(Parent) === 'elements') {
Parent.getElements('[data-qui]').each(function (elements) {
Array.combine(nodes, elements.filter(function (Node) {
Parent.getElements('[data-qui]').each(function(elements) {
Array.combine(nodes, elements.filter(function(Node) {
return Node;
}));
});
......@@ -380,26 +396,26 @@ define('qui/classes/QUI', [
nodes = document.id(Parent).getElements('[data-qui]');
}
let list = nodes.map(function (Elm) {
let list = nodes.map(function(Elm) {
return Elm.get('data-qui');
});
// cleanup -> empty data-qui
list = list.filter(function (item) {
list = list.filter(function(item) {
return item !== '';
}).clean();
nodes = nodes.filter(function (Elm) {
nodes = nodes.filter(function(Elm) {
return Elm.get('data-qui') !== '';
}).clean();
require(list, function () {
require(list, function() {
let i, len, Cls, Elm;
let formNodes = {
'TEXTAREA': true,
'INPUT' : true,
'SELECT' : true
'INPUT': true,
'SELECT': true
};
for (i = 0, len = nodes.length; i < len; i++) {
......@@ -442,7 +458,7 @@ define('qui/classes/QUI', [
if (typeof callback !== 'undefined') {
callback();
}
}.bind(this), function (err) {
}.bind(this), function(err) {
reject(err);
});
});
......@@ -451,12 +467,10 @@ define('qui/classes/QUI', [
/**
* Fire the Error Event
*
* @method qui/classes/QUI#triggerError
*
* @param {qui/classes/messages/Message|Exception} Exception - Exception Objekt
* @return {Object} this (qui/classes/QUI)
*/
triggerError: function (Exception) {
triggerError: function(Exception) {
return this.trigger(Exception.getMessage(), '', 0);
},
......@@ -471,7 +485,7 @@ define('qui/classes/QUI', [
*
* @return {Object} this (qui/classes/QUI)
*/
trigger: function (msg, url, lineNumber) {
trigger: function(msg, url, lineNumber) {
this.fireEvent('error', [msg, url, lineNumber]);
return this;
......@@ -480,16 +494,15 @@ define('qui/classes/QUI', [
/**
* Return the message handler
*
* @method qui/classes/QUI#getMessageHandler
* @param {Function} [callback] - optional, callback function
* @return Promise
*/
getMessageHandler: function (callback) {
getMessageHandler: function(callback) {
return new Promise((resolve, reject) => {
if (typeof this.$execGetMessageHandler !== 'undefined' && !this.MessageHandler) {
this.$execGetMessageHandler = true;
(function () {
(function() {
this.getMessageHandler(callback).then(resolve);
}).delay(20, this);
......@@ -522,22 +535,48 @@ define('qui/classes/QUI', [
/**
* Return the message handler
*
* @method qui/classes/QUI#getControls
* @param {Function} callback
*/
getControls: function (callback) {
getControls: function(callback) {
if (this.Controls) {
callback(this.Controls);
}
},
/**
* hide all context menus
*/
hideContextMenus: function() {
this.Controls.getByType('qui/controls/contextmenu/Menu').map((Instance) => {
if (!Instance.getParent()) {
return
}
const Parent = Instance.getParent();
if (!Parent.getElm()) {
Instance.destroy();
return;
}
if (!Parent.getElm().getParent('body')) {
Instance.destroy();
return;
}
if (Instance.getElm().getStyle('display') !== 'none') {
Instance.hide();
}
});
},
/**
* Return fx animation object for the node
*
* @param {HTMLElement} Node
* @return {Object}
*/
fx: function (Node) {
fx: function(Node) {
return new Animate(Node);
}
});
......
......@@ -14,8 +14,8 @@ define('qui/classes/Windows', [
'qui/classes/DOM',
'qui/utils/System'
], function (require, DOM, SystemUtils) {
"use strict";
], function(require, DOM, SystemUtils) {
'use strict';
/**
* @class qui/classes/Controls
......@@ -25,7 +25,7 @@ define('qui/classes/Windows', [
return new Class({
Extends: DOM,
Type : 'qui/classes/Windows',
Type: 'qui/classes/Windows',
Binds: [
'$onWindowOpen',
......@@ -33,20 +33,20 @@ define('qui/classes/Windows', [
'$onWindowDestroy'
],
initialize: function () {
this.$windows = {};
initialize: function() {
this.$windows = {};
this.$currentWindow = null;
try {
this.calcWindowSize();
} catch (e) {
window.addEvent('domready', function () {
window.addEvent('domready', function() {
this.calcWindowSize();
}.bind(this));
}
require(['qui/QUI'], function (QUI) {
QUI.addEvent('onResize', function () {
require(['qui/QUI'], function(QUI) {
QUI.addEvent('onResize', function() {
if (!this.openedWindowsLength()) {
this.calcWindowSize();
}
......@@ -57,7 +57,7 @@ define('qui/classes/Windows', [
/**
* calculate the window size
*/
calcWindowSize: function () {
calcWindowSize: function() {
if (this.openedWindowsLength()) {
return;
}
......@@ -65,9 +65,9 @@ define('qui/classes/Windows', [
this.$oldBodyStyle = {
overflow: document.body.style.overflow,
position: document.body.style.position,
width : document.body.style.width,
top : document.body.style.top,
scroll : document.body.getScroll(),
width: document.body.style.width,
top: document.body.style.top,
scroll: document.body.getScroll(),
minWidth: document.body.style.minWidth
};
},
......@@ -77,11 +77,11 @@ define('qui/classes/Windows', [
*
* @param {Object} Popup - qui/controls/windows/Popup
*/
register: function (Popup) {
register: function(Popup) {
Popup.addEvents({
onOpenBegin: this.$onWindowOpen,
onDestroy : this.$onWindowDestroy,
onClose : this.$onWindowClose
onDestroy: this.$onWindowDestroy,
onClose: this.$onWindowClose
});
this.$windows[Popup.getId()] = Popup;
......@@ -93,7 +93,7 @@ define('qui/classes/Windows', [
*
* @return {Number}
*/
getLength: function () {
getLength: function() {
return Object.getLength(this.$windows);
},
......@@ -102,8 +102,8 @@ define('qui/classes/Windows', [
*
* @returns {Number}
*/
openedWindowsLength: function () {
var openWindows = Object.map(this.$windows, function (Win) {
openedWindowsLength: function() {
var openWindows = Object.map(this.$windows, function(Win) {
return Win.isOpened() ? 1 : 0;
});
......@@ -115,7 +115,7 @@ define('qui/classes/Windows', [
*
* @param {Object} Popup - qui/controls/windows/Popup
*/
$onWindowOpen: function (Popup) {
$onWindowOpen: function(Popup) {
var maxIndex = this.$getmaxWindowZIndex();
Popup.Background.getElm().setStyle('zIndex', maxIndex + 1);
......@@ -129,7 +129,7 @@ define('qui/classes/Windows', [
*
* @param {Object} Popup - qui/controls/windows/Popup
*/
$onWindowDestroy: function (Popup) {
$onWindowDestroy: function(Popup) {
if (this.$currentWindow == Popup) {
this.$currentWindow = null;
}
......@@ -144,7 +144,7 @@ define('qui/classes/Windows', [
*
* @param {Object} Popup - qui/controls/windows/Popup
*/
$onWindowClose: function (Popup) {
$onWindowClose: function(Popup) {
if (this.$currentWindow == Popup) {
this.$currentWindow = null;
}
......@@ -155,8 +155,8 @@ define('qui/classes/Windows', [
document.body.setStyles({
overflow: oldStyle.overflow || null,
position: oldStyle.position || null,
width : oldStyle.width || null,
top : oldStyle.top || null,
width: oldStyle.width || null,
top: oldStyle.top || null,
minWidth: oldStyle.minWidth || null
});
......@@ -166,7 +166,7 @@ define('qui/classes/Windows', [
if (ios) {
document.body.setStyles({
'-webkit-transform': null,
'transform' : null
'transform': null
});
}
......@@ -183,7 +183,7 @@ define('qui/classes/Windows', [
*
* @return {Number}
*/
$getmaxWindowZIndex: function () {
$getmaxWindowZIndex: function() {
var i, index;
var currentIndex = 0;
......@@ -212,8 +212,8 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
openAlert: function (params) {
return this.createAlert(params).then(function (Alert) {
openAlert: function(params) {
return this.createAlert(params).then(function(Alert) {
Alert.open();
return Alert;
......@@ -226,8 +226,8 @@ define('qui/classes/Windows', [
* @param {Object} params - confirm box params
* @returns {Promise}
*/
openConfirm: function (params) {
return this.createConfirm(params).then(function (Confirm) {
openConfirm: function(params) {
return this.createConfirm(params).then(function(Confirm) {
Confirm.open();
return Confirm;
......@@ -240,8 +240,8 @@ define('qui/classes/Windows', [
* @param {Object} params - popup box params
* @returns {Promise}
*/
openPopup: function (params) {
return this.createPopup(params).then(function (Popup) {
openPopup: function(params) {
return this.createPopup(params).then(function(Popup) {
Popup.open();
return Popup;
......@@ -254,8 +254,8 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
openPrompt: function (params) {
return this.createPrompt(params).then(function (Prompt) {
openPrompt: function(params) {
return this.createPrompt(params).then(function(Prompt) {
Prompt.open();
return Prompt;
......@@ -268,8 +268,8 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
openSubmit: function (params) {
return this.createAlert(params).then(function (Alert) {
openSubmit: function(params) {
return this.createAlert(params).then(function(Alert) {
Alert.open();
return Alert;
......@@ -286,9 +286,9 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
createAlert: function (params) {
return new Promise(function (response, reject) {
require(['qui/controls/windows/Alert'], function (Alert) {
createAlert: function(params) {
return new Promise(function(response, reject) {
require(['qui/controls/windows/Alert'], function(Alert) {
response(new Alert(params));
}, reject);
});
......@@ -300,9 +300,9 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
createConfirm: function (params) {
return new Promise(function (response, reject) {
require(['qui/controls/windows/Confirm'], function (Confirm) {
createConfirm: function(params) {
return new Promise(function(response, reject) {
require(['qui/controls/windows/Confirm'], function(Confirm) {
response(new Confirm(params));
}, reject);
});
......@@ -314,9 +314,9 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
createPopup: function (params) {
return new Promise(function (response, reject) {
require(['qui/controls/windows/Popup'], function (Popup) {
createPopup: function(params) {
return new Promise(function(response, reject) {
require(['qui/controls/windows/Popup'], function(Popup) {
response(new Popup(params));
}, reject);
});
......@@ -328,9 +328,9 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
createPrompt: function (params) {
return new Promise(function (response, reject) {
require(['qui/controls/windows/Prompt'], function (Prompt) {
createPrompt: function(params) {
return new Promise(function(response, reject) {
require(['qui/controls/windows/Prompt'], function(Prompt) {
response(new Prompt(params));
}, reject);
});
......@@ -342,9 +342,9 @@ define('qui/classes/Windows', [
* @param {Object} params - alert box params
* @returns {Promise}
*/
createSubmit: function (params) {
return new Promise(function (response, reject) {
require(['qui/controls/windows/Submit'], function (Submit) {
createSubmit: function(params) {
return new Promise(function(response, reject) {
require(['qui/controls/windows/Submit'], function(Submit) {
response(new Submit(params));
}, reject);
});
......
......@@ -12,8 +12,8 @@ define('qui/classes/request/Ajax', [
'qui/controls/messages/Error',
'qui/Locale'
], function (QUI, DOM, MessageError, Locale) {
"use strict";
], function(QUI, DOM, MessageError, Locale) {
'use strict';
/**
* QUIQQER Ajax
......@@ -34,23 +34,23 @@ define('qui/classes/request/Ajax', [
return new Class({
Extends: DOM,
Type : 'qui/classes/request/Ajax',
Type: 'qui/classes/request/Ajax',
Binds: [
'$parseResult'
],
$Request: null,
$result : null,
$result: null,
options: {
method : 'post',
url : '',
async : true,
method: 'post',
url: '',
async: true,
timeout: 10000
},
initialize: function (options) {
initialize: function(options) {
this.parent(options);
},
......@@ -62,7 +62,7 @@ define('qui/classes/request/Ajax', [
* @param {Object} params - Parameters which to be sent
* @return {Request} Request Object
*/
send: function (params) {
send: function(params) {
var self = this;
params = self.parseParams(params || {});
......@@ -70,31 +70,31 @@ define('qui/classes/request/Ajax', [
self.setAttribute('params', params);
self.$Request = new Request({
url : self.getAttribute('url'),
method : self.getAttribute('method'),
async : self.getAttribute('async'),
url: self.getAttribute('url'),
method: self.getAttribute('method'),
async: self.getAttribute('async'),
timeout: self.getAttribute('timeout'),
onProgress: function () {
onProgress: function() {
self.fireEvent('progress', [self]);
},
onComplete: function () {
onComplete: function() {
self.fireEvent('complete', [self]);
},
onSuccess: self.$parseResult,
onCancel: function () {
onCancel: function() {
self.fireEvent('cancel', [self]);
},
onFailure: function (Xhr) {
require(['qui/controls/messages/Error'], function (Exception) {
onFailure: function(Xhr) {
require(['qui/controls/messages/Error'], function(Exception) {
self.fireEvent('error', [
new Exception({
message: Xhr.statusText,
code : Xhr.status
code: Xhr.status
}),
self
]);
......@@ -102,7 +102,7 @@ define('qui/classes/request/Ajax', [
}
});
var query = Object.toQueryString(params),
var query = Object.toQueryString(params),
strlenCheck = parseInt(query.length) +
parseInt(self.getAttribute('url').length);
......@@ -120,7 +120,7 @@ define('qui/classes/request/Ajax', [
*
* @method qui/classes/request/Ajax#cancel
*/
cancel: function () {
cancel: function() {
this.$Request.cancel();
},
......@@ -130,7 +130,7 @@ define('qui/classes/request/Ajax', [
* @method qui/classes/request/Ajax#destroy
* @fires onDestroy
*/
destroy: function () {
destroy: function() {
this.fireEvent('destroy', [this]);
},
......@@ -145,7 +145,7 @@ define('qui/classes/request/Ajax', [
* Ajax.send( myparams );
* var result = Ajax.getResult();
*/
getResult: function () {
getResult: function() {
return this.$result;
},
......@@ -158,7 +158,7 @@ define('qui/classes/request/Ajax', [
* @param {Object} params - params that will be send
* @return {Object} Param list
*/
parseParams: function (params) {
parseParams: function(params) {
var k, type_of;
var result = {};
......@@ -214,7 +214,7 @@ define('qui/classes/request/Ajax', [
*
* @ignore
*/
$parseResult: function (responseText) {
$parseResult: function(responseText) {
var i, len, res, func, result;
var params = this.getAttribute('params');
......@@ -224,7 +224,7 @@ define('qui/classes/request/Ajax', [
}
var event_params = [],
rfs = JSON.decode(params._rf || []);
rfs = JSON.decode(params._rf || []);
if (this.getAttribute('_rf')) {
rfs = this.getAttribute('_rf');
......@@ -236,7 +236,7 @@ define('qui/classes/request/Ajax', [
if (!this.$result) {
var end;
var str = responseText || '',
var str = responseText || '',
start = 9;
len = str.length;
......@@ -246,7 +246,7 @@ define('qui/classes/request/Ajax', [
return this.fireEvent('error', [
new MessageError({
message: 'No QUIQQER XML',
code : 500
code: 500
}),
this
]);
......@@ -257,7 +257,7 @@ define('qui/classes/request/Ajax', [
return this.fireEvent('error', [
new MessageError({
message: 'No QUIQQER XML',
code : 500
code: 500
}),
this
]);
......@@ -282,16 +282,16 @@ define('qui/classes/request/Ajax', [
result.message_handler.length) {
var messages = result.message_handler;
QUI.getMessageHandler(function (MH) {
QUI.getMessageHandler(function(MH) {
var i, len;
var func_add_to_mh = function (Message) {
var func_add_to_mh = function(Message) {
MH.add(Message);
};
for (i = 0, len = messages.length; i < len; i++) {
// parse time for javascript date
if ("time" in messages[i]) {
if ('time' in messages[i]) {
messages[i].time = messages[i] * 1000;
}
......@@ -304,9 +304,9 @@ define('qui/classes/request/Ajax', [
if (result.Exception) {
return this.fireEvent('error', [
new MessageError({
message : result.Exception.message || '',
code : result.Exception.code || 0,
type : result.Exception.type || 'Exception',
message: result.Exception.message || '',
code: result.Exception.code || 0,
type: result.Exception.type || 'Exception',
attributes: result.Exception.attributes || false
}),
this
......@@ -316,7 +316,7 @@ define('qui/classes/request/Ajax', [
// check the single function
for (i = 0, len = rfs.length; i < len; i++) {
func = rfs[i];
res = result[func];
res = result[func];
if (!res) {
event_params.push(null);
......@@ -326,9 +326,9 @@ define('qui/classes/request/Ajax', [
if (res.Exception) {
this.fireEvent('error', [
new MessageError({
message : res.Exception.message || '',
code : res.Exception.code || 0,
type : res.Exception.type || 'Exception',
message: res.Exception.message || '',
code: res.Exception.code || 0,
type: res.Exception.type || 'Exception',
attributes: res.Exception.attributes || false
}),
this
......
/**
* Polifill for the localStorage and sessionStorage
* Based on Remy Sharp's Storage polyfill - thanks
......@@ -8,52 +7,46 @@
*/
/* jshint ignore:start */
define('qui/classes/storage/Polyfill', function()
{
"use strict";
define('qui/classes/storage/Polyfill', function() {
'use strict';
if ( typeof window.localStorage !== 'undefined' &&
typeof window.sessionStorage !== 'undefined')
{
if (typeof window.localStorage !== 'undefined' &&
typeof window.sessionStorage !== 'undefined') {
return;
}
var Storage = function (type)
{
var Storage = function(type) {
function createCookie(name, value, days)
{
var date, expires;
if ( days )
{
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
} else
{
expires = "";
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = '; expires=' + date.toGMTString();
} else {
expires = '';
}
document.cookie = name+"="+value+expires+"; path=/";
document.cookie = name + '=' + value + expires + '; path=/';
}
function readCookie(name)
{
var i, c,
nameEQ = name + "=",
ca = document.cookie.split(';');
nameEQ = name + '=',
ca = document.cookie.split(';');
for ( i = 0; i < ca.length; i++ )
{
for (i = 0; i < ca.length; i++) {
c = ca[i];
while ( c.charAt(0) == ' ' ) {
c = c.substring( 1, c.length );
while (c.charAt(0) == ' ') {
c = c.substring(1, c.length);
}
if ( c.indexOf(nameEQ) === 0 ) {
return c.substring( nameEQ.length, c.length );
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length, c.length);
}
}
......@@ -64,23 +57,19 @@ define('qui/classes/storage/Polyfill', function()
{
data = JSON.stringify(data);
if ( type == 'session' )
{
if (type == 'session') {
window.name = data;
} else
{
} else {
createCookie('localStorage', data, 365);
}
}
function clearData()
{
if ( type == 'session' )
{
if (type == 'session') {
window.name = '';
} else
{
} else {
createCookie('localStorage', '', 365);
}
}
......@@ -97,51 +86,49 @@ define('qui/classes/storage/Polyfill', function()
return {
length: 0,
clear: function ()
{
clear: function() {
data = {};
this.length = 0;
clearData();
},
getItem: function (key) {
getItem: function(key) {
return data[key] === undefined ? null : data[key];
},
key: function (i)
{
key: function(i) {
// not perfect, but works
var ctr = 0;
for (var k in data)
{
if (ctr == i) return k;
else ctr++;
for (var k in data) {
if (ctr == i) {
return k;
} else {
ctr++;
}
}
return null;
},
removeItem: function (key)
{
removeItem: function(key) {
delete data[key];
this.length--;
setData(data);
},
setItem: function (key, value)
{
data[key] = value+''; // forces the value to a string
setItem: function(key, value) {
data[key] = value + ''; // forces the value to a string
this.length++;
setData(data);
}
};
};
if ( typeof window.localStorage === 'undefined' ) {
if (typeof window.localStorage === 'undefined') {
window.localStorage = new Storage('local');
}
if ( typeof window.sessionStorage === 'undefined' ) {
if (typeof window.sessionStorage === 'undefined') {
window.sessionStorage = new Storage('session');
}
......
......@@ -22,8 +22,8 @@ try {
console.info('Please allow cookies.');
}
define('qui/classes/storage/Storage', needle, function (QDOM) {
"use strict";
define('qui/classes/storage/Storage', needle, function(QDOM) {
'use strict';
/**
* Local storage
......@@ -35,7 +35,7 @@ define('qui/classes/storage/Storage', needle, function (QDOM) {
return new Class({
Extends: QDOM,
Type : 'qui/classes/storage/Storage',
Type: 'qui/classes/storage/Storage',
$data: {},
......@@ -46,7 +46,7 @@ define('qui/classes/storage/Storage', needle, function (QDOM) {
* @param {String} key
* @param {String|Number|Boolean} value
*/
set: function (key, value) {
set: function(key, value) {
try {
window.localStorage.setItem(key, value);
......@@ -62,7 +62,7 @@ define('qui/classes/storage/Storage', needle, function (QDOM) {
* @param {String} key
* @return {String|Number|Boolean} the wanted storage
*/
get: function (key) {
get: function(key) {
try {
return window.localStorage.getItem(key);
......@@ -83,7 +83,7 @@ define('qui/classes/storage/Storage', needle, function (QDOM) {
* @method qui/classes/storage/Storage#remove
* @param {String} key
*/
remove: function (key) {
remove: function(key) {
try {
window.localStorage.removeItem(key);
......@@ -101,7 +101,7 @@ define('qui/classes/storage/Storage', needle, function (QDOM) {
*
* @method qui/classes/storage/Storage#clear
*/
clear: function () {
clear: function() {
this.$data = {};
try {
......
......@@ -6,8 +6,8 @@
*
* @require qui/classes/DOM
*/
define('qui/classes/utils/Animate', ['qui/classes/DOM'], function (QDOM) {
"use strict";
define('qui/classes/utils/Animate', ['qui/classes/DOM'], function(QDOM) {
'use strict';
/**
* @class qui/controls/utils/Animate
......@@ -17,14 +17,14 @@ define('qui/classes/utils/Animate', ['qui/classes/DOM'], function (QDOM) {
return new Class({
Extends: QDOM,
Type : 'qui/classes/utils/Animate',
Type: 'qui/classes/utils/Animate',
options: {
equation: false,
duration: 250
},
initialize: function (Node, params) {
initialize: function(Node, params) {
this.parent(params);
this.$FX = moofx(Node);
},
......@@ -35,10 +35,10 @@ define('qui/classes/utils/Animate', ['qui/classes/DOM'], function (QDOM) {
* @param {Object} params
* @returns {Promise}
*/
animate: function (params) {
animate: function(params) {
params = params || {};
return new Promise(function (resolve) {
return new Promise(function(resolve) {
this.$FX.animate(params, {
duration: this.getAttribute('duration'),
equation: this.getAttribute('equation'),
......
......@@ -14,8 +14,8 @@
* @event onComplete [ this, event ]
*/
define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
"use strict";
define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function(DOM) {
'use strict';
/**
* @class qui/classes/utils/DragDrop
......@@ -28,7 +28,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
return new Class({
Extends: DOM,
Type : 'qui/classes/utils/DragDrop',
Type: 'qui/classes/utils/DragDrop',
Binds: [
'$complete',
......@@ -40,9 +40,9 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
options: {
dropables: [document.body],
styles : false,
cssClass : false,
delay : 500, // when trigger the dragdrop, after miliseconds
styles: false,
cssClass: false,
delay: 500, // when trigger the dragdrop, after miliseconds
limit: {
x: false, // [min, max]
......@@ -50,21 +50,21 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
}
},
initialize: function (Elm, options) {
initialize: function(Elm, options) {
var self = this;
this.parent(options);
this.$Drag = null;
this.$Drag = null;
this.$Element = Elm;
this.$enable = true;
this.$enable = true;
if (typeof Elm === 'undefined') {
return;
}
Elm.addEvents({
mousedown: function (event) {
mousedown: function(event) {
if (!self.$enable) {
return;
}
......@@ -80,7 +80,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
event.stop();
},
mouseup: function (event) {
mouseup: function(event) {
if (typeof self.$timer !== 'undefined') {
clearTimeout(self.$timer);
}
......@@ -88,7 +88,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
self.$stop(event);
},
mouseleave: function (event) {
mouseleave: function(event) {
if (self.$Drag) {
return;
}
......@@ -108,7 +108,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @method qui/classes/utils/DragDrop#getElm
* @return {HTMLElement} Main Dom-Node Element
*/
getElm: function () {
getElm: function() {
return this.$Elm;
},
......@@ -117,7 +117,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
*
* @method qui/classes/utils/DragDrop#enable
*/
enable: function () {
enable: function() {
this.$enable = true;
},
......@@ -126,7 +126,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
*
* @method qui/classes/utils/DragDrop#disable
*/
disable: function () {
disable: function() {
this.$enable = false;
},
......@@ -136,7 +136,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @method qui/classes/utils/DragDrop#$start
* @param {DOMEvent} event
*/
$start: function (event) {
$start: function(event) {
if (!this.$enable) {
return;
}
......@@ -159,30 +159,30 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
this.setAttribute('_mousedown', true);
var mx = event.page.x,
my = event.page.y,
var mx = event.page.x,
my = event.page.y,
Elm = this.$Element,
Elm = this.$Element,
ElmSize = Elm.getSize(),
limit = this.getAttribute('limit'),
limit = this.getAttribute('limit'),
docsize = document.body.getSize();
// create the shadow element
this.$Drag = new Element('div', {
'class': 'box',
styles : {
position : 'absolute',
top : my - 20,
left : mx - 40,
zIndex : 1000,
styles: {
position: 'absolute',
top: my - 20,
left: mx - 40,
zIndex: 1000,
MozOutline: 'none',
outline : 0,
color : '#fff',
padding : 10,
cursor : 'pointer',
outline: 0,
color: '#fff',
padding: 10,
cursor: 'pointer',
width : ElmSize.x,
height : ElmSize.y,
width: ElmSize.x,
height: ElmSize.y,
background: 'rgba(0,0,0, 0.5)'
}
}).inject(document.body);
......@@ -224,16 +224,16 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
droppables: dropables,
onComplete: this.$complete,
onDrop : this.$onDrop,
onEnter : this.$onEnter,
onLeave : this.$onLeave,
onDrag : this.$onDrag,
onDrop: this.$onDrop,
onEnter: this.$onEnter,
onLeave: this.$onLeave,
onDrag: this.$onDrag,
limit: limit
}).start({
target: Elm,
page : {
page: {
x: mx,
y: my
}
......@@ -245,7 +245,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
*
* @method qui/classes/utils/DragDrop#$stop
*/
$stop: function () {
$stop: function() {
if (Browser.ie8) {
return;
}
......@@ -273,7 +273,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @method qui/classes/utils/DragDrop#$complete
* @param {DOMEvent} event
*/
$complete: function (event) {
$complete: function(event) {
this.fireEvent('complete', [this, event]);
this.$stop();
},
......@@ -285,7 +285,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @param {HTMLElement} Element
* @param {DOMEvent} event
*/
$onDrag: function (Element, event) {
$onDrag: function(Element, event) {
this.fireEvent('drag', [this, Element, event]);
},
......@@ -297,7 +297,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @param {HTMLElement} Dropable
* @param {DOMEvent} event
*/
$onDrop: function (Element, Dropable, event) {
$onDrop: function(Element, Dropable, event) {
this.fireEvent('drop', [this, Element, Dropable, event]);
},
......@@ -308,7 +308,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @param {HTMLElement} Element
* @param {HTMLElement} Dropable
*/
$onEnter: function (Element, Dropable) {
$onEnter: function(Element, Dropable) {
this.fireEvent('enter', [this, Element, Dropable]);
},
......@@ -319,7 +319,7 @@ define('qui/classes/utils/DragDrop', ['qui/classes/DOM'], function (DOM) {
* @param {HTMLElement} Element
* @param {HTMLElement} Dropable
*/
$onLeave: function (Element, Dropable) {
$onLeave: function(Element, Dropable) {
this.fireEvent('leave', [this, Element, Dropable]);
}
});
......
......@@ -34,28 +34,28 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
define('qui/classes/utils/Push', function () {
"use strict";
define('qui/classes/utils/Push', function() {
'use strict';
var w = window;
return function () {
return function() {
var self = this,
isUndefined = function (obj) {
isUndefined = function(obj) {
return obj === undefined;
},
isString = function (obj) {
isString = function(obj) {
return obj && obj.constructor === String;
},
isFunction = function (obj) {
isFunction = function(obj) {
return obj && obj.constructor === Function;
},
/* Whether Push has permission to notify */
/* Whether Push has permission to notify */
hasPermission = false,
/* List of active notifications */
/* List of active notifications */
notifications = [],
/**
......@@ -63,18 +63,22 @@ define('qui/classes/utils/Push', function () {
* @param {Notification} notification
* @return {void}
*/
close_notification = function (notification) {
close_notification = function(notification) {
/* Safari 6+, Chrome 23+ */
if (typeof notification.close === 'function') {
notification.close();
/* Legacy webkit browsers */
} else if (notification.cancel) {
notification.cancel();
/* IE9+ */
} else if (w.external && w.external.msIsSiteMode) {
w.external.msSiteModeClearIconOverlay();
} else {
if (notification.cancel) {
notification.cancel();
/* IE9+ */
} else {
if (w.external && w.external.msIsSiteMode) {
w.external.msSiteModeClearIconOverlay();
}
}
}
},
......@@ -82,7 +86,7 @@ define('qui/classes/utils/Push', function () {
* Updates the notification count
* @return {void}
*/
updateCount = function () {
updateCount = function() {
self.count = notifications.length;
},
......@@ -90,7 +94,7 @@ define('qui/classes/utils/Push', function () {
* Callback function for the 'create' method
* @return {void}
*/
create_callback = function (title, options) {
create_callback = function(title, options) {
var notification;
/* Set empty settings if none are specified */
options = options || {};
......@@ -108,48 +112,57 @@ define('qui/classes/utils/Push', function () {
);
/* Legacy webkit browsers */
} else if (w.webkitNotifications) {
notification = w.webkitNotifications.createNotification(
options.icon,
title,
options.body
);
notification.show();
/* Firefox Mobile */
} else if (navigator.mozNotification) {
notification = navigator.mozNotification.createNotification(
title,
options.body,
options.icon
);
notification.show();
/* IE9+ */
} else if (w.external && w.external.msIsSiteMode()) {
//Clear any previous notifications
w.external.msSiteModeClearIconOverlay();
w.external.msSiteModeSetIconOverlay(((isString(options.icon) || isUndefined(options.icon)) ? options.icon : options.icon.x16), title);
w.external.msSiteModeActivate();
notification = {};
} else {
if (w.webkitNotifications) {
notification = w.webkitNotifications.createNotification(
options.icon,
title,
options.body
);
notification.show();
/* Firefox Mobile */
} else {
if (navigator.mozNotification) {
notification = navigator.mozNotification.createNotification(
title,
options.body,
options.icon
);
notification.show();
/* IE9+ */
} else {
if (w.external && w.external.msIsSiteMode()) {
//Clear any previous notifications
w.external.msSiteModeClearIconOverlay();
w.external.msSiteModeSetIconOverlay(
((isString(options.icon) || isUndefined(options.icon)) ? options.icon : options.icon.x16),
title
);
w.external.msSiteModeActivate();
notification = {};
}
}
}
}
/* Wrapper used to close notification later on */
var wrapper = {
close: function () {
close: function() {
close_notification(notification);
}
};
/* Autoclose timeout */
if (options.timeout && options.timeout !== false) {
setTimeout(function () {
setTimeout(function() {
wrapper.close();
}, options.timeout);
}
......@@ -210,14 +223,14 @@ define('qui/classes/utils/Push', function () {
* @param {Function} [onDenied] - Function to execute once permission is granted
* @return {void}
*/
self.Permission.request = function (onGranted, onDenied) {
self.Permission.request = function(onGranted, onDenied) {
/* Return if Push not supported */
if (!self.isSupported) {
return;
}
/* Default callback */
var callback = function (result) {
var callback = function(result) {
switch (result) {
case self.Permission.GRANTED:
hasPermission = true;
......@@ -240,8 +253,10 @@ define('qui/classes/utils/Push', function () {
w.webkitNotifications.requestPermission(callback);
/* Safari 6+, Chrome 23+ */
} else if (w.Notification && w.Notification.requestPermission) {
w.Notification.requestPermission(callback);
} else {
if (w.Notification && w.Notification.requestPermission) {
w.Notification.requestPermission(callback);
}
}
};
......@@ -249,7 +264,7 @@ define('qui/classes/utils/Push', function () {
* Returns whether Push has been granted permission to run
* @return {Boolean}
*/
self.Permission.has = function () {
self.Permission.has = function() {
return hasPermission;
};
......@@ -257,7 +272,7 @@ define('qui/classes/utils/Push', function () {
* Gets the permission level
* @return {Permission} The permission level
*/
self.Permission.get = function () {
self.Permission.get = function() {
var permission;
/* Return if Push not supported */
......@@ -270,20 +285,28 @@ define('qui/classes/utils/Push', function () {
permission = w.Notification.permissionLevel;
/* Legacy webkit browsers */
} else if (w.webkitNotifications && w.webkitNotifications.checkPermission) {
permission = Permissions[w.webkitNotifications.checkPermission()];
/* Firefox 23+ */
} else if (w.Notification && w.Notification.permission) {
permission = w.Notification.permission;
/* Firefox Mobile */
} else if (navigator.mozNotification) {
permission = Permissions.GRANTED;
/* IE9+ */
} else if (w.external && w.external.msIsSiteMode() !== undefined) {
permission = w.external.msIsSiteMode() ? Permission.GRANTED : Permission.DEFAULT;
} else {
if (w.webkitNotifications && w.webkitNotifications.checkPermission) {
permission = Permissions[w.webkitNotifications.checkPermission()];
/* Firefox 23+ */
} else {
if (w.Notification && w.Notification.permission) {
permission = w.Notification.permission;
/* Firefox Mobile */
} else {
if (navigator.mozNotification) {
permission = Permissions.GRANTED;
/* IE9+ */
} else {
if (w.external && w.external.msIsSiteMode() !== undefined) {
permission = w.external.msIsSiteMode() ? Permission.GRANTED : Permission.DEFAULT;
}
}
}
}
}
return permission;
......@@ -297,7 +320,7 @@ define('qui/classes/utils/Push', function () {
* Detects whether the user's browser supports notifications
* @return {Boolean}
*/
self.isSupported = (function () {
self.isSupported = (function() {
var isSupported = false;
try {
......@@ -305,14 +328,14 @@ define('qui/classes/utils/Push', function () {
/* Safari, Chrome */ !!(w.Notification ||
/* Chrome & ff-html5notifications plugin */
w.webkitNotifications ||
/* Chrome & ff-html5notifications plugin */
w.webkitNotifications ||
/* Firefox Mobile */
navigator.mozNotification ||
/* Firefox Mobile */
navigator.mozNotification ||
/* IE9+ */
(w.external && w.external.msIsSiteMode() !== undefined));
/* IE9+ */
(w.external && w.external.msIsSiteMode() !== undefined));
} catch (e) {
}
......@@ -326,7 +349,7 @@ define('qui/classes/utils/Push', function () {
* @param {Array} options
* @return {void}
*/
self.create = function (title, options) {
self.create = function(title, options) {
/* Fail if the browser is not supported */
if (!self.isSupported) {
console.error('PushError: push.js is incompatible with self browser.');
......@@ -340,7 +363,7 @@ define('qui/classes/utils/Push', function () {
/* Request permission if it isn't granted */
if (!self.Permission.has()) {
self.Permission.request(function () {
self.Permission.request(function() {
return create_callback(title, options);
});
} else {
......@@ -353,7 +376,7 @@ define('qui/classes/utils/Push', function () {
* @param {String} tag - Tag of the notification to close
* @return {void}
*/
self.close = function (tag) {
self.close = function(tag) {
var notification;
for (var i = 0; i < notifications.length; i++) {
......@@ -381,7 +404,7 @@ define('qui/classes/utils/Push', function () {
* Clears all notifications
* @return {void}
*/
self.clear = function () {
self.clear = function() {
for (var i = 0; i < notifications.length; i++) {
close_notification(notifications[i]);
}
......
/**
* Simulate Event to an Element
* Help from: https://github.com/eduardolundgren/jquery-simulate/blob/master/jquery.simulate.js
......@@ -12,17 +11,15 @@ define('qui/classes/utils/SimulateEvent', [
'qui/classes/DOM'
], function(QDOM)
{
"use strict";
], function(QDOM) {
'use strict';
return new Class({
Extends : QDOM,
Type : 'qui/classes/utils/SimulateEvent',
Extends: QDOM,
Type: 'qui/classes/utils/SimulateEvent',
initialize : function(Elm)
{
initialize: function(Elm) {
this.$Elm = Elm;
},
......@@ -33,8 +30,7 @@ define('qui/classes/utils/SimulateEvent', [
* @param {Object} [options]
* @returns {DOMEvent}
*/
simulateEvent : function(type, options)
{
simulateEvent: function(type, options) {
var evt = this.createEvent(type, options);
this.dispatchEvent(type, evt);
......@@ -48,8 +44,7 @@ define('qui/classes/utils/SimulateEvent', [
* @param {Object} [options]
* @returns {DOMEvent}
*/
createEvent : function(type, options)
{
createEvent: function(type, options) {
if (/^mouse(over|out|down|up|move)|(dbl)?click$/.test(type)) {
return this.mouseEvent(type, options);
}
......@@ -66,8 +61,7 @@ define('qui/classes/utils/SimulateEvent', [
* @param {DOMEvent} evt
* @returns {*}
*/
dispatchEvent : function(type, evt)
{
dispatchEvent: function(type, evt) {
if (this.$Elm.dispatchEvent) {
this.$Elm.dispatchEvent(evt);
return evt;
......@@ -87,13 +81,12 @@ define('qui/classes/utils/SimulateEvent', [
* @param {String} type
* @param {Object} options
*/
mouseEvent: function(type, options)
{
mouseEvent: function(type, options) {
var evt;
var e = Object.merge({
bubbles: true,
cancelable: (type != "mousemove"),
cancelable: (type != 'mousemove'),
view: window,
detail: 0,
screenX: 0,
......@@ -110,7 +103,7 @@ define('qui/classes/utils/SimulateEvent', [
if (typeof document.createEvent === 'function') {
evt = document.createEvent("MouseEvents");
evt = document.createEvent('MouseEvents');
evt.initMouseEvent(type, e.bubbles, e.cancelable, e.view, e.detail,
e.screenX, e.screenY, e.clientX, e.clientY,
......@@ -118,10 +111,9 @@ define('qui/classes/utils/SimulateEvent', [
e.button, this.$Elm
);
} else
{
} else {
evt = Object.merge(document.createEventObject(), e);
evt.button = { 0:1, 1:4, 2:2 }[evt.button] || evt.button;
evt.button = {0: 1, 1: 4, 2: 2}[evt.button] || evt.button;
}
return evt;
......@@ -133,8 +125,7 @@ define('qui/classes/utils/SimulateEvent', [
* @param {String} type
* @param {Object} options
*/
keyboardEvent: function(type, options)
{
keyboardEvent: function(type, options) {
var evt;
var e = Object.merge({
......@@ -149,11 +140,9 @@ define('qui/classes/utils/SimulateEvent', [
charCode: 0
}, options || {});
if (typeof document.createEvent === 'function')
{
try
{
evt = document.createEvent("KeyEvents");
if (typeof document.createEvent === 'function') {
try {
evt = document.createEvent('KeyEvents');
evt.initKeyEvent(
type,
......@@ -168,20 +157,21 @@ define('qui/classes/utils/SimulateEvent', [
e.charCode
);
} catch(err)
{
evt = document.createEvent("Events");
} catch (err) {
evt = document.createEvent('Events');
evt.initEvent(type, e.bubbles, e.cancelable);
$.extend(evt, { view: e.view,
$.extend(evt, {
view: e.view,
ctrlKey: e.ctrlKey, altKey: e.altKey, shiftKey: e.shiftKey, metaKey: e.metaKey,
keyCode: e.keyCode, charCode: e.charCode
});
}
} else if (document.createEventObject)
{
evt = Object.merge(document.createEventObject(), e);
} else {
if (document.createEventObject) {
evt = Object.merge(document.createEventObject(), e);
}
}
// ie || opera
......
......@@ -18,8 +18,8 @@ define('qui/controls/Control', [
'css!qui/controls/Control.css'
], function (QUI, Locale, DOM) {
"use strict";
], function(QUI, Locale, DOM) {
'use strict';
/**
* @class qui/controls/Control
......@@ -34,7 +34,7 @@ define('qui/controls/Control', [
return new Class({
Extends: DOM,
Type : 'qui/controls/Control',
Type: 'qui/controls/Control',
$Parent: false,
......@@ -51,7 +51,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#init
* @param {Object} options - option params
*/
initialize: function (options) {
initialize: function(options) {
this.parent(options);
QUI.Controls.add(this);
......@@ -64,7 +64,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#create
* @return {HTMLElement}
*/
create: function () {
create: function() {
if (this.$Elm) {
return this.$Elm;
}
......@@ -77,11 +77,11 @@ define('qui/controls/Control', [
},
/**
* Destroy the Object and all relationsships to some Object
* Destroy the Object and all relationships to some Object
*
* @method qui/controls/Control#destroy
*/
destroy: function () {
destroy: function() {
this.fireEvent('destroy', [this]);
if (typeof this.$Elm !== 'undefined' && this.$Elm) {
......@@ -89,16 +89,17 @@ define('qui/controls/Control', [
}
// destroy internal qui controls
var controls = QUI.Controls.getControlsInElement(this.$Elm),
controlIds = controls.map(function (InnerControl) {
var controls = QUI.Controls.getControlsInElement(this.$Elm),
controlIds = controls.map(function(InnerControl) {
return InnerControl.getId();
});
controlIds.each(function (InnerControl) {
controlIds.each(function(InnerControl) {
QUI.Controls.destroy(InnerControl);
});
this.$Elm = null;
this.fireEvent('destroyEnd', [this]); // don't move this, if the object no longer exists, the event is not triggered
// storage clear
var oid = Slick.uidOf(this);
......@@ -119,7 +120,7 @@ define('qui/controls/Control', [
* @param {String} [pos] - optional
* @return {Object} qui/controls/Control
*/
inject: function (Parent, pos) {
inject: function(Parent, pos) {
this.fireEvent('drawBegin', [this]);
if (typeof this.$Elm === 'undefined' || !this.$Elm) {
......@@ -149,7 +150,7 @@ define('qui/controls/Control', [
this.fireEvent('inject', [this]);
(function () {
(function() {
try {
this.$Elm.fireEvent('load');
} catch (e) {
......@@ -174,7 +175,7 @@ define('qui/controls/Control', [
* @param {HTMLElement} Elm - Elm node
* @return {Object} qui/controls/Control
*/
imports: function (Elm) {
imports: function(Elm) {
this.$Elm = Elm;
this.$readDataOptions(Elm);
......@@ -200,7 +201,7 @@ define('qui/controls/Control', [
* @param {HTMLElement} Elm - Elm node
* @return {Object} qui/controls/Control
*/
replaces: function (Elm) {
replaces: function(Elm) {
if (this.$Elm) {
return this.$Elm;
}
......@@ -240,7 +241,7 @@ define('qui/controls/Control', [
*
* @param {HTMLElement} [Elm]
*/
$readDataOptions: function (Elm) {
$readDataOptions: function(Elm) {
var TempElm = Elm || this.getElm();
var attribute, attrName, attrValue, numb;
......@@ -248,14 +249,14 @@ define('qui/controls/Control', [
for (var i = 0, len = attributes.length; i < len; i++) {
attribute = attributes[i];
attrName = attribute.name;
attrName = attribute.name;
if (!attrName.match('data-qui-options-')) {
continue;
}
attrValue = attribute.value;
numb = Number.from(attrValue);
numb = Number.from(attrValue);
if (typeOf(numb) === 'number' && numb == attrValue) {
attrValue = numb;
......@@ -278,10 +279,10 @@ define('qui/controls/Control', [
* @method qui/controls/Control#serialize
* @return {Object}
*/
serialize: function () {
serialize: function() {
return {
attributes: this.getAttributes(),
type : this.getType()
type: this.getType()
};
},
......@@ -292,7 +293,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#unserialize
* @param {Object} data
*/
unserialize: function (data) {
unserialize: function(data) {
if (data.attributes) {
this.setAttributes(data.attributes);
}
......@@ -304,7 +305,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#getElm
* @return {HTMLElement}
*/
getElm: function () {
getElm: function() {
if (typeof this.$Elm === 'undefined' || !this.$Elm) {
this.create();
}
......@@ -318,7 +319,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#getParent
* @return {Object|Boolean} qui/controls/Control | false
*/
getParent: function () {
getParent: function() {
return this.$Parent || false;
},
......@@ -330,7 +331,7 @@ define('qui/controls/Control', [
* @param {Object} Parent - qui/controls/Control
* @return {Object} qui/controls/Control
*/
setParent: function (Parent) {
setParent: function(Parent) {
this.$Parent = Parent;
return this;
},
......@@ -341,8 +342,8 @@ define('qui/controls/Control', [
* @method qui/controls/Control#getPath
* @return {String}
*/
getPath: function () {
var path = '/' + this.getAttribute('name'),
getPath: function() {
var path = '/' + this.getAttribute('name'),
Parent = this.getParent();
if (!Parent) {
......@@ -358,7 +359,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#hide
* @return {Object} qui/controls/Control
*/
hide: function () {
hide: function() {
if (this.$Elm) {
this.$Elm.setStyle('display', 'none');
}
......@@ -372,7 +373,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#show
* @return {Object} qui/controls/Control
*/
show: function () {
show: function() {
if (this.$Elm) {
this.$Elm.setStyle('display', null);
}
......@@ -385,7 +386,7 @@ define('qui/controls/Control', [
*
* @return {Boolean}
*/
isHidden: function () {
isHidden: function() {
if (!this.$Elm) {
return true;
}
......@@ -399,7 +400,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#highlight
* @return {Object} qui/controls/Control
*/
highlight: function () {
highlight: function() {
this.fireEvent('highlight', [this]);
return this;
},
......@@ -410,7 +411,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#normalize
* @return {Object} qui/controls/Control
*/
normalize: function () {
normalize: function() {
this.fireEvent('normalize', [this]);
return this;
},
......@@ -421,7 +422,7 @@ define('qui/controls/Control', [
* @method qui/controls/Control#focus
* @return {Object} qui/controls/Control
*/
focus: function () {
focus: function() {
if (this.$Elm) {
// try catch for ie 8 fix
try {
......@@ -438,7 +439,7 @@ define('qui/controls/Control', [
*
* @method qui/controls/Control#resize
*/
resize: function () {
resize: function() {
this.fireEvent('resize', [this]);
},
......@@ -447,7 +448,7 @@ define('qui/controls/Control', [
*
* @param {Object} styles
*/
setStyles: function (styles) {
setStyles: function(styles) {
this.getElm().setStyles(styles);
},
......@@ -457,7 +458,7 @@ define('qui/controls/Control', [
* @param {String} key
* @param {String|Number} value
*/
setStyle: function (key, value) {
setStyle: function(key, value) {
this.getElm().setStyle(key, value);
},
......@@ -469,7 +470,7 @@ define('qui/controls/Control', [
* @param {Function} onfinish - callback function
* @param {Object} [options] - optional { nobuttons : true }
*/
openSheet: function (onfinish, options) {
openSheet: function(onfinish, options) {
var self = this;
options = options || {};
......@@ -480,7 +481,7 @@ define('qui/controls/Control', [
var Sheet = new Element('div', {
'class': 'qui-sheet qui-box',
html : '<div class="qui-sheet-content box"></div>' +
html: '<div class="qui-sheet-content box"></div>' +
'<div class="qui-sheet-buttons box">' +
'<div class="qui-sheet-buttons-back qui-button btn-white">' +
'<span>' +
......@@ -488,31 +489,31 @@ define('qui/controls/Control', [
'</span>' +
'</div>' +
'</div>',
styles : {
styles: {
display: 'none',
left : -20,
left: -20,
opacity: 0
}
}).inject(this.$Elm);
Sheet.getElement('.qui-sheet-buttons-back').addEvent(
'click',
function () {
function() {
Sheet.fireEvent('close');
}
);
var oldOverflow = this.getElm().getStyle('overflow');
Sheet.addEvent('close', function () {
Sheet.addEvent('close', function() {
self.getElm().setStyle('overflow', oldOverflow);
moofx(Sheet).animate({
left : -20,
left: -20,
opacity: 0
}, {
duration: 200,
callback: function () {
callback: function() {
Sheet.destroy();
}
});
......@@ -540,11 +541,11 @@ define('qui/controls/Control', [
Sheet.setStyle('display', null);
moofx(Sheet).animate({
left : 0,
left: 0,
opacity: 1
}, {
duration: 200,
callback: function () {
callback: function() {
onfinish(Content, Sheet);
}
});
......
......@@ -23,8 +23,8 @@ define('qui/controls/bookmarks/Panel', [
'css!qui/controls/bookmarks/Panel.css'
], function (QUI, QUIPanel, QUIButton, Utils) {
"use strict";
], function(QUI, QUIPanel, QUIButton, Utils) {
'use strict';
/**
* @class qui/controls/bookmarks/Panel
......@@ -34,7 +34,7 @@ define('qui/controls/bookmarks/Panel', [
return new Class({
Extends: QUIPanel,
Type : 'qui/controls/bookmarks/Panel',
Type: 'qui/controls/bookmarks/Panel',
Binds: [
'$create',
......@@ -43,12 +43,12 @@ define('qui/controls/bookmarks/Panel', [
'$onItemMouseLeave'
],
initialize: function (options) {
initialize: function(options) {
this.$bookmarks = [];
this.setAttributes({
title : 'Bookmarks',
icon : 'icon-book fa fa-bookmark',
title: 'Bookmarks',
icon: 'icon-book fa fa-bookmark',
footer: false
});
......@@ -59,17 +59,17 @@ define('qui/controls/bookmarks/Panel', [
/**
* resize the bookmark panels
*/
resize: function () {
resize: function() {
this.parent();
var size = this.$Content.getSize(),
var size = this.$Content.getSize(),
width = size.x - 150;
if (width <= 0) {
return;
}
this.$Content.getElements('.qui-bookmark-text').each(function (Text) {
this.$Content.getElements('.qui-bookmark-text').each(function(Text) {
Text.setStyle('width', width);
});
},
......@@ -80,14 +80,14 @@ define('qui/controls/bookmarks/Panel', [
* @method qui/controls/bookmarks/Panel#serialize
* @return {Object} data
*/
serialize: function () {
serialize: function() {
var i, len, icon, clsName, Icon, Bookmark;
var bookmarks = [];
for (i = 0, len = this.$bookmarks.length; i < len; i++) {
Bookmark = this.$bookmarks[i];
Icon = Bookmark.getElement('.qui-bookmark-icon');
icon = '';
Icon = Bookmark.getElement('.qui-bookmark-icon');
icon = '';
if (Icon.getElement('img')) {
icon = Icon.getElement('img').src;
......@@ -101,17 +101,17 @@ define('qui/controls/bookmarks/Panel', [
}
bookmarks.push({
text : Bookmark.getElement('.qui-bookmark-text').get('text'),
icon : icon,
text: Bookmark.getElement('.qui-bookmark-text').get('text'),
icon: icon,
click: Bookmark.get('data-click'),
path : Bookmark.get('data-path')
path: Bookmark.get('data-path')
});
}
return {
attributes: this.getAttributes(),
type : this.getType(),
bookmarks : bookmarks
type: this.getType(),
bookmarks: bookmarks
};
},
......@@ -122,7 +122,7 @@ define('qui/controls/bookmarks/Panel', [
* @param {Object} data
* @return {Object} this (qui/controls/bookmarks/Panel)
*/
unserialize: function (data) {
unserialize: function(data) {
this.setAttributes(data.attributes);
if (!this.$Container) {
......@@ -142,10 +142,10 @@ define('qui/controls/bookmarks/Panel', [
this.$bookmarks.push(
this.$createEntry({
text : Bookmark.text,
icon : Bookmark.icon,
text: Bookmark.text,
icon: Bookmark.icon,
click: Bookmark.click,
path : Bookmark.path
path: Bookmark.path
}).inject(this.$Container)
);
}
......@@ -160,7 +160,7 @@ define('qui/controls/bookmarks/Panel', [
*
* @method qui/controls/bookmarks/Panel#$create
*/
$create: function () {
$create: function() {
this.$Container = new Element('div').inject(
this.getBody()
);
......@@ -170,9 +170,7 @@ define('qui/controls/bookmarks/Panel', [
}
// qui-contextitem items can be droped
this.getElm()
.addClass('qui-contextitem-dropable')
.addClass('qui-sitemap-entry-dropable');
this.getElm().addClass('qui-contextitem-dropable').addClass('qui-sitemap-entry-dropable');
this.fireEvent('load', [this]);
},
......@@ -184,7 +182,7 @@ define('qui/controls/bookmarks/Panel', [
* @param {Object} Item - qui/controls/Control, A QUI control
* @return {Object} this (qui/controls/bookmarks/Panel)
*/
appendChild: function (Item) {
appendChild: function(Item) {
if (!this.$Container) {
return this;
}
......@@ -202,10 +200,10 @@ define('qui/controls/bookmarks/Panel', [
}).inject(this.$Container);
} else {
Child = this.$createEntry({
text : Item.getAttribute('text'),
icon : Item.getAttribute('icon'),
text: Item.getAttribute('text'),
icon: Item.getAttribute('icon'),
click: Item.getAttribute('bookmark'),
path : ''
path: ''
}).inject(this.$Container);
}
......@@ -222,7 +220,7 @@ define('qui/controls/bookmarks/Panel', [
*
* @method qui/controls/desktop/panels/Bookmarks#remove
*/
remove: function () {
remove: function() {
},
......@@ -233,25 +231,25 @@ define('qui/controls/bookmarks/Panel', [
* @param {Object} params - {text, icon, click}
* @return {HTMLElement}
*/
$createEntry: function (params) {
$createEntry: function(params) {
var BookmarkPanel = this;
params.text = params.text || '';
params.icon = params.icon || false;
params.text = params.text || '';
params.icon = params.icon || false;
params.click = params.click || '';
params.path = params.path || '';
params.path = params.path || '';
var Bookmark = new Element('div', {
'class' : 'qui-bookmark box smooth',
'html' : '<span class="qui-bookmark-icon"></span>' +
'<span class="qui-bookmark-text">' + params.text + '</span>',
'class': 'qui-bookmark box smooth',
'html': '<span class="qui-bookmark-icon"></span>' +
'<span class="qui-bookmark-text">' + params.text + '</span>',
'data-click': params.click,
'data-path' : params.path,
title : params.text,
events : {
click: function () {
'data-path': params.path,
title: params.text,
events: {
click: function() {
var click = this.get('data-click'),
path = this.get('data-path');
path = this.get('data-path');
if (path) {
if (BookmarkPanel.$clickMenuItem(path)) {
......@@ -276,13 +274,13 @@ define('qui/controls/bookmarks/Panel', [
});
var Remove = new QUIButton({
icon : 'icon-remove fa fa-close',
'class' : 'qui-bookmark-button btn-red',
styles : {
icon: 'icon-remove fa fa-close',
'class': 'qui-bookmark-button btn-red',
styles: {
'float': 'right',
display: 'none'
},
events : {
events: {
onClick: this.$clickRemoveButton
},
Bookmark: Bookmark
......@@ -297,7 +295,7 @@ define('qui/controls/bookmarks/Panel', [
Icon.addClass(params.icon);
} else {
new Element('img.qui-button-image', {
src : params.icon,
src: params.icon,
styles: {
'display': 'block' // only image, fix
}
......@@ -315,10 +313,10 @@ define('qui/controls/bookmarks/Panel', [
* @param {String} path - Path to the menu item
* @return {Boolean}
*/
$clickMenuItem: function (path) {
$clickMenuItem: function(path) {
path = path.replace(/^\/|\/$/g, '');
var parts = path.split('/'),
var parts = path.split('/'),
Parent = QUI.Controls.get(parts[0]);
if (!Parent || !Parent.length) {
......@@ -346,12 +344,12 @@ define('qui/controls/bookmarks/Panel', [
* @method qui/controls/bookmarks/Panel#$clickRemoveButton
* @param {Object} Btn - qui/controls/buttons/Button
*/
$clickRemoveButton: function (Btn) {
$clickRemoveButton: function(Btn) {
var i, id, len, list, Bookmark;
list = [];
list = [];
Bookmark = Btn.getAttribute('Bookmark');
id = Slick.uidOf(Bookmark);
id = Slick.uidOf(Bookmark);
for (i = 0, len = this.$bookmarks.length; i < len; i++) {
if (Slick.uidOf(this.$bookmarks[i]) != id) {
......@@ -373,7 +371,7 @@ define('qui/controls/bookmarks/Panel', [
* @method qui/controls/bookmarks/Panel#$onItemMouseEnter
* @param {DOMEvent} event
*/
$onItemMouseEnter: function (event) {
$onItemMouseEnter: function(event) {
if (this.getAttribute('dragable') === false) {
return;
}
......@@ -387,7 +385,7 @@ define('qui/controls/bookmarks/Panel', [
* @method qui/controls/bookmarks/Panel#$onItemMouseLeave
* @param {DOMEvent} event
*/
$onItemMouseLeave: function (event) {
$onItemMouseLeave: function(event) {
event.target.getElements('button').setStyle('display', 'none');
}
});
......
/**
* A breadcrumb bar
*
......@@ -15,9 +14,8 @@ define('qui/controls/breadcrumb/Bar', [
'css!qui/controls/breadcrumb/Bar.css'
], function(Control)
{
"use strict";
], function(Control) {
'use strict';
/**
* @class qui/controls/breadcrumb/Bar
......@@ -28,20 +26,19 @@ define('qui/controls/breadcrumb/Bar', [
*/
return new Class({
Extends : Control,
Type : 'qui/controls/breadcrumb/Bar',
Extends: Control,
Type: 'qui/controls/breadcrumb/Bar',
options : {
width : false, // with of the bar
itemClasses : false, // if the items should get some extra css classes
// can be an array or string
cssclass : false // extra css classes for the bar
options: {
width: false, // with of the bar
itemClasses: false, // if the items should get some extra css classes
// can be an array or string
cssclass: false // extra css classes for the bar
},
initialize : function(options)
{
initialize: function(options) {
this.$items = [];
this.parent( options );
this.parent(options);
},
/**
......@@ -50,19 +47,18 @@ define('qui/controls/breadcrumb/Bar', [
* @method qui/controls/breadcrumb/Bar#create
* @return {HTMLElement}
*/
create : function()
{
create: function() {
this.$Elm = new Element('div', {
'class' : 'qui-breadcrumb box',
'data-quiid' : this.getId()
'class': 'qui-breadcrumb box',
'data-quiid': this.getId()
});
if ( this.getAttribute( 'width' ) ) {
this.$Elm.setStyle( 'width', this.getAttribute( 'width' ) );
if (this.getAttribute('width')) {
this.$Elm.setStyle('width', this.getAttribute('width'));
}
if ( this.getAttribute( 'cssclass' ) ) {
this.$Elm.addClass( this.getAttribute( 'cssclass' ) );
if (this.getAttribute('cssclass')) {
this.$Elm.addClass(this.getAttribute('cssclass'));
}
return this.$Elm;
......@@ -75,25 +71,23 @@ define('qui/controls/breadcrumb/Bar', [
* @param {Object} Item - qui/controls/breadcrumb/Item
* @return {Object} this (qui/controls/breadcrumb/Bar)
*/
appendChild : function(Item)
{
if ( Item.getType() !== 'qui/controls/breadcrumb/Item' ) {
appendChild: function(Item) {
if (Item.getType() !== 'qui/controls/breadcrumb/Item') {
return this;
}
this.$items.push( Item );
this.$items.push(Item);
Item.inject( this.getElm() );
Item.inject(this.getElm());
if ( this.getAttribute( 'itemClasses' ) )
{
var cssclass = this.getAttribute( 'itemClasses' );
if (this.getAttribute('itemClasses')) {
var cssclass = this.getAttribute('itemClasses');
if ( typeOf( cssclass ) == 'array' ) {
cssclass = cssclass.join( ' ' );
if (typeOf(cssclass) == 'array') {
cssclass = cssclass.join(' ');
}
Item.getElm().addClass( cssclass );
Item.getElm().addClass(cssclass);
}
return this;
......@@ -105,10 +99,9 @@ define('qui/controls/breadcrumb/Bar', [
* @method qui/controls/breadcrumb/Bar#firstChild
* @return {Object|Boolean} qui/controls/breadcrumb/Item | false
*/
firstChild : function()
{
if ( typeof this.$items[ 0 ] !== 'undefined' ) {
return this.$items[ 0 ];
firstChild: function() {
if (typeof this.$items[0] !== 'undefined') {
return this.$items[0];
}
return false;
......@@ -120,8 +113,7 @@ define('qui/controls/breadcrumb/Bar', [
* @method qui/controls/breadcrumb/Bar#lastChild
* @return {Object|Boolean} qui/controls/breadcrumb/Item | false
*/
lastChild : function()
{
lastChild: function() {
return this.$items.getLast();
},
......@@ -131,8 +123,7 @@ define('qui/controls/breadcrumb/Bar', [
* @method qui/controls/breadcrumb/Bar#getChildren
* @return {Array}
*/
getChildren : function()
{
getChildren: function() {
return this.$items;
},
......@@ -141,9 +132,8 @@ define('qui/controls/breadcrumb/Bar', [
*
* @method qui/controls/breadcrumb/Bar#clear
*/
clear : function()
{
for ( var i = 0, len = this.$items.length; i < len; i++ ) {
clear: function() {
for (var i = 0, len = this.$items.length; i < len; i++) {
this.$items[i].destroy();
}
......@@ -155,10 +145,9 @@ define('qui/controls/breadcrumb/Bar', [
*
* @method qui/controls/breadcrumb/Bar#resize
*/
resize : function()
{
if ( this.getAttribute( 'width' ) ) {
this.getElm().setStyle( 'width', this.getAttribute( 'width' ) );
resize: function() {
if (this.getAttribute('width')) {
this.getElm().setStyle('width', this.getAttribute('width'));
}
}
});
......
/**
* A breadcrumb bar item
*
......@@ -19,9 +18,8 @@ define('qui/controls/breadcrumb/Item', [
'css!qui/controls/breadcrumb/Item.css'
], function(Control, Utils)
{
"use strict";
], function(Control, Utils) {
'use strict';
/**
* @class qui/controls/breadcrumb/Item
......@@ -32,17 +30,16 @@ define('qui/controls/breadcrumb/Item', [
*/
return new Class({
Extends : Control,
Type : 'qui/controls/breadcrumb/Item',
Extends: Control,
Type: 'qui/controls/breadcrumb/Item',
options : {
text : '',
icon : false
options: {
text: '',
icon: false
},
initialize : function(options)
{
this.parent( options );
initialize: function(options) {
this.parent(options);
},
/**
......@@ -51,49 +48,44 @@ define('qui/controls/breadcrumb/Item', [
* @method qui/controls/breadcrumb/Item#create
* @return {HTMLElement}
*/
create : function()
{
create: function() {
var self = this,
icon = this.getAttribute( 'icon' );
icon = this.getAttribute('icon');
this.$Elm = new Element('div', {
'class' : 'qui-breadcrumb-item box smooth',
html : '<span class="qui-breadcrumb-item-text">'+
this.getAttribute( 'text' ) +
'</span>',
alt : this.getAttribute( 'text' ),
title : this.getAttribute( 'text' ),
'data-quiid' : this.getId(),
events :
{
click : function(event) {
self.fireEvent( 'click', [ self, event ] );
'class': 'qui-breadcrumb-item box smooth',
html: '<span class="qui-breadcrumb-item-text">' +
this.getAttribute('text') +
'</span>',
alt: this.getAttribute('text'),
title: this.getAttribute('text'),
'data-quiid': this.getId(),
events:
{
click: function(event) {
self.fireEvent('click', [self, event]);
}
}
}
});
if ( icon )
{
var Icon = this.$Elm.getElement( '.qui-breadcrumb-item-icon' );
if (icon) {
var Icon = this.$Elm.getElement('.qui-breadcrumb-item-icon');
if ( !Icon )
{
if (!Icon) {
Icon = new Element('span', {
'class' : 'qui-breadcrumb-item-icon'
'class': 'qui-breadcrumb-item-icon'
}).inject(
this.$Elm, 'top'
);
}
// font awesome
if ( Utils.isFontAwesomeClass( icon ) )
{
Icon.addClass( icon );
} else
{
if (Utils.isFontAwesomeClass(icon)) {
Icon.addClass(icon);
} else {
Icon.setStyles({
backgroundImage : 'url("'+ this.getAttribute( 'icon' ) +'")',
paddingLeft : 20
backgroundImage: 'url("' + this.getAttribute('icon') + '")',
paddingLeft: 20
});
}
}
......