commit f85cec8fd17465add8edbb75f476cb36e9f1aa84 Author: zhongjin Date: Sun Sep 16 09:00:12 2018 +0800 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..45d85b2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +/.idea/ +/node_modules +*.zip +**/*.zip +/_socket +/.build +#/lib/js +#/lib/css +#/www/_socket +#/cordova/www +#/cordova/platforms/android/assets/www +#/cordova/platforms/android/.gradle +#/cordova/platforms/android/build +#/cordova/platforms/android/CordovaLib/build +#/www/edit.full.html +#/www/index.full.html +#/www/worker-css.js +#/www/worker-html.js +#/www/worker-javascript.js +#/www/css/vis.min.css +#/www/css/visEdit.min.css +#/www/js/vis.min.js +#/www/js/vis.mmin.js +#/www/js/visEdit.min.js +#/www/js/visEdit.mmin.js +#/www/css/channel.png +#/www/css/device.png +#/www/css/icons.gif +#/www/css/loading.gif +#/www/css/state.png +#/iob_npm.done +#/package-lock.json +admin/i18n/*/flat.txt +admin/i18n/flat.txt +.DS_Store + + diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..ab5a99d --- /dev/null +++ b/.npmignore @@ -0,0 +1,15 @@ +Gruntfile.js +gulpfile.js +tasks +ablage.html +node_modules +cordova +.idea +.git +test +*.zip +.travis.yml +appveyor.yml +iob_npm.done +package-lock.json +admin/i18n diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d25da47 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +os: + - linux + - osx +language: node_js +node_js: + - '4' + - '6' + - '8' + - '10' +before_script: + - export NPMVERSION=$(echo "$($(which npm) -v)"|cut -c1) + - 'if [[ $NPMVERSION == 5 ]]; then npm install -g npm@5; fi' + - npm -v + - npm install winston@2.3.0 --production + - 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' + - npm install iobroker.web --prefix ./node_modules/iobroker.js-controller/ --production +env: + - CXX=g++-4.8 +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..51ee865 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,568 @@ +// To use this file in WebStorm, right click on the file name in the Project Panel (normally left) and select "Open Grunt Console" + +/** @namespace __dirname */ +/* jshint -W097 */ +/* jshint strict:false */ +/* jslint node: true */ +'use strict'; + +function getAppName() { + var parts = __dirname.replace(/\\/g, '/').split('/'); + return parts[parts.length - 1].split('.')[0].toLowerCase(); +} + +module.exports = function (grunt) { + + var srcDir = __dirname + '/'; + var pkg = grunt.file.readJSON('package.json'); + var iopackage = grunt.file.readJSON('io-package.json'); + var version = (pkg && pkg.version) ? pkg.version : iopackage.common.version; + var appName = getAppName(); + + // Project configuration. + grunt.initConfig({ + pkg: pkg, + replace: { + core: { + options: { + patterns: [ + { + match: /var version = *'[.0-9]*';/g, + replacement: "var version = '" + version + "';" + }, + { + match: /"version": *"[.0-9]*",/g, + replacement: '"version": "' + version + '",' + }, + { + match: /version: *"[.0-9]*",/, + replacement: 'version: "' + version + '",' + }, + { + match: /version: *'[.0-9]*',/, + replacement: "version: '" + version + "'," + }, { + match: //, + replacement: '' + }, + { + match: /# vis Version [.0-9]+/, + replacement: '# vis Version ' + version + }, + { + match: /# dev build [.0-9]+/g, + replacement: '# dev build 0' + } + ] + }, + files: [ + { + expand: true, + flatten: true, + src: [ + srcDir + 'package.json', + srcDir + 'io-package.json' + ], + dest: srcDir + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'www/cache.manifest', + srcDir + 'www/edit.html', + srcDir + 'www/index.html' + ], + dest: srcDir + '/www' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'www/js/vis.js' + ], + dest: srcDir + '/www/js' + } + ] + }, + name: { + options: { + patterns: [ + { + match: /iobroker/gi, + replacement: appName + }, + { + match: / *\s*Copyright \(c\) \d+-\d+ bluefox https:\/\/github.com\/GermanBluefox, hobbyquaker https:\/\/github.com\/hobbyquaker/gi, + replacement: '' + } + ] + }, + files: [ + { + expand: true, + flatten: true, + src: [ + srcDir + '*.*', + srcDir + '.travis.yml', + '!' + srcDir + 'Gruntfile.js' + ], + dest: srcDir + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'admin/*.*', + '!' + srcDir + 'admin/*.png' + ], + dest: srcDir + 'admin' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'lib/*.*' + ], + dest: srcDir + 'lib' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'example/*.*' + ], + dest: srcDir + 'example' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'www/*.*' + ], + dest: srcDir + 'www' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'www/js/*.*' + ], + dest: srcDir + 'www/js' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'www/widgets/*.*' + ], + dest: srcDir + 'www/widgets' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'test/*.*' + ], + dest: srcDir + 'test' + }, + { + expand: true, + flatten: true, + src: [ + srcDir + 'test/lib/*.*' + ], + dest: srcDir + 'test/lib' + } + ] + }, + minify: { + options: { + patterns: [ + { + match: /' + }, + { + match: //, + replacement: '' + }, + { + match: //, + replacement: '' + }, + { + match: //, + replacement: '' + }, + { + match: //, + replacement: '' + }, + { + match: //, + replacement: '' + }, + { + match: /' + }, + { + match: / + + + + + + + + + + + +
+ + + + +

vis adapter settings

+ + + + + + +
 
instruction
+
+ + diff --git a/admin/index_m.html b/admin/index_m.html new file mode 100644 index 0000000..7bbe089 --- /dev/null +++ b/admin/index_m.html @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + +
+
+
+
+
+ +
+
+
+
+ + +
+
+
+ +
+
+
+ instruction +
+
+
+
+
+ + diff --git a/admin/vis.png b/admin/vis.png new file mode 100644 index 0000000..f52bcd0 Binary files /dev/null and b/admin/vis.png differ diff --git a/admin/words.js b/admin/words.js new file mode 100644 index 0000000..4a26d92 --- /dev/null +++ b/admin/words.js @@ -0,0 +1,11 @@ +// DO NOT EDIT THIS FILE!!! IT WILL BE AUTOMATICALLY GENERATED FROM src/i18n +/*global systemDictionary:true */ +'use strict'; + +systemDictionary = { + "Check license": { "en": "Check license", "de": "Lizenz prüfen", "ru": "Проверить лицензию", "pt": "Verifique a licença", "nl": "Controleer licentie", "fr": "Vérifier la licence", "it": "Controlla la licenza", "es": "Verificar licencia", "pl": "Sprawdź licencję"}, + "License:": { "en": "License key:", "de": "License Key:", "ru": "Лицензионный ключ:", "pt": "Chave de licença:", "nl": "Licentiesleutel:", "fr": "Clé de licence:", "it": "Chiave di licenza:", "es": "Clave de licencia:", "pl": "Klucz licencyjny:"}, + "Service is offline. Please try later.": { "en": "Service is offline or no internet available. Please try later or check the internet connection.", "de": "Service ist momentan nicht erreichbar oder keine Internetverbindung vorhanden. Bitte fersuchen Sie später noch ein mal oder prüfen Sie die Internetverbindung.", "ru": "Сервис сейчас недоступен или нет интернет соединения. Попробуйте попозже или проверте интеренет соединение.", "pt": "O serviço está offline ou não há internet disponível. Por favor tente mais tarde ou confira a conexão com a internet.", "nl": "Service is offline of geen internet beschikbaar. Probeer het later opnieuw of controleer de internetverbinding.", "fr": "Le service est hors ligne ou pas disponible sur Internet. Veuillez réessayer plus tard ou vérifier la connexion Internet.", "it": "Il servizio è offline o non disponibile su Internet. Si prega di provare più tardi o controllare la connessione internet.", "es": "El servicio está fuera de línea o no hay internet disponible. Por favor intente más tarde o verifique la conexión a internet.", "pl": "Usługa jest niedostępna lub nie ma dostępu do Internetu. Spróbuj później lub sprawdź połączenie internetowe."}, + "instruction": { "en": "To use vis, you must get the license key for it.
vis is free for private use, but for commercial use it has a price.
You can get the license on iobroker.net after short registration.", "de": "Man braucht eine Lizenz um vis zu nutzen.
vis ist kostenlos für private Nutzung. Nur für kommerzielle Gebrauch muss man für eine Lizenz bezahlen.
Man kann eine Lizenz auf iobroker.net nach der Registrierung bekommen.", "ru": "Для пользования vis необходимо получить лицензионный ключ.
vis бесплатен для личного использования в некоммерческих целях. Для использования vis в коммерческих целях необходимо заплатить за лицензию.
Лицензионный ключ можно получить здесь iobroker.net после регистрации.", "pt": "Para usar vis , você deve obter a chave de licença para isso. vis é grátis para uso privado, mas para uso comercial, ele tem um preço.
Você pode obter a licença em iobroker.net após curto registro.", "nl": "Als u vis wilt gebruiken, moet u hiervoor de licentiesleutel hebben.
vis is gratis voor privégebruik, maar voor commercieel gebruik heeft het een prijs.
You kan de licentie krijgen op iobroker.net na een korte registratie.", "fr": "Pour utiliser vis , vous devez obtenir la clé de licence.
vis est libre pour un usage privé, mais pour un usage commercial, il a un prix.
Vous peut obtenir la licence sur iobroker.net après une brève inscription.", "it": "Per utilizzare vis , devi ottenere il codice di licenza per esso.
vis è gratuito per uso privato, ma per uso commerciale ha un prezzo.
Tu può ottenere la licenza su iobroker.net dopo una breve registrazione.", "es": "Para usar vis , debe obtener la clave de licencia correspondiente.
vis es gratuito para uso privado, pero para uso comercial tiene un precio.
Usted puede obtener la licencia en iobroker.net después de un breve registro.", "pl": "Aby użyć vis , musisz uzyskać klucz licencyjny. vis jest bezpłatny do użytku prywatnego, ale do celów komercyjnych ma swoją cenę. może uzyskać licencję na iobroker.net po krótkiej rejestracji."}, + "vis adapter settings": { "en": "vis adapter settings", "de": "vis Adapter-Einstellungen", "ru": "Настройки драйвера vis", "pt": "vis as configurações do adaptador", "nl": "vis adapter instellingen", "fr": "paramètres de l'adaptateur vis", "it": "impostazioni della scheda vis", "es": "vis configuración del adaptador", "pl": "ustawienia adaptera vis"}, +}; \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f5eb962 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,26 @@ +version: 'test-{build}' +environment: + matrix: + - nodejs_version: '4' + - nodejs_version: '6' + - nodejs_version: '8' + - nodejs_version: '10' +platform: + - x86 + - x64 +clone_folder: 'c:\projects\%APPVEYOR_PROJECT_NAME%' +install: + - ps: 'Install-Product node $env:nodejs_version $env:platform' + - ps: '$NpmVersion = (npm -v).Substring(0,1)' + - ps: 'if($NpmVersion -eq 5) { npm install -g npm@5 }' + - ps: npm --version + - npm install + - npm install winston@2.3.1 + - 'npm install https://github.com/ioBroker/ioBroker.js-controller/tarball/master --production' + - npm install iobroker.web --prefix ./node_modules/iobroker.js-controller/ +test_script: + - echo %cd% + - node --version + - npm --version + - npm test +build: 'off' diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..14415bc --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,459 @@ +'use strict'; + +var gulp = require('gulp'); +var fs = require('fs'); +var replace = require('gulp-replace'); +var pkg = require('./package.json'); +var iopackage = require('./io-package.json'); +var version = (pkg && pkg.version) ? pkg.version : iopackage.common.version; +/*var appName = getAppName(); + +function getAppName() { + var parts = __dirname.replace(/\\/g, '/').split('/'); + return parts[parts.length - 1].split('.')[0].toLowerCase(); +} +*/ +const fileName = 'words.js'; +var languages = { + en: {}, + de: {}, + ru: {}, + pt: {}, + nl: {}, + fr: {}, + it: {}, + es: {}, + pl: {} +}; +var srcDir = __dirname + '/'; + +function lang2data(lang, isFlat) { + var str = isFlat ? '' : '{\n'; + var count = 0; + for (var w in lang) { + if (lang.hasOwnProperty(w)) { + count++; + if (isFlat) { + str += (lang[w] === '' ? (isFlat[w] || w) : lang[w]) + '\n'; + } else { + var key = ' "' + w.replace(/"/g, '\\"') + '": '; + str += key + '"' + lang[w].replace(/"/g, '\\"') + '",\n'; + } + } + } + if (!count) return isFlat ? '' : '{\n}'; + if (isFlat) { + return str; + } else { + return str.substring(0, str.length - 2) + '\n}'; + } +} + +function readWordJs(src) { + try { + var words; + if (fs.existsSync(src + 'js/' + fileName)) { + words = fs.readFileSync(src + 'js/' + fileName).toString(); + } else { + words = fs.readFileSync(src + fileName).toString(); + } + + var lines = words.split(/\r\n|\r|\n/g); + var i = 0; + while (!lines[i].match(/^\$\.extend\(systemDictionary, {/)) { + i++; + } + lines.splice(0, i); + + // remove last empty lines + i = lines.length - 1; + while (!lines[i]) { + i--; + } + if (i < lines.length - 1) { + lines.splice(i + 1); + } + + lines[0] = lines[0].replace('$.extend(systemDictionary, ', ''); + lines[lines.length - 1] = lines[lines.length - 1].trim().replace(/}\);$/, '}'); + words = lines.join('\n'); + var resultFunc = new Function('return ' + words + ';'); + + return resultFunc(); + } catch (e) { + return null; + } +} +function padRight(text, totalLength) { + return text + (text.length < totalLength ? new Array(totalLength - text.length).join(' ') : ''); +} +function writeWordJs(data, src) { + var text = '// DO NOT EDIT THIS FILE!!! IT WILL BE AUTOMATICALLY GENERATED FROM src/i18n\n'; + text += '/*global systemDictionary:true */\n'; + text += '\'use strict\';\n\n'; + text += 'systemDictionary = {\n'; + for (var word in data) { + if (data.hasOwnProperty(word)) { + text += ' ' + padRight('"' + word.replace(/"/g, '\\"') + '": {', 50); + var line = ''; + for (var lang in data[word]) { + if (data[word].hasOwnProperty(lang)) { + line += '"' + lang + '": "' + padRight(data[word][lang].replace(/"/g, '\\"') + '",', 50) + ' '; + } + } + if (line) { + line = line.trim(); + line = line.substring(0, line.length - 1); + } + text += line + '},\n'; + } + } + text += '};'; + if (fs.existsSync(src + 'js/' + fileName)) { + fs.writeFileSync(src + 'js/' + fileName, text); + } else { + fs.writeFileSync(src + '' + fileName, text); + } +} + +const EMPTY = ''; + +function words2languages(src) { + var langs = Object.assign({}, languages); + var data = readWordJs(src); + if (data) { + for (var word in data) { + if (data.hasOwnProperty(word)) { + for (var lang in data[word]) { + if (data[word].hasOwnProperty(lang)) { + langs[lang][word] = data[word][lang]; + // pre-fill all other languages + for (var j in langs) { + if (langs.hasOwnProperty(j)) { + langs[j][word] = langs[j][word] || EMPTY; + } + } + } + } + } + } + if (!fs.existsSync(src + 'i18n/')) { + fs.mkdirSync(src + 'i18n/'); + } + for (var l in langs) { + if (!langs.hasOwnProperty(l)) continue; + var keys = Object.keys(langs[l]); + //keys.sort(); + var obj = {}; + for (var k = 0; k < keys.length; k++) { + obj[keys[k]] = langs[l][keys[k]]; + } + if (!fs.existsSync(src + 'i18n/' + l)) { + fs.mkdirSync(src + 'i18n/' + l); + } + + fs.writeFileSync(src + 'i18n/' + l + '/translations.json', lang2data(obj)); + } + } else { + console.error('Cannot read or parse ' + fileName); + } +} +function words2languagesFlat(src) { + var langs = Object.assign({}, languages); + var data = readWordJs(src); + if (data) { + for (var word in data) { + if (data.hasOwnProperty(word)) { + for (var lang in data[word]) { + if (data[word].hasOwnProperty(lang)) { + langs[lang][word] = data[word][lang]; + // pre-fill all other languages + for (var j in langs) { + if (langs.hasOwnProperty(j)) { + langs[j][word] = langs[j][word] || EMPTY; + } + } + } + } + } + } + var keys = Object.keys(langs.en); + keys.sort(); + for (var l in langs) { + if (!langs.hasOwnProperty(l)) continue; + var obj = {}; + for (var k = 0; k < keys.length; k++) { + obj[keys[k]] = langs[l][keys[k]]; + } + langs[l] = obj; + } + if (!fs.existsSync(src + 'i18n/')) { + fs.mkdirSync(src + 'i18n/'); + } + for (var ll in langs) { + if (!langs.hasOwnProperty(ll)) continue; + if (!fs.existsSync(src + 'i18n/' + ll)) { + fs.mkdirSync(src + 'i18n/' + ll); + } + + fs.writeFileSync(src + 'i18n/' + ll + '/flat.txt', lang2data(langs[ll], langs.en)); + } + fs.writeFileSync(src + 'i18n/flat.txt', keys.join('\n')); + } else { + console.error('Cannot read or parse ' + fileName); + } +} +function languagesFlat2words(src) { + var dirs = fs.readdirSync(src + 'i18n/'); + var langs = {}; + var bigOne = {}; + var order = Object.keys(languages); + dirs.sort(function (a, b) { + var posA = order.indexOf(a); + var posB = order.indexOf(b); + if (posA === -1 && posB === -1) { + if (a > b) return 1; + if (a < b) return -1; + return 0; + } else if (posA === -1) { + return -1; + } else if (posB === -1) { + return 1; + } else { + if (posA > posB) return 1; + if (posA < posB) return -1; + return 0; + } + }); + var keys = fs.readFileSync(src + 'i18n/flat.txt').toString().split('\n'); + + for (var l = 0; l < dirs.length; l++) { + if (dirs[l] === 'flat.txt') continue; + var lang = dirs[l]; + var values = fs.readFileSync(src + 'i18n/' + lang + '/flat.txt').toString().split('\n'); + langs[lang] = {}; + keys.forEach(function (word, i) { + langs[lang][word] = values[i]; + }); + + var words = langs[lang]; + for (var word in words) { + if (words.hasOwnProperty(word)) { + bigOne[word] = bigOne[word] || {}; + if (words[word] !== EMPTY) { + bigOne[word][lang] = words[word]; + } + } + } + } + // read actual words.js + var aWords = readWordJs(); + + var temporaryIgnore = ['pt', 'fr', 'nl', 'flat.txt']; + if (aWords) { + // Merge words together + for (var w in aWords) { + if (aWords.hasOwnProperty(w)) { + if (!bigOne[w]) { + console.warn('Take from actual words.js: ' + w); + bigOne[w] = aWords[w] + } + dirs.forEach(function (lang) { + if (temporaryIgnore.indexOf(lang) !== -1) return; + if (!bigOne[w][lang]) { + console.warn('Missing "' + lang + '": ' + w); + } + }); + } + } + + } + + writeWordJs(bigOne, src); +} +function languages2words(src) { + var dirs = fs.readdirSync(src + 'i18n/'); + var langs = {}; + var bigOne = {}; + var order = Object.keys(languages); + dirs.sort(function (a, b) { + var posA = order.indexOf(a); + var posB = order.indexOf(b); + if (posA === -1 && posB === -1) { + if (a > b) return 1; + if (a < b) return -1; + return 0; + } else if (posA === -1) { + return -1; + } else if (posB === -1) { + return 1; + } else { + if (posA > posB) return 1; + if (posA < posB) return -1; + return 0; + } + }); + for (var l = 0; l < dirs.length; l++) { + if (dirs[l] === 'flat.txt') continue; + var lang = dirs[l]; + langs[lang] = fs.readFileSync(src + 'i18n/' + lang + '/translations.json').toString(); + langs[lang] = JSON.parse(langs[lang]); + var words = langs[lang]; + for (var word in words) { + if (words.hasOwnProperty(word)) { + bigOne[word] = bigOne[word] || {}; + if (words[word] !== EMPTY) { + bigOne[word][lang] = words[word]; + } + } + } + } + // read actual words.js + var aWords = readWordJs(); + + var temporaryIgnore = ['pt', 'fr', 'nl', 'it', 'es', 'pl']; + if (aWords) { + // Merge words together + for (var w in aWords) { + if (aWords.hasOwnProperty(w)) { + if (!bigOne[w]) { + console.warn('Take from actual words.js: ' + w); + bigOne[w] = aWords[w] + } + dirs.forEach(function (lang) { + if (temporaryIgnore.indexOf(lang) !== -1) return; + if (!bigOne[w][lang]) { + console.warn('Missing "' + lang + '": ' + w); + } + }); + } + } + + } + + writeWordJs(bigOne, src); +} + +gulp.task('wwwWords2languages', function (done) { + words2languages('./www/'); + done(); +}); + +gulp.task('wwwWords2languagesFlat', function (done) { + words2languagesFlat('./www/'); + done(); +}); + +gulp.task('wwwLanguagesFlat2words', function (done) { + languagesFlat2words('./www/'); + done(); +}); + +gulp.task('wwwLanguages2words', function (done) { + languages2words('./www/'); + done(); +}); + +gulp.task('adminWords2languages', function (done) { + words2languages('./admin/'); + done(); +}); + +gulp.task('adminWords2languagesFlat', function (done) { + words2languagesFlat('./admin/'); + done(); +}); + +gulp.task('adminLanguagesFlat2words', function (done) { + languagesFlat2words('./admin/'); + done(); +}); + +gulp.task('adminLanguages2words', function (done) { + languages2words('./admin/'); + done(); +}); + + +gulp.task('replacePkg', function (done) { + gulp.src([ + srcDir + 'package.json', + srcDir + 'io-package.json' + ]) + .pipe(replace(/"version": *"[.0-9]*",/g, '"version": "' + version + '",')) + .pipe(gulp.dest(srcDir)); +}); +gulp.task('replaceVis', function () { + return gulp.src([ + srcDir + 'www/js/vis.js' + ]) + .pipe(replace(/var version = *'[.0-9]*';/g, 'var version = "' + version + '";')) + .pipe(replace(/"version": *"[.0-9]*",/g, '"version": "' + version + '",')) + .pipe(replace(/version: *"[.0-9]*",/g, 'version: "' + version + '",')) + .pipe(replace(/version: *'[.0-9]*',/g, 'version: \'' + version + '\',')) + .pipe(replace(//g, '')) + .pipe(replace(/# vis Version [.0-9]+/g, '# vis Version ' + version)) + .pipe(replace(/ dev build [.0-9]+/g, '# dev build 0')) + .pipe(gulp.dest( srcDir + '/www/js')); +}); +gulp.task('replaceHtml', function (done) { + gulp.src([ + srcDir + 'www/cache.manifest', + srcDir + 'www/index.html', + srcDir + 'www/edit.html' + ]) + .pipe(replace(//g, '')) + .pipe(replace(/var version = *'[.0-9]*';/g, 'var version = \'' + version + '\';')) + .pipe(replace(/"version": *"[.0-9]*",/g, '"version": "' + version + '",')) + .pipe(replace(/version: *"[.0-9]*",/g, 'version: "' + version + '",')) + .pipe(replace(/version: *'[.0-9]*',/g, 'version: \'' + version + '\',')) + .pipe(replace(/# vis Version [.0-9]+/g, '# vis Version ' + version)) + .pipe(replace(/# dev build [.0-9]+/g, '# dev build 0')) + .pipe(gulp.dest(srcDir + '/www')); +}); + +gulp.task('updatePackages', function (done) { + iopackage.common.version = pkg.version; + iopackage.common.news = iopackage.common.news || {}; + if (!iopackage.common.news[pkg.version]) { + var news = iopackage.common.news; + var newNews = {}; + + newNews[pkg.version] = { + en: 'news', + de: 'neues', + ru: 'новое' + }; + iopackage.common.news = Object.assign(newNews, news); + } + fs.writeFileSync('io-package.json', JSON.stringify(iopackage, null, 4)); + done(); +}); + +gulp.task('updateReadme', function (done) { + var readme = fs.readFileSync('README.md').toString(); + var pos = readme.indexOf('## Changelog\n'); + if (pos !== -1) { + var readmeStart = readme.substring(0, pos + '## Changelog\n'.length); + var readmeEnd = readme.substring(pos + '## Changelog\n'.length); + + if (readme.indexOf(version) === -1) { + var timestamp = new Date(); + var date = timestamp.getFullYear() + '-' + + ('0' + (timestamp.getMonth() + 1).toString(10)).slice(-2) + '-' + + ('0' + (timestamp.getDate()).toString(10)).slice(-2); + + var news = ''; + if (iopackage.common.news && iopackage.common.news[pkg.version]) { + news += '* ' + iopackage.common.news[pkg.version].en; + } + + fs.writeFileSync('README.md', readmeStart + '### ' + version + ' (' + date + ')\n' + (news ? news + '\n\n' : '\n') + readmeEnd); + } + } + done(); +}); + +gulp.task('replace', ['replacePkg', 'replaceVis', 'replaceHtml']); + +gulp.task('default', ['updatePackages', 'updateReadme', 'replace']); diff --git a/img/dark_screen.png b/img/dark_screen.png new file mode 100644 index 0000000..ac00f09 Binary files /dev/null and b/img/dark_screen.png differ diff --git a/io-package.json b/io-package.json new file mode 100644 index 0000000..44caf3b --- /dev/null +++ b/io-package.json @@ -0,0 +1,240 @@ +{ + "common": { + "name": "vis", + "version": "1.1.7", + "title": "Visualisation", + "titleLang": { + "en": "Visualisation", + "de": "Visualisierung", + "ru": "Визуализация", + "pt": "Visualização", + "nl": "Visualisatie", + "fr": "Visualisation", + "it": "Visualizzazione", + "es": "Visualización", + "pl": "Wizualizacja" + }, + "news": { + "1.1.7": { + "en": "view8 corrected", + "de": "view8 korrigiert", + "ru": "view8 исправлено", + "pt": "view8 corrigido", + "nl": "view8 gecorrigeerd", + "fr": "view8 corrigé", + "it": "view8 corretta", + "es": "view8 corregido", + "pl": "view8 poprawiony" + }, + "1.1.6": { + "en": "New special bindings are supported\nError with fast view changes is fixed\nfix (jqui - ctrl - IconState / val - Icon Bool)", + "de": "Neue spezielle Bindungen werden unterstützt\nFehler bei schnellen Ansichtsänderungen ist behoben\nfix (jqui - Strg - IconState / val - Icon Bool)", + "ru": "Поддерживаются новые специальные привязки\nИсправлена ​​ошибка с быстрым изменением вида\nfix (jqui - ctrl - IconState / val - Icon Bool)", + "pt": "Novas ligações especiais são suportadas\nErro com alterações de visualização rápida corrigidas\ncorrigir (jqui - ctrl - IconState / val - Bool de ícone)", + "nl": "Nieuwe speciale bindingen worden ondersteund\nFout bij snelle wijzigingen in weergave is opgelost\nfix (jqui - ctrl - IconState / val - Icon Bool)", + "fr": "Les nouvelles liaisons spéciales sont prises en charge\nErreur avec les changements d'affichage rapide est fixée\ncorriger (jqui - ctrl - IconState / val - Icône Bool)", + "it": "Sono supportati nuovi binding speciali\nL'errore con le modifiche veloci alla vista è stato risolto\ncorreggere (jqui - ctrl - IconState / val - Icon Bool)", + "es": "Se admiten nuevos enlaces especiales\nSe corrigió el error con los cambios de vista rápida\ncorregir (jqui - ctrl - IconState / val - Icon Bool)", + "pl": "Nowe powiązania specjalne są obsługiwane\nNaprawiono błąd związany z szybkimi zmianami widoku\nnapraw (jqui - ctrl - IconState / val - Icon Bool)" + }, + "1.1.4": { + "en": "Fixing the saving of project\nFixing the background selector\nFixing the null pointer problem\nFixing the selection helper\nUpdate translations", + "de": "Die Projektspeicherung ist korrigiert\nHintergrundselektors ist korrigiert\nReparieren des Null-Zeiger-Problems\nAuswahlhelfer korrigiert\nÜbersetzungen", + "ru": "исправлено сохранение проекта\nисправлен переключатель фона\nУстранение проблемы с нулевым указателем\nисправлен выбор виджетов\nпереводы", + "pt": "Reparando a poupança do projeto\nCorrigindo o seletor de fundo\nCorrigindo o problema do ponteiro nulo\nReparando o auxiliar de seleção\nAtualizar traduções", + "nl": "Het opslaan van het project bevestigen\nDe achtergrondkiezer bevestigen\nVaststelling van het probleem met de null-wijzer\nDe selectiehulp bevestigen\nUpdate vertalingen", + "fr": "Fixer la sauvegarde du projet\nFixer le sélecteur d'arrière-plan\nCorrection du problème du pointeur nul\nCorrection de l'assistant de sélection\nMise à jour", + "it": "Risolvendo il salvataggio del progetto\nRisolto il problema con il selettore dello sfondo\nRisolvere il problema con il puntatore nullo\nRiparare l'helper di selezione\nAggiorna traduzioni", + "es": "Corregir el guardado del proyecto\nReparar el selector de fondo\nCorregir el problema del puntero nulo\nReparar el asistente de selección\nActualizar traducciones", + "pl": "Naprawienie zapisu projektu\nNaprawianie wybieraka tła\nNaprawiono problem z pustym wskaźnikiem\nNaprawianie pomocnika wyboru\nZaktualizuj tłumaczenia" + }, + "1.1.2": { + "en": "Fixing the saving of project\nFixing the background selector\nFixing the null pointer problem\nFixing the selection helper\nUpdate translations", + "de": "Die Projektspeicherung ist korrigiert\nHintergrundselektors ist korrigiert\nReparieren des Null-Zeiger-Problems\nAuswahlhelfer korrigiert\nÜbersetzungen", + "ru": "исправлено сохранение проекта\nисправлен переключатель фона\nУстранение проблемы с нулевым указателем\nисправлен выбор виджетов\nпереводы", + "pt": "Reparando a poupança do projeto\nCorrigindo o seletor de fundo\nCorrigindo o problema do ponteiro nulo\nReparando o auxiliar de seleção\nAtualizar traduções", + "nl": "Het opslaan van het project bevestigen\nDe achtergrondkiezer bevestigen\nVaststelling van het probleem met de null-wijzer\nDe selectiehulp bevestigen\nUpdate vertalingen", + "fr": "Fixer la sauvegarde du projet\nFixer le sélecteur d'arrière-plan\nCorrection du problème du pointeur nul\nCorrection de l'assistant de sélection\nMise à jour", + "it": "Risolvendo il salvataggio del progetto\nRisolto il problema con il selettore dello sfondo\nRisolvere il problema con il puntatore nullo\nRiparare l'helper di selezione\nAggiorna traduzioni", + "es": "Corregir el guardado del proyecto\nReparar el selector de fondo\nCorregir el problema del puntero nulo\nReparar el asistente de selección\nActualizar traducciones", + "pl": "Naprawienie zapisu projektu\nNaprawianie wybieraka tła\nNaprawiono problem z pustym wskaźnikiem\nNaprawianie pomocnika wyboru\nZaktualizuj tłumaczenia" + }, + "1.1.1": { + "en": "The problem with view change on the touch devices fixed", + "de": "Das Problem mit der Ansicht Änderung auf den Touch-Geräten behoben", + "ru": "Проблема с изменением вида на сенсорных устройствах исправлена", + "pt": "O problema com a mudança de exibição nos dispositivos de toque fixos", + "nl": "Het probleem met de wijziging van weergave op de aanraakapparaten is opgelost", + "fr": "Le problème avec le changement de vue sur les appareils tactiles fixés", + "it": "Risolto il problema con il cambio di vista sui dispositivi touch", + "es": "El problema con el cambio de vista en los dispositivos táctiles solucionó", + "pl": "Naprawiono problem z zmianą widoku na urządzeniach dotykowych" + }, + "1.0.5": { + "en": "show number of datapoints in every project", + "de": "Zeige die Anzahl von Datenpunkten in jedem Projekt", + "ru": "Показывет количество используемых данных в каждом проекте" + }, + "1.0.4": { + "en": "Add autocomplete for view CSS options\nchange edit of view CSS background options", + "de": "Automatische Vervollständigung für View-CSS-Optionen hinzufügen\nÄndern der CSS-Hintergrundoptionen für View", + "ru": "Добавлено автозаполнение для CSS опций страницы\nИзменение редактирования background CSS страницы" + }, + "1.0.3": { + "en": "Release candidate\nFix parse of invalid bindings\nadd moment.js", + "de": "Release candidate\nKorrigiere die Aufbau von falschen Bindings\nmoment.js hinzugefügt", + "ru": "Release candidate\nПоправлен рендеринг неправильных bindings\nДобавлен moment.js" + }, + "0.15.6": { + "en": "Added array operator to bindings", + "de": "Array Operator zu bindings hinzugefügt" + }, + "0.15.5": { + "en": "Fix widgets upload", + "de": "Korrigiere Widgets uplaod", + "ru": "Исправлено обновление виджетов" + }, + "0.15.4": { + "en": "Add swipe", + "de": "Swipe hunzugefügt", + "ru": "Добавлен swipe" + }, + "0.15.3": { + "en": "Add full screen widget\nFix timestamp widget", + "de": "Full Screen Widget hunzugefügt\nKorrigiere timestamp widget", + "ru": "Добавлен виджет full screen\nИсправлен виджет timestamp" + }, + "0.15.2": { + "en": "Fix binding if it has \"-\" in the OID", + "de": "Korrigiere den fehler mit Binding und \"-\" in OID", + "ru": "Исправлены bindings, если содержат минус в имени" + }, + "0.15.1": { + "en": "Fix error with context menu\nAllow add class to view", + "de": "Korrigiere den fehler mit dem Kontext-Menu\nErlaube Klasse zur Seite hinzufügen", + "ru": "Исправлено контекстное меню\nМожно добавлять классы к страницам" + } + }, + "desc": { + "en": "Graphical user interface for iobroker", + "de": "Grafische Benutzeroberfläche für iobroker", + "ru": "Графический пользовательский интерфейс для iobroker", + "pt": "Interface gráfica do usuário para iobroker", + "nl": "Grafische gebruikersinterface voor iobroker", + "fr": "Interface utilisateur graphique pour iobroker", + "it": "Interfaccia utente grafica per iobroker", + "es": "Interfaz gráfica de usuario para iobroker", + "pl": "Graficzny interfejs użytkownika dla iobroker" + }, + "platform": "Javascript/Node.js", + "loglevel": "info", + "icon": "vis.png", + "enabled": true, + "mode": "once", + "extIcon": "https://raw.githubusercontent.com/iobroker/iobroker.vis/master/admin/vis.png", + "keywords": [ + "DashUI", + "GUI", + "graphical", + "scada" + ], + "readme": "https://github.com/iobroker/iobroker.vis/blob/master/README.md", + "authors": [ + "bluefox " + ], + "localLink": "%web_protocol%://%ip%:%web_port%/vis/edit.html", + "license": "CC BY-NC", + "dependencies": [ + { + "web": ">=1.5.4" + } + ], + "restartAdapters": [ + "vis" + ], + "serviceStates": "lib/states.js", + "singleton": true, + "type": "visualization", + "highlight": true, + "noConfig": false, + "materialize": true, + "welcomeScreen": { + "link": "vis/index.html", + "name": "vis runtime", + "img": "vis/img/favicon.png", + "color": "#ffe9c8", + "order": 0 + }, + "welcomeScreenPro": { + "link": "vis/edit.html", + "name": "vis editor", + "img": "vis/img/faviconEdit.png", + "color": "#c8ffe1", + "order": 1 + } + }, + "native": { + "defaultFileMode": 1604, + "license": "" + }, + "instanceObjects": [ + { + "_id": "", + "type": "meta", + "common": { + "name": "user files and images for vis", + "type": "meta.user" + }, + "native": {} + }, + { + "_id": "control", + "type": "channel", + "common": { + "name": "Control vis" + }, + "native": {} + }, + { + "_id": "control.instance", + "type": "state", + "common": { + "name": "Control vis", + "type": "string", + "desc": "Write here browser instance ID to control or 'FFFFFFFF' to control all instances" + }, + "native": {} + }, + { + "_id": "control.command", + "type": "state", + "common": { + "name": "Command for vis", + "type": "string", + "desc": "Writing this variable akt as the trigger. Instance and data must be preset before 'command' will be written. 'changedView' will be signalled too", + "states": { + "alert": "alert", + "changeView": "changeView", + "refresh": "refresh", + "reload": "reload", + "dialog": "dialog", + "popup": "popup", + "playSound": "playSound", + "changedView": "changedView", + "tts": "tts" + } + }, + "native": {} + }, + { + "_id": "control.data", + "type": "state", + "common": { + "name": "Data for control vis", + "type": "string", + "desc": "Used for: alert, changeView, dialog, popup, playSound, changedView" + }, + "native": {} + } + ] +} \ No newline at end of file diff --git a/lib/cloudCert.crt b/lib/cloudCert.crt new file mode 100644 index 0000000..c2cece1 --- /dev/null +++ b/lib/cloudCert.crt @@ -0,0 +1,9 @@ +-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp1C0AJ+H6KeRo77undcx +kyKDn3edWDaTNrxvg4DhlGgCEBAcStoROu+6TKMw5bc/V+U4s7vqfz9vxh4GXtUk +RwPsx2ggrhp08bUYeO9zA9EMFICD6Klva6FALqCLpwv4e8g1CzeKQqhxzAe7v/Ey +dMW4foMyugGHGEO6ZCbHyPMdrg0A4NmpSV/TsWduBbjkq03D63ovAzM+u2lAHHrt +84QShY1ZZoRCHD2F7bRQW906wiVZNfQYKSeTkfc9Ctatuz8JMIq57dlyAF/R6+jC +UodEZvqO9ZTDRGbX2MWDdedRMAt8hPQxjxugiUheMCCrTbdZ5bxeXqyaTLYuzNyV +bwIDAQAB +-----END PUBLIC KEY----- \ No newline at end of file diff --git a/lib/convert.js b/lib/convert.js new file mode 100644 index 0000000..2df6eba --- /dev/null +++ b/lib/convert.js @@ -0,0 +1,100 @@ +// this file is used by controller when build uploads +function stringify(name, data, isConvert, files) { + if (isConvert && name.match(/vis-views\.json$/)) { + var parts = name.split('/'); + var project = parts.shift(); + data = data.toString(); + // detect: /vis/, /vis.0/, /icon-blabla/, ... + var m = data.match(/": "\/[-_0-9\w]+(\.[-_0-9\w]+)?\/.+\.(png|jpg|jpeg|gif|wav|mp3|bmp|svg)+"/g); + if (m) { + for (var mm = 0; mm < m.length; mm++) { + var fn = m[mm].substring(5); // remove ": "/ + var originalFileName = fn.replace(/"/g, ''); // remove last " + var p = fn.split('/'); + var adapter = p.shift(); // remove vis.0 or whatever + var _project = p.length > 1 ? p.shift() : ''; + fn = p.length ? p.shift() : ''; // keep only one subdirectory + fn += p.length ? '/' + p.join('/') : '';// all other subdirectories combine again + + if (adapter !== 'vis.0' || _project !== project) { + // add to files + if (files.indexOf(originalFileName) === -1) { // if "vis.0/dir/otherProject.png" + files.push(originalFileName); + } + data = data.replace(m[mm], '": "/vis.0/' + project + '/' + fn); + } + } + } + // try to replace + m = data.match(/src=\\"\/[-_0-9\w]+(\.[-_0-9\w]+)?\/.+\.(png|jpg|jpeg|gif|wav|mp3|bmp|svg)+\\"/g); + if (m) { + for (var mm = 0; mm < m.length; mm++) { + var fn = m[mm].substring(7); // remove src=\"/ + var originalFileName = fn.replace(/\\"/g, ''); // remove last " + var p = fn.split('/'); + var adapter = p.shift(); // remove vis.0 or whatever + var _project = p.length > 1 ? p.shift() : ''; + fn = p.length ? p.shift() : ''; // keep only one subdirectory + fn += p.length ? '/' + p.join('/') : '';// all other subdirectories combine again + + if (adapter !== 'vis.0' || _project !== project) { + // add to files + if (files.indexOf(originalFileName) === -1) { // if "vis.0/dir/otherProject.png" + files.push(originalFileName); + } + data = data.replace(m[mm], 'src=\\"/vis.0/' + project + '/' + fn); + } + } + } + // try to replace + m = data.match(/src='\/[-_0-9\w]+(\.[-_0-9\w]+)?\/.+\.(png|jpg|jpeg|gif|wav|mp3|bmp|svg)+'/g); + if (m) { + for (var mm = 0; mm < m.length; mm++) { + var fn = m[mm].substring(6); // remove src="/ + var originalFileName = fn.replace(/'/g, ''); // remove last " + var p = fn.split('/'); + var adapter = p.shift(); // remove vis.0 or whatever + var _project = p.length > 1 ? p.shift() : ''; + fn = p.length ? p.shift() : ''; // keep only one subdirectory + fn += p.length ? '/' + p.join('/') : '';// all other subdirectories combine again + + if (adapter !== 'vis.0' || _project !== project) { + // add to files + if (files.indexOf(originalFileName) === -1) { // if "vis.0/dir/otherProject.png" + files.push(originalFileName); + } + data = data.replace(m[mm], "src='/vis.0/" + project + '/' + fn); + } + } + } + // try to replace + m = data.match(/\.[A-Z]{3}\d{7}\./g); + if (m) { + for (var t = 0; t < m.length; t++) { + data = data.replace(m[t], '.ABC' + Math.round(Math.random() * 1000000) + '.'); + } + } + // try to replace 12.13.14.15 + data = data.replace(/\/\/(?:[0-9]{1,3}\.){3}[0-9]{1,3}\//g, '//127.0.0.1/'); + + // try to replace http://user:pass@address/ + data = data.replace(/((http|https):\/\/)?([-\w0-9_.]+?):([-\w0-9_*.]+)?@[-\w0-9.]+\//g, '//127.0.0.1/'); + } + return data; +} + +function parse(projectName, fileName, data, settings) { + if (fileName.match(/vis-views\.json$/)) { + // Check if all images are in the right directory + var project = projectName; + if (project[project.length - 1] === '/') project = project.substring(0, project.length - 1); + data = data.toString(); + + // detect: "/vis.0/project/picture.png" + data = data.replace(/"\/vis.0\/([-_0-9\w]+)\//g, '"/vis.0/' + project + '/'); + data = data.replace(/'\/vis.0\/([-_0-9\w]+)\//g, "'/vis.0/" + project + '/'); + } + return data; +} +module.exports.stringify = stringify; +module.exports.parse = parse; \ No newline at end of file diff --git a/lib/install.js b/lib/install.js new file mode 100644 index 0000000..d9dabab --- /dev/null +++ b/lib/install.js @@ -0,0 +1,211 @@ +var fs = require('fs'); +var path = require('path'); + +function copyFileSync(source, target) { + var targetFile = target; + + //if target is a directory a new file with the same name will be created + if (fs.existsSync(target)) { + if (fs.lstatSync(target).isDirectory()) { + targetFile = path.join(target, path.basename(source)); + } + } + + fs.writeFileSync(targetFile, fs.readFileSync(source)); +} + +function copyFolderRecursiveSync(source, target) { + var files = []; + + //check if folder needs to be created or integrated + var targetFolder = path.join(target, path.basename(source)); + if (!fs.existsSync(targetFolder)) { + fs.mkdirSync(targetFolder); + } + + //copy + if (fs.lstatSync(source).isDirectory() ) { + files = fs.readdirSync( source ); + files.forEach(function (file) { + var curSource = path.join(source, file); + if (fs.lstatSync(curSource).isDirectory()) { + copyFolderRecursiveSync(curSource, targetFolder); + } else { + copyFileSync(curSource, targetFolder); + } + }); + } +} + +function deleteFolderRecursive (path) { + var files = []; + if (fs.existsSync(path)) { + files = fs.readdirSync(path); + files.forEach(function(file, index){ + var curPath = path + '/' + file; + if(fs.lstatSync(curPath).isDirectory()) { // recurse + deleteFolderRecursive(curPath); + } else { // delete file + fs.unlinkSync(curPath); + } + }); + fs.rmdirSync(path); + } +} + +var generic = [ + 'basic', + 'jqplot', + 'jqui', + 'tabs', + 'swipe' +]; + +var widgetSetsDependencies = { + jqui: ['basic'] +}; + +function syncWidgetSets(onlyLocal, isLicenseError) { + if (process.argv.indexOf('--beta') !== -1) return; + + var pack = null; + var changed = false; + var found; + var name; + var path = __dirname + '/../../'; + + // find all installed widget sets + if (onlyLocal) { + path = __dirname + '/../node_modules/'; + } else { + path = __dirname + '/../../'; + } + var dirs = fs.readdirSync(path); + var sets = []; + for (var d = 0; d < dirs.length; d++) { + if (dirs[d].match(/^iobroker\./i) && fs.existsSync(path + dirs[d] + '/widgets/')) { + pack = null; + try { + pack = JSON.parse(fs.readFileSync(path + dirs[d] + '/io-package.json').toString()); + } catch (e) { + console.warn('Cannot parse "' + path + dirs[d] + '/io-package.json": ' + e); + } + sets.push({path: path + dirs[d], name: dirs[d].toLowerCase(), pack: pack}); + } + } + if (!onlyLocal) { + try { + dirs = fs.readdirSync(__dirname + '/../../../../'); + for (d = 0; d < dirs.length; d++) { + if (dirs[d].match(/^iobroker\./i) && fs.existsSync(__dirname + '/../../../../' + dirs[d] + '/widgets/')) { + found = false; + name = dirs[d].toLowerCase(); + for (var s = 0; s < sets.length; s++) { + if (sets[s].name === name) { + found = true; + break; + } + } + if (!found) { + pack = null; + try { + pack = JSON.parse(fs.readFileSync(__dirname + '/../../../../' + dirs[d] + '/io-package.json').toString()); + } catch (e) { + console.warn('Cannot parse "' + __dirname + '/../../../../' + dirs[d] + '/io-package.json": ' + e); + } + sets.push({path: __dirname + '/../../../../' + dirs[d], name: dirs[d].toLowerCase()}); + } + } + } + } catch (e) { + + } + } + + // Now we have the list of widgets => copy them all to widgets directory + for (d = 0; d < sets.length; d++) { + copyFolderRecursiveSync(sets[d].path + '/widgets/', __dirname + '/../www/'); + } + var widgetSets = []; + + // Read the list of installed widgets + var installed = fs.readdirSync(__dirname + '/../www/widgets/'); + for (d = 0; d < installed.length; d++) { + if (installed[d].match(/\.html$/)) { + name = installed[d].replace('.html', ''); + var isGeneric = generic.indexOf(name) !== -1; + found = isGeneric; + + if (!found) { + for (var b = 0; b < sets.length; b++) { + var ssName = sets[b].name.toLowerCase(); + if (ssName === 'iobroker.vis-' + name || ssName === 'iobroker.' + name) { + found = true; + break; + } + } + } + + if (!found) { + changed = true; + //delete + fs.unlinkSync(__dirname + '/../www/widgets/' + name + '.html'); + if (fs.existsSync(__dirname + '/../www/widgets/' + name)) { + deleteFolderRecursive(__dirname + '/../www/widgets/' + name); + } + } + else { + if (isGeneric) { + if (widgetSetsDependencies[name] && widgetSetsDependencies[name].length) { + widgetSets.push({name: name, depends: widgetSetsDependencies[name]}); + } else { + widgetSets.push(name); + } + } else { + for (var g = 0; g < sets.length; g++) { + var sName = sets[g].name.toLowerCase(); + if (sName === 'iobroker.vis-' + name || sName === 'iobroker.' + name) { + if (sets[g].pack && sets[g].pack.native && sets[g].pack.native.always) { + widgetSets.push({name: name, always: true}); + } else if (sets[g].pack && sets[g].pack.native && sets[g].pack.native.dependencies) { + widgetSets.push({name: name, depends: sets[g].pack.native.dependencies}); + } else { + widgetSets.push(name); + } + break; + } + } + } + } + } + } + + // build config file + var visConfig = { + widgetSets: widgetSets + }; + + var text = 'var visConfig = ' + JSON.stringify(visConfig, null, 4) + ';\n'; + if (isLicenseError) { + text = text.replace('var visConfig = {', 'var visConfig = {license: false,'); + } + text += 'if (typeof exports !== \'undefined\') {\n'; + text += ' exports.config = visConfig;\n'; + text += '} else {\n'; + text += ' visConfig.language = window.navigator.userLanguage || window.navigator.language;\n'; + text += '}\n'; + + var oldText = fs.readFileSync(__dirname + '/../www/js/config.js').toString(); + if (oldText !== text) { + fs.writeFileSync(__dirname + '/../www/js/config.js', text); + return text; + } else { + return false; + } +} + +if (typeof module !== 'undefined' && module.parent) { + module.exports = syncWidgetSets; +} else { + syncWidgetSets(); +} diff --git a/lib/states.js b/lib/states.js new file mode 100644 index 0000000..b00c0a1 --- /dev/null +++ b/lib/states.js @@ -0,0 +1,53 @@ +var getUsedObjectIDs = require(__dirname + '/../www/js/visUtils').getUsedObjectIDs; + +function calcProject(objects, projects, instance, result, callback) { + if (!projects || !projects.length) { + callback(null, result || []); + return; + } + result = result || []; + var project = projects.shift(); + if (!project || !project.isDir) { + setImmediate(calcProject, objects, projects, instance, result, callback); + return; + } + + // calculate datapoints in one project + objects.readFile('vis.' + instance, '/' + project.file + '/vis-views.json', function (err, data) { + var json; + try { + json = JSON.parse(data); + } catch (e) { + console.error('Cannot parse "/' + project.file + '/vis-views.json'); + setImmediate(calcProject, objects, projects, instance, result, callback); + return; + } + var dps = getUsedObjectIDs(json, false); + if (dps && dps.IDs) { + result.push({id: 'vis.' + instance + '.datapoints.' + project.file.replace(/[.\\s]/g, '_'), val: dps.IDs.length}); + } + setImmediate(calcProject, objects, projects, instance, result, callback); + }); +} + +function calcProjects(objects, states, instance, config, callback) { + objects.readDir('vis.' + instance, '/', function (err, projects) { + if (err || !projects || !projects.length) { + callback && callback(err || null, [{id: 'vis.' + instance + '.datapoints.total', val: 0}]); + } else { + calcProject(objects, projects, instance, [], function (err, result) { + if (result && result.length) { + var total = 0; + for (var r = 0; r < result.length; r++) { + total += result[r].val; + } + result.push({id: 'vis.' + instance + '.datapoints.total', val: total}); + } + + callback && callback(err, result); + }); + } + }); +} + +module.exports = calcProjects; \ No newline at end of file diff --git a/lib/utils.js b/lib/utils.js new file mode 100644 index 0000000..c8a0eb7 --- /dev/null +++ b/lib/utils.js @@ -0,0 +1,83 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +let controllerDir; +let appName; + +/** + * returns application name + * + * The name of the application can be different and this function finds it out. + * + * @returns {string} + */ + function getAppName() { + const parts = __dirname.replace(/\\/g, '/').split('/'); + return parts[parts.length - 2].split('.')[0]; +} + +/** + * looks for js-controller home folder + * + * @param {boolean} isInstall + * @returns {string} + */ +function getControllerDir(isInstall) { + // Find the js-controller location + const possibilities = [ + 'iobroker.js-controller', + 'ioBroker.js-controller', + ]; + /** @type {string} */ + let controllerPath; + for (const pkg of possibilities) { + try { + const possiblePath = require.resolve(pkg); + if (fs.existsSync(possiblePath)) { + controllerPath = possiblePath; + break; + } + } catch (e) { /* not found */ } + } + if (controllerPath == null) { + if (!isInstall) { + console.log('Cannot find js-controller'); + process.exit(10); + } else { + process.exit(); + } + } + // we found the controller + return path.dirname(controllerPath); +} + +/** + * reads controller base settings + * + * @alias getConfig + * @returns {object} + */ + function getConfig() { + let configPath; + if (fs.existsSync( + configPath = path.join(controllerDir, 'conf', appName + '.json') + )) { + return JSON.parse(fs.readFileSync(configPath, 'utf8')); + } else if (fs.existsSync( + configPath = path.join(controllerDir, 'conf', + appName.toLowerCase() + '.json') + )) { + return JSON.parse(fs.readFileSync(configPath, 'utf8')); + } else { + throw new Error('Cannot find ' + controllerDir + '/conf/' + appName + '.json'); + } +} +appName = getAppName(); +controllerDir = getControllerDir(typeof process !== 'undefined' && process.argv && process.argv.indexOf('--install') !== -1); +const adapter = require(path.join(controllerDir, 'lib/adapter.js')); + +exports.controllerDir = controllerDir; +exports.getConfig = getConfig; +exports.Adapter = adapter; +exports.appName = appName; diff --git a/main.js b/main.js new file mode 100644 index 0000000..e45603a --- /dev/null +++ b/main.js @@ -0,0 +1,371 @@ +/** + * + * iobroker vis Adapter + * + * (c) 2014-2017 bluefox, hobbyquaker + * + * CC-NC-BY 4.0 License + * + */ +/* jshint -W097 */ +/* jshint strict:false */ +/* jslint node: true */ +'use strict'; + +var adapterName = require(__dirname + '/package.json').name.split('.').pop(); +var isBeta = adapterName.indexOf('beta') !== -1; + +var utils = require(__dirname + '/lib/utils'); // Get common adapter utils +var adapter = new utils.Adapter(adapterName); +var fs = require('fs'); +var path = require('path'); +var syncWidgetSets = require(__dirname + '/lib/install.js'); +var https = require('https'); +var jwt = require('jsonwebtoken'); +//var minify = require('html-minifier').minify; + +adapter.on('ready', function () { + main(); +}); + +function writeFile(fileName, callback) { + var config = require(__dirname + '/www/js/config.js').config; + var index; + var srcFileNameParts = fileName.split('.'); + var ext = srcFileNameParts.pop(); + var srcFileName = srcFileNameParts.join('.') + '.src.' + ext; + if (fs.existsSync(__dirname + '/www/' + srcFileName)) { + index = fs.readFileSync(__dirname + '/www/' + srcFileName).toString(); + } else { + index = fs.readFileSync(__dirname + '/www/' + fileName).toString(); + fs.writeFileSync(__dirname + '/www/' + srcFileName, index); + } + + // enable cache + index = index.replace('', + ''); + + var begin = ''; + var end = ''; + var bigInsert = ''; + for (var w in config.widgetSets) { + if (!config.widgetSets.hasOwnProperty(w)) continue; + var file; + var name; + + if (typeof config.widgetSets[w] === 'object') { + name = config.widgetSets[w].name + '.html'; + } else { + name = config.widgetSets[w] + '.html'; + } + file = fs.readFileSync(__dirname + '/www/widgets/' + name); + // extract all css and js + + + bigInsert += '\n' + file.toString() + '\n\n'; + } + var pos = index.indexOf(begin); + if (pos !== -1) { + var start = index.substring(0, pos + begin.length); + pos = index.indexOf(end); + if (pos !== -1) { + var _end = index.substring(pos); + index = start + '\n' + bigInsert + '\n' + _end; + + /*index = minify(index, { + removeAttributeQuotes: true, + removeComments: true, + collapseInlineTagWhitespace: true, + collapseWhitespace: true, + decodeEntities: true, + minifyCSS: true, + minifyJS: true, + removeRedundantAttributes: true, + removeScriptTypeAttributes: true, + removeStyleLinkTypeAttributes: true + });*/ + + adapter.readFile(adapterName, fileName, function (err, data) { + if (data && data !== index) { + fs.writeFileSync(__dirname + '/www/' + fileName, index); + adapter.writeFile(adapterName, fileName, index, function () { + if (callback) callback(true); + }); + } else { + if (callback) callback(false); + } + }); + } else if (callback) { + callback(false); + } + } else if (callback) { + callback(false); + } +} + +function upload(callback) { + adapter.log.info('Upload ' + adapter.name + ' anew, while changes detected...'); + var file = utils.controllerDir + '/iobroker.js'; + var child = require('child_process').spawn('node', [file, 'upload', adapter.name, 'widgets']); + var count = 0; + child.stdout.on('data', function (data) { + count++; + adapter.log.debug(data.toString().replace('\n', '')); + if ((count % 100) === 0) adapter.log.info(count + ' files uploaded...'); + }); + child.stderr.on('data', function (data) { + adapter.log.error(data.toString().replace('\n', '')); + }); + child.on('exit', function (exitCode) { + adapter.log.info('Uploaded. ' + (exitCode ? 'Exit - ' + exitCode : 0)); + callback(exitCode); + }); +} + +function updateCacheManifest(callback) { + adapter.log.info('Changes in index.html detected => update cache.manifest'); + var data = fs.readFileSync(__dirname + '/www/cache.manifest').toString(); + var build = data.match(/# dev build ([0-9]+)/); + data = data.replace(/# dev build [0-9]+/, '# dev build ' + (parseInt(build[1] || 0, 10) + 1)); + fs.writeFileSync(__dirname + '/www/cache.manifest', data); + + adapter.writeFile(adapterName, 'cache.manifest', data, function () { + callback && callback(); + }); +} +// Update index.html +function checkFiles(configChanged, isBeta) { + if (isBeta) { + adapter.stop(); + return; + } + writeFile('index.html', function (indexChanged) { + // Update edit.html + writeFile('edit.html', function (editChanged) { + if (indexChanged || editChanged || configChanged) { + updateCacheManifest(function () { + upload(function () { + adapter.stop(); + }); + }); + } else { + adapter.stop(); + } + }); + }); +} + +function copyFiles(root, filesOrDirs, callback) { + if (!filesOrDirs) { + adapter.readDir('vis.0', root, function (err, filesOrDirs) { + copyFiles(root, filesOrDirs || [], callback); + }); + return; + } + if (!filesOrDirs.length) { + if (typeof callback === 'function') callback(); + return; + } + + var task = filesOrDirs.shift(); + if (task.isDir) { + copyFiles(root + task.file + '/', null, function () { + setTimeout(copyFiles, 0, root, filesOrDirs, callback); + }) + } else { + adapter.readFile('vis.0', root + task.file, function (err, data) { + if (data || data === 0 || data === '') { + adapter.writeFile(adapterName + '.0', root + task.file, data, function () { + setTimeout(copyFiles, 0, root, filesOrDirs, callback); + }); + } else { + setTimeout(copyFiles, 0, root, filesOrDirs, callback); + } + }); + } +} + +function generatePages(isLicenseError) { + var count = 0; + var changed = false; + + if (!isBeta) { + changed = syncWidgetSets(false, isLicenseError); + + if (changed) { + // upload config.js + count++; + var config = changed; + adapter.readFile(adapterName, 'js/config.js', function (err, data) { + if (data && data !== config) { + adapter.log.info('config.js changed. Upload.'); + adapter.writeFile(adapterName, 'js/config.js', config, function () { + if (!--count) checkFiles(changed, isBeta); + }); + } else { + if (!--count) checkFiles(changed, isBeta); + } + }); + changed = true; + } + } else { + count++; + // try to read vis-beta.0/files + adapter.readDir(adapterName + '.0', '/', function (err, dirs) { + if (!dirs || !dirs.length) { + // copy all directories + copyFiles('/', null, function () { + if (!--count) checkFiles(changed, isBeta); + }) + } else { + if (!--count) checkFiles(changed, isBeta); + } + }); + } + + // create command variable + count++; + adapter.getObject('control.command', function (err, obj) { + if (!obj) { + adapter.setObject('control.command', + { + "type": "state", + "common": { + "name": "Command for vis", + "type": "string", + "desc": "Writing this variable akt as the trigger. Instance and data must be preset before 'command' will be written. 'changedView' will be signalled too", + "states": { + "alert": "alert", + "changeView": "changeView", + "refresh": "refresh", + "reload": "reload", + "dialog": "dialog", + "popup": "popup", + "playSound": "playSound", + "changedView": "changedView", + "tts": "tts" + } + }, + "native": {} + }, + function () { + if (!--count) checkFiles(changed, isBeta); + }) ; + } else { + if (!--count) checkFiles(changed, isBeta); + } + }); + + // Create common user CSS file + count++; + adapter.readFile(adapterName, 'css/vis-common-user.css', function (err, data) { + if (err || data === null || data === undefined) { + adapter.writeFile(adapterName, 'css/vis-common-user.css', '', function () { + if (!--count) checkFiles(changed, isBeta); + }); + } else { + if (!--count) checkFiles(changed, isBeta); + } + }); +} + +function indicateError(callback) { + var data = fs.readFileSync(__dirname + '/www/js/config.js').toString(); + if (data.indexOf('license: false,') === -1) { + data = data.replace('var visConfig = {', 'var visConfig = {license: false,'); + fs.writeFileSync(__dirname + '/www/js/config.js', data); + + adapter.writeFile(adapterName, 'js/config.js', data, function () { + updateCacheManifest(callback); + }); + } else { + callback && callback(); + } +} + +function main() { + // Check if noConfig = false + if (adapter.common.noConfig) { + adapter.getForeignObject('system.adapter.' + adapter.namespace, function (err, obj) { + obj.common.noConfig = false; + adapter.setForeignObject(obj._id, obj, function () { + adapter.stop(); + }); + }); + + return; + } + + // first of all check license + if (!adapter.config.license || typeof adapter.config.license !== 'string') { + indicateError(function () { + adapter.log.error('No license found for vis. Please get one on https://iobroker.net !'); + //adapter.stop(); + generatePages(true); + }); + } else { + // An object of options to indicate where to post to + var postOptions = { + host: 'iobroker.net', + path: '/cert/', + method: 'POST', + headers: { + 'Content-Type': 'text/plain', + 'Content-Length': Buffer.byteLength(adapter.config.license) + } + }; + + // Set up the request + var postReq = https.request(postOptions, function (res) { + res.setEncoding('utf8'); + var result = ''; + res.on('data', function (chunk) { + result += chunk; + }); + + res.on('end', function () { + try { + var data = JSON.parse(result); + if (data.result === 'OK') { + adapter.log.info('vis license is OK.'); + generatePages(); + } else { + indicateError(function () { + adapter.log.error('License is invalid! Nothing updated. Error: ' + (data ? data.result: 'unknown')); + //adapter.stop(); + generatePages(true); + }); + } + } catch (e) { + indicateError(function () { + adapter.log.error('Cannot check license! Nothing updated. Error: ' + (data ? data.result: 'unknown')); + //adapter.stop(); + generatePages(true); + }); + } + }); + }).on('error', function (error) { + jwt.verify(adapter.config.license, fs.readFileSync(__dirname + '/lib/cloudCert.crt'), function (err, decoded) { + if (err) { + adapter.log.error('Cannot check license: ' + error); + //adapter.stop(); + generatePages(true); + } else { + if (decoded && decoded.expires * 1000 < new Date().getTime()) { + adapter.log.error('Cannot check license: Expired on ' + new Date(decoded.expires * 1000).toString()); + adapter.stop(); + } else if (!decoded) { + adapter.log.error('Cannot check license: License is empty'); + //adapter.stop(); + generatePages(true); + } else { + generatePages(false); + } + } + }); + }); + + postReq.write(adapter.config.license); + postReq.end(); + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d380c43 --- /dev/null +++ b/package.json @@ -0,0 +1,51 @@ +{ + "name": "iobroker.vis", + "description": "Graphical user interface for iobroker.", + "version": "1.1.7", + "author": { + "name": "bluefox", + "email": "dogafox@gmail.com" + }, + "contributors": [ + "bluefox ", + "hobbyquaker " + ], + "homepage": "https://github.com/iobroker/iobroker.vis", + "repository": { + "type": "git", + "url": "https://github.com/iobroker/iobroker.vis" + }, + "licenses": [ + { + "type": "CC-BY-NC-4.0", + "url": "https://github.com/iobroker/iobroker.vis/blob/master/LICENSE" + } + ], + "keywords": [ + "iobroker", + "GUI", + "DashUI", + "web interface", + "home automation", + "SCADA" + ], + "dependencies": { + "jsonwebtoken": "^8.2.2" + }, + "devDependencies": { + "gulp": "^3.9.1", + "gulp-replace": "^1.0.0", + "iobroker.web": "*", + "mocha": "^5.2.0", + "chai": "^4.1.2" + }, + "bugs": { + "url": "https://github.com/iobroker/iobroker.vis/issues" + }, + "main": "main.js", + "scripts": { + "test": "node node_modules/mocha/bin/mocha --exit", + "install": "node main.js --install" + }, + "license": "CC-BY-NC-4.0" +} diff --git a/test/lib/setup.js b/test/lib/setup.js new file mode 100644 index 0000000..16857ed --- /dev/null +++ b/test/lib/setup.js @@ -0,0 +1,728 @@ +/* jshint -W097 */// jshint strict:false +/*jslint node: true */ +// check if tmp directory exists +var fs = require('fs'); +var path = require('path'); +var child_process = require('child_process'); +var rootDir = path.normalize(__dirname + '/../../'); +var pkg = require(rootDir + 'package.json'); +var debug = typeof v8debug === 'object'; +pkg.main = pkg.main || 'main.js'; + +var adapterName = path.normalize(rootDir).replace(/\\/g, '/').split('/'); +adapterName = adapterName[adapterName.length - 2]; +var adapterStarted = false; + +function getAppName() { + var parts = __dirname.replace(/\\/g, '/').split('/'); + return parts[parts.length - 3].split('.')[0]; +} + +var appName = getAppName().toLowerCase(); + +var objects; +var states; + +var pid = null; + +function copyFileSync(source, target) { + + var targetFile = target; + + //if target is a directory a new file with the same name will be created + if (fs.existsSync(target)) { + if ( fs.lstatSync( target ).isDirectory() ) { + targetFile = path.join(target, path.basename(source)); + } + } + + try { + fs.writeFileSync(targetFile, fs.readFileSync(source)); + } + catch (err) { + console.log("file copy error: " +source +" -> " + targetFile + " (error ignored)"); + } +} + +function copyFolderRecursiveSync(source, target, ignore) { + var files = []; + + var base = path.basename(source); + if (base === adapterName) { + base = pkg.name; + } + //check if folder needs to be created or integrated + var targetFolder = path.join(target, base); + if (!fs.existsSync(targetFolder)) { + fs.mkdirSync(targetFolder); + } + + //copy + if (fs.lstatSync(source).isDirectory()) { + files = fs.readdirSync(source); + files.forEach(function (file) { + if (ignore && ignore.indexOf(file) !== -1) { + return; + } + + var curSource = path.join(source, file); + var curTarget = path.join(targetFolder, file); + if (fs.lstatSync(curSource).isDirectory()) { + // ignore grunt files + if (file.indexOf('grunt') !== -1) return; + if (file === 'chai') return; + if (file === 'mocha') return; + copyFolderRecursiveSync(curSource, targetFolder, ignore); + } else { + copyFileSync(curSource, curTarget); + } + }); + } +} + +if (!fs.existsSync(rootDir + 'tmp')) { + fs.mkdirSync(rootDir + 'tmp'); +} + +function storeOriginalFiles() { + console.log('Store original files...'); + var dataDir = rootDir + 'tmp/' + appName + '-data/'; + + var f = fs.readFileSync(dataDir + 'objects.json'); + var objects = JSON.parse(f.toString()); + if (objects['system.adapter.admin.0'] && objects['system.adapter.admin.0'].common) { + objects['system.adapter.admin.0'].common.enabled = false; + } + if (objects['system.adapter.admin.1'] && objects['system.adapter.admin.1'].common) { + objects['system.adapter.admin.1'].common.enabled = false; + } + + fs.writeFileSync(dataDir + 'objects.json.original', JSON.stringify(objects)); + try { + f = fs.readFileSync(dataDir + 'states.json'); + fs.writeFileSync(dataDir + 'states.json.original', f); + } + catch (err) { + console.log('no states.json found - ignore'); + } +} + +function restoreOriginalFiles() { + console.log('restoreOriginalFiles...'); + var dataDir = rootDir + 'tmp/' + appName + '-data/'; + + var f = fs.readFileSync(dataDir + 'objects.json.original'); + fs.writeFileSync(dataDir + 'objects.json', f); + try { + f = fs.readFileSync(dataDir + 'states.json.original'); + fs.writeFileSync(dataDir + 'states.json', f); + } + catch (err) { + console.log('no states.json.original found - ignore'); + } + +} + +function checkIsAdapterInstalled(cb, counter, customName) { + customName = customName || pkg.name.split('.').pop(); + counter = counter || 0; + var dataDir = rootDir + 'tmp/' + appName + '-data/'; + console.log('checkIsAdapterInstalled...'); + + try { + var f = fs.readFileSync(dataDir + 'objects.json'); + var objects = JSON.parse(f.toString()); + if (objects['system.adapter.' + customName + '.0']) { + console.log('checkIsAdapterInstalled: ready!'); + setTimeout(function () { + if (cb) cb(); + }, 100); + return; + } else { + console.warn('checkIsAdapterInstalled: still not ready'); + } + } catch (err) { + + } + + if (counter > 20) { + console.error('checkIsAdapterInstalled: Cannot install!'); + if (cb) cb('Cannot install'); + } else { + console.log('checkIsAdapterInstalled: wait...'); + setTimeout(function() { + checkIsAdapterInstalled(cb, counter + 1); + }, 1000); + } +} + +function checkIsControllerInstalled(cb, counter) { + counter = counter || 0; + var dataDir = rootDir + 'tmp/' + appName + '-data/'; + + console.log('checkIsControllerInstalled...'); + try { + var f = fs.readFileSync(dataDir + 'objects.json'); + var objects = JSON.parse(f.toString()); + if (objects['system.adapter.admin.0']) { + console.log('checkIsControllerInstalled: installed!'); + setTimeout(function () { + if (cb) cb(); + }, 100); + return; + } + } catch (err) { + + } + + if (counter > 20) { + console.log('checkIsControllerInstalled: Cannot install!'); + if (cb) cb('Cannot install'); + } else { + console.log('checkIsControllerInstalled: wait...'); + setTimeout(function() { + checkIsControllerInstalled(cb, counter + 1); + }, 1000); + } +} + +function installAdapter(customName, cb) { + if (typeof customName === 'function') { + cb = customName; + customName = null; + } + customName = customName || pkg.name.split('.').pop(); + console.log('Install adapter...'); + var startFile = 'node_modules/' + appName + '.js-controller/' + appName + '.js'; + // make first install + if (debug) { + child_process.execSync('node ' + startFile + ' add ' + customName + ' --enabled false', { + cwd: rootDir + 'tmp', + stdio: [0, 1, 2] + }); + checkIsAdapterInstalled(function (error) { + if (error) console.error(error); + console.log('Adapter installed.'); + if (cb) cb(); + }); + } else { + // add controller + var _pid = child_process.fork(startFile, ['add', customName, '--enabled', 'false'], { + cwd: rootDir + 'tmp', + stdio: [0, 1, 2, 'ipc'] + }); + + waitForEnd(_pid, function () { + checkIsAdapterInstalled(function (error) { + if (error) console.error(error); + console.log('Adapter installed.'); + if (cb) cb(); + }); + }); + } +} + +function waitForEnd(_pid, cb) { + if (!_pid) { + cb(-1, -1); + return; + } + _pid.on('exit', function (code, signal) { + if (_pid) { + _pid = null; + cb(code, signal); + } + }); + _pid.on('close', function (code, signal) { + if (_pid) { + _pid = null; + cb(code, signal); + } + }); +} + +function installJsController(cb) { + console.log('installJsController...'); + if (!fs.existsSync(rootDir + 'tmp/node_modules/' + appName + '.js-controller') || + !fs.existsSync(rootDir + 'tmp/' + appName + '-data')) { + // try to detect appName.js-controller in node_modules/appName.js-controller + // travis CI installs js-controller into node_modules + if (fs.existsSync(rootDir + 'node_modules/' + appName + '.js-controller')) { + console.log('installJsController: no js-controller => copy it from "' + rootDir + 'node_modules/' + appName + '.js-controller"'); + // copy all + // stop controller + console.log('Stop controller if running...'); + var _pid; + if (debug) { + // start controller + _pid = child_process.exec('node ' + appName + '.js stop', { + cwd: rootDir + 'node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2] + }); + } else { + _pid = child_process.fork(appName + '.js', ['stop'], { + cwd: rootDir + 'node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2, 'ipc'] + }); + } + + waitForEnd(_pid, function () { + // copy all files into + if (!fs.existsSync(rootDir + 'tmp')) fs.mkdirSync(rootDir + 'tmp'); + if (!fs.existsSync(rootDir + 'tmp/node_modules')) fs.mkdirSync(rootDir + 'tmp/node_modules'); + + if (!fs.existsSync(rootDir + 'tmp/node_modules/' + appName + '.js-controller')){ + console.log('Copy js-controller...'); + copyFolderRecursiveSync(rootDir + 'node_modules/' + appName + '.js-controller', rootDir + 'tmp/node_modules/'); + } + + console.log('Setup js-controller...'); + var __pid; + if (debug) { + // start controller + _pid = child_process.exec('node ' + appName + '.js setup first --console', { + cwd: rootDir + 'tmp/node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2] + }); + } else { + __pid = child_process.fork(appName + '.js', ['setup', 'first', '--console'], { + cwd: rootDir + 'tmp/node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2, 'ipc'] + }); + } + waitForEnd(__pid, function () { + checkIsControllerInstalled(function () { + // change ports for object and state DBs + var config = require(rootDir + 'tmp/' + appName + '-data/' + appName + '.json'); + config.objects.port = 19001; + config.states.port = 19000; + fs.writeFileSync(rootDir + 'tmp/' + appName + '-data/' + appName + '.json', JSON.stringify(config, null, 2)); + console.log('Setup finished.'); + + copyAdapterToController(); + + installAdapter(function () { + storeOriginalFiles(); + if (cb) cb(true); + }); + }); + }); + }); + } else { + // check if port 9000 is free, else admin adapter will be added to running instance + var client = new require('net').Socket(); + client.connect(9000, '127.0.0.1', function() { + console.error('Cannot initiate fisrt run of test, because one instance of application is running on this PC. Stop it and repeat.'); + process.exit(0); + }); + + setTimeout(function () { + client.destroy(); + if (!fs.existsSync(rootDir + 'tmp/node_modules/' + appName + '.js-controller')) { + console.log('installJsController: no js-controller => install from git'); + + child_process.execSync('npm install https://github.com/' + appName + '/' + appName + '.js-controller/tarball/master --prefix ./ --production', { + cwd: rootDir + 'tmp/', + stdio: [0, 1, 2] + }); + } else { + console.log('Setup js-controller...'); + var __pid; + if (debug) { + // start controller + child_process.exec('node ' + appName + '.js setup first', { + cwd: rootDir + 'tmp/node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2] + }); + } else { + child_process.fork(appName + '.js', ['setup', 'first'], { + cwd: rootDir + 'tmp/node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2, 'ipc'] + }); + } + } + + // let npm install admin and run setup + checkIsControllerInstalled(function () { + var _pid; + + if (fs.existsSync(rootDir + 'node_modules/' + appName + '.js-controller/' + appName + '.js')) { + _pid = child_process.fork(appName + '.js', ['stop'], { + cwd: rootDir + 'node_modules/' + appName + '.js-controller', + stdio: [0, 1, 2, 'ipc'] + }); + } + + waitForEnd(_pid, function () { + // change ports for object and state DBs + var config = require(rootDir + 'tmp/' + appName + '-data/' + appName + '.json'); + config.objects.port = 19001; + config.states.port = 19000; + fs.writeFileSync(rootDir + 'tmp/' + appName + '-data/' + appName + '.json', JSON.stringify(config, null, 2)); + + copyAdapterToController(); + + installAdapter(function () { + storeOriginalFiles(); + if (cb) cb(true); + }); + }); + }); + }, 1000); + } + } else { + setTimeout(function () { + console.log('installJsController: js-controller installed'); + if (cb) cb(false); + }, 0); + } +} + +function copyAdapterToController() { + console.log('Copy adapter...'); + // Copy adapter to tmp/node_modules/appName.adapter + copyFolderRecursiveSync(rootDir, rootDir + 'tmp/node_modules/', ['.idea', 'test', 'tmp', '.git', appName + '.js-controller']); + console.log('Adapter copied.'); +} + +function clearControllerLog() { + var dirPath = rootDir + 'tmp/log'; + var files; + try { + if (fs.existsSync(dirPath)) { + console.log('Clear controller log...'); + files = fs.readdirSync(dirPath); + } else { + console.log('Create controller log directory...'); + files = []; + fs.mkdirSync(dirPath); + } + } catch(e) { + console.error('Cannot read "' + dirPath + '"'); + return; + } + if (files.length > 0) { + try { + for (var i = 0; i < files.length; i++) { + var filePath = dirPath + '/' + files[i]; + fs.unlinkSync(filePath); + } + console.log('Controller log cleared'); + } catch (err) { + console.error('cannot clear log: ' + err); + } + } +} + +function clearDB() { + var dirPath = rootDir + 'tmp/iobroker-data/sqlite'; + var files; + try { + if (fs.existsSync(dirPath)) { + console.log('Clear sqlite DB...'); + files = fs.readdirSync(dirPath); + } else { + console.log('Create controller log directory...'); + files = []; + fs.mkdirSync(dirPath); + } + } catch(e) { + console.error('Cannot read "' + dirPath + '"'); + return; + } + if (files.length > 0) { + try { + for (var i = 0; i < files.length; i++) { + var filePath = dirPath + '/' + files[i]; + fs.unlinkSync(filePath); + } + console.log('Clear sqlite DB'); + } catch (err) { + console.error('cannot clear DB: ' + err); + } + } +} + +function setupController(cb) { + installJsController(function (isInited) { + clearControllerLog(); + clearDB(); + + if (!isInited) { + restoreOriginalFiles(); + copyAdapterToController(); + } + // read system.config object + var dataDir = rootDir + 'tmp/' + appName + '-data/'; + + var objs; + try { + objs = fs.readFileSync(dataDir + 'objects.json'); + objs = JSON.parse(objs); + } + catch (e) { + console.log('ERROR reading/parsing system configuration. Ignore'); + objs = {'system.config': {}}; + } + if (!objs || !objs['system.config']) { + objs = {'system.config': {}}; + } + + if (cb) cb(objs['system.config']); + }); +} + +function startAdapter(objects, states, callback) { + if (adapterStarted) { + console.log('Adapter already started ...'); + if (callback) callback(objects, states); + return; + } + adapterStarted = true; + console.log('startAdapter...'); + if (fs.existsSync(rootDir + 'tmp/node_modules/' + pkg.name + '/' + pkg.main)) { + try { + if (debug) { + // start controller + pid = child_process.exec('node node_modules/' + pkg.name + '/' + pkg.main + ' --console silly', { + cwd: rootDir + 'tmp', + stdio: [0, 1, 2] + }); + } else { + // start controller + pid = child_process.fork('node_modules/' + pkg.name + '/' + pkg.main, ['--console', 'silly'], { + cwd: rootDir + 'tmp', + stdio: [0, 1, 2, 'ipc'] + }); + } + } catch (error) { + console.error(JSON.stringify(error)); + } + } else { + console.error('Cannot find: ' + rootDir + 'tmp/node_modules/' + pkg.name + '/' + pkg.main); + } + if (callback) callback(objects, states); +} + +function startController(isStartAdapter, onObjectChange, onStateChange, callback) { + if (typeof isStartAdapter === 'function') { + callback = onStateChange; + onStateChange = onObjectChange; + onObjectChange = isStartAdapter; + isStartAdapter = true; + } + + if (onStateChange === undefined) { + callback = onObjectChange; + onObjectChange = undefined; + } + + if (pid) { + console.error('Controller is already started!'); + } else { + console.log('startController...'); + adapterStarted = false; + var isObjectConnected; + var isStatesConnected; + + var Objects = require(rootDir + 'tmp/node_modules/' + appName + '.js-controller/lib/objects/objectsInMemServer'); + objects = new Objects({ + connection: { + "type" : "file", + "host" : "127.0.0.1", + "port" : 19001, + "user" : "", + "pass" : "", + "noFileCache": false, + "connectTimeout": 2000 + }, + logger: { + silly: function (msg) { + console.log(msg); + }, + debug: function (msg) { + console.log(msg); + }, + info: function (msg) { + console.log(msg); + }, + warn: function (msg) { + console.warn(msg); + }, + error: function (msg) { + console.error(msg); + } + }, + connected: function () { + isObjectConnected = true; + if (isStatesConnected) { + console.log('startController: started!'); + if (isStartAdapter) { + startAdapter(objects, states, callback); + } else { + if (callback) { + callback(objects, states); + callback = null; + } + } + } + }, + change: onObjectChange + }); + + // Just open in memory DB itself + var States = require(rootDir + 'tmp/node_modules/' + appName + '.js-controller/lib/states/statesInMemServer'); + states = new States({ + connection: { + type: 'file', + host: '127.0.0.1', + port: 19000, + options: { + auth_pass: null, + retry_max_delay: 15000 + } + }, + logger: { + silly: function (msg) { + console.log(msg); + }, + debug: function (msg) { + console.log(msg); + }, + info: function (msg) { + console.log(msg); + }, + warn: function (msg) { + console.log(msg); + }, + error: function (msg) { + console.log(msg); + } + }, + connected: function () { + isStatesConnected = true; + if (isObjectConnected) { + console.log('startController: started!!'); + if (isStartAdapter) { + startAdapter(objects, states, callback); + } else { + if (callback) { + callback(objects, states); + callback = null; + } + } + } + }, + change: onStateChange + }); + } +} + +function stopAdapter(cb) { + if (!pid) { + console.error('Controller is not running!'); + if (cb) { + setTimeout(function () { + cb(false); + }, 0); + } + } else { + adapterStarted = false; + pid.on('exit', function (code, signal) { + if (pid) { + console.log('child process terminated due to receipt of signal ' + signal); + if (cb) cb(); + pid = null; + } + }); + + pid.on('close', function (code, signal) { + if (pid) { + if (cb) cb(); + pid = null; + } + }); + + pid.kill('SIGTERM'); + } +} + +function _stopController() { + if (objects) { + objects.destroy(); + objects = null; + } + if (states) { + states.destroy(); + states = null; + } +} + +function stopController(cb) { + var timeout; + if (objects) { + console.log('Set system.adapter.' + pkg.name + '.0'); + objects.setObject('system.adapter.' + pkg.name + '.0', { + common:{ + enabled: false + } + }); + } + + stopAdapter(function () { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + + _stopController(); + + if (cb) { + cb(true); + cb = null; + } + }); + + timeout = setTimeout(function () { + timeout = null; + console.log('child process NOT terminated'); + + _stopController(); + + if (cb) { + cb(false); + cb = null; + } + pid = null; + }, 5000); +} + +// Setup the adapter +function setAdapterConfig(common, native, instance) { + var objects = JSON.parse(fs.readFileSync(rootDir + 'tmp/' + appName + '-data/objects.json').toString()); + var id = 'system.adapter.' + adapterName.split('.').pop() + '.' + (instance || 0); + if (common) objects[id].common = common; + if (native) objects[id].native = native; + fs.writeFileSync(rootDir + 'tmp/' + appName + '-data/objects.json', JSON.stringify(objects)); +} + +// Read config of the adapter +function getAdapterConfig(instance) { + var objects = JSON.parse(fs.readFileSync(rootDir + 'tmp/' + appName + '-data/objects.json').toString()); + var id = 'system.adapter.' + adapterName.split('.').pop() + '.' + (instance || 0); + return objects[id]; +} + +if (typeof module !== undefined && module.parent) { + module.exports.getAdapterConfig = getAdapterConfig; + module.exports.setAdapterConfig = setAdapterConfig; + module.exports.startController = startController; + module.exports.stopController = stopController; + module.exports.setupController = setupController; + module.exports.stopAdapter = stopAdapter; + module.exports.startAdapter = startAdapter; + module.exports.installAdapter = installAdapter; + module.exports.appName = appName; + module.exports.adapterName = adapterName; + module.exports.adapterStarted = adapterStarted; +} diff --git a/test/testAdapter.js b/test/testAdapter.js new file mode 100644 index 0000000..afe399a --- /dev/null +++ b/test/testAdapter.js @@ -0,0 +1,142 @@ +/* jshint -W097 */// jshint strict:false +/*jslint node: true */ +var expect = require('chai').expect; +var setup = require(__dirname + '/lib/setup'); + +var objects = null; +var states = null; +var onStateChanged = null; +var onObjectChanged = null; +var sendToID = 1; + +var adapterShortName = setup.adapterName.substring(setup.adapterName.indexOf('.') + 1); +var runningMode = require(__dirname + '/../io-package.json').common.mode; + +function checkConnectionOfAdapter(cb, counter) { + counter = counter || 0; + console.log('Try check #' + counter); + if (counter > 30) { + if (cb) cb('Cannot check connection'); + return; + } + + states.getState('system.adapter.' + adapterShortName + '.0.alive', function (err, state) { + if (err) console.error(err); + if (state && state.val) { + if (cb) cb(); + } else { + setTimeout(function () { + checkConnectionOfAdapter(cb, counter + 1); + }, 1000); + } + }); +} + +function checkValueOfState(id, value, cb, counter) { + counter = counter || 0; + if (counter > 20) { + if (cb) cb('Cannot check value Of State ' + id); + return; + } + + states.getState(id, function (err, state) { + if (err) console.error(err); + if (value === null && !state) { + if (cb) cb(); + } else + if (state && (value === undefined || state.val === value)) { + if (cb) cb(); + } else { + setTimeout(function () { + checkValueOfState(id, value, cb, counter + 1); + }, 500); + } + }); +} + +function sendTo(target, command, message, callback) { + onStateChanged = function (id, state) { + if (id === 'messagebox.system.adapter.test.0') { + callback(state.message); + } + }; + + states.pushMessage('system.adapter.' + target, { + command: command, + message: message, + from: 'system.adapter.test.0', + callback: { + message: message, + id: sendToID++, + ack: false, + time: (new Date()).getTime() + } + }); +} + +describe('Test ' + adapterShortName + ' adapter', function() { + before('Test ' + adapterShortName + ' adapter: Start js-controller', function (_done) { + this.timeout(600000); // because of first install from npm + + setup.setupController(function () { + var config = setup.getAdapterConfig(); + // enable adapter + config.common.enabled = true; + config.common.loglevel = 'debug'; + + //config.native.dbtype = 'sqlite'; + + setup.setAdapterConfig(config.common, config.native); + + setup.startController(true, function(id, obj) {}, function (id, state) { + if (onStateChanged) onStateChanged(id, state); + }, + function (_objects, _states) { + objects = _objects; + states = _states; + _done(); + }); + }); + }); + + it('Test ' + adapterShortName + ' instance object: it must exists', function (done) { + objects.getObject('system.adapter.' + adapterShortName + '.0', function (err, obj) { + expect(err).to.be.null; + expect(obj).to.be.an('object'); + expect(obj).not.to.be.null; + done(); + }); + }); + + it('Test ' + adapterShortName + ' adapter: Check if adapter started', function (done) { + this.timeout(60000); + checkConnectionOfAdapter(function (res) { + if (res) console.log(res); + if (runningMode === 'daemon') { + expect(res).not.to.be.equal('Cannot check connection'); + } else { + //?? + } + done(); + }); + }); +/**/ + +/* + PUT YOUR OWN TESTS HERE USING + it('Testname', function ( done) { + ... + }); + + You can also use "sendTo" method to send messages to the started adapter +*/ + + after('Test ' + adapterShortName + ' adapter: Stop js-controller', function (done) { + this.timeout(10000); + + setup.stopController(function (normalTerminated) { + console.log('Adapter normal terminated: ' + normalTerminated); + done(); + }); + }); +}); \ No newline at end of file diff --git a/test/testPackageFiles.js b/test/testPackageFiles.js new file mode 100644 index 0000000..c600a60 --- /dev/null +++ b/test/testPackageFiles.js @@ -0,0 +1,91 @@ +/* jshint -W097 */ +/* jshint strict:false */ +/* jslint node: true */ +/* jshint expr: true */ +var expect = require('chai').expect; +var fs = require('fs'); + +describe('Test package.json and io-package.json', function() { + it('Test package files', function (done) { + console.log(); + + var fileContentIOPackage = fs.readFileSync(__dirname + '/../io-package.json', 'utf8'); + var ioPackage = JSON.parse(fileContentIOPackage); + + var fileContentNPMPackage = fs.readFileSync(__dirname + '/../package.json', 'utf8'); + var npmPackage = JSON.parse(fileContentNPMPackage); + + expect(ioPackage).to.be.an('object'); + expect(npmPackage).to.be.an('object'); + + expect(ioPackage.common.version, 'ERROR: Version number in io-package.json needs to exist').to.exist; + expect(npmPackage.version, 'ERROR: Version number in package.json needs to exist').to.exist; + + expect(ioPackage.common.version, 'ERROR: Version numbers in package.json and io-package.json needs to match').to.be.equal(npmPackage.version); + + if (!ioPackage.common.news || !ioPackage.common.news[ioPackage.common.version]) { + console.log('WARNING: No news entry for current version exists in io-package.json, no rollback in Admin possible!'); + console.log(); + } + + expect(npmPackage.author, 'ERROR: Author in package.json needs to exist').to.exist; + expect(ioPackage.common.authors, 'ERROR: Authors in io-package.json needs to exist').to.exist; + + if (ioPackage.common.name.indexOf('template') !== 0) { + if (Array.isArray(ioPackage.common.authors)) { + expect(ioPackage.common.authors.length, 'ERROR: Author in io-package.json needs to be set').to.not.be.equal(0); + if (ioPackage.common.authors.length === 1) { + expect(ioPackage.common.authors[0], 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name '); + } + } + else { + expect(ioPackage.common.authors, 'ERROR: Author in io-package.json needs to be a real name').to.not.be.equal('my Name '); + } + } + else { + console.log('WARNING: Testing for set authors field in io-package skipped because template adapter'); + console.log(); + } + expect(fs.existsSync(__dirname + '/../README.md'), 'ERROR: README.md needs to exist! Please create one with description, detail information and changelog. English is mandatory.').to.be.true; + if (!ioPackage.common.titleLang || typeof ioPackage.common.titleLang !== 'object') { + console.log('WARNING: titleLang is not existing in io-package.json. Please add'); + console.log(); + } + if ( + ioPackage.common.title.indexOf('iobroker') !== -1 || + ioPackage.common.title.indexOf('ioBroker') !== -1 || + ioPackage.common.title.indexOf('adapter') !== -1 || + ioPackage.common.title.indexOf('Adapter') !== -1 + ) { + console.log('WARNING: title contains Adapter or ioBroker. It is clear anyway, that it is adapter for ioBroker.'); + console.log(); + } + + if (ioPackage.common.name.indexOf('vis-') !== 0) { + if (!ioPackage.common.materialize || !fs.existsSync(__dirname + '/../admin/index_m.html') || !fs.existsSync(__dirname + '/../gulpfile.js')) { + console.log('WARNING: Admin3 support is missing! Please add it'); + console.log(); + } + if (ioPackage.common.materialize) { + expect(fs.existsSync(__dirname + '/../admin/index_m.html'), 'Admin3 support is enabled in io-package.json, but index_m.html is missing!').to.be.true; + } + } + + var licenseFileExists = fs.existsSync(__dirname + '/../LICENSE'); + var fileContentReadme = fs.readFileSync(__dirname + '/../README.md', 'utf8'); + if (fileContentReadme.indexOf('## Changelog') === -1) { + console.log('Warning: The README.md should have a section ## Changelog'); + console.log(); + } + expect((licenseFileExists || fileContentReadme.indexOf('## License') !== -1), 'A LICENSE must exist as LICENSE file or as part of the README.md').to.be.true; + if (!licenseFileExists) { + console.log('Warning: The License should also exist as LICENSE file'); + console.log(); + } + if (fileContentReadme.indexOf('## License') === -1) { + console.log('Warning: The README.md should also have a section ## License to be shown in Admin3'); + console.log(); + } + done(); + }); +}); diff --git a/www/cache.manifest b/www/cache.manifest new file mode 100644 index 0000000..113f369 --- /dev/null +++ b/www/cache.manifest @@ -0,0 +1,18 @@ +CACHE MANIFEST +# +# vis Version 1.1.7 +# dev build 0 + + + +NETWORK: +* + + +CACHE: +./img/disconnect.png + +FALLBACK: +./index.html ./offline.html +./edit.html ./offline.html + diff --git a/www/cordova.js b/www/cordova.js new file mode 100644 index 0000000..2f6b2d6 --- /dev/null +++ b/www/cordova.js @@ -0,0 +1 @@ +// do nothing \ No newline at end of file diff --git a/www/css/add_kian.css b/www/css/add_kian.css new file mode 100644 index 0000000..01797dd --- /dev/null +++ b/www/css/add_kian.css @@ -0,0 +1,36 @@ +.ui-slider-vertical { + width: 6px; +} + +.ui-slider-horizontal { + width: 93%; +} + +.ui-tabs-panel { + margin-top: 1px !important; +} + +.ui-dialog-titlebar { + margin: 5px !important; +} + +.dashui-steal-label { + width: 0 !important; + height: 10px !important; + top: 5px !important; + padding-left: 0 !important; +} + +#css_view_inspector, #export_view, #import_view { + padding: 6px !important; +} + +button.ui-dialog-titlebar-close { + right: -22px !important; + top: -8px !important; +} + +.vis-editor-dialog button.ui-dialog-titlebar-close { + right: -5px !important; + top: -1px !important; +} \ No newline at end of file diff --git a/www/css/app.css b/www/css/app.css new file mode 100644 index 0000000..e69de29 diff --git a/www/css/backgrounds.css b/www/css/backgrounds.css new file mode 100644 index 0000000..5cdcd01 --- /dev/null +++ b/www/css/backgrounds.css @@ -0,0 +1,522 @@ +/* ------------------------ Backgrounds styles ---------------------------*/ +.hq-background-blue-marine-lines +{ + background-image: url(../img/back/oblique-line-bk.png); + background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyYWRpYWxHcmFkaWVudCBpZD0iZyI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNDI4Q0JEIi8+PHN0b3Agb2Zmc2V0PSIwLjIiIHN0b3AtY29sb3I9IiMyNzYyODYiLz48c3RvcCBvZmZzZXQ9IjAuMzMiIHN0b3AtY29sb3I9IiMyMjRlNzIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMDAzMjkiLz48L3JhZGlhbEdyYWRpZW50PjxyZWN0IHg9IjAlIiB5PSIwJSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0iIzAwMDMyOSIgLz48cmVjdCB4PSIwJSIgeT0iLTg5cHgiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjIxMC44MiUiIGZpbGw9InVybCgjZykiIC8+PC9zdmc+); + background-image: url(../img/back/oblique-line-bk.png), -webkit-gradient(radial,50% 350,0,50% 350,156,color-stop(0%,#428CBD),color-stop(20%,#276286),color-stop(33%,#224e72),color-stop(100%,#000329)); + background-image:-webkit-radial-gradient(center 350px,50% 105.41%,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: url(../img/back/oblique-line-bk.png), -moz-radial-gradient(center 350px,circle,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: url(../img/back/oblique-line-bk.png), -ms-radial-gradient(center 350px,circle,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image:-o-radial-gradient(center 350px,50% 105.41%,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: url(../img/back/oblique-line-bk.png), radial-gradient(50% 105.41% at center 350px,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); +} +.hq-background-blue-marine +{ + background-image: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxyYWRpYWxHcmFkaWVudCBpZD0iZyI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNDI4Q0JEIi8+PHN0b3Agb2Zmc2V0PSIwLjIiIHN0b3AtY29sb3I9IiMyNzYyODYiLz48c3RvcCBvZmZzZXQ9IjAuMzMiIHN0b3AtY29sb3I9IiMyMjRlNzIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMDAzMjkiLz48L3JhZGlhbEdyYWRpZW50PjxyZWN0IHg9IjAlIiB5PSIwJSIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0iIzAwMDMyOSIgLz48cmVjdCB4PSIwJSIgeT0iLTg5cHgiIHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjIxMC44MiUiIGZpbGw9InVybCgjZykiIC8+PC9zdmc+); + background-image: -webkit-gradient(radial,50% 350,0,50% 350,156,color-stop(0%,#428CBD),color-stop(20%,#276286),color-stop(33%,#224e72),color-stop(100%,#000329)); + background-image:-webkit-radial-gradient(center 350px,50% 105.41%,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: -moz-radial-gradient(center 350px,circle,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: -ms-radial-gradient(center 350px,circle,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image:-o-radial-gradient(center 350px,50% 105.41%,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); + background-image: radial-gradient(50% 105.41% at center 350px,#428CBD 0,#276286 20%,#224e72 33%,#000329 100%); +} +.hq-background-radial-blue +{ + background: rgb(160,199,229); + background: -moz-linear-gradient(left, rgba(160,199,229,1) 1%, rgba(179,206,226,1) 46%, rgba(192,211,224,1) 100%); + background: -webkit-gradient(linear, left top, right top, color-stop(1%,rgba(160,199,229,1)), color-stop(46%,rgba(179,206,226,1)), color-stop(100%,rgba(192,211,224,1))); + background: -webkit-linear-gradient(left, rgba(160,199,229,1) 1%,rgba(179,206,226,1) 46%,rgba(192,211,224,1) 100%); + background: -o-linear-gradient(left, rgba(160,199,229,1) 1%,rgba(179,206,226,1) 46%,rgba(192,211,224,1) 100%); + background: -ms-linear-gradient(left, rgba(160,199,229,1) 1%,rgba(179,206,226,1) 46%,rgba(192,211,224,1) 100%); + background: linear-gradient(left, rgba(160,199,229,1) 1%,rgba(179,206,226,1) 46%,rgba(192,211,224,1) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a0c7e5', endColorstr='#c0d3e0',GradientType=1 ); +} +.hq-background-gradient-box +{ + margin:0 0 16px 0; + background-color:#e5edf6; + background-image:url(../img/back/box-radial.png); + background-position:0 0; + background-repeat:no-repeat; + border-top:1px solid #c7d1dc; + border-right:1px solid #c8d2dd; + border-bottom:1px solid #ced9e4; + border-left:1px solid #c8d2dd +} +.hq-background-h-gradient-black-0 +{ + background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.65) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.65))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.65) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#a6000000',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-black-1 +{ + background: -moz-linear-gradient(top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-black-2 +{ + background: rgb(181,189,200); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(181,189,200,1) 0%, rgba(130,140,149,1) 36%, rgba(40,52,59,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(181,189,200,1)), color-stop(36%,rgba(130,140,149,1)), color-stop(100%,rgba(40,52,59,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(181,189,200,1) 0%,rgba(130,140,149,1) 36%,rgba(40,52,59,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b5bdc8', endColorstr='#28343b',GradientType=0 ); /* IE6-9 */ + +} +.hq-background-h-gradient-black-3 +{ + background: rgb(40,52,59); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(40,52,59,1) 0%, rgba(130,140,149,1) 64%, rgba(181,189,200,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(40,52,59,1)), color-stop(64%,rgba(130,140,149,1)), color-stop(100%,rgba(181,189,200,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(40,52,59,1) 0%,rgba(130,140,149,1) 64%,rgba(181,189,200,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(40,52,59,1) 0%,rgba(130,140,149,1) 64%,rgba(181,189,200,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(40,52,59,1) 0%,rgba(130,140,149,1) 64%,rgba(181,189,200,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(40,52,59,1) 0%,rgba(130,140,149,1) 64%,rgba(181,189,200,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#28343b', endColorstr='#b5bdc8',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-black-4 +{ +background: rgb(69,72,77); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(69,72,77,1) 0%, rgba(0,0,0,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(69,72,77,1)), color-stop(100%,rgba(0,0,0,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(69,72,77,1) 0%,rgba(0,0,0,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#45484d', endColorstr='#000000',GradientType=0 ); /* IE6-9 */ + +} +.hq-background-h-gradient-black-5 +{ +background: rgb(0,0,0); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(0,0,0,1) 0%, rgba(69,72,77,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,1)), color-stop(100%,rgba(69,72,77,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(69,72,77,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(69,72,77,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(0,0,0,1) 0%,rgba(69,72,77,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(0,0,0,1) 0%,rgba(69,72,77,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#45484d',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-orange-0 +{ +background: rgb(250,198,149); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(250,198,149,1) 0%, rgba(245,171,102,1) 47%, rgba(239,141,49,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(250,198,149,1)), color-stop(47%,rgba(245,171,102,1)), color-stop(100%,rgba(239,141,49,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(250,198,149,1) 0%,rgba(245,171,102,1) 47%,rgba(239,141,49,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(250,198,149,1) 0%,rgba(245,171,102,1) 47%,rgba(239,141,49,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(250,198,149,1) 0%,rgba(245,171,102,1) 47%,rgba(239,141,49,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(250,198,149,1) 0%,rgba(245,171,102,1) 47%,rgba(239,141,49,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fac695', endColorstr='#ef8d31',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-orange-1 +{ +background: rgb(239,141,49); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(239,141,49,1) 0%, rgba(245,171,102,1) 53%, rgba(250,198,149,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(239,141,49,1)), color-stop(53%,rgba(245,171,102,1)), color-stop(100%,rgba(250,198,149,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(239,141,49,1) 0%,rgba(245,171,102,1) 53%,rgba(250,198,149,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(239,141,49,1) 0%,rgba(245,171,102,1) 53%,rgba(250,198,149,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(239,141,49,1) 0%,rgba(245,171,102,1) 53%,rgba(250,198,149,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(239,141,49,1) 0%,rgba(245,171,102,1) 53%,rgba(250,198,149,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ef8d31', endColorstr='#fac695',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-orange-2 +{ +background: rgb(255,168,76); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(255,168,76,1) 0%, rgba(255,123,13,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,168,76,1)), color-stop(100%,rgba(255,123,13,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(255,168,76,1) 0%,rgba(255,123,13,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(255,168,76,1) 0%,rgba(255,123,13,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(255,168,76,1) 0%,rgba(255,123,13,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(255,168,76,1) 0%,rgba(255,123,13,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffa84c', endColorstr='#ff7b0d',GradientType=0 ); /* IE6-9 */ + +} +.hq-background-h-gradient-orange-3 +{ +background: rgb(255,123,13); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(255,123,13,1) 0%, rgba(255,168,76,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,123,13,1)), color-stop(100%,rgba(255,168,76,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(255,123,13,1) 0%,rgba(255,168,76,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(255,123,13,1) 0%,rgba(255,168,76,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(255,123,13,1) 0%,rgba(255,168,76,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(255,123,13,1) 0%,rgba(255,168,76,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff7b0d', endColorstr='#ffa84c',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-0 +{ +background: rgb(240,249,255); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(240,249,255,1) 0%, rgba(203,235,255,1) 47%, rgba(161,219,255,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(240,249,255,1)), color-stop(47%,rgba(203,235,255,1)), color-stop(100%,rgba(161,219,255,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(240,249,255,1) 0%,rgba(203,235,255,1) 47%,rgba(161,219,255,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(240,249,255,1) 0%,rgba(203,235,255,1) 47%,rgba(161,219,255,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(240,249,255,1) 0%,rgba(203,235,255,1) 47%,rgba(161,219,255,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(240,249,255,1) 0%,rgba(203,235,255,1) 47%,rgba(161,219,255,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f0f9ff', endColorstr='#a1dbff',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-1 +{ +background: rgb(161,219,255); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(161,219,255,1) 0%, rgba(203,235,255,1) 53%, rgba(240,249,255,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(161,219,255,1)), color-stop(53%,rgba(203,235,255,1)), color-stop(100%,rgba(240,249,255,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(161,219,255,1) 0%,rgba(203,235,255,1) 53%,rgba(240,249,255,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(161,219,255,1) 0%,rgba(203,235,255,1) 53%,rgba(240,249,255,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(161,219,255,1) 0%,rgba(203,235,255,1) 53%,rgba(240,249,255,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(161,219,255,1) 0%,rgba(203,235,255,1) 53%,rgba(240,249,255,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a1dbff', endColorstr='#f0f9ff',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-2 +{ +background: rgb(184,198,223); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(184,198,223,1) 0%, rgba(109,136,183,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(184,198,223,1)), color-stop(100%,rgba(109,136,183,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(184,198,223,1) 0%,rgba(109,136,183,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(184,198,223,1) 0%,rgba(109,136,183,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(184,198,223,1) 0%,rgba(109,136,183,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(184,198,223,1) 0%,rgba(109,136,183,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b8c6df', endColorstr='#6d88b7',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-3 +{ +background: rgb(109,136,183); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(109,136,183,1) 0%, rgba(184,198,223,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(109,136,183,1)), color-stop(100%,rgba(184,198,223,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(109,136,183,1) 0%,rgba(184,198,223,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(109,136,183,1) 0%,rgba(184,198,223,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(109,136,183,1) 0%,rgba(184,198,223,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(109,136,183,1) 0%,rgba(184,198,223,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6d88b7', endColorstr='#b8c6df',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-4 +{ +background: rgb(207,231,250); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(207,231,250,1) 0%, rgba(99,147,193,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(207,231,250,1)), color-stop(100%,rgba(99,147,193,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(207,231,250,1) 0%,rgba(99,147,193,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cfe7fa', endColorstr='#6393c1',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-5 +{ +background: rgb(99,147,193); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(99,147,193,1) 0%, rgba(207,231,250,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(99,147,193,1)), color-stop(100%,rgba(207,231,250,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(99,147,193,1) 0%,rgba(207,231,250,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(99,147,193,1) 0%,rgba(207,231,250,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(99,147,193,1) 0%,rgba(207,231,250,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(99,147,193,1) 0%,rgba(207,231,250,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6393c1', endColorstr='#cfe7fa',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-6 +{ +background: rgb(167,207,223); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(167,207,223,1) 0%, rgba(35,83,138,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(167,207,223,1)), color-stop(100%,rgba(35,83,138,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(167,207,223,1) 0%,rgba(35,83,138,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(167,207,223,1) 0%,rgba(35,83,138,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(167,207,223,1) 0%,rgba(35,83,138,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(167,207,223,1) 0%,rgba(35,83,138,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a7cfdf', endColorstr='#23538a',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-blue-7 +{ +background: rgb(35,83,138); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(35,83,138,1) 0%, rgba(167,207,223,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(35,83,138,1)), color-stop(100%,rgba(167,207,223,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(35,83,138,1) 0%,rgba(167,207,223,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(35,83,138,1) 0%,rgba(167,207,223,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(35,83,138,1) 0%,rgba(167,207,223,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(35,83,138,1) 0%,rgba(167,207,223,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#23538a', endColorstr='#a7cfdf',GradientType=0 ); /* IE6-9 */ + +} +.hq-background-h-gradient-yellow-0 +{ + background: rgb(254,252,234); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(254,252,234,1) 0%, rgba(241,218,54,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,252,234,1)), color-stop(100%,rgba(241,218,54,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(254,252,234,1) 0%,rgba(241,218,54,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(254,252,234,1) 0%,rgba(241,218,54,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(254,252,234,1) 0%,rgba(241,218,54,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(254,252,234,1) 0%,rgba(241,218,54,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefcea', endColorstr='#f1da36',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-yellow-1 +{ + background: rgb(241,218,54); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(241,218,54,1) 0%, rgba(254,252,234,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(241,218,54,1)), color-stop(100%,rgba(254,252,234,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(241,218,54,1) 0%,rgba(254,252,234,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(241,218,54,1) 0%,rgba(254,252,234,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(241,218,54,1) 0%,rgba(254,252,234,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(241,218,54,1) 0%,rgba(254,252,234,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f1da36', endColorstr='#fefcea',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-yellow-2 +{ +background: rgb(241,231,103); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(241,231,103,1) 0%, rgba(254,182,69,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(241,231,103,1)), color-stop(100%,rgba(254,182,69,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(241,231,103,1) 0%,rgba(254,182,69,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f1e767', endColorstr='#feb645',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-yellow-3 +{ +background: rgb(254,182,69); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(254,182,69,1) 0%, rgba(241,231,103,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,182,69,1)), color-stop(100%,rgba(241,231,103,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(254,182,69,1) 0%,rgba(241,231,103,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(254,182,69,1) 0%,rgba(241,231,103,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(254,182,69,1) 0%,rgba(241,231,103,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(254,182,69,1) 0%,rgba(241,231,103,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feb645', endColorstr='#f1e767',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-green-0 +{ + background: rgb(180,221,180); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(180,221,180,1) 0%, rgba(131,199,131,1) 17%, rgba(82,177,82,1) 33%, rgba(0,138,0,1) 67%, rgba(0,87,0,1) 83%, rgba(0,36,0,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(180,221,180,1)), color-stop(17%,rgba(131,199,131,1)), color-stop(33%,rgba(82,177,82,1)), color-stop(67%,rgba(0,138,0,1)), color-stop(83%,rgba(0,87,0,1)), color-stop(100%,rgba(0,36,0,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(180,221,180,1) 0%,rgba(131,199,131,1) 17%,rgba(82,177,82,1) 33%,rgba(0,138,0,1) 67%,rgba(0,87,0,1) 83%,rgba(0,36,0,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(180,221,180,1) 0%,rgba(131,199,131,1) 17%,rgba(82,177,82,1) 33%,rgba(0,138,0,1) 67%,rgba(0,87,0,1) 83%,rgba(0,36,0,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(180,221,180,1) 0%,rgba(131,199,131,1) 17%,rgba(82,177,82,1) 33%,rgba(0,138,0,1) 67%,rgba(0,87,0,1) 83%,rgba(0,36,0,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(180,221,180,1) 0%,rgba(131,199,131,1) 17%,rgba(82,177,82,1) 33%,rgba(0,138,0,1) 67%,rgba(0,87,0,1) 83%,rgba(0,36,0,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#b4ddb4', endColorstr='#002400',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-green-1 +{ +background: rgb(0,36,0); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(0,36,0,1) 0%, rgba(0,87,0,1) 17%, rgba(0,138,0,1) 33%, rgba(82,177,82,1) 67%, rgba(131,199,131,1) 83%, rgba(180,221,180,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,36,0,1)), color-stop(17%,rgba(0,87,0,1)), color-stop(33%,rgba(0,138,0,1)), color-stop(67%,rgba(82,177,82,1)), color-stop(83%,rgba(131,199,131,1)), color-stop(100%,rgba(180,221,180,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(0,36,0,1) 0%,rgba(0,87,0,1) 17%,rgba(0,138,0,1) 33%,rgba(82,177,82,1) 67%,rgba(131,199,131,1) 83%,rgba(180,221,180,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(0,36,0,1) 0%,rgba(0,87,0,1) 17%,rgba(0,138,0,1) 33%,rgba(82,177,82,1) 67%,rgba(131,199,131,1) 83%,rgba(180,221,180,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(0,36,0,1) 0%,rgba(0,87,0,1) 17%,rgba(0,138,0,1) 33%,rgba(82,177,82,1) 67%,rgba(131,199,131,1) 83%,rgba(180,221,180,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(0,36,0,1) 0%,rgba(0,87,0,1) 17%,rgba(0,138,0,1) 33%,rgba(82,177,82,1) 67%,rgba(131,199,131,1) 83%,rgba(180,221,180,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#002400', endColorstr='#b4ddb4',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-green-2 +{ +background: rgb(205,235,142); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(205,235,142,1) 0%, rgba(165,201,86,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(205,235,142,1)), color-stop(100%,rgba(165,201,86,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(205,235,142,1) 0%,rgba(165,201,86,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(205,235,142,1) 0%,rgba(165,201,86,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(205,235,142,1) 0%,rgba(165,201,86,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(205,235,142,1) 0%,rgba(165,201,86,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cdeb8e', endColorstr='#a5c956',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-green-3 +{ +background: rgb(165,201,86); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(165,201,86,1) 0%, rgba(205,235,142,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(165,201,86,1)), color-stop(100%,rgba(205,235,142,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(165,201,86,1) 0%,rgba(205,235,142,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(165,201,86,1) 0%,rgba(205,235,142,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(165,201,86,1) 0%,rgba(205,235,142,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(165,201,86,1) 0%,rgba(205,235,142,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a5c956', endColorstr='#cdeb8e',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-green-4 +{ +background: rgb(254,254,253); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(254,254,253,1) 0%, rgba(220,227,196,1) 42%, rgba(174,191,118,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,254,253,1)), color-stop(42%,rgba(220,227,196,1)), color-stop(100%,rgba(174,191,118,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(254,254,253,1) 0%,rgba(220,227,196,1) 42%,rgba(174,191,118,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(254,254,253,1) 0%,rgba(220,227,196,1) 42%,rgba(174,191,118,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(254,254,253,1) 0%,rgba(220,227,196,1) 42%,rgba(174,191,118,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(254,254,253,1) 0%,rgba(220,227,196,1) 42%,rgba(174,191,118,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fefefd', endColorstr='#aebf76',GradientType=0 ); /* IE6-9 */ +} +.hq-background-gray-0 +{ + background: rgb(63,76,107); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(63,76,107,1) 0%, rgba(63,76,107,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(63,76,107,1)), color-stop(100%,rgba(63,76,107,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(63,76,107,1) 0%,rgba(63,76,107,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3f4c6b', endColorstr='#3f4c6b',GradientType=0 ); /* IE6-9 */ +} +.hq-background-gray-1 +{ + background: rgb(238,238,238); /* Old browsers */ + background: -moz-linear-gradient(top, rgba(238,238,238,1) 0%, rgba(238,238,238,1) 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(238,238,238,1)), color-stop(100%,rgba(238,238,238,1))); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* IE10+ */ + background: linear-gradient(to bottom, rgba(238,238,238,1) 0%,rgba(238,238,238,1) 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-0 +{ +background: rgb(206,220,231); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(206,220,231,1) 0%, rgba(89,106,114,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(206,220,231,1)), color-stop(100%,rgba(89,106,114,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cedce7', endColorstr='#596a72',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-1 +{ +background: rgb(89,106,114); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(89,106,114,1)), color-stop(100%,rgba(206,220,231,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(89,106,114,1) 0%,rgba(206,220,231,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(89,106,114,1) 0%,rgba(206,220,231,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(89,106,114,1) 0%,rgba(206,220,231,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(89,106,114,1) 0%,rgba(206,220,231,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#596a72', endColorstr='#cedce7',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-2 +{ +background: rgb(242,245,246); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(242,245,246,1) 0%, rgba(227,234,237,1) 37%, rgba(200,215,220,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(242,245,246,1)), color-stop(37%,rgba(227,234,237,1)), color-stop(100%,rgba(200,215,220,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(242,245,246,1) 0%,rgba(227,234,237,1) 37%,rgba(200,215,220,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f2f5f6', endColorstr='#c8d7dc',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-3 +{ +background: rgb(200,215,220); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(200,215,220,1) 0%, rgba(227,234,237,1) 63%, rgba(242,245,246,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(200,215,220,1)), color-stop(63%,rgba(227,234,237,1)), color-stop(100%,rgba(242,245,246,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(200,215,220,1) 0%,rgba(227,234,237,1) 63%,rgba(242,245,246,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(200,215,220,1) 0%,rgba(227,234,237,1) 63%,rgba(242,245,246,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(200,215,220,1) 0%,rgba(227,234,237,1) 63%,rgba(242,245,246,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(200,215,220,1) 0%,rgba(227,234,237,1) 63%,rgba(242,245,246,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#c8d7dc', endColorstr='#f2f5f6',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-4 +{ +background: rgb(216,224,222); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(216,224,222,1) 0%, rgba(174,191,188,1) 22%, rgba(153,175,171,1) 33%, rgba(142,166,162,1) 50%, rgba(130,157,152,1) 67%, rgba(78,92,90,1) 82%, rgba(14,14,14,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(216,224,222,1)), color-stop(22%,rgba(174,191,188,1)), color-stop(33%,rgba(153,175,171,1)), color-stop(50%,rgba(142,166,162,1)), color-stop(67%,rgba(130,157,152,1)), color-stop(82%,rgba(78,92,90,1)), color-stop(100%,rgba(14,14,14,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(216,224,222,1) 0%,rgba(174,191,188,1) 22%,rgba(153,175,171,1) 33%,rgba(142,166,162,1) 50%,rgba(130,157,152,1) 67%,rgba(78,92,90,1) 82%,rgba(14,14,14,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(216,224,222,1) 0%,rgba(174,191,188,1) 22%,rgba(153,175,171,1) 33%,rgba(142,166,162,1) 50%,rgba(130,157,152,1) 67%,rgba(78,92,90,1) 82%,rgba(14,14,14,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(216,224,222,1) 0%,rgba(174,191,188,1) 22%,rgba(153,175,171,1) 33%,rgba(142,166,162,1) 50%,rgba(130,157,152,1) 67%,rgba(78,92,90,1) 82%,rgba(14,14,14,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(216,224,222,1) 0%,rgba(174,191,188,1) 22%,rgba(153,175,171,1) 33%,rgba(142,166,162,1) 50%,rgba(130,157,152,1) 67%,rgba(78,92,90,1) 82%,rgba(14,14,14,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d8e0de', endColorstr='#0e0e0e',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-5 +{ +background: rgb(254,255,232); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(254,255,232,1) 0%, rgba(214,219,191,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,232,1)), color-stop(100%,rgba(214,219,191,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(254,255,232,1) 0%,rgba(214,219,191,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffe8', endColorstr='#d6dbbf',GradientType=0 ); /* IE6-9 */ +} +.hq-background-h-gradient-gray-6 +{ +background: rgb(214,219,191); /* Old browsers */ +background: -moz-linear-gradient(top, rgba(214,219,191,1) 0%, rgba(254,255,232,1) 100%); /* FF3.6+ */ +background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(214,219,191,1)), color-stop(100%,rgba(254,255,232,1))); /* Chrome,Safari4+ */ +background: -webkit-linear-gradient(top, rgba(214,219,191,1) 0%,rgba(254,255,232,1) 100%); /* Chrome10+,Safari5.1+ */ +background: -o-linear-gradient(top, rgba(214,219,191,1) 0%,rgba(254,255,232,1) 100%); /* Opera 11.10+ */ +background: -ms-linear-gradient(top, rgba(214,219,191,1) 0%,rgba(254,255,232,1) 100%); /* IE10+ */ +background: linear-gradient(to bottom, rgba(214,219,191,1) 0%,rgba(254,255,232,1) 100%); /* W3C */ +filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d6dbbf', endColorstr='#feffe8',GradientType=0 ); /* IE6-9 */ +} +.hq-background-aluminium1 +{ + background: -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -moz-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -ms-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -o-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background-size: 10px 10px, 10px 10px, 100% 100%; + background-position: 1px 1px, 0px 0px, center center; +} +.hq-background-aluminium2 { + background: -webkit-radial-gradient(center, circle farthest-corner, rgba(255,255,255,0) 50%, rgba(200,200,200,1)), -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -moz-radial-gradient(center, circle farthest-corner, rgba(255,255,255,0) 50%, rgba(200,200,200,1)), -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -ms-radial-gradient(center, circle farthest-corner, rgba(255,255,255,0) 50%, rgba(200,200,200,1)), -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: -o-radial-gradient(center, circle farthest-corner, rgba(255,255,255,0) 50%, rgba(200,200,200,1)), -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background: radial-gradient(center, circle farthest-corner, rgba(255,255,255,0) 50%, rgba(200,200,200,1)), -webkit-radial-gradient(center, circle, rgba(255,255,255,.35), rgba(255,255,255,0) 20%, rgba(255,255,255,0) 21%), -webkit-radial-gradient(center, circle, rgba(0,0,0,.2), rgba(0,0,0,0) 20%, rgba(0,0,0,0) 21%), -webkit-radial-gradient(center, circle farthest-corner, #f0f0f0, #c0c0c0); + background-size: 100% 100%, 10px 10px, 10px 10px, 100% 100%; + background-position: top center, 1px 1px, 0px 0px, top center; +} +.hq-background-colorful { + background: + linear-gradient(limegreen, transparent), + linear-gradient(90deg, skyblue, transparent), + linear-gradient(-90deg, coral, transparent); + background-blend-mode: screen; +} +/* by Atle Mo (design), Lea Verou */ +.hq-background-carbon-fibre1 { + background: + radial-gradient(black 15%, transparent 16%) 0 0, + radial-gradient(black 15%, transparent 16%) 8px 8px, + radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px, + radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px; + background-color:#282828; + background-size:16px 16px; +} +/* by Atle Mo (design), Sébastien Grosjean */ +.hq-background-carbon-fibre { + background: + linear-gradient(27deg, #151515 5px, transparent 5px) 0 5px, + linear-gradient(207deg, #151515 5px, transparent 5px) 10px 0px, + linear-gradient(27deg, #222 5px, transparent 5px) 0px 10px, + linear-gradient(207deg, #222 5px, transparent 5px) 10px 5px, + linear-gradient(90deg, #1b1b1b 10px, transparent 10px), + linear-gradient(#1d1d1d 25%, #1a1a1a 25%, #1a1a1a 50%, transparent 50%, transparent 75%, #242424 75%, #242424); + background-color: #131313; + background-size: 20px 20px; +} +/* by Tab Atkins Jr */ +.hq-background-bricks { + background-color: silver; + background-image: linear-gradient(335deg, #b00 23px, transparent 23px), + linear-gradient(155deg, #d00 23px, transparent 23px), + linear-gradient(335deg, #b00 23px, transparent 23px), + linear-gradient(155deg, #d00 23px, transparent 23px); + background-size: 58px 58px; + background-position: 0px 2px, 4px 35px, 29px 31px, 34px 6px; +} +/* by Sarah Backhouse */ +.hq-background-lined-paper { + background-color: #fff; + background-image: + linear-gradient(90deg, transparent 79px, #abced4 79px, #abced4 81px, transparent 81px), + linear-gradient(#eee .1em, transparent .1em); + background-size: 100% 1.2em; + } +.hq-background-blueprint-grid { + background-color:#269; + background-image: linear-gradient(white 2px, transparent 2px), + linear-gradient(90deg, white 2px, transparent 2px), + linear-gradient(rgba(255,255,255,.3) 1px, transparent 1px), + linear-gradient(90deg, rgba(255,255,255,.3) 1px, transparent 1px); + background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px; + background-position:-2px -2px, -2px -2px, -1px -1px, -1px -1px +} +.hq-background-blue-flowers +{ + background-image: url(../img/back/flowers.jpg); +} \ No newline at end of file diff --git a/www/css/doc.css b/www/css/doc.css new file mode 100644 index 0000000..ea6cfed --- /dev/null +++ b/www/css/doc.css @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------- + Global Reset +----------------------------------------------------------------------------*/ + +* { + padding:0; + margin:0; +} + +h1, h2, h3, h4, h5, h6, p, pre, blockquote, label, ul, ol, dl, fieldset, address { margin:1em 0; } + + +li, dd { margin-left:5%; } +fieldset { padding: .5em; } +select option{ padding:0 5px; } +a{ outline:none; } +a img{ border:none; } + +p { +display: block; + -webkit-margin-before: 0.5em; + -webkit-margin-after: 1em; + -webkit-margin-start: 0px; + -webkit-margin-end: 0px; +} + +/*---------------------------------------------------------------------------- + Main Layout +----------------------------------------------------------------------------*/ + +body { + font-family: "proxima-nova-1", "proxima-nova-2", Arial, sans-serif; + font-size: 17px; + line-height: 1.4; + color: #333; + background: #f7f7fa; + text-shadow: 0 1px 0 rgba(255,255,255,1.0); + border-top: 4px solid #556270; + padding-bottom: 400px; + margin-left: 8px; + margin-top: -6px; + +} + +a { + color: #2382c8; + text-decoration: none; +} +a:hover { + text-decoration: underline; +} + +hr { + display: none; +} +hr:before { + content: '\2022 \2022 \2022 \2022 \2022'; +} + +header { + margin: 0 0 20px 0; + text-align: center; + border-bottom: 1px solid #fff; +} + +ul.nav { + margin: 0; + padding: 12px 0 10px 0; + list-style-type: none; + line-height: 30px; + border-bottom: 1px solid #dfe4ea; +} +ul.nav li { + margin: 0 20px; + display: inline-block; + text-transform: uppercase; + font-size: 14px; + font-weight: 600; +} + +ul.nav li a { + color: #bbb; + text-decoration: none; +} + +/*------------------------------------------------------------------------------ + Post Styles +------------------------------------------------------------------------------*/ + +h2 { + padding-left:1em; + font-family: 'lucida sans unicode', 'lucida grande', sans-serif; + color: #C90000; + font-size: 2.2em; + font-weight: bold; +} + +h3 { + padding-left:1em; + font-size: 1.5em; + color: #333; + font-family: 'lucida sans unicode', 'lucida grande', sans-serif; + width: 100%; + background: blanchedalmond; + margin-left: -8px; +} + +h3 a:hover { + text-decoration: none; +} + +h4 { + padding-left:1em; + font-size: 1em; + color: #000; + font-weight: bold; + -webkit-margin-after: 0.1em; + margin-left: -8px; +} + +blockquote { + margin: 1.0em 0; + padding: 0 0 0 15px; + font-size: 16px; + border-left: 2px solid #aaa; +} +blockquote p { + margin: 12px 0; + color: #999; +} + +table { + border-top: 1px solid #CCCCCC; + border-bottom: 2px solid #CCC; + color: #000; + background: #fff; + border-collapse: separate; + font-size: 11px; +} + +caption { + padding: 10px 10px 5px 0; + text-align: left; + font-size: 12px; + text-transform: uppercase; + font-weight: bold; +} + +th { + text-align: center; + padding: 5px; +} + +td { + text-align: center; + padding: 3px 5px; +} + +table.data th, table.data td { + text-align: left; +} + diff --git a/www/css/montserrat-regular-webfont.woff b/www/css/montserrat-regular-webfont.woff new file mode 100644 index 0000000..ef8e86f Binary files /dev/null and b/www/css/montserrat-regular-webfont.woff differ diff --git a/www/css/styles.css b/www/css/styles.css new file mode 100644 index 0000000..32623c7 --- /dev/null +++ b/www/css/styles.css @@ -0,0 +1,67 @@ +/* ---------------- green - gray style -------------------- */ + +body .vis-style-green-gray { + font-family: Montserrat, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + color: #444; + background: #eee; +} + +@font-face { + font-family: 'Montserrat'; + font-style: normal; + font-weight: 400; + src: url(montserrat-regular-webfont.woff); + unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000; +} + +.vis-style-green-gray .vis-widget-body { + padding: 0.5em; +} + +.vis-style-green-gray .vis-widget-body, +.vis-style-green-gray .editmode-helper { + width: calc(100% - 1em); + height: calc(100% - 1em); +} + +.vis-style-green-gray .vis-image { + width: calc(100% - 1em) !important; + height: calc(100% - 1em) !important; +} + + /* table */ +.vis-style-green-gray table { + background: #34495E; + color: #fff; + border-radius: .4em; + overflow: hidden; +} + +.vis-style-green-gray table { + height: 100%; + width: 100%; +} + +.vis-style-green-gray tr { + border-top: 1px solid #46637f; + border-bottom: 1px solid #46637f; +} + +.vis-style-green-gray th { + color: #dd5; +} +.vis-style-green-gray th, .vis-style-green-gray td { + text-align: center; +} + +/* headers */ +.vis-style-green-gray h1 { + font-weight: normal; + letter-spacing: -1px; + color: #34495E; +} + + + diff --git a/www/css/vis-editor.css b/www/css/vis-editor.css new file mode 100644 index 0000000..0200e4c --- /dev/null +++ b/www/css/vis-editor.css @@ -0,0 +1,1110 @@ +html { + /* use this tag locally, where it is really required */ + /*-webkit-user-select: none;*/ + user-select: none; + overflow: hidden!important; + position: absolute!important; + width: 100%!important; + height: 100%!important; + +} +body { + min-height: 100%!important; + max-height: 100%!important; + overflow: hidden!important; + position: absolute!important; + width: 100%!important; + top: 0; + left: 0; + margin: 0; + padding: 0; + font-family: Arial, sans-serif; +} + +:focus { + outline: none; +} + +.vis_container_edit { + width: -webkit-calc(100% - 5px)!important; + width: calc(100% - 2px)!important; + height: -webkit-calc(100% - 30px)!important; + height: calc(100% - 30px)!important; + position: relative; + overflow: auto; + border-bottom-width: 0; +} + +::-webkit-scrollbar { + width: 16px; + height: 16px; + background-color: transparent !important; +} + +::-webkit-scrollbar-track { + background-color: transparent !important; +} + +::-webkit-scrollbar-track-piece { + background-color: transparent !important; +} + +::-webkit-scrollbar-thumb { + max-height: 5px !important; + border-radius: 2px; + /*-webkit-box-shadow: inset -2px -2px 7px rgba(0, 0, 0, 0.5), inset 2px 2px 7px rgba(255, 255, 255, 0.5);*/ + background-image: none; + border-color: transparent !important; + border-width: 2px; + border-style: solid; + background-clip: content-box; +} + +::-webkit-scrollbar-corner { + background-color: transparent; +} + +::-webkit-scrollbar-button { + display: none; +} + +#vis_container::-webkit-scrollbar-track:horizontal { + background-color: transparent !important; + border-color: inherit !important; + border-top-width: 1px !important; + border-bottom-width: 0; + border-left-width: 0; + border-right-width: 0; + border-style: solid; +} + +#vis_container::-webkit-scrollbar-track:vertical { + background-color: transparent !important; + border-color: inherit !important; + border-top-width: 0; + border-bottom-width: 0; + border-left-width: 1px !important; + border-right-width: 0; + border-style: solid; +} + +.vis-edit-different { + color: #ccc +} + +#button_undo { + height: 29px; + padding-left: 3px; + padding-right: 3px; + position: relative; + top: -5px; + left: -12px; + display: inline-block; +} + +#saving_progress { + width: 26px; + height: 26px; +} + +#exit_button { + width: 26px; + height: 26px; +} + +#new_view_name { + width: 200px; +} + +#add_view { + margin-left: 3px; + height: 23px; +} + +#dup_view { + height: 23px; + margin-top: 2px; +} + +#tabs-1 .ui-multiselect { + width: 292px !important; + height: 28px; +} + +#rib_view_del { + +} + +#new_name { + width: 200px; +} + +#rename_view { + margin-left: 3px; +} + +#add_widget { + +} + +#del_widget { +} + +#widget_doc { +} + +#dup_widget { + width: 142px; +} + +.vis-widget-tools > .ui-multiselect { + height: 28px; + margin-top: 15px; + width: 244px !important; + position: relative; + left: 1px; + top: 9px; + +} + +.widget_attrs_header { + width: 115px !important; +} + +#attr_wrap .ui-multiselect { + width: 265px !important; +} + +#attr_wrap .vis-edit-textbox { + width: calc(100% - 5px); + resize: vertical; +} + +#attr_wrap .vis-edit-textbox-with-button { + width: calc(100% - 30px); +} +.vis-edit-percent-calc { + margin-top: -2px !important; + margin-left: 4px !important; +} +.vis-edit-percent-calc .ui-button-text { + padding: 0 !important; + font-size: 10px; +} +.vis-resize-group .ui-resizable-e, .vis-resize-group .ui-resizable-s { + background: gray; + opacity: 0.5; +} +.vis-edit-group-widget { + background: white; +} + +.vis-edit-group { + background: lightgrey; +} + +#snap_type { + width: 60px; +} + +#grid_size { + width: 50px; +} + +#screen_hide_description { + width: 15px; + height: 15px; + position: relative; + top: 4px; + float: right; + margin-right: 3px; +} + +#screen_size_x { + width: 250px; +} + +#screen_size_y { + width: 250px; + +} + +#wizard_rooms { + width: 100px; +} + +#wizard_funcs { + width: 100px; +} + +#wizard_widgets { + width: 100px; +} + +#wizard_run { + margin-left: 87px; + margin-top: 5px; +} + +#create_instance { + width: 160px; +} + +#remove_instance { + margin-left: 87px; + margin-top: 5px; + width: 160px; +} + +#export_view { +} + +#import_view { +} + +#export_local_view { +} + +#import_local_view { +} + +#clear_local_view { +} + +#language { + width: 250px; +} + +#vis_instance { + width: 70px; +} + +.ui-selecting { + +} + +.table-no-space { + border: 0; + border-collapse: collapse; + border-spacing: 0; +/* padding: 0;*/ + margin: 0; +} +.fullscreen { + position: absolute !important; + z-index: 10000; + width: 100% !important; + height: 100% !important; + overflow: auto !important; + background: #ffffff; +} + +/*ribbon*/ + +.ribbon_tab { + max-height: 46px; + min-height: 46px; + overflow: hidden; + padding: 0 !important; + border-radius: 0 !important; + border: none; + position: relative; + + width: 100%; +} + +.ribbon_tab_content { + width: 100%; + height: 45px; + display: -webkit-box; + display: flex; + -webkit-box-pack: start; + justify-content: flex-start; + -webkit-box-align: center; + align-items: center; +} + +.menu-tab { + height: 27px; + border-bottom: none !important; + padding-right: 4px; + padding-left: 4px !important; + position: relative !important; + top: 1px; + margin-left: -9px; + margin-right: 13px; +} + +.menu-tab-text { + padding: 2px 4px 2px 4px !important; + cursor: pointer; +} + +.menu-item { + background-image: none !important; + cursor: pointer; + height: 27px; + width: 250px; +} + +.ribbon_field { + height: 40px; + margin-left: 5px; + background: rgba(0, 0, 0, 0); + font-size: 11px; + font-weight: bolder; + font-family: Arial, sans-serif; + padding-left: 3px; + padding-right: 3px; + display: -webkit-box; + display: flex; + -webkit-box-orient: vertical; + -webkit-box-direction: normal; + flex-direction: column; + -webkit-box-pack: center; + justify-content: center; +} + +#panel_body { + width: 100%; + position: relative; + overflow: hidden; + display: inline-block; + vertical-align: top; +} + +.toolbox { + text-align: center; + height: -webkit-calc(100% - 83px); + height: calc(100% - 83px); + overflow: auto; + border-color: inherit; + margin: 0; + position: relative; + top: -4px; + border-right-width: 0; + border-bottom-width: 1px; + border-bottom-style: solid; + /* display: table; */ + vertical-align: middle; +} + +.wid-prev { + width: 130px; + padding: 0; + overflow: hidden; + position: relative; + text-align: left; + display: inline-block; + /* flex-direction: column; */ + /* align-items: center; */ + background-color: rgba(0, 0, 0, 0) !important; + margin: 3px; + /*box-shadow: inset -3px -3px 5px rgba(20, 20, 20, 0.7), inset 3px 3px 5px rgba(220, 220, 220, 0.8);*/ + border-radius: 2px; + font-weight: bolder; + font-size: 11px; + border-width: 1px; + border-style: solid; + border-color: inherit; +} + +.wid-prev-k { + width: 80px !important; + font-size: 9px !important; + /* padding: 0!important; */ + margin: 2px !important; + border-radius: 3px !important; + font-weight: bolder !important; +} + +.wid-prev-content { + padding-right: 0 !important; + padding-left: 5px !important; + padding-top: 0 !important; + padding-bottom: 0 !important; + margin: 4px; + height: auto; + overflow: hidden; + /* text-align: center !important; */ + display: inline-block; +} + +.wid-prev-name { + width: 100%; + text-align: center; + font-family: Verdana, Arial, sans-serif; + font-weight: normal; +} + +.wid-prev-type { + display: none; + width: 100%; + text-align: center; + font-size: smaller; +} + +#btn_prev_zoom { + display: inline-block; + float: right; + padding: 3px; + border-width: 1px; + border-style: solid; + border-color: inherit; + border-radius: 6px; + margin-top: -4px; + margin-right: 2px; +} + +#btn_prev_type { + display: inline-block; + float: right; + padding: 3px; + border-width: 1px; + border-style: solid; + border-color: inherit; + border-radius: 6px; + margin-top: -4px; +} + +.wid-prev:after { + width: 100%; + height: 100%; + content: ""; + display: block; + position: absolute; + cursor: pointer; + top: 0; + left: 0; + z-index: 90; +} + +.vis-widget-lock:after { + content: ""; + position: absolute; + top: 3px; + left: 3px; + width: -webkit-calc(100% - 6px); + width: calc(100% - 6px); + height: -webkit-calc(100% - 6px); + height: calc(100% - 6px); + z-index: 998; +} +.vis-inspect-group { + font-weight: bold !important; +} +.vis-widget_prev { + position: relative !important; + top: 0 !important; + left: 0 !important; + padding: 0 !important; +} + +.select_set { + width: 100% !important; + font-size: 21px !important; + font-weight: bold !important; + border-radius: 0; + height: 30px !important; + text-align: center; + +} + +#pan_add_wid { + width: 190px; + display: inline-block; + height: 100%; + /* border-right-width: 0;*/ + border-bottom-width: 0; + border-top-width: 0; + border-left-width: 0; + /* display: inline-block; */ + float: left; +} + +#pan_attr { + display: block; + height: 100%; + /* left: auto; */ + /* white-space: nowrap; */ + /* position: absolute; */ + /* right: 0; */ + width: 355px; + + margin-right: 1px; + margin-top: 0; + margin-bottom: 0; + margin-left: 0; + /* float: right; */ + padding: 0; + /* top: 0; */ + border-radius: 0; +} + +#inspect_view_bkg_parent { + white-space: normal; +} + +/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ + +#vis_wrap { + /* width: auto; */ + max-height: 100%; + position: absolute; + display: inline-block; + height: 100%; + overflow: hidden; + clear: both; + /* right: 0; */ + /* top: 0; */ +} + +#view_select { + width: -webkit-calc(100% - 1px); + width: calc(100% - 1px); + height: 28px; + display: -webkit-inline-box; + display: inline-flex; + position: relative; + border: none; +} + +#view_select_left { + height: 28px; + width: 28px; + border-radius: 0; + margin: 0; +} + +#view_select_list { + height: 28px; + width: 28px; + border-radius: 0; + margin: 0; +} + +#view_select_tabs_wrap { + height: 27px; + max-width: -webkit-calc(100% - 86px); + max-width: calc(100% - 86px); + overflow: hidden; +} + +#view_select_tabs { + display: inline-block; + position: relative; + height: 25px; + padding-top: 3px; +} + +#view_select_right { + height: 28px; + width: 28px; + border-radius: 0; + margin: 0; +} + +.view-select-tab { + display: inline; + white-space: nowrap; + margin-left: 1px; + margin-right: 1px; + padding: 2px 6px 3px 6px; + min-width: 40px; + text-align: center; + font-size: 16px; + height: 19px; + top: 2px; + position: relative; + cursor: pointer; +} + +/*xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ +#css_find_prev{ + margin-left: 4px +} +.tab_attr { + padding: 0 0 0 4px !important; + border-width: 1px 0 0 0 !important; + font-size: 12px; + font-weight: normal !important; + height: -webkit-calc(100% - 70px); + height: calc(100% - 70px); + overflow: auto; +} + +#attr_wrap { + /* height: -webkit-calc(100% - 14px); */ + height: 100%; + padding: 0; + border-radius: 0; + position: absolute; + right: 0; + top: -1px; + min-width: 20px; + width: auto; + overflow: visible; + font-size: 13px !important; +} +#attr_wrap .vis-edit-td-caption, +#attr_wrap .vis-inspect-group, +.group-view-css-common, +.group-view-css-font-text, +.group-view-css-background { + font-size: 13px !important; +} + +#select_set-button { + width: -webkit-calc(100% - 2px) !important; + width: calc(100% - 2px) !important; + border-radius: 0 !important; + height: 30px; + padding: 0; +} + +#select_set-button > span.ui-selectmenu-text { + padding-top: 3px !important; + padding-bottom: 3px !important; +} + +.vis-edit-td-field .ui-slider { + width: -webkit-calc(100% - 10px); + width: calc(100% - 10px); + margin-left: 5px; +} + +.btn-iconbar { + width: 24px; + height: 24px; + position: relative; + border: 1px solid transparent; + display: inline-block; + top: 1px; +} + +.icon-on-iconbar { + height: 18px; + width: 18px; + margin: 2px; + display: inline-block; + border: 1px solid rgba(0, 0, 0, 0); + border-radius: 6px; +} + +#select_active_widget + button { + width: 100% !important; + font-size: 12px; + white-space: nowrap; + height: 22px; + /* padding-top: 3px; */ +} + +.select_active_widget { + width: 400px !important; + font-size: 12px; +} + +td > .select_active_widget :nth-child(2) { + width: 255px; + overflow: hidden; + display: inline-block; + height: 15px; + padding-top: 1px; +} + +.select_view { + width: 350px !important; +} + +#select_view + button { + width: 100% !important; + font-size: 12px; + white-space: nowrap; + height: 22px; +} + +.select_view :nth-child(2) { + position: relative; + top: 2px; +} + +#rib_wid_copy_view + button { + width: 100% !important; + height: 22px; + font: inherit; +} + +#rib_view_copyname { + width: -webkit-calc(100% - 3px); + width: calc(100% - 3px); + height: 15px; + font: inherit; +} + +#rib_view_newname { + width: -webkit-calc(100% - 3px); + width: calc(100% - 3px); + height: 15px; + font: inherit; +} + +#rib_view_addname { + width: -webkit-calc(100% - 3px); + width: calc(100% - 3px); + height: 15px; + font: inherit; +} + +.screen_size { + font-size: 12px; + width: 260px !important; +} + +#screen_size + button { + width: 100% !important; + white-space: nowrap; + height: 24px !important; +} + +.widget-helper { + border: 1px dashed white; + position: absolute; + z-index: 90; + pointer-events: none; +} + +.widget_inner_helper { + border: 1px dashed black; + pointer-events: none; + width: calc(100% - 2px); + height: calc(100% - 2px); +} + +.oid-dev { + width: 50px; + padding: 0 !important; + height: 18px; +} + +.fullscreen-pan-attr{ + z-index: 10001; + width: auto; + position: absolute; + right: 0; + /* height: 100%; */ + min-width: 20px; + background: transparent; + border: none; +} +#pan_attr_hover{ + height: 100%; + width: calc(100% + 30px); + position: absolute; + top: 0; + right: 0; +} +#css_editor_head { + height: 30px; + display: flex; + padding: 2px; + /* line-height: 25px; */ + /* display: none; */ +} +#css_editor { + height: calc(100% - 30px); + width: 100%; +} +#css_find{ + margin-left: 10px; + /* display: inline-block; */ + /* height: 22px; */ + /* position: relative; */ + /* top: -8px; */ + width: calc(100% - 210px); +} +#css_file_save{ + margin-left: 10px; +} +#script_editor_head { + height: 30px; + display: flex; + padding: 2px; + /* line-height: 25px; */ + /* display: none; */ +} +#script_editor { + height: calc(100% - 30px); + width: 100%; +} +#script_find{ + margin-left: 10px; + /* display: inline-block; */ + /* height: 22px; */ + /* position: relative; */ + /* top: -8px; */ + width: calc(100% - 210px); +} +#script_file_save{ + margin-left: 10px; +} + +.view-select-menu { + max-height: calc(100% - 100px); + overflow-y: scroll; + overflow-x: hidden; +} + +.custom-vis-menu { + height: 300px !important; + overflow-y: scroll; +} + +.vis-widget-edit-locked:after { + content: 'locked'; + background: repeating-linear-gradient( + 45deg, + #606dbc, + #606dbc 10px, + #465298 10px, + #465298 20px + ); + z-index: 901; + width: 100%; + height: 100%; + position: absolute; + top: 0; + left: 0; + opacity: 0.1; +} + +.vis-widgets-highlight:before { + content: ""; + position: absolute; + top: 0; + left: 0; + width: -webkit-calc(100% - 3px); + width: calc(100% - 3px); + height: -webkit-calc(100% - 3px); + height: calc(100% - 3px); + z-index: 997; + opacity: 0.3; + background: repeating-linear-gradient( + 135deg, + #FFFFFF, + #FFFFFF 20px, + #000000 20px, + #000000 40px + ); +} +.ui-icon-logout { + background-image: url(../lib/img/logout.png) !important; +} + +.ui-autocomplete { + height: 300px; + overflow-y: scroll; + overflow-x: hidden; +} + +.ui-selectmenu-open { + z-index: 999; +} + +.vis-grid { + position: absolute; + z-index: 0; + top: 0; + left: 0; + right: 0; + bottom: 0; + pointer-events: none; + margin: 0; + background-repeat: repeat, repeat; +} + +@-webkit-keyframes vis-leading-line-shadow { + from {-webkit-box-shadow: 0 0 1px 1px rgba(255,0,0,0.5);} + to {-webkit-box-shadow: none;} +} +@-moz-keyframes vis-leading-line-shadow { + from {-moz-box-shadow: 0 0 1px 1px rgba(255,0,0,0.5);} + to {-moz-box-shadow: none;} +} +@keyframes vis-leading-line-shadow { + from {box-shadow: 0 0 1px 1px rgba(255,0,0,0.5);} + to {box-shadow: none;} +} + +.vis-leading-line { + background: red; + opacity: 0.7; + position: absolute; + pointer-events: none; + z-index: 2000; + /*-webkit-animation: vis-leading-line-shadow 0.3s 1; + -moz-animation: vis-leading-line-shadow 0.3s 1; + animation: vis-leading-line-shadow 0.3s 1;*/ +} + +.vis-drop-zone { + width: calc(100% - 6px); + height: calc(100% - 6px); + position: absolute; + opacity: 0.95; + top: 0; + left: 0; + background: #eee; + -webkit-border-radius: 15px; + -moz-border-radius: 15px; + z-index: 1; + font-size: 32px; + font-weight: bold; + text-align: center; + border: 3px dashed black; + border-radius: 15px; +} + +.vis-dropzone-error { + background: #faa !important; + color: #f00; +} +.vis-import-text-drop { + width: calc(100% - 6px); + height: 150px; + padding-top: 20px; + text-align: center; + cursor: pointer; + border: 3px dashed #c6c6c6; + border-radius: 15px; + color: #c6c6c6; +} +.vis-import-text-drop-plus { + position: absolute; + top: 30px; + left: calc(50% - 40px); + font-size: 100px; + font-weight: bold; + opacity: 0.2; +} +.selectmenu-overflow { + height: 300px; +} + +@keyframes blinker { + 50% { opacity: 0; } +} +.vis-license-error { + color: red; + font-weight: bold; + animation: blinker 1s linear infinite; +} +/* --------- vis preview icons ------------------- */ +.vis-preview-informers-container { + position: absolute; + opacity: 0.2; + top: 10px; + right: 0; + z-index: 5; + width: 27px; +} + +.vis-preview-informer { + width: 24px; + height: 24px; + background-repeat: no-repeat; +} + +.vis-preview-control { + background-image: url("../icon/control.png"); +} + +.vis-preview-navigation { + background-image: url("../icon/navigation.png"); +} +.vis-preview-filter { + background-image: url("../icon/filter.png"); +} +.vis-preview-timestamp { + background-image: url("../icon/timestamp.png"); +} +.vis-preview-dialog { + background-image: url("../icon/dialog.png"); +} +.vis-preview-static { + background-image: url("../icon/static.png"); +} +.vis-preview-val { + background-image: url("../icon/value.png"); +} +.vis-preview-container { + background-image: url("../icon/container.png"); +} +.vis-preview-rgb { + background-image: url("../icon/rgb.png"); +} +.vis-preview-stateful { + background-image: url("../icon/stateful.png"); +} +.vis-preview-table { + background-image: url("../icon/table.png"); +} +.vis-preview-tools { + background-image: url("../icon/tools.png"); +} +.vis-preview-bar { + background-image: url("../icon/bar.png"); +} +.vis-preview-window { + background-image: url("../icon/window.png"); +} +.vis-preview-shutter { + background-image: url("../icon/shutter.png"); +} +.vis-preview-door { + background-image: url("../icon/door.png"); +} +.vis-preview-lamp { + background-image: url("../icon/lamp.png"); +} +.vis-preview-temperature { + background-image: url("../icon/temperature.png"); +} +.vis-preview-humidity { + background-image: url("../icon/humidity.png"); +} +.vis-preview-dimmer { + background-image: url("../icon/dimmer.png"); +} +.vis-preview-checkbox { + background-image: url("../icon/checkbox.png"); +} +.vis-preview-state { + background-image: url("../icon/state.png"); +} +.vis-preview-lock { + background-image: url("../icon/lockIcon.png"); +} + +/*-------------------------- group-editor ------------------------------ */ +.group-edit-header { + padding: 5px; + position: absolute; + width: 250px; + height: 20px; + background: rgba(117, 175, 255, 0.69); + font-size: 20px; + top: 0; + right: 0; + z-index: 999; +} +.group-edit-close { + position: absolute; + top: 5px; + right: 3px; +} + +/*------------------------- context menu ------------------------------------*/ +.ui-menu-item { + font-size: 12px !important; + text-align: left; +} \ No newline at end of file diff --git a/www/css/vis.css b/www/css/vis.css new file mode 100644 index 0000000..2ed5a19 --- /dev/null +++ b/www/css/vis.css @@ -0,0 +1,652 @@ +/* Reset all fonts settings */ +body, html { + font-style: normal; + font-stretch: normal; + text-shadow: none; + text-transform: none; + text-rendering: auto; + color: initial; + letter-spacing: normal; + word-spacing: normal; + text-indent: 0; + display: inline-block; + text-align: start; + font: 1em Arial; +} + +/* set font as in editor */ +#vis_container { + font-family: Arial, sans-serif; +} + +.vis-widget { + position: absolute; + overflow: hidden; +} + +.vis-view { + top: 0; + min-height: 100%; + min-width: 100%; +} +.vis-no-user-select { + -webkit-touch-callout: none; + -ms-touch-select: none; + -ms-touch-action: none; + + touch-callout: none; + touch-select: none; + touch-action: none; + + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + + user-select: none; +} + +.vis-no-pointer-events { + pointer-events: none +} + +.tplSpanOnOff { + border: 1px solid blue; + display: block; + width: 50px; + height: 50px; +} + +.tplSpanOnOff-on { + background-color: green; + text-shadow: none; +} + +.tplSpanOnOff-off { + +} + +.ui-slider-vertical { + + height: 93%; +} + +.ui-dialog .ui-dialog-content { + padding: .5em 0; +} + +.vis-widget-button { + width: auto; + height: auto; +} + +.vis-widget-body { + width: 100%; + height: 100%; +} + +.vis-widget-prev-body { + width: 100%; + height: 100%; +} + +.vis-signals-blink { + animation: vis-blink-animation 1s steps(5, start) infinite; + -webkit-animation: vis-blink-animation 1s steps(5, start) infinite; +} +@keyframes vis-blink-animation { + to { + visibility: hidden; + } +} +@-webkit-keyframes vis-blink-animation { + to { + visibility: hidden; + } +} + +@-webkit-keyframes vis-waitico-rotate { + from { + -webkit-transform: rotate(0deg); + } + to { + -webkit-transform: rotate(360deg); + } +} + +#vis-waitico { + position: absolute; + top: 50%; + left: 50%; + margin: -24px 0 0 -24px; + height: 48px; + width: 48px; + text-indent: 250px; + white-space: nowrap; + overflow: hidden; + background: url(../img/gear-icon-md.png); + background-size: 100% auto; + -webkit-animation-duration: 2s; + -webkit-animation-name: vis-waitico-rotate; + -webkit-animation-iteration-count: infinite; + -webkit-animation-timing-function: linear; +} + +#dialog-message { + padding-left: 15px; +} + +.ui-selectable-helper { + opacity: 0.1 !important; + background: red !important; +} +.noTitle .ui-dialog-titlebar { + display: none; + margin-top: 30px; +} + +button.ui-dialog-titlebar-close { + width: 30px !important; + height: 30px !important; + margin-top: -14px !important; +} + +div.vis-editor-dialog { + /* min-width: 440px !important; + max-width: 440px !important;*/ +} + +div.vis-editor-dialog div div button.ui-dialog-titlebar-close { + margin-left: 1px !important; + margin-top: -4px !important; +} + +a.ui-dialog-titlebar-minimize { + width: 26px !important; + height: 26px !important; + padding: 1px !important; + margin-top: -4px !important; +} + +a.ui-dialog-titlebar-restore { + width: 26px !important; + height: 26px !important; + padding: 1px !important; + margin-top: -4px !important; +} + +.ui-dialog-titlebar-restore span { + margin-top: 5px !important; + margin-left: 5px !important; +} + +.ui-dialog-titlebar-minimize span { + margin-top: 5px !important; + margin-left: 5px !important; +} + +.vis-panel h4 { + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size: 12pt; + font-weight: bold; + padding-top: 0; + padding-bottom: 0; + padding-left: 6px; + width: calc(100% - 7px); +} + +.vis-no-spaces { + padding: 0; + margin: 0; + border: 0; + border-spacing: 0; +} + +.vis-wait-screen { + width: 100%; + height: 100%; + z-index: 5000; + /* background: -moz-linear-gradient(top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.65)), color-stop(100%,rgba(0,0,0,0))); + background: -webkit-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); + background: -o-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); + background: -ms-linear-gradient(top, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); + background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%,rgba(0,0,0,0) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a6000000', endColorstr='#00000000',GradientType=0 ); */ +} + +.vis-progressbar { + position: absolute; + top: 50%; + left: 38%; + width: 20%; +} + +.vis-wait-text { + position: absolute; + top: 10%; + left: 38%; + font-family: 'trebuchet MS', sans-serif; + color: #525252; + font-size: 1.5em; + font-weight: bold; + font-variant: small-caps; +} + +.vis-show-new { + border: 3px dotted rgba(167, 232, 226, 0.9); + z-index: 1; + pointer-events: none; +} + +.vis-edit-td-caption { +} + +.vis-edit-td-field { + width: auto; +} + +.vis-edit-textbox { + width: calc(100% - 4px); +} + +.vis-edit-select { + width: auto; +} + +.vis-wizard-select { + width: 200px; +} + +.vis-group-button-width { + width: 100%; + font-weight: bold; +} +.vis-user-disabled { + background: gray !important; + opacity: 0.3 !important; + pointer-events: none; +} +.vis-view-disabled-text { + font-size: 24px; + position: absolute; + left: calc(50% - 150px); + top: calc(50% - 12px); +} +.vis-view-disabled { + position: absolute; + z-index: 10000; + top: 0; + bottom: 0; + left: 0; + right: 0; + opacity: 0.4; + background: black; + cursor: not-allowed; +} + +div#tabs { + + height: 100%; + overflow: hidden; + min-width: 360px; +} + +div#vis_editor { + min-width: 440px !important; + max-width: 440px !important; + overflow-y: hidden; + overflow-x: scroll; +} + +.vis-steal-css, .vis-clear-css { + display: inline-block; +} + +.vis-steal-cursor { + cursor: crosshair !important; +} + +.vis-inspect-css { + font-size: 11px !important; +} + +.vis-steal-label { + width: 17px; + height: 17px; +} + +#css_table { + width: 220px; +} + +.editmode-helper { + position: absolute; + width: 100%; + height: 100%; + background: url(../img/editmode-pattern.png); + /*z-index: 89*/ +} + +.vis-wait-screen { + position: absolute; + top: 0; + left: 0; + height: 100%; + width: 100%; +} + +.vis-clipboard { + position: absolute; + top: 0; + padding-top: 4px; + padding-bottom: 4px; + padding-left: 14px; + padding-right: 14px; + background-color: rgb(55, 169, 232); + opacity: 0.8; + z-index: 1003; + -webkit-border-bottom-right-radius: 7px; + -webkit-border-bottom-left-radius: 7px; + -moz-border-radius-bottomright: 7px; + -moz-border-radius-bottomleft: 7px; + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; + font-family: Arial, Helvetica, sans-serif; +} + +.vis-stealmode { + position: absolute; + top: 0; + padding-top: 4px; + padding-bottom: 4px; + padding-left: 14px; + padding-right: 14px; + background-color: orange; + opacity: 0.8; + z-index: 1003; + -webkit-border-bottom-right-radius: 7px; + -webkit-border-bottom-left-radius: 7px; + -moz-border-radius-bottomright: 7px; + -moz-border-radius-bottomleft: 7px; + border-bottom-right-radius: 7px; + border-bottom-left-radius: 7px; +} + +/*--------------------------------------------- Authentication dialog ------------------------------- */ +/* Mask for background, by default is not display */ +#login-mask { + display: none; + background: #000; + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + opacity: 0.8; + z-index: 999; +} + +/* You can customize to your needs */ +.login-popup { + display: none; + background: #333; + padding: 10px; + border: 2px solid #ddd; + float: left; + font-size: 1.2em; + position: fixed; + top: 50%; + left: 50%; + z-index: 99999; + box-shadow: 0 0 20px #999; + /* CSS3 */ + -moz-box-shadow: 0 0 20px #999; + /* Firefox */ + -webkit-box-shadow: 0 0 20px #999; + /* Safari, Chrome */ + border-radius: 3px 3px 3px 3px; + -moz-border-radius: 3px; + /* Firefox */ + -webkit-border-radius: 3px; + /* Safari, Chrome */; +} + +.login-input-field label { + display: block; + padding-bottom: 7px; +} + +.login-input-field span { + display: block; +} + +.login-input-field span { + color: #999; + font-size: 11px; + line-height: 18px; +} + +.login-input-field { + text-align: center; + background: #666666; + border-bottom: 1px solid #333; + border-left: 1px solid #000; + border-right: 1px solid #333; + border-top: 1px solid #000; + color: #fff; + border-radius: 3px 3px 3px 3px; + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + font: 13px Arial, Helvetica, sans-serif; + padding: 6px 6px 4px; +} + +#login-password { + width: 205px; + text-align: left; +} + +#login-username { + width: 220px; +} + +.login-message { + width: 100%; + text-align: center; + padding-bottom: 10px; + color: white; + font-weight: bold; +} + +#login-box input:-moz-placeholder { + color: #bbb; + text-shadow: 0 0 2px #000; +} + +#login-box input::-webkit-input-placeholder { + color: #bbb; + text-shadow: 0 0 2px #000; +} + +.login-button { + background: -moz-linear-gradient(center top, #f3f3f3, #dddddd); + background: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#dddddd)); + background: -o-linear-gradient(top, #f3f3f3, #dddddd); + filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f3f3f3', EndColorStr='#dddddd'); + border-color: #000; + border-width: 1px; + border-radius: 4px 4px 4px 4px; + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + color: #333; + cursor: pointer; + display: inline-block; + padding: 6px 6px 4px; + margin-top: 10px; + font-size: 12px; + width: 220px; +} + +.login-button:hover { + background: #ddd; +} + + +/* ---------------- Notifications themes (info, warn)--------------------------- */ + +div.jGrowl div.info { + background-color: #FFF1C2; + color: navy; +} + +div.jGrowl div.info { + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + width: 280px; + height: 55px; + overflow: hidden; + opacity: 0.95; +} + +div.jGrowl div.warn { + background-color: #FFF1C2; + color: red; +} + +div.jGrowl div.warn { + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + width: 280px; + height: 55px; + overflow: hidden; + opacity: 1; +} + +/* ------------------ connecting -------------------------- */ +#server-disconnect { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + z-index: 5000; +} +.disconnect-light { + background-color: rgba(231,231,231,0.9); +} +.disconnect-dark { + background-color: rgba(25,25,25,0.9); +} +#server-disconnect > * { + /* center child divs */ + position: absolute; + top: 50%; + left: 50%; + /* x-border-box */ + box-sizing: border-box; + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -webkit-box-sizing: border-box; + /* x-unselectable */ + user-select: none; + -o-user-select: none; + -ms-user-select: none; + -moz-user-select: -moz-none; + -webkit-user-select: none; + cursor: default; +} +.splash-screen-circle-outer { + z-index: 20000; + width: 100px; + height: 100px; + border-radius: 100px; + margin-top: -50px; + margin-left: -50px; + border: 5px solid rgba(87, 113, 145, 0.9); + opacity: .9; + border-right: 5px solid rgba(0, 0, 0, 0); + border-left: 5px solid rgba(0, 0, 0, 0); + box-shadow: 0 0 35px #577191; + -moz-animation: spinPulse 5s infinite ease-in-out; + -webkit-animation: spinPulse 5s infinite linear; +} +.splash-screen-circle-inner { + z-index: 20001; + width: 80px; + height: 80px; + border-radius: 80px; + margin-top: -40px; + margin-left: -40px; + background-color: rgba(0, 0, 0, 0); + border: 5px solid rgba(87, 113, 145, 0.9); + opacity: .9; + border-left: 5px solid rgba(0, 0, 0, 0); + border-right: 5px solid rgba(0, 0, 0, 0); + box-shadow: 0 0 15px #577191; + -moz-animation: spinoffPulse 5s infinite linear; + -webkit-animation: spinoffPulse 5s infinite linear; +} +.splash-screen-text { + z-index: 20002; + width: 100px; + height: 100px; + line-height: 100px; + margin-top: -50px; + margin-left: -50px; + font-family: Verdana, Geneva, sans-serif; + font-size: 13px; + text-align: center; + text-shadow: 1px 1px #cccccc; + vertical-align: middle; + color: #002951; +} +@-moz-keyframes spinPulse { + 0% { + -moz-transform: rotate(160deg); + opacity: 0; + box-shadow: 0 0 1px #577191; + } + 50% { + -moz-transform: rotate(145deg); + opacity: 1; + } + 100% { + -moz-transform: rotate(-320deg); + opacity: 0; + } +} +@-moz-keyframes spinoffPulse { + 0% { + -moz-transform: rotate(0deg); + } + 100% { + -moz-transform: rotate(360deg); + } +} +@-webkit-keyframes spinPulse { + 0% { + -webkit-transform: rotate(160deg); + opacity: 0; + box-shadow: 0 0 1px #577191; + } + 50% { + -webkit-transform: rotate(145deg); + opacity: 1; + } + 100% { + -webkit-transform: rotate(-320deg); + opacity: 0; + } +} +@-webkit-keyframes spinoffPulse { + 0% { + -webkit-transform: rotate(0deg); + } + 100% { + -webkit-transform: rotate(360deg); + } +} + + diff --git a/www/edit.html b/www/edit.html new file mode 100644 index 0000000..6c5812f --- /dev/null +++ b/www/edit.html @@ -0,0 +1,1147 @@ + + + + + + + + + + + + + + + + + + Edit vis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+ + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + +
+ +
+ +
No connection
+
+ + + + diff --git a/www/icon/add.png b/www/icon/add.png new file mode 100644 index 0000000..d603ff1 Binary files /dev/null and b/www/icon/add.png differ diff --git a/www/icon/align-height.png b/www/icon/align-height.png new file mode 100644 index 0000000..7f8d193 Binary files /dev/null and b/www/icon/align-height.png differ diff --git a/www/icon/align-horizontal-center-2.png b/www/icon/align-horizontal-center-2.png new file mode 100644 index 0000000..4dbae43 Binary files /dev/null and b/www/icon/align-horizontal-center-2.png differ diff --git a/www/icon/align-horizontal-left.png b/www/icon/align-horizontal-left.png new file mode 100644 index 0000000..5a25d75 Binary files /dev/null and b/www/icon/align-horizontal-left.png differ diff --git a/www/icon/align-horizontal-right-2.png b/www/icon/align-horizontal-right-2.png new file mode 100644 index 0000000..0180eb9 Binary files /dev/null and b/www/icon/align-horizontal-right-2.png differ diff --git a/www/icon/align-vertical-bottom-2.png b/www/icon/align-vertical-bottom-2.png new file mode 100644 index 0000000..fdac15c Binary files /dev/null and b/www/icon/align-vertical-bottom-2.png differ diff --git a/www/icon/align-vertical-center-2.png b/www/icon/align-vertical-center-2.png new file mode 100644 index 0000000..2b1b335 Binary files /dev/null and b/www/icon/align-vertical-center-2.png differ diff --git a/www/icon/align-vertical-top-2.png b/www/icon/align-vertical-top-2.png new file mode 100644 index 0000000..9f293cd Binary files /dev/null and b/www/icon/align-vertical-top-2.png differ diff --git a/www/icon/align-width.png b/www/icon/align-width.png new file mode 100644 index 0000000..5bd06de Binary files /dev/null and b/www/icon/align-width.png differ diff --git a/www/icon/bar.png b/www/icon/bar.png new file mode 100644 index 0000000..72ece02 Binary files /dev/null and b/www/icon/bar.png differ diff --git a/www/icon/cancel.png b/www/icon/cancel.png new file mode 100644 index 0000000..4f417d3 Binary files /dev/null and b/www/icon/cancel.png differ diff --git a/www/icon/checkbox.png b/www/icon/checkbox.png new file mode 100644 index 0000000..b941bf6 Binary files /dev/null and b/www/icon/checkbox.png differ diff --git a/www/icon/container.png b/www/icon/container.png new file mode 100644 index 0000000..40289d2 Binary files /dev/null and b/www/icon/container.png differ diff --git a/www/icon/control.png b/www/icon/control.png new file mode 100644 index 0000000..21366f4 Binary files /dev/null and b/www/icon/control.png differ diff --git a/www/icon/copy.png b/www/icon/copy.png new file mode 100644 index 0000000..80e8ef3 Binary files /dev/null and b/www/icon/copy.png differ diff --git a/www/icon/delete.png b/www/icon/delete.png new file mode 100644 index 0000000..d2ea56c Binary files /dev/null and b/www/icon/delete.png differ diff --git a/www/icon/dialog.png b/www/icon/dialog.png new file mode 100644 index 0000000..c0a3802 Binary files /dev/null and b/www/icon/dialog.png differ diff --git a/www/icon/distribute-horizontal-equal.png b/www/icon/distribute-horizontal-equal.png new file mode 100644 index 0000000..0f400d2 Binary files /dev/null and b/www/icon/distribute-horizontal-equal.png differ diff --git a/www/icon/distribute-vertical-equal.png b/www/icon/distribute-vertical-equal.png new file mode 100644 index 0000000..1934db8 Binary files /dev/null and b/www/icon/distribute-vertical-equal.png differ diff --git a/www/icon/door.png b/www/icon/door.png new file mode 100644 index 0000000..a73324d Binary files /dev/null and b/www/icon/door.png differ diff --git a/www/icon/filter.png b/www/icon/filter.png new file mode 100644 index 0000000..099279b Binary files /dev/null and b/www/icon/filter.png differ diff --git a/www/icon/groupFixed.png b/www/icon/groupFixed.png new file mode 100644 index 0000000..099279b Binary files /dev/null and b/www/icon/groupFixed.png differ diff --git a/www/icon/groupVisibility.png b/www/icon/groupVisibility.png new file mode 100644 index 0000000..43d9e10 Binary files /dev/null and b/www/icon/groupVisibility.png differ diff --git a/www/icon/info.png b/www/icon/info.png new file mode 100644 index 0000000..8ee4558 Binary files /dev/null and b/www/icon/info.png differ diff --git a/www/icon/lamp.png b/www/icon/lamp.png new file mode 100644 index 0000000..570904f Binary files /dev/null and b/www/icon/lamp.png differ diff --git a/www/icon/lock.png b/www/icon/lock.png new file mode 100644 index 0000000..f428c23 Binary files /dev/null and b/www/icon/lock.png differ diff --git a/www/icon/lockIcon.png b/www/icon/lockIcon.png new file mode 100644 index 0000000..6b0f433 Binary files /dev/null and b/www/icon/lockIcon.png differ diff --git a/www/icon/navigation.png b/www/icon/navigation.png new file mode 100644 index 0000000..8d45570 Binary files /dev/null and b/www/icon/navigation.png differ diff --git a/www/icon/ok.png b/www/icon/ok.png new file mode 100644 index 0000000..242d68d Binary files /dev/null and b/www/icon/ok.png differ diff --git a/www/icon/refresh-4.png b/www/icon/refresh-4.png new file mode 100644 index 0000000..3ba8e95 Binary files /dev/null and b/www/icon/refresh-4.png differ diff --git a/www/icon/rename.png b/www/icon/rename.png new file mode 100644 index 0000000..355d1b9 Binary files /dev/null and b/www/icon/rename.png differ diff --git a/www/icon/rgb.png b/www/icon/rgb.png new file mode 100644 index 0000000..a29cb71 Binary files /dev/null and b/www/icon/rgb.png differ diff --git a/www/icon/shutter.png b/www/icon/shutter.png new file mode 100644 index 0000000..c4d3507 Binary files /dev/null and b/www/icon/shutter.png differ diff --git a/www/icon/state.png b/www/icon/state.png new file mode 100644 index 0000000..9fb1cde Binary files /dev/null and b/www/icon/state.png differ diff --git a/www/icon/stateful.png b/www/icon/stateful.png new file mode 100644 index 0000000..2f6425a Binary files /dev/null and b/www/icon/stateful.png differ diff --git a/www/icon/static.png b/www/icon/static.png new file mode 100644 index 0000000..05e0e13 Binary files /dev/null and b/www/icon/static.png differ diff --git a/www/icon/table.png b/www/icon/table.png new file mode 100644 index 0000000..38c56d4 Binary files /dev/null and b/www/icon/table.png differ diff --git a/www/icon/temperature.png b/www/icon/temperature.png new file mode 100644 index 0000000..960059b Binary files /dev/null and b/www/icon/temperature.png differ diff --git a/www/icon/timestamp.png b/www/icon/timestamp.png new file mode 100644 index 0000000..a5b0828 Binary files /dev/null and b/www/icon/timestamp.png differ diff --git a/www/icon/tools.png b/www/icon/tools.png new file mode 100644 index 0000000..0d973a8 Binary files /dev/null and b/www/icon/tools.png differ diff --git a/www/icon/value.png b/www/icon/value.png new file mode 100644 index 0000000..d4205f4 Binary files /dev/null and b/www/icon/value.png differ diff --git a/www/icon/window.png b/www/icon/window.png new file mode 100644 index 0000000..d396e36 Binary files /dev/null and b/www/icon/window.png differ diff --git a/www/img/Heating.png b/www/img/Heating.png new file mode 100644 index 0000000..0cbd41a Binary files /dev/null and b/www/img/Heating.png differ diff --git a/www/img/Lamp.png b/www/img/Lamp.png new file mode 100644 index 0000000..1323ab2 Binary files /dev/null and b/www/img/Lamp.png differ diff --git a/www/img/OutsideTemp.png b/www/img/OutsideTemp.png new file mode 100644 index 0000000..45d7c58 Binary files /dev/null and b/www/img/OutsideTemp.png differ diff --git a/www/img/Window.png b/www/img/Window.png new file mode 100644 index 0000000..e446443 Binary files /dev/null and b/www/img/Window.png differ diff --git a/www/img/back/box-radial.png b/www/img/back/box-radial.png new file mode 100644 index 0000000..8156aab Binary files /dev/null and b/www/img/back/box-radial.png differ diff --git a/www/img/back/flowers.jpg b/www/img/back/flowers.jpg new file mode 100644 index 0000000..8b019c9 Binary files /dev/null and b/www/img/back/flowers.jpg differ diff --git a/www/img/back/oblique-line-bk.png b/www/img/back/oblique-line-bk.png new file mode 100644 index 0000000..0f9e2e9 Binary files /dev/null and b/www/img/back/oblique-line-bk.png differ diff --git a/www/img/bg-dots-10.svg b/www/img/bg-dots-10.svg new file mode 100644 index 0000000..c251f17 --- /dev/null +++ b/www/img/bg-dots-10.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-15.svg b/www/img/bg-dots-15.svg new file mode 100644 index 0000000..5de163c --- /dev/null +++ b/www/img/bg-dots-15.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-20.svg b/www/img/bg-dots-20.svg new file mode 100644 index 0000000..c9fa9c0 --- /dev/null +++ b/www/img/bg-dots-20.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-25.svg b/www/img/bg-dots-25.svg new file mode 100644 index 0000000..0f4b831 --- /dev/null +++ b/www/img/bg-dots-25.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-30.svg b/www/img/bg-dots-30.svg new file mode 100644 index 0000000..f894c3b --- /dev/null +++ b/www/img/bg-dots-30.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-40.svg b/www/img/bg-dots-40.svg new file mode 100644 index 0000000..60f185b --- /dev/null +++ b/www/img/bg-dots-40.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-5.svg b/www/img/bg-dots-5.svg new file mode 100644 index 0000000..39a8f05 --- /dev/null +++ b/www/img/bg-dots-5.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bg-dots-50.svg b/www/img/bg-dots-50.svg new file mode 100644 index 0000000..e6b6998 --- /dev/null +++ b/www/img/bg-dots-50.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/www/img/bulbOff.png b/www/img/bulbOff.png new file mode 100644 index 0000000..8c880e3 Binary files /dev/null and b/www/img/bulbOff.png differ diff --git a/www/img/bulbOn.png b/www/img/bulbOn.png new file mode 100644 index 0000000..008985f Binary files /dev/null and b/www/img/bulbOn.png differ diff --git a/www/img/bulb_off.png b/www/img/bulb_off.png new file mode 100644 index 0000000..3b20b21 Binary files /dev/null and b/www/img/bulb_off.png differ diff --git a/www/img/bulb_on.png b/www/img/bulb_on.png new file mode 100644 index 0000000..3c98e23 Binary files /dev/null and b/www/img/bulb_on.png differ diff --git a/www/img/camera.png b/www/img/camera.png new file mode 100644 index 0000000..160a2db Binary files /dev/null and b/www/img/camera.png differ diff --git a/www/img/cc-nc-by.png b/www/img/cc-nc-by.png new file mode 100644 index 0000000..5f98214 Binary files /dev/null and b/www/img/cc-nc-by.png differ diff --git a/www/img/disconnect.png b/www/img/disconnect.png new file mode 100644 index 0000000..e353994 Binary files /dev/null and b/www/img/disconnect.png differ diff --git a/www/img/door-bell.mp3 b/www/img/door-bell.mp3 new file mode 100644 index 0000000..a62380a Binary files /dev/null and b/www/img/door-bell.mp3 differ diff --git a/www/img/editmode-pattern.png b/www/img/editmode-pattern.png new file mode 100644 index 0000000..19fc97c Binary files /dev/null and b/www/img/editmode-pattern.png differ diff --git a/www/img/eg_trans.png b/www/img/eg_trans.png new file mode 100644 index 0000000..ba78c6c Binary files /dev/null and b/www/img/eg_trans.png differ diff --git a/www/img/favicon.png b/www/img/favicon.png new file mode 100644 index 0000000..d72ad0d Binary files /dev/null and b/www/img/favicon.png differ diff --git a/www/img/faviconEdit.png b/www/img/faviconEdit.png new file mode 100644 index 0000000..9b56124 Binary files /dev/null and b/www/img/faviconEdit.png differ diff --git a/www/img/garage-door-closed.png b/www/img/garage-door-closed.png new file mode 100644 index 0000000..13b36a1 Binary files /dev/null and b/www/img/garage-door-closed.png differ diff --git a/www/img/garage-door-opened.png b/www/img/garage-door-opened.png new file mode 100644 index 0000000..cdc763b Binary files /dev/null and b/www/img/garage-door-opened.png differ diff --git a/www/img/gear-icon-md.png b/www/img/gear-icon-md.png new file mode 100644 index 0000000..a916448 Binary files /dev/null and b/www/img/gear-icon-md.png differ diff --git a/www/img/hexabump.png b/www/img/hexabump.png new file mode 100644 index 0000000..67c055a Binary files /dev/null and b/www/img/hexabump.png differ diff --git a/www/img/kde_folder.png b/www/img/kde_folder.png new file mode 100644 index 0000000..f2680e0 Binary files /dev/null and b/www/img/kde_folder.png differ diff --git a/www/img/no_filter.png b/www/img/no_filter.png new file mode 100644 index 0000000..a6dd890 Binary files /dev/null and b/www/img/no_filter.png differ diff --git a/www/img/sound.png b/www/img/sound.png new file mode 100644 index 0000000..f652319 Binary files /dev/null and b/www/img/sound.png differ diff --git a/www/img/tank.png b/www/img/tank.png new file mode 100644 index 0000000..ed511da Binary files /dev/null and b/www/img/tank.png differ diff --git a/www/img/zip.png b/www/img/zip.png new file mode 100644 index 0000000..1ccd546 Binary files /dev/null and b/www/img/zip.png differ diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..e6c85ea --- /dev/null +++ b/www/index.html @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + vis + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
...
+
+
+
+ + + diff --git a/www/js/app.js b/www/js/app.js new file mode 100644 index 0000000..502ef7f --- /dev/null +++ b/www/js/app.js @@ -0,0 +1 @@ +//do nothing \ No newline at end of file diff --git a/www/js/config.js b/www/js/config.js new file mode 100644 index 0000000..5e53d9d --- /dev/null +++ b/www/js/config.js @@ -0,0 +1,19 @@ +var visConfig = { + "widgetSets": [ + "basic", + "jqplot", + { + "name": "jqui", + "depends": [ + "basic" + ] + }, + "tabs", + "swipe" + ] +}; +if (typeof exports !== 'undefined') { + exports.config = visConfig; +} else { + visConfig.language = window.navigator.userLanguage || window.navigator.language; +} diff --git a/www/js/conn.js b/www/js/conn.js new file mode 100644 index 0000000..6c149dc --- /dev/null +++ b/www/js/conn.js @@ -0,0 +1,1389 @@ +////// ----------------------- Connection "class" ---------------------- //////////// +/* jshint browser:true */ +/* global document*/ +/* global console*/ +/* global session*/ +/* global window*/ +/* global location*/ +/* global setTimeout*/ +/* global clearTimeout*/ +/* global io*/ +/* global $*/ +/* global socketNamespace */ +/* global socketUrl */ +/* global socketSession */ +/* global storage */ +/* jshint -W097 */// jshint strict:false + +'use strict'; + +// The idea of servConn is to use this class later in every addon. +// The addon just must say, what must be loaded (values, objects, indexes) and +// the class loads it for addon. Authentication will be done automatically, so addon does not care about it. +// It will be .js file with localData and servConn + +var servConn = { + _socket: null, + _onConnChange: null, + _onUpdate: null, + _isConnected: false, + _disconnectedSince: null, + _connCallbacks: { + onConnChange: null, + onUpdate: null, + onRefresh: null, + onAuth: null, + onCommand: null, + onError: null + }, + _authInfo: null, + _isAuthDone: false, + _isAuthRequired: false, + _authRunning: false, + _cmdQueue: [], + _connTimer: null, + _type: 'socket.io', // [SignalR | socket.io | local] + _timeout: 0, // 0 - use transport default timeout to detect disconnect + _reconnectInterval: 10000, // reconnect interval + _reloadInterval: 30, // if connection was absent longer than 30 seconds + _cmdData: null, + _cmdInstance: null, + _isSecure: false, + _defaultMode: 0x644, + _useStorage: false, + _objects: null, // used if _useStorage === true + _enums: null, // used if _useStorage === true + _autoSubscribe: true, + namespace: 'vis.0', + + getType: function () { + return this._type; + }, + getIsConnected: function () { + return this._isConnected; + }, + getIsLoginRequired: function () { + return this._isSecure; + }, + getUser: function () { + return this._user; + }, + setReloadTimeout: function (timeout){ + this._reloadInterval = parseInt(timeout, 10); + }, + setReconnectInterval: function (interval){ + this._reconnectInterval = parseInt(interval, 10); + }, + _checkConnection: function (func, _arguments) { + if (!this._isConnected) { + console.log('No connection!'); + return false; + } + + if (this._queueCmdIfRequired(func, _arguments)) return false; + + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return false; + } + return true; + }, + _monitor: function () { + if (this._timer) return; + var ts = (new Date()).getTime(); + if (this._reloadInterval && ts - this._lastTimer > this._reloadInterval * 1000) { + // It seems, that PC was in a sleep => Reload page to request authentication anew + this.reload(); + } else { + this._lastTimer = ts; + } + var that = this; + this._timer = setTimeout(function () { + that._timer = null; + that._monitor(); + }, 10000); + }, + _onAuth: function (objectsRequired, isSecure) { + var that = this; + + this._isSecure = isSecure; + + if (this._isSecure) { + that._lastTimer = (new Date()).getTime(); + this._monitor(); + } + + if (this._autoSubscribe) this._socket.emit('subscribe', '*'); + if (objectsRequired) this._socket.emit('subscribeObjects', '*'); + + if (this._isConnected === true) { + // This seems to be a reconnect because we're already connected! + // -> prevent firing onConnChange twice + return; + } + this._isConnected = true; + if (this._connCallbacks.onConnChange) { + setTimeout(function () { + that._socket.emit('authEnabled', function (auth, user) { + that._user = user; + that._connCallbacks.onConnChange(that._isConnected); + if (typeof app !== 'undefined') app.onConnChange(that._isConnected); + }); + }, 0); + } + }, + reconnect: function (connOptions) { + var that = this; + // reconnect + if ((!connOptions.mayReconnect || connOptions.mayReconnect()) && !this._connectInterval) { + this._connectInterval = setInterval(function () { + console.log('Trying connect...'); + that._socket.connect(); + that._countDown = Math.floor(that._reconnectInterval / 1000); + if (typeof $ !== 'undefined') { + $('.splash-screen-text').html(that._countDown + '...').css('color', 'red'); + } + }, this._reconnectInterval); + + this._countDown = Math.floor(this._reconnectInterval / 1000); + if (typeof $ !== 'undefined') { + $('.splash-screen-text').html(this._countDown + '...'); + } + + this._countInterval = setInterval(function () { + that._countDown--; + if (typeof $ !== 'undefined') { + $('.splash-screen-text').html(that._countDown + '...'); + } + }, 1000); + } + }, + reload: function () { + if (window.location.host === 'iobroker.net' || + window.location.host === 'iobroker.biz' || + window.location.host === 'iobroker.pro') { + window.location = '/'; + } else { + window.location.reload(); + } + }, + init: function (connOptions, connCallbacks, objectsRequired, autoSubscribe) { + var that = this; // support of old safari + // init namespace + if (typeof socketNamespace !== 'undefined') this.namespace = socketNamespace; + + connOptions = connOptions || {}; + if (!connOptions.name) connOptions.name = this.namespace; + + if (autoSubscribe !== undefined) this._autoSubscribe = autoSubscribe; + + // To start vis as local use one of: + // - start vis from directory with name local, e.g. c:/blbla/local/ioBroker.vis/www/index.html + // - do not create "_socket/info.js" file in "www" directory + // - create "_socket/info.js" file with + // var socketUrl = "local"; var socketSession = ""; sysLang="en"; + // in this case you can overwrite browser language settings + if (document.URL.split('/local/')[1] || (typeof socketUrl === 'undefined' && !connOptions.connLink) || (typeof socketUrl !== 'undefined' && socketUrl === 'local')) { + this._type = 'local'; + } + + if (typeof session !== 'undefined') { + var user = session.get('user'); + if (user) { + that._authInfo = { + user: user, + hash: session.get('hash'), + salt: session.get('salt') + }; + } + } + + this._connCallbacks = connCallbacks; + + var connLink = connOptions.connLink || window.localStorage.getItem('connLink'); + + // Connection data from "/_socket/info.js" + if (!connLink && typeof socketUrl !== 'undefined') connLink = socketUrl; + if (!connOptions.socketSession && typeof socketSession !== 'undefined') connOptions.socketSession = socketSession; + if (connOptions.socketForceWebSockets === undefined && + typeof socketForceWebSockets !== 'undefined') { + connOptions.socketForceWebSockets = socketForceWebSockets; + } + + // if no remote data + if (this._type === 'local') { + // report connected state + this._isConnected = true; + if (this._connCallbacks.onConnChange) this._connCallbacks.onConnChange(this._isConnected); + if (typeof app !== 'undefined') app.onConnChange(this._isConnected); + } else + if (typeof io !== 'undefined') { + connOptions.socketSession = connOptions.socketSession || 'nokey'; + + var url; + if (connLink) { + if (typeof connLink !== 'undefined') { + if (connLink[0] === ':') connLink = location.protocol + '//' + location.hostname + connLink; + } + url = connLink; + } else { + url = location.protocol + '//' + location.host; + } + + // remove port if via cloud + if (url.match(/iobroker\.pro|iobroker\.net/)) { + url = url.replace(/:\d+/, ''); + } + + this._socket = io.connect(url, { + query: 'key=' + connOptions.socketSession, + 'reconnection limit': 10000, + 'max reconnection attempts': Infinity, + reconnection: false, + upgrade: !connOptions.socketForceWebSockets, + rememberUpgrade: connOptions.socketForceWebSockets, + transports: connOptions.socketForceWebSockets ? ['websocket'] : undefined + }); + + this._socket.on('connect', function () { + if (that._disconnectedSince) { + var offlineTime = (new Date()).getTime() - that._disconnectedSince; + console.log('was offline for ' + (offlineTime / 1000) + 's'); + + // reload whole page if no connection longer than some period + if (that._reloadInterval && offlineTime > that._reloadInterval * 1000 && !that.authError) that.reload(); + + that._disconnectedSince = null; + } + + if (that._connectInterval) { + clearInterval(that._connectInterval); + that._connectInterval = null; + } + if (that._countInterval) { + clearInterval(that._countInterval); + that._countInterval = null; + } + var elem = document.getElementById('server-disconnect'); + if (elem) elem.style.display = 'none'; + + that._socket.emit('name', connOptions.name); + console.log((new Date()).toISOString() + ' Connected => authenticate'); + setTimeout(function () { + var timeOut = 6000; + // If online give more time + if (window.location.href.indexOf('iobroker.') !== -1) { + timeOut = 12000; + } + that.waitConnect = setTimeout(function() { + console.error('No answer from server'); + if (!that.authError) { + that.reload(); + } + }, timeOut); + + that._socket.emit('authenticate', function (isOk, isSecure) { + if (that.waitConnect) { + clearTimeout(that.waitConnect); + that.waitConnect = null; + } + + console.log((new Date()).toISOString() + ' Authenticated: ' + isOk); + if (isOk) { + that._onAuth(objectsRequired, isSecure); + } else { + console.log('permissionError'); + } + }); + }, 50); + }); + + this._socket.on('reauthenticate', function (err) { + if (that._connCallbacks.onConnChange) { + that._connCallbacks.onConnChange(false); + if (typeof app !== 'undefined' && !that.authError) app.onConnChange(false); + } + console.warn('reauthenticate'); + if (that.waitConnect) { + clearTimeout(that.waitConnect); + that.waitConnect = null; + } + + if (connCallbacks.onAuthError) { + if (!that.authError) { + that.authError = true; + connCallbacks.onAuthError(err); + } + } else { + that.reload(); + } + }); + + this._socket.on('connect_error', function () { + if (typeof $ !== 'undefined') { + $('.splash-screen-text').css('color', '#002951'); + } + + that.reconnect(connOptions); + }); + + this._socket.on('disconnect', function () { + that._disconnectedSince = (new Date()).getTime(); + + // called only once when connection lost (and it was here before) + that._isConnected = false; + if (that._connCallbacks.onConnChange) { + setTimeout(function () { + var elem = document.getElementById('server-disconnect'); + if (elem) elem.style.display = ''; + that._connCallbacks.onConnChange(that._isConnected); + if (typeof app !== 'undefined') app.onConnChange(that._isConnected); + }, 5000); + } else { + var elem = document.getElementById('server-disconnect'); + if (elem) elem.style.display = ''; + } + + // reconnect + that.reconnect(connOptions); + }); + + // after reconnect the "connect" event will be called + this._socket.on('reconnect', function () { + var offlineTime = (new Date()).getTime() - that._disconnectedSince; + console.log('was offline for ' + (offlineTime / 1000) + 's'); + + // reload whole page if no connection longer than one minute + if (that._reloadInterval && offlineTime > that._reloadInterval * 1000) { + that.reload(); + } + // anyway "on connect" is called + }); + + this._socket.on('objectChange', function (id, obj) { + // If cache used + if (that._useStorage && typeof storage !== 'undefined') { + var objects = that._objects || storage.get('objects'); + if (objects) { + if (obj) { + objects[id] = obj; + } else { + if (objects[id]) delete objects[id]; + } + storage.set('objects', objects); + } + } + + if (that._connCallbacks.onObjectChange) that._connCallbacks.onObjectChange(id, obj); + }); + + this._socket.on('stateChange', function (id, state) { + if (!id || state === null || typeof state !== 'object') return; + + if (that._connCallbacks.onCommand && id === that.namespace + '.control.command') { + if (state.ack) return; + + if (state.val && + typeof state.val === 'string' && + state.val[0] === '{' && + state.val[state.val.length - 1] === '}') { + try { + state.val = JSON.parse(state.val); + } catch (e) { + console.log('Command seems to be an object, but cannot parse it: ' + state.val); + } + } + + // if command is an object {instance: 'iii', command: 'cmd', data: 'ddd'} + if (state.val && state.val.instance) { + if (that._connCallbacks.onCommand(state.val.instance, state.val.command, state.val.data)) { + // clear state + that.setState(id, {val: '', ack: true}); + } + } else { + if (that._connCallbacks.onCommand(that._cmdInstance, state.val, that._cmdData)) { + // clear state + that.setState(id, {val: '', ack: true}); + } + } + } else if (id === that.namespace + '.control.data') { + that._cmdData = state.val; + } else if (id === that.namespace + '.control.instance') { + that._cmdInstance = state.val; + } else if (that._connCallbacks.onUpdate) { + that._connCallbacks.onUpdate(id, state); + } + }); + + this._socket.on('permissionError', function (err) { + if (that._connCallbacks.onError) { + /* { + command: + type: + operation: + arg: + }*/ + that._connCallbacks.onError(err); + } else { + console.log('permissionError'); + } + }); + + this._socket.on('error', function (err) { + if (err === 'Invalid password or user name') { + console.warn('reauthenticate'); + if (that.waitConnect) { + clearTimeout(that.waitConnect); + that.waitConnect = null; + } + + if (connCallbacks.onAuthError) { + if (!that.authError) { + that.authError = true; + connCallbacks.onAuthError(err); + } + } else { + that.reload(); + } + } else { + console.error('Socket error: ' + err); + if (typeof $ !== 'undefined') { + $('.splash-screen-text').css('color', '#002951'); + } + + that.reconnect(connOptions); + } + }); + } + }, + logout: function (callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + + this._socket.emit('logout', callback); + }, + getVersion: function (callback) { + if (!this._checkConnection('getVersion', arguments)) return; + + this._socket.emit('getVersion', function (version) { + if (callback) callback(version); + }); + }, + subscribe: function (idOrArray, callback) { + if (!this._checkConnection('subscribe', arguments)) return; + + this._socket.emit('subscribe', idOrArray, callback); + }, + unsubscribe: function (idOrArray, callback) { + if (!this._checkConnection('unsubscribe', arguments)) return; + + this._socket.emit('unsubscribe', idOrArray, callback); + }, + _checkAuth: function (callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getVersion', function (version) { + if (callback) + callback(version); + }); + }, + readFile: function (filename, callback, isRemote) { + if (!callback) throw 'No callback set'; + + if (this._type === 'local') { + try { + var data = storage.get(filename); + callback(null, data ? JSON.parse(storage.get(filename)) : null); + } catch (err) { + callback(err, null); + } + } else { + if (!this._checkConnection('readFile', arguments)) return; + + if (!isRemote && typeof app !== 'undefined' && !app.settings.dontCache) { + app.readLocalFile(filename.replace(/^\/vis\.0\//, ''), callback); + } else { + var adapter = this.namespace; + if (filename[0] === '/') { + var p = filename.split('/'); + adapter = p[1]; + p.splice(0, 2); + filename = p.join('/'); + } + + this._socket.emit('readFile', adapter, filename, function (err, data, mimeType) { + setTimeout(function () { + callback(err, data, filename, mimeType); + }, 0); + }); + } + } + }, + getMimeType: function (ext) { + if (ext.indexOf('.') !== -1) ext = ext.toLowerCase().match(/\.[^.]+$/); + var _mimeType; + if (ext === '.css') { + _mimeType = 'text/css'; + } else if (ext === '.bmp') { + _mimeType = 'image/bmp'; + } else if (ext === '.png') { + _mimeType = 'image/png'; + } else if (ext === '.jpg') { + _mimeType = 'image/jpeg'; + } else if (ext === '.jpeg') { + _mimeType = 'image/jpeg'; + } else if (ext === '.gif') { + _mimeType = 'image/gif'; + } else if (ext === '.tif') { + _mimeType = 'image/tiff'; + } else if (ext === '.js') { + _mimeType = 'application/javascript'; + } else if (ext === '.html') { + _mimeType = 'text/html'; + } else if (ext === '.htm') { + _mimeType = 'text/html'; + } else if (ext === '.json') { + _mimeType = 'application/json'; + } else if (ext === '.xml') { + _mimeType = 'text/xml'; + } else if (ext === '.svg') { + _mimeType = 'image/svg+xml'; + } else if (ext === '.eot') { + _mimeType = 'application/vnd.ms-fontobject'; + } else if (ext === '.ttf') { + _mimeType = 'application/font-sfnt'; + } else if (ext === '.woff') { + _mimeType = 'application/font-woff'; + } else if (ext === '.wav') { + _mimeType = 'audio/wav'; + } else if (ext === '.mp3') { + _mimeType = 'audio/mpeg3'; + } else { + _mimeType = 'text/javascript'; + } + return _mimeType; + }, + readFile64: function (filename, callback, isRemote) { + var that = this; + if (!callback) { + throw 'No callback set'; + } + + if (!this._checkConnection('readFile', arguments)) return; + + if (!isRemote && typeof app !== 'undefined' && !app.settings.dontCache) { + app.readLocalFile(filename.replace(/^\/vis\.0\//, ''), function (err, data, mimeType) { + setTimeout(function () { + if (data) { + callback(err, {mime: mimeType || that.getMimeType(filename), data: btoa(data)}, filename); + } else { + callback(err, filename); + } + }, 0); + }); + } else { + var adapter = this.namespace; + if (filename[0] === '/') { + var p = filename.split('/'); + adapter = p[1]; + p.splice(0, 2); + filename = p.join('/'); + } + + this._socket.emit('readFile64', adapter, filename, function (err, data, mimeType) { + setTimeout(function () { + if (data) { + callback(err, {mime: mimeType || that.getMimeType(filename), data: data}, filename); + } else { + callback(err, {mime: mimeType || that.getMimeType(filename)}, filename); + } + }, 0); + }); + } + }, + writeFile: function (filename, data, mode, callback) { + if (typeof mode === 'function') { + callback = mode; + mode = null; + } + if (this._type === 'local') { + storage.set(filename, JSON.stringify(data)); + if (callback) callback(); + } else { + if (!this._checkConnection('writeFile', arguments)) return; + + if (typeof data === 'object') data = JSON.stringify(data, null, 2); + + var parts = filename.split('/'); + var adapter = parts[1]; + parts.splice(0, 2); + if (adapter === 'vis') { + this._socket.emit('writeFile', adapter, parts.join('/'), data, mode ? {mode: this._defaultMode} : {}, callback); + } else { + this._socket.emit('writeFile', this.namespace, filename, data, mode ? {mode: this._defaultMode} : {}, callback); + } + } + }, + // Write file base 64 + writeFile64: function (filename, data, callback) { + if (!this._checkConnection('writeFile', arguments)) return; + + var parts = filename.split('/'); + var adapter = parts[1]; + parts.splice(0, 2); + + this._socket.emit('writeFile', adapter, parts.join('/'), atob(data), {mode: this._defaultMode}, callback); + }, + readDir: function (dirname, callback) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + if (!dirname) dirname = '/'; + var parts = dirname.split('/'); + var adapter = parts[1]; + parts.splice(0, 2); + + this._socket.emit('readDir', adapter, parts.join('/'), {filter: true}, function (err, data) { + if (callback) callback(err, data); + }); + }, + mkdir: function (dirname, callback) { + var parts = dirname.split('/'); + var adapter = parts[1]; + parts.splice(0, 2); + + this._socket.emit('mkdir', adapter, parts.join('/'), function (err) { + if (callback) callback(err); + }); + }, + unlink: function (name, callback) { + var parts = name.split('/'); + var adapter = parts[1]; + parts.splice(0, 2); + + this._socket.emit('unlink', adapter, parts.join('/'), function (err) { + if (callback) callback(err); + }); + }, + renameFile: function (oldname, newname, callback) { + var parts1 = oldname.split('/'); + var adapter = parts1[1]; + parts1.splice(0, 2); + var parts2 = newname.split('/'); + parts2.splice(0, 2); + this._socket.emit('rename', adapter, parts1.join('/'), parts2.join('/'), function (err) { + if (callback) callback(err); + }); + }, + setState: function (pointId, value, callback) { + //socket.io + if (this._socket === null) { + //console.log('socket.io not initialized'); + return; + } + this._socket.emit('setState', pointId, value, callback); + }, + // callback(err, data) + getStates: function (IDs, callback) { + if (typeof IDs === 'function') { + callback = IDs; + IDs = null; + } + + if (this._type === 'local') { + return callback(null, []); + } else { + if (!this._checkConnection('getStates', arguments)) return; + + this.gettingStates = this.gettingStates || 0; + this.gettingStates++; + if (this.gettingStates > 1) { + // fix for slow devices + console.log('Trying to get empty list, because the whole list could not be loaded'); + IDs = []; + } + var that = this; + this._socket.emit('getStates', IDs, function (err, data) { + that.gettingStates--; + if (err || !data) { + if (callback) { + callback(err || 'Authentication required'); + } + } else if (callback) { + callback(null, data); + } + }); + } + }, + _fillChildren: function (objects) { + var items = []; + + for (var id in objects) { + if (!objects.hasOwnProperty(id)) continue; + items.push(id); + } + items.sort(); + + for (var i = 0; i < items.length; i++) { + if (objects[items[i]].common) { + var j = i + 1; + var children = []; + var len = items[i].length + 1; + var name = items[i] + '.'; + while (j < items.length && items[j].substring(0, len) === name) { + children.push(items[j++]); + } + + objects[items[i]].children = children; + } + } + }, + // callback(err, data) + getObjects: function (useCache, callback) { + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + // If cache used + if (this._useStorage && useCache) { + if (typeof storage !== 'undefined') { + var objects = this._objects || storage.get('objects'); + if (objects) return callback(null, objects); + } else if (this._objects) { + return callback(null, this._objects); + } + } + + if (!this._checkConnection('getObjects', arguments)) return; + var that = this; + this._socket.emit('getObjects', function (err, data) { + // Read all enums + that._socket.emit('getObjectView', 'system', 'enum', {startkey: 'enum.', endkey: 'enum.\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + var enums = {}; + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + enums[res.rows[i].id] = res.rows[i].value; + } + + // Read all adapters for images + that._socket.emit('getObjectView', 'system', 'instance', {startkey: 'system.adapter.', endkey: 'system.adapter.\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + // find out default file mode + if (data['system.adapter.' + that.namespace] && + data['system.adapter.' + that.namespace].native && + data['system.adapter.' + that.namespace].native.defaultFileMode) { + that._defaultMode = data['system.adapter.' + that.namespace].native.defaultFileMode; + } + + // Read all channels for images + that._socket.emit('getObjectView', 'system', 'channel', {startkey: '', endkey: '\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + + // Read all devices for images + that._socket.emit('getObjectView', 'system', 'device', {startkey: '', endkey: '\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + + if (that._useStorage) { + that._fillChildren(data); + that._objects = data; + that._enums = enums; + + if (typeof storage !== 'undefined') { + storage.set('objects', data); + storage.set('enums', enums); + storage.set('timeSync', (new Date()).getTime()); + } + } + + if (callback) callback(err, data); + }); + }); + }); + }); + }); + }, + getChildren: function (id, useCache, callback) { + if (!this._checkConnection('getChildren', arguments)) return; + + if (typeof id === 'function') { + callback = id; + id = null; + useCache = false; + } + if (typeof id === 'boolean') { + callback = useCache; + useCache = id; + id = null; + } + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + + if (!id) return callback('getChildren: no id given'); + + var that = this; + var data = []; + + if (this._useStorage && useCache) { + if (typeof storage !== 'undefined') { + var objects = storage.get('objects'); + if (objects && objects[id] && objects[id].children) { + return callback(null, objects[id].children); + } + } else if (this._objects && this._objects[id] && this._objects[id].children) { + return callback(null, this._objects[id].children); + } + } + + // Read all devices + that._socket.emit('getObjectView', 'system', 'device', {startkey: id + '.', endkey: id + '.\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + + that._socket.emit('getObjectView', 'system', 'channel', {startkey: id + '.', endkey: id + '.\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + + // Read all adapters for images + that._socket.emit('getObjectView', 'system', 'state', {startkey: id + '.', endkey: id + '.\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + for (var i = 0; i < res.rows.length; i++) { + data[res.rows[i].id] = res.rows[i].value; + } + var list = []; + + var count = id.split('.').length; + + // find direct children + for (var _id in data) { + var parts = _id.split('.'); + if (count + 1 === parts.length) { + list.push(_id); + } + } + list.sort(); + + if (that._useStorage && typeof storage !== 'undefined') { + var objects = storage.get('objects') || {}; + + for (var id_ in data) { + objects[id_] = data[id_]; + } + if (objects[id] && objects[id].common) { + objects[id].children = list; + } + // Store for every element theirs children + var items = []; + for (var __id in data) { + items.push(__id); + } + items.sort(); + + for (var k = 0; k < items.length; k++) { + if (objects[items[k]].common) { + var j = k + 1; + var children = []; + var len = items[k].length + 1; + var name = items[k] + '.'; + while (j < items.length && items[j].substring(0, len) === name) { + children.push(items[j++]); + } + + objects[items[k]].children = children; + } + } + + storage.set('objects', objects); + } + + if (callback) callback(err, list); + }); + }); + }); + }, + getObject: function (id, useCache, callback) { + if (typeof id === 'function') { + callback = id; + id = null; + useCache = false; + } + if (typeof id === 'boolean') { + callback = useCache; + useCache = id; + id = null; + } + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + if (!id) return callback('no id given'); + + // If cache used + if (this._useStorage && useCache && typeof storage !== 'undefined') { + if (typeof storage !== 'undefined') { + var objects = this._objects || storage.get('objects'); + if (objects && objects[id]) return callback(null, objects[id]); + } else if (this._enums) { + return callback(null, this._enums); + } + } + + var that = this; + + this._socket.emit('getObject', id, function (err, obj) { + if (err) { + callback(err); + return; + } + if (that._useStorage && typeof storage !== 'undefined') { + var objects = storage.get('objects') || {}; + objects[id] = obj; + storage.set('objects', objects); + } + return callback(null, obj); + }); + }, + getGroups: function (groupName, useCache, callback) { + if (typeof groupName === 'function') { + callback = groupName; + groupName = null; + useCache = false; + } + if (typeof groupName === 'boolean') { + callback = useCache; + useCache = groupName; + groupName = null; + } + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + groupName = groupName || ''; + + // If cache used + if (this._useStorage && useCache) { + if (typeof storage !== 'undefined') { + var groups = this._groups || storage.get('groups'); + if (groups) return callback(null, groups); + } else if (this._groups) { + return callback(null, this._groups); + } + } + if (this._type === 'local') { + return callback(null, []); + } else { + var that = this; + // Read all enums + this._socket.emit('getObjectView', 'system', 'group', {startkey: 'system.group.' + groupName, endkey: 'system.group.' + groupName + '\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + var groups = {}; + for (var i = 0; i < res.rows.length; i++) { + var obj = res.rows[i].value; + groups[obj._id] = obj; + } + if (that._useStorage) { + that._groups = groups; + + if (typeof storage !== 'undefined') { + storage.set('groups', groups); + } + } + + callback(null, groups); + }); + } + }, + getEnums: function (enumName, useCache, callback) { + if (typeof enumName === 'function') { + callback = enumName; + enumName = null; + useCache = false; + } + if (typeof enumName === 'boolean') { + callback = useCache; + useCache = enumName; + enumName = null; + } + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + + // If cache used + if (this._useStorage && useCache) { + if (typeof storage !== 'undefined') { + var enums = this._enums || storage.get('enums'); + if (enums) return callback(null, enums); + } else if (this._enums) { + return callback(null, this._enums); + } + } + + if (this._type === 'local') { + return callback(null, []); + } else { + + enumName = enumName ? enumName + '.' : ''; + var that = this; + // Read all enums + this._socket.emit('getObjectView', 'system', 'enum', {startkey: 'enum.' + enumName, endkey: 'enum.' + enumName + '\u9999'}, function (err, res) { + if (err) { + callback(err); + return; + } + var enums = {}; + for (var i = 0; i < res.rows.length; i++) { + var obj = res.rows[i].value; + enums[obj._id] = obj; + } + if (that._useStorage && typeof storage !== 'undefined') { + storage.set('enums', enums); + } + callback(null, enums); + }); + } + }, + getLoggedUser: function (callback) { + this._socket.emit('authEnabled', callback); + }, + // return time when the objects were synchronized + getSyncTime: function () { + if (this._useStorage && typeof storage !== 'undefined') { + var timeSync = storage.get('timeSync'); + if (timeSync) return new Date(timeSync); + } + return null; + }, + addObject: function (objId, obj, callback) { + if (!this._isConnected) { + console.log('No connection!'); + } else + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + } + }, + delObject: function (objId) { + if (!this._checkConnection('delObject', arguments)) return; + + this._socket.emit('delObject', objId); + }, + httpGet: function (url, callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('httpGet', url, function (data) { + if (callback) callback(data); + }); + }, + logError: function (errorText) { + console.log("Error: " + errorText); + if (!this._isConnected) { + //console.log('No connection!'); + return; + } + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('log', 'error', 'Addon DashUI ' + errorText); + }, + _queueCmdIfRequired: function (func, args) { + var that = this; + if (!this._isAuthDone) { + // Queue command + this._cmdQueue.push({func: func, args: args}); + + if (!this._authRunning) { + this._authRunning = true; + // Try to read version + this._checkAuth(function (version) { + // If we have got version string, so there is no authentication, or we are authenticated + that._authRunning = false; + if (version) { + that._isAuthDone = true; + // Repeat all stored requests + var __cmdQueue = that._cmdQueue; + // Trigger GC + that._cmdQueue = null; + that._cmdQueue = []; + for (var t = 0, len = __cmdQueue.length; t < len; t++) { + that[__cmdQueue[t].func].apply(that, __cmdQueue[t].args); + } + } else { + // Auth required + that._isAuthRequired = true; + // What for AuthRequest from server + } + }); + } + + return true; + } else { + return false; + } + }, + authenticate: function (user, password, salt) { + this._authRunning = true; + + if (user !== undefined) { + this._authInfo = { + user: user, + hash: password + salt, + salt: salt + }; + } + + if (!this._isConnected) { + console.log('No connection!'); + return; + } + + if (!this._authInfo) { + console.log("No credentials!"); + } + }, + getConfig: function (useCache, callback) { + if (!this._checkConnection('getConfig', arguments)) return; + + if (typeof useCache === 'function') { + callback = useCache; + useCache = false; + } + if (this._useStorage && useCache) { + if (typeof storage !== 'undefined') { + var objects = storage.get('objects'); + if (objects && objects['system.config']) { + return callback(null, objects['system.config'].common); + } + } else if (this._objects && this._objects['system.config']) { + return callback(null, this._objects['system.config'].common); + } + } + var that = this; + this._socket.emit('getObject', 'system.config', function (err, obj) { + if (callback && obj && obj.common) { + + if (that._useStorage && typeof storage !== 'undefined') { + var objects = storage.get('objects') || {}; + objects['system.config'] = obj; + storage.set('objects', objects); + } + + callback(null, obj.common); + } else { + callback('Cannot read language'); + } + }); + }, + sendCommand: function (instance, command, data, ack) { + this.setState(this.namespace + '.control.instance', {val: instance || 'notdefined', ack: true}); + this.setState(this.namespace + '.control.data', {val: data, ack: true}); + this.setState(this.namespace + '.control.command', {val: command, ack: ack === undefined ? true : ack}); + }, + _detectViews: function (projectDir, callback) { + this.readDir('/' + this.namespace + '/' + projectDir, function (err, dirs) { + // find vis-views.json + for (var f = 0; f < dirs.length; f++) { + if (dirs[f].file === 'vis-views.json' && (!dirs[f].acl || dirs[f].acl.read)) { + return callback(err, {name: projectDir, readOnly: (dirs[f].acl && !dirs[f].acl.write), mode: dirs[f].acl ? dirs[f].acl.permissions : 0}); + } + } + callback(err); + }); + }, + readProjects: function (callback) { + var that = this; + this.readDir('/' + this.namespace, function (err, dirs) { + var result = []; + var count = 0; + for (var d = 0; d < dirs.length; d++) { + if (dirs[d].isDir) { + count++; + that._detectViews(dirs[d].file, function (subErr, project) { + if (project) result.push(project); + + err = err || subErr; + if (!(--count)) callback(err, result); + }); + } + } + }); + }, + chmodProject: function (projectDir, mode, callback) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('chmodFile', this.namespace, projectDir + '*', {mode: mode}, function (err, data) { + if (callback) callback(err, data); + }); + }, + clearCache: function () { + if (typeof storage !== 'undefined') { + storage.empty(); + } + }, + getHistory: function (id, options, callback) { + if (!this._checkConnection('getHistory', arguments)) return; + + if (!options) options = {}; + if (!options.timeout) options.timeout = 2000; + + var timeout = setTimeout(function () { + timeout = null; + callback('timeout'); + }, options.timeout); + this._socket.emit('getHistory', id, options, function (err, result) { + if (timeout) { + clearTimeout(timeout); + timeout = null; + } + callback(err, result); + }); + }, + getLiveHost: function (cb) { + var that = this; + this._socket.emit('getObjectView', 'system', 'host', {startkey: 'system.host.', endkey: 'system.host.\u9999'}, function (err, res) { + var _hosts = []; + for (var h = 0; h < res.rows.length; h++) { + _hosts.push(res.rows[h].id + '.alive'); + } + if (!_hosts.length) { + cb(''); + return; + } + that.getStates(_hosts, function (err, states) { + for (var h in states) { + if (states.hasOwnProperty(h) && (states[h].val === 'true' || states[h].val === true)) { + cb(h.substring(0, h.length - '.alive'.length)); + return; + } + } + cb(''); + }); + }); + }, + readDirAsZip: function (project, useConvert, callback) { + if (!callback) { + callback = useConvert; + useConvert = undefined; + } + if (!this._isConnected) { + console.log('No connection!'); + return; + } + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + if (project.match(/\/$/)) project = project.substring(0, project.length - 1); + var that = this; + this.getLiveHost(function (host) { + if (!host) { + window.alert('No active host found'); + return; + } + // to do find active host + that._socket.emit('sendToHost', host, 'readDirAsZip', { + id: that.namespace, + name: project || 'main', + options: { + settings: useConvert + } + }, function (data) { + if (data.error) console.error(data.error); + if (callback) callback(data.error, data.data); + }); + + }); + }, + writeDirAsZip: function (project, base64, callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + if (project.match(/\/$/)) project = project.substring(0, project.length - 1); + var that = this; + this.getLiveHost(function (host) { + if (!host) { + window.alert('No active host found'); + return; + } + that._socket.emit('sendToHost', host, 'writeDirAsZip', { + id: that.namespace, + name: project || 'main', + data: base64 + }, function (data) { + if (data.error) console.error(data.error); + if (callback) callback(data.error); + }); + + }); + } +}; diff --git a/www/js/connSignalR.js b/www/js/connSignalR.js new file mode 100644 index 0000000..56b3e08 --- /dev/null +++ b/www/js/connSignalR.js @@ -0,0 +1,1063 @@ +////// ----------------------- Connection "class" ---------------------- //////////// + +/* jshint browser:true */ +/* global document*/ +/* global console*/ +/* global session*/ +/* global window*/ +/* global location*/ +/* global setTimeout*/ +/* global clearTimeout*/ +/* global io*/ +/* global $*/ + +// The idea of servConn is to use this class later in every addon (Yahui, Control and so on). +// The addon just must say, what must be loaded (values, objects, indexes) and +// the class loads it for addon. Authentication will be done automatically, so addon does not care about it. +// It will be .js file with localData and servConn + +var servConn = { + _socket: null, + _hub: null, + _onConnChange: null, + _onUpdate: null, + _isConnected: false, + _disconnectedSince: null, + _connCallbacks: { + onConnChange: null, + onUpdate: null, + onRefresh: null, + onAuth: null + }, + _authInfo: null, + _isAuthDone: false, + _isAuthRequired: false, + _authRunning: false, + _cmdQueue: [], + _connTimer: null, + _type: 1, // 0 - SignalR, 1 - socket.io, 2 - local demo + _timeout: 0, // 0 - use transport default timeout to detect disconnect + _reconnectInterval: 10000, // reconnect interval + + getIsConnected: function () { + return this._isConnected; + }, + getType: function () { + return this._type; + }, + init: function (connCallbacks, type) { + if (typeof type == "string") { + type = type.toLowerCase(); + } + + if (typeof session !== 'undefined') { + var user = session.get('user'); + if (user) { + this._authInfo = { + user: user, + hash: session.get('hash'), + salt: session.get('salt') + }; + } + } + + // If autodetect + if (type === undefined) { + type = visConfig.connType; + + if (type === undefined || type === null) { + if (typeof io != "undefined") { + type = 1; // socket.io + } else if (typeof $ != "undefined" && typeof $.connection != "undefined") { + type = 0; // SignalR + } else { + type = 2; // local demo + } + } + } + + this._connCallbacks = connCallbacks; + + var connLink = visConfig.connLink || window.localStorage.getItem("connLink"); + if (type === 0 || type == 'signalr') { + this._type = 0; + + this.connection = $.hubConnection(connLink); + this._hub = this.connection.createHubProxy("serverHub"); + //this._hub = $.connection.serverHub; + if (!this._hub) { + this._autoReconnect(); + return; + } + + var that = this; + this._hub.on("updatePointValue", function (model) { + if (that._connCallbacks.onUpdate) { + that._connCallbacks.onUpdate({name: model.name, val: model.val, ts: model.ts, ack: model.ack}); + } + }); + + this._hub.on("authRequest", function (message, salt) { + that._isAuthRequired = true; + that._isAuthDone = false; + + console.log('Auth request: ' + message); + + if (that._authInfo) { + // If we have auth information, send it automatically + that.authenticate(); + } else if (that._connCallbacks.onAuth) { + // Else request from GUI input of user, pass and data (salt) + that._connCallbacks.onAuth(message, salt); + } else { + // TODO Translate + alert('server requires authentication, but no onAuth callback is installed!'); + } + + }); + this._hub.on("refresh", function () { + if (that._connCallbacks.onRefresh) { + that._connCallbacks.onRefresh(); + } + }); + this.connection.start().done(function () { + that._isConnected = true; + if (that._connCallbacks.onConnChange) { + that._connCallbacks.onConnChange(that._isConnected); + } + that._autoReconnect(); + }); + this.connection.reconnecting(function () { + that._isConnected = false; + if (that._connCallbacks.onConnChange) { + that._connCallbacks.onConnChange(that._isConnected); + } + that._autoReconnect(); + }); + this.connection.reconnected(function () { + that._isConnected = true; + if (that._connCallbacks.onConnChange) { + that._connCallbacks.onConnChange(that._isConnected); + } + that._autoReconnect(); + }); + this.connection.disconnected(function () { + that._isConnected = false; + if (that._connCallbacks.onConnChange) { + that._connCallbacks.onConnChange(that._isConnected); + } + that._autoReconnect(); + }); + } else if (type == 1 || type == "socket.io") { + this._type = 1; + if (typeof io != "undefined") { + if (typeof socketSession == 'undefined') { + socketSession = 'nokey'; + } + var url; + if (connLink) { + url = connLink; + } else { + url = jQuery(location).attr('protocol') + '//' + jQuery(location).attr('host'); + } + + this._socket = io.connect(url, { + 'query': 'key=' + socketSession, + 'reconnection limit': 10000, + 'max reconnection attempts': Infinity + }); + + this._socket._myParent = this; + + this._socket.on('connect', function () { + //console.log("socket.io connect"); + if (this._myParent._isConnected === true) { + // This seems to be a reconnect because we're already connected! + // -> prevent firing onConnChange twice + return; + } + this._myParent._isConnected = true; + if (this._myParent._connCallbacks.onConnChange) { + this._myParent._connCallbacks.onConnChange(this._myParent._isConnected); + } + //this._myParent._autoReconnect(); + }); + + this._socket.on('disconnect', function () { + //console.log("socket.io disconnect"); + this._myParent._disconnectedSince = (new Date()).getTime(); + this._myParent._isConnected = false; + if (this._myParent._connCallbacks.onConnChange) { + this._myParent._connCallbacks.onConnChange(this._myParent._isConnected); + } + // Auto-Reconnect + //this._myParent._autoReconnect(); + }); + this._socket.on('reconnect', function () { + //console.log("socket.io reconnect"); + var offlineTime = (new Date()).getTime() - this._myParent._disconnectedSince; + //console.log("was offline for " + (offlineTime / 1000) + "s"); + + // TODO does this make sense? + //if (offlineTime > 12000) { + //window.location.reload(); + //} + this._myParent._isConnected = true; + if (this._myParent._connCallbacks.onConnChange) { + this._myParent._connCallbacks.onConnChange(this._myParent._isConnected); + } + //this._myParent._autoReconnect(); + }); + this._socket.on('refreshAddons', function () { + if (this._myParent._connCallbacks.onRefresh) { + this._myParent._connCallbacks.onRefresh(); + } + }); + + this._socket.on('event', function (obj) { + if (obj === null) { + return; + } + + var o = {}; + o.name = obj[0] + ""; + o.val = obj[1]; + o.ts = obj[2]; + o.ack = obj[3]; + o.lc = obj[4]; + + if (this._myParent._connCallbacks.onUpdate) { + this._myParent._connCallbacks.onUpdate(o); + } + + }); + } //else { + //console.log("socket.io not initialized"); + //} + } else if (type == 2 || type == "local") { + this._type = 2; + this._isAuthDone = true; + + this._isConnected = true; + if (this._connCallbacks.onConnChange) { + this._connCallbacks.onConnChange(this._isConnected); + } + } + + // start connection timer + //this._autoReconnect(); + // Detect if running under cordova + var app = document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1; + if (app) { + $('body').append(''); + $("#system_menu").click(function () { + console.log("Goto settings"); + if (window.localStorage) { + window.localStorage.setItem("connSettings", true); + } + // Call settings window + window.location.href = '../index.html'; + }); + // Install menu on menu button + document.addEventListener("menubutton", function () { + var menuDiv = $("#system_menu"); + if (servConn.menuOpen) { + console.log("close the menu"); + menuDiv.hide(); + servConn.menuOpen = false; + } else { + console.log("open the menu"); + menuDiv.show(); + servConn.menuOpen = true; + } + }, false); + } + }, + // After 3 hours debugging... + // It is questionable if ths function really required. + // Socket.io automatically reconnects to the server and sets _isConnected to true, so + // it will never happened... + // And in the future we will have two servers - one for static pages and one for socket.io. + + // @Bluefox: i introduced this function because socket.io didn't reconnect sometimes after a long + // offline period (several minutes/hours). Since 0.9beta97 it's buggy and causes a reload-loop with android + // stock browser: + // http://homematic-forum.de/forum/viewtopic.php?f=48&t=18271 + // so i deactivated it for now + + _autoReconnect: function () { + // If connected + if (this._isConnected) { + if (window.localStorage) { + window.localStorage.setItem("connCounter", 0); + } + // Stop connection timer + if (this._connTimer) { + clearInterval(this._connTimer); + this._connTimer = null; + } + } else { + // If not connected and the timer not yet started + if (!this._connTimer) { + // Start connection timer + this._connTimer = _setInterval(function (conn) { + if (!conn._isConnected) { + var counter = 0; + if (window.localStorage) { + counter = parseInt(window.localStorage.getItem("connCounter") || 0); + window.localStorage.setItem("connCounter", counter++); + } + // Auto-Reconnect. DashUI can be located in any path. + var url = document.location.href; + var k = url.indexOf('#'); + if (k != -1) { + url = url.substring(0, k); + } + if (url.indexOf('.html') == -1) { + url += 'index.html'; + } + k = url.indexOf('?'); + if (k != -1) { + url = url.substring(0, k); + } + url += '?random=' + Date.now().toString(); + var parts = url.split('/'); + parts = parts.slice(3); + url = '/' + parts.join('/'); + + // Detect if running under cordova + var app = document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1; + if (app && counter > 3) { + url = url.replace('dashui/index.html', 'index.html'); + } + + $.ajax({ + url: url, + cache: false, + success: function (data) { + // Check if it really index.html and not offline.html as fallback + if (data && data.length > 1000) { + if (window.localStorage) { + window.localStorage.setItem("connSettings", true); + } + window.location.reload(); + } + } + }); + } else { + clearInterval(conn._connTimer); + conn._connTimer = null; + } + }, this._reconnectInterval, this); + } + } + }, + getVersion: function (callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + + if (this._queueCmdIfRequired('getVersion', callback)) { + return; + } + + //SignalR + if (this._type === 0) { + this._hub.invoke('getVersion').done(function (version) { + if (callback) { + callback(version); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getVersion', function (version) { + if (callback) { + callback(version); + } + }); + } + }, + _checkAuth: function (callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type === 0) { + //SignalR + this._hub.invoke('getVersion').done(function (version) { + if (callback) + callback(version); + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getVersion', function (version) { + if (callback) + callback(version); + }); + } + }, + readFile: function (filename, callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + + if (this._queueCmdIfRequired("readFile", filename, callback)) { + return; + } + + if (this._type === 0) { + //SignalR + this._hub.invoke('readFile', filename).done(function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('readFile', filename, function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 2) { + //local + + // Try load views from local storage + if (filename.indexOf('dashui-views') != -1) { + if (typeof storage !== 'undefined') { + vis.views = storage.get(filename); + if (vis.views) { + callback(vis.views); + return; + } else { + vis.views = {}; + } + } + } + + // Load from ../datastore/dashui-views.json the demo views + jQuery.ajax({ + url: '../datastore/' + filename, + type: 'get', + async: false, + dataType: 'text', + cache: true, + success: function (data) { + try { + vis.views = jQuery.parseJSON(data); + if (typeof vis.views == 'string') { + vis.views = (JSON && JSON.parse(vis.views)) || jQuery.parseJSON(vis.views); + } + } catch (e) { + // TODO Translate + alert('Invalid ' + filename + ' json format'); + } + callback(vis.views); + if (!vis.views) { + alert(_('No Views found on Server')); + } + }, + error: function (state) { + // TODO Translate + alert('Cannot get ' + location.href + '/../datastore/' + filename + '\n' + state.statusText); + callback([]); + } + }); + } + }, + touchFile: function (filename) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + + if (this._type === 0) { + //SignalR + this._hub.invoke('touchFile', filename); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('touchFile', filename); + } + }, + writeFile: function (filename, data, callback) { + if (this._type === 0) { + //SignalR + this._hub.invoke('writeFile', filename, JSON.stringify(data)).done(function (isOk) { + if (callback) { + callback(isOk); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('writeFile', filename, data, function (isOk) { + if (callback) { + callback(isOk); + } + }); + } else if (this._type == 2) { + if (filename.indexOf('dashui-views') != -1) { + if (typeof storage !== 'undefined') { + storage.set(filename, vis.views); + if (!storage.get('localWarnShown')) { + alert(_('All changes are saved locally. To reset changes clear the cache.')); + storage.set('localWarnShown', true); + } + if (callback) { + callback(true); + } + } + } + } + }, + readDir: function (dirname, callback) { + if (this._type === 0) { + //SignalR + this._hub.invoke('readDir', dirname).done(function (jsonString) { + var data; + try { + data = JSON.parse(jsonString); + } catch (e) { + servConn.logError('readDir: Invalid JSON string - ' + e); + data = null; + } + + if (callback) { + callback (data); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('readdir', dirname, function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 2) { + if (dirname.indexOf('www/dashui/img') != -1) { + // Load from img the list of files. To make it possible, call "dir /B /O > list.txt" in every img directory. + jQuery.ajax({ + url: dirname.replace('www/dashui/', '') + '/list.txt', + type: 'get', + async: false, + dataType: 'text', + cache: true, + success: function (data) { + var files = (data) ? data.split('\n') : []; + if (callback) { + callback(files); + } + }, + error: function (state) { + // TODO Translate + alert('Cannot get ' + location.href + dirname.replace('www/dashui/', '') + '/list.txt' + '\n' + state.statusText); + callback([]); + } + }); + } + } + }, + setPointValue: function (pointId, value) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + + if (this._queueCmdIfRequired("setPointValue", pointId, value)) { + return; + } + + if (this._type === 0) { + //SignalR + this._hub.invoke('setDataPoint', {id: pointId, val: value}); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('setState', [pointId, value]); + } else if (this._type == 2) { + //local + console.log('This is only demo. No point will be controlled.'); + } + }, + getDataPoints: function (callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._queueCmdIfRequired("getDataPoints", callback)) { + return; + } + + if (this._type === 0) { + //SignalR + + this._hub.invoke('getDataPoints').done(function (jsonString) { + var data = {}; + if (jsonString === null) { + if (callback) { + callback('Authentication required'); + } + } else if (jsonString !== undefined) { + try { + data = (JSON && JSON.parse(jsonString)) || jQuery.parseJSON(jsonString); + } catch (e) { + servConn.logError('getDataPoints: Invalid JSON string - ' + e); + data = null; + if (callback) { + callback('getDataPoints: Invalid JSON string - ' + e); + } + } + } + // Convert array to mapped object {name1: object1, name2: object2} + for (var i = 0, len = data.length; i < len; i++) { + if (data[i]) { + var obj = data[i]; + var dp = obj.id; + var o; + + data[dp] = obj; + if (localData.uiState['_' + dp + '.Value'] === undefined) { + o = {}; + o['_' + dp] = {Value: data[dp].val, Timestamp: data[dp].ts, Certain: data[dp].ack, LastChange: data[dp].lc}; + localData.uiState.attr(o); + } else { + o = {}; + var id = ' ' + dp;//.replace(/\./g, '\\.'); + o[id + '.Value'] = obj.val; + o[id + '.Timestamp'] = obj.ts; + o[id + '.Certain'] = obj.ack; + o[id + '.LastChange'] = obj.lc; + } + } + } + + if (callback) { + callback(); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getDatapoints', function (data) { + if (data === null) { + if (callback) { + callback('Authentication required'); + } + } else if (data !== undefined) { + for (var dp in data) { + var obj = data[dp]; + var o = {}; + var id = dp;//.replace(/\./g, '\\.'); + if (localData.uiState['_' + dp/*.replace(/\./g, '\\.')*/ + '.Value'] === undefined) { + try { + o['_' + dp + '.Value'] = obj[0]; + o['_' + dp + '.Timestamp'] = obj[1]; + localData.uiState.attr(o); + } catch (e) { + servConn.logError('Error: can\'t create uiState object for ' + dp + '(' + e + ')'); + } + } else { + o['_' + id + '.Value'] = obj[0]; + o['_' + id + '.Timestamp'] = obj[1]; + o['_' + id + '.Certain'] = obj[2]; + o['_' + id + '.LastChange'] = obj[3]; + console.log(o); + localData.uiState.attr(o); + } + } + } + if (callback) { + callback(); + } + }); + } else if (this._type == 2) { + // local + // Load from ../datastore/local-data.json the demo views + jQuery.ajax({ + url: '../datastore/local-data' + vis.viewFileSuffix + '.json', + type: 'get', + async: false, + dataType: 'text', + cache: vis.useCache, + success: function (data) { + var _localData = (JSON && JSON.parse(data)) || jQuery.parseJSON(data); + localData.metaIndex = _localData.metaIndex; + localData.metaObjects = _localData.metaObjects; + for (var dp in _localData.uiState) { + try { + // TODO possible problem with legacy + console.log(dp); + localData.uiState.attr(dp, _localData.uiState[dp]); + } catch (e) { + servConn.logError('Cannot export ' + dp); + } + } + callback(null); + }, + error: function (state) { + console.log(state.statusText); + localData.uiState.attr('_no', {Value: false, Timestamp: null, Certain: true, LastChange: null}); + // Local + if(callback) { + callback(null); + } + } + }); + + } + }, + getDataObjects: function (callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + + if (this._queueCmdIfRequired("getDataObjects", callback)) { + return; + } + + if (this._type === 0) { + //SignalR + this._hub.invoke('getDataObjects').done(function (jsonString) { + var data = {}; + try { + data = JSON.parse(jsonString); + // Convert array to mapped object {name1: object1, name2: object2} + for (var i = 0, len = data.length; i < len; i++) { + if (data[i]) { + data[data[i].id] = data[i]; + delete data[data[i].id].id; + } + } + } catch (e) { + servConn.logError('getDataObjects: Invalid JSON string - ' + e); + data = null; + } + + if (callback) { + callback(data); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getObjects', function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 2) { + if (callback) { + callback(localData.metaObjects); + } + } + }, + getDataIndex: function (callback) { + if (!this._isConnected) { + console.log('No connection!'); + return; + } + if (this._type === 0) { + //SignalR + if (callback) { + callback([]); + } + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getIndex', function (data) { + if (callback) + callback(data); + }); + } else if (this._type == 2) { + if (callback) { + callback(localData.metaIndex); + } + } + }, + addObject: function (objId, obj, callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type === 0) { + //SignalR + this._hub.invoke('addObject', objId, obj).done(function (cid) { + if (callback) { + callback(cid); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('setObject', objId, obj, function (cid) { + if (callback) { + callback(cid); + } + }); + } + }, + delObject: function (objId) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type === 0) { + //SignalR + this._hub.invoke('deleteObject', objId); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('delObject', objId); + } + }, // Deprecated + // TODO @Bluefox: Why deprecated? Ursprüngliches Konzept war dass der Value eines Homematic-Programms true/false ist und angibt + // ob ein Programm aktiv/inaktiv ist -> HM-Script Methode .Active() + // Eigentlich wirft der Umbau den Du da vor geraumer Zeit in CCU.IO vorgenommen hast (damit über den Value ein Programm + // angetriggert werden kann) dieses Konzept über den Haufen. Wirkt sich bei mir persönlich an der Stelle nicht aus + // da ich keine Homematic-Programme verwende, aber ... + // ... LessonsLearned: Wir müssen häufiger und mehr kommunizieren bevor wir solche Änderungen vornehmen :) + execProgramm: function (objId) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('programExecute', [objId]); + } + }, + httpGet: function (url, callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type === 0) { + //SignalR + this._hub.invoke('httpGet', url).done(function (jsonString) { + if (callback) { + callback(jsonString); + } + }); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('httpGet', url, function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 2) { + if (callback) { + callback(''); + } + } + }, + getStringtable: function (callback) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + if (this._type === 0) { + //SignalR + //this._hub.invoke('getUrl(url).done(function (jsonString) { + if (callback) { + callback(null); + } + //}); + } else if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('getStringtable', function (data) { + if (callback) { + callback(data); + } + }); + } else if (this._type == 2) { + if (callback) { + callback(null); + } + } + }, + alarmReceipt: function (alarm) { + if (!this._isConnected) { + console.log("No connection!"); + return; + } + //if (this._type === 0) { + //SignalR + //this._hub.invoke('getUrl(url).done(function (jsonString) { + //}); + //} else + if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('alarmReceipt', alarm); + } else if (this._type == 2) { + if (callback) { + callback(null); + } + } + }, + logError: function (errorText) { + console.log("Error: " + errorText); + if (!this._isConnected) { + //console.log("No connection!"); + return; + } + //if (this._type === 0) { + //SignalR + //this._hub.server.log(errorText); + //} else + if (this._type == 1) { + //socket.io + if (this._socket === null) { + console.log('socket.io not initialized'); + return; + } + this._socket.emit('log', 'error', 'Addon DashUI ' + errorText); + } else if (this._type == 2) { + // Do nothing + } + }, + _queueCmdIfRequired: function (func, arg1, arg2, arg3, arg4) { + if (!this._isAuthDone) { + // Queue command + this._cmdQueue.push({func: func, args:[arg1, arg2, arg3, arg4]}); + + if (!this._authRunning) { + this._authRunning = true; + var that = this; + // Try to read version + this._checkAuth(function (version) { + // If we have got version string, so there is no authentication, or we are authenticated + that._authRunning = false; + if (version) { + that._isAuthDone = true; + // Repeat all stored requests + var __cmdQueue = that._cmdQueue; + // Trigger GC + that._cmdQueue = null; + that._cmdQueue = []; + for (var t = 0, len = __cmdQueue.length; t < len; t++) { + that[__cmdQueue[t].func](__cmdQueue[t].args[0], __cmdQueue[t].args[1], __cmdQueue[t].args[2], __cmdQueue[t].args[3]); + } + } else { + // Auth required + that._isAuthRequired = true; + // What for AuthRequest from server + } + }); + } + + return true; + } else { + return false; + } + }, + authenticate: function (user, password, salt) { + this._authRunning = true; + + if (user !== undefined) { + this._authInfo = { + user: user, + hash: password + salt, + salt: salt + }; + } + + if (!this._isConnected) { + console.log("No connection!"); + return; + } + + if (!this._authInfo) { + console.log("No credentials!"); + } + + //SignalR + if (this._type === 0) { + var that = this; + this._hub.invoke('authenticate', that._authInfo.user, that._authInfo.hash, that._authInfo.salt).done(function (error) { + this._authRunning = false; + if (!error) { + that._isAuthDone = true; + if (typeof session !== 'undefined') { + session.set("user", that._authInfo.user); + session.set("hash", that._authInfo.hash); + session.set("salt", that._authInfo.salt); + } + + // Repeat all stored requests + var __cmdQueue = that._cmdQueue; + // Trigger garbage collector + that._cmdQueue = null; + that._cmdQueue = []; + for (var t = 0, len = __cmdQueue.length; t < len; t++) { + that[__cmdQueue[t].func](__cmdQueue[t].args[0], __cmdQueue[t].args[1], __cmdQueue[t].args[2], __cmdQueue[t].args[3]); + } + } else { + // Another authRequest should come, wait for this + console.log("Cannot authenticate: " + error); + this._authInfo = null; + } + }); + } + } +}; diff --git a/www/js/fm/fileManager.css b/www/js/fm/fileManager.css new file mode 100644 index 0000000..1a4fbcf --- /dev/null +++ b/www/js/fm/fileManager.css @@ -0,0 +1,395 @@ +/*________________FM_____________________________________________________________________*/ + +.fm_dialog { + min-width: 550px !important; + overflow: hidden !important; + cursor: default; + padding: 5px !important; + -webkit-touch-callout: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.fm_iconbar { + text-align: left; + top: 0; + position: relative; + width: calc(100% - 34px); + height: 29px; + left: 32px; + +} + +.fm-files { + width: calc(100% - 5px); + position: relative; + overflow-x: hidden; + text-align: left; + +} + +.fm-buttonbar { + height: 78px; + width: calc(100% - 20px); + display: flex; + justify-content: center; + bottom: 5px; + position: absolute; + left: 10px; + flex-direction: column; +} + +#fm_btn_open { + width: 150px !important; + height: 36px; + margin-top: 10px; +} + +#fm_btn_cancel { + width: 150px !important; + height: 36px; + margin-left: 50px; + margin-top: 10px; +} +#btn_fm_add_ok { + width: 150px !important; + height: 36px; + margin-top: 10px; +} + +#btn_fm_add_close { + width: 150px !important; + height: 36px; + margin-left: 50px; + margin-top: 10px; +} + +.fm_file_icon { +} + +.fm_folder { + +} + +.fm_file_table { + text-align: left; + +} + +.fm_td_folder { + /*background-image: url("/ScriptGUI/img/plus.png");*/ + height: 16px; + width: 16px; +} + +.fm_th { + border-radius: 6px 6px 8px 8px; + text-align: left; + border: medium none !important; + padding: 2px; + padding-left: -12px; + +} + +.fm_bar_icon { + height: 25px; + width: 25px; + top: -1px; +} + +#fm_bar_all { + height: 27px; + width: 37px; + position: absolute; + right: 40px; + top: 1px; +} +#fm_bar_background { + height: 27px; + width: 37px; + position: absolute; + right: -1px; + top: 1px; +} +#fm_bar_folder { + height: 28px; + position: absolute; + right: 40px; + width: 33px; +} + +.fm-dark-background { + background: grey !important; +} +.fm-light-background { + background: lightgrey !important; +} +.fm_bar_all { + +} + +.fm_bar_folder { + +} + +#fm_th_icon { + background: none; + +} + +#fm_table { + width: calc(100% - 1px); + border-spacing: 0; + border-collapse: collapse; + margin-left: 1px; + word-break: keep-all; + white-space: nowrap; + +} + +.no_background { + background: none !important; + height: 24px; + padding: 1px; +} + +#fm_bar_back { + + margin-left: 39px; + border-radius: 50px; + height: 64px; + position: absolute; + width: 64px; + left: -73px; + background-repeat: no-repeat; + top: -1px; + background-size: 64px; + border: 2px ridge silver; +} +.fm_bar_back_behind { + margin-left: 39px; + display: none; height: 64px; + position: absolute; + width: 64px; + left: -73px; + background-color: #d3d3d3; + top: -1px; + background-size: 64px; + border: 2px ridge silver; + border-radius: 64px !important; +} + +#fm_tr_head { + display: none; + visibility: hidden; +} + +#fm_th_name { + +} + +.fm_prev_container { + width: 150px; + display: inline-table; + position: relative; + margin: 5px 5px 0 5px; + line-height: 15px; + vertical-align: top; +} + +.fm_prev_img { + max-height: 100%; + max-width: 100%; +} + +.fm_prev_img_container { + height: 128px; + width: 128px; + align-items: center; + display: flex; + justify-content: center; + margin-left: 11px; +} + +.fm_prev_name { + white-space: pre-wrap; + height: 40px !important; + min-height: 47px !important; + font-size: 13px; + font-weight: bold; + text-align: center; + width: 150px; + word-wrap: break-word; +} + +.fm_prev_overlay { + height: 100%; + position: absolute; + top: 0; + width: 100%; + left: 0; +} + +#fm_scroll_pane { + width: 100%; + position: relative; + overflow: hidden; +} + +#fm_table_head { + display: flex; + justify-content: space-around; +} + +#fm_table_head_name{ + display: inline-block; + margin: 0; + padding: 0; + position: relative; + width: calc(100% / 4 - 5px); +} + +#fm_table_head_type{ + display: inline-block; + margin: 0; + padding: 0; + position: relative; + width: calc(100% / 4 - 10px); +} +#fm_table_head_size{ + display: inline-block; + margin: 0; + padding: 0; + position: relative; + width: calc(100% / 4 - 10px); +} +#fm_table_head_datum { + display: inline-block; + margin: 0; + padding: 0; + position: relative; + width: calc(100% / 4 - 5px); +} +.fm_prev_selected{ + border: 1px solid cyan; + border-radius: 6px; + box-shadow: 0 0 15px #0FF7FF; + +} +.fm-path-div{ + margin-bottom: 5px; + margin-top: 5px; + text-align: right; + padding-left: 41px; + width: calc(100% - 90px); +} + +.fm_table_selected{ + border-radius: 3px !important; +} + +.fm_file_filter{ + display: none; +} + +#fm_table_head .ui-icon { + left: auto; + position: absolute; + right: 10px +} +.fm_td_hide{ + margin: 0; + max-width: 0; + overflow: hidden; + padding: 0; + color: transparent; +} + +.fm_tr{ + +} + +.fm-error { + color: red +} + +#dialog_fm_add{ + height: calc(100% - 53px) !important; + width: calc(100% - 10px) !important; + position: absolute; + padding: 5px !important; + z-index:100000!important; +} + +#fm_add_dropzone{ + height: calc(100% - 100px); + width: calc(100% - 27px); + display: inline-table; + position: absolute; + left: 10px; + top: 10px; +} + +.dialog_fm_add{ + height: calc(100% - 5px) !important; + width: calc(100% - 10px) !important; + position: absolute !important; + top: 0 !important; + z-index:100000!important; +} + +.fm_dropbox_text{ + font-size: 50px; + font-weight: bold; + height: 100%; + justify-content: center; + margin: 0; + opacity: 0.5; + position: absolute; + text-align: center; + width: 100%; + align-items: center; + display: block; +} + +#fm_inp_save{ + display: block; + height: 20px; + width: calc(100% - 150px); +} + +#fm_btn_save{ + height: 36px; + margin-top: 10px; + width: 150px !important +} + +#fm_btn_wrap{ + +} + +#fm_save_wrap{ + align-items: center; + display: flex; + justify-content: space-around; + margin-top: 6px; +} + +.fm_add_buttonbar{ + height: 78px; + width: calc(100% - 20px); + display: flex; + justify-content: center; + bottom: 5px; + position: absolute; + left: 10px; + flex-direction: inherit; +} + +.dialog_fm_rename{ + height: 170px !important; + width: 400px !important; + text-align: center; +} \ No newline at end of file diff --git a/www/js/fm/fileManager.js b/www/js/fm/fileManager.js new file mode 100644 index 0000000..deeb348 --- /dev/null +++ b/www/js/fm/fileManager.js @@ -0,0 +1,1313 @@ +/** + * Copyright (c) 2014-2015 Steffen Schorling http://github.com/smiling-Jack + * Lizenz: [CC BY-NC 3.0](http://creativecommons.org/licenses/by-nc/3.0/de/) + */ +/* global storage */ + +var fmScriptEls = document.getElementsByTagName('script'); +var fmThisScriptEl = fmScriptEls[fmScriptEls.length - 1]; +//var fmFolder = fmThisScriptEl.src.substr(0, fmThisScriptEl.src.lastIndexOf('/') + 1); +var fmFolder = 'js/fm/'; +//$('head').append(''); + + +(function ($) { + "use strict"; + $.fn.cursorPosition = function(position) { + var input = this.get(0); + if (!input) return; // No (input) element found + if (position !== undefined) { + if(input.createTextRange) { + var range = input.createTextRange(); + range.move('character', position); + range.select(); + } else if(input.selectionStart) { + input.focus(); + input.setSelectionRange(position, position); + } else { + input.focus(); + } + } else { + if ('selectionStart' in input) { + // Standard-compliant browsers + return input.selectionStart; + } else if (document.selection) { + // IE + input.focus(); + var sel = document.selection.createRange(); + var selLen = document.selection.createRange().text.length; + sel.moveStart('character', -input.value.length); + return sel.text.length - selLen; + } + } + }; + + $.fm = function (options, callback) { + var fmConn; + if (typeof SGI != 'undefined') { + // TO DO wrapper must be created. Direct using of socket is not convenient. + fmConn = SGI.socket; + } else if (options.conn) { + fmConn = options.conn; + } + + jQuery.event.props.push('dataTransfer'); + + var o = { + defaultPath: options.defaultPath || '', + lang: options.lang || 'en', // de, en , ru + // File position by socket connection + root: options.root || '', // zb. 'www/' + path: options.path || '/', // zb. 'www/dashui/' + uploadDir: options.uploadDir || '', + fileFilter: options.fileFilter || null, + folderFilter: options.folderFilter || false, + view: options.view || 'table', // table, list + mode: options.mode || 'show', // open, save, show + data: '1', + audio: ['mp3', 'wav', 'ogg'], + img: ['gif','png', 'bmp', 'jpg', 'jpeg', 'tif', 'svg'], + icons: ['zip', 'prg', 'js', 'css', 'mp3', 'wav'], + userArg: options.userArg, + zindex: options.zindex +// save_data : options.save_data, +// save_mime : options.save_mime + }; + var uploadArray = []; + var selFile = ''; + var selType = ''; + var config = {}; + if (o.fileFilter && !o.fileFilter.length) o.fileFilter = null; + + if (typeof storage != 'undefined') { + try { + config = storage.get('visFM'); + if (config) { + config = JSON.parse(config); + } else { + config = {}; + } + } catch (e) { + console.log('Cannot load FM config'); + config = {}; + } + } + + o.view = config.view || o.view; + if (o.defaultPath == o.path) { + o.path = config.path || o.path; + } else { + config.path = o.path; + } + o.filter = config.filter || ''; + + // Analyse path, if it is a file name + if (o.path && o.path[o.path.length - 1] != '/') { + var parts = o.path.split('/'); + o.currentFile = parts.pop(); + o.path = parts.join('/') + '/'; + } + + if (o.path.substring(0, 'widgets/'.length) == 'widgets/' || o.path.substring(0, 'img/'.length) == 'img/') { + o.path = '/vis/' + o.path; + } + + var fmWord = { + 'sort this column' : {'de': 'Spalte sortieren', 'en': 'sort this column', 'ru': 'Сортировать'}, + 'File manager' : {'de': 'Datei Manager', 'en': 'File manager', 'ru': 'Проводник'}, + 'Back' : {'de': 'Zurück', 'en': 'Back', 'ru': 'Назад'}, + 'Refresh' : {'de': 'Aktualisieren', 'en': 'Refresh', 'ru': 'Обновить'}, + 'New folder' : {'de': 'Neuer Ordner', 'en': 'New folder', 'ru': 'Новая папка'}, + 'Upload' : {'de': 'Upload', 'en': 'Upload', 'ru': 'Загрузить'}, + 'Download' : {'de': 'Download', 'en': 'Download', 'ru': 'Скачать'}, + 'Rename' : {'de': 'Umbenennen', 'en': 'Rename', 'ru': 'Переименовать'}, + 'Delete' : {'de': 'Löschen', 'en': 'Delete', 'ru': 'Удалить'}, + 'List view' : {'de': 'Listen Ansicht', 'en': 'List view', 'ru': 'Список'}, + 'Preview' : {'de': 'Vorschau', 'en': 'Preview', 'ru': 'Предпросмотр'}, + 'Play' : {'de': 'Play', 'en': 'Play', 'ru': 'Воспроизвести'}, + 'Stop' : {'de': 'Stop', 'en': 'Stop', 'ru': 'Стоп'}, + 'Show all files' : {'de': 'Alle Datein anzeigen', 'en': 'Show all files', 'ru': 'Показать все'}, + 'File name:' : {'de': 'Datei Name:', 'en': 'File name:', 'ru': 'Имя файла: '}, + 'Path:' : {'de': 'Pfad:', 'en': 'Path:', 'ru': 'Путь к файлу: '}, + 'Save' : {'de': 'Speichern', 'en': 'Save', 'ru': 'Сохранить'}, + 'Open' : {'de': 'Auswählen', 'en': 'Select', 'ru': 'Выбрать'}, + 'Cancel' : {'de': 'Abbrechen', 'en': 'Cancel', 'ru': 'Отмена'}, + 'Upload to' : {'de': 'Upload nach', 'en': 'Upload to', 'ru': 'Загрузить в'}, + 'Dropbox' : {'de': 'Dropbox', 'en': 'Dropbox', 'ru': 'Dropbox'}, + 'Drop the files here' : {'de': 'Hier Datein reinziehen oder clicken', 'en': 'Drop the files or click here', 'ru': 'Перетяните файлы сюда или нажмите'}, + 'Close' : {'de': 'Schliesen', 'en': 'Close', 'ru': 'Закрыть'}, + 'OK' : {'de': 'OK', 'en': 'OK', 'ru': 'Ok'}, + 'Cannot create folder' : {'de': 'Ordner erstellen nicht möglich', 'en': 'Failed to create folder', 'ru': 'Невозможно создать папку'}, + 'New name' : {'de': 'Neuer Name', 'en': 'New name', 'ru': 'Новое имя'}, + 'Cannot rename' : {'de': 'Rename nicht möglich', 'en': 'Rename failed', 'ru': 'Невозможно переименовать'}, + 'Delete failed' : {'de': 'Löschen nicht möglich', 'en': 'Delete failed', 'ru': 'Невозможно удалить'}, + 'no_con' : {'de': 'Keine Verbindung zu Server', 'en': 'Cannot connect to server', 'ru': 'Нет соединения с сервером'}, + 'Name' : {'de': 'Name', 'en': 'Name', 'ru': 'Имя'}, + 'Type' : {'de': 'Typ', 'en': 'Type', 'ru': 'Тип'}, + 'Size' : {'de': 'Größe', 'en': 'Size', 'ru': 'Размер'}, + 'Date' : {'de': 'Datum', 'en': 'Date', 'ru': 'Дата'}, + 'Upload possible only to ' : {'de': 'Kann laden nur in ', 'en': 'Upload possible only to ', 'ru': 'Загрузка возможна только в '}, + 'Change background' : {'de': 'Dialog-Hintergrund ändern', 'en': 'Change dialog background', 'ru': 'Сменить фон окна'}, + 'Enter filter...' : {'de': 'Filter eingeben...', 'en': 'Enter filter...', 'ru': 'Задайте фильтр...'} + }; + + function fmTranslate(text) { + + if (fmWord[text]) { + if (fmWord[text][o.lang]) { + return fmWord[text][o.lang]; + + } else if (fmWord[text].en) + console.warn(text); + return fmWord[text].en; + } else { + console.warn(text); + return text; + } + } + + function load(path) { + if (!path) { + path = '/'; + $('.fm-path').val(path); + $('.fm-path').cursorPosition(1); + o.path = o.root + path; + } + + try { + fmConn.readDir(path, function (err, data) { + if (!err && data) { + o.data = data; + var p = path.replace(o.root, ''); + + $('.fm-path').data('old', p); + $('.fm-path').val(p).unbind('change').unbind('keyup').change(function () { + var timer = $(this).data('timer'); + if (timer) clearTimeout(timer); + + $(this).data('timer', setTimeout(function () { + var val = $('.fm-path').val(); + if (!val) { + val = '/'; + $('.fm-path').val(val); + $('.fm-path').cursorPosition(1); + } + o.path = o.root + val; + + if ($('.fm-path').data('old') != val) { + o.cursorPosition = $('.fm-path').cursorPosition(); + $('.fm-path').data('timer', null); + load(val); + $('.fm-path').data('old', val); + } + }, 500)); + + }).keyup(function () { + $(this).trigger('change'); + }); + + build(o); + } else { + o.data = []; + build(o, err); + $('.fm-files').html('' + err + ''); + } + $('.fm-path').cursorPosition(o.cursorPosition); + o.cursorPosition = undefined; + }); + } catch (err) { + alert(fmTranslate('No connection to server')); + } + } + + function read(o, files, uploadArray) { + + var reader = new FileReader(); + reader.onload = function () { + uploadArray.push({name: files[0].name, value: reader.result}); + + var type = files[0].name.split('.').pop().toLowerCase(); + var icon = "undef"; + var class_name = files[0].name.split('.')[0].replace(" ", "_"); + + if (o.img.indexOf(type) > -1) { + + $('#fm_add_dropzone').append( + '
' + + '
' + + '
' + files[0].name + '
' + + '
' + + '
'); + + } else { + if (o.icons.indexOf(type) > -1) icon = type; + + $('#fm_add_dropzone').append( + '
' + + '
' + + '
' + files[0].name + '
' + + '
' + + '
'); + } + files.shift(); + if (files.length > 0) { + read(o, files, uploadArray); + } else { + $('.dialog_fm_add > *').css({cursor: "default"}); + } + }; + reader.readAsDataURL(files[0]); + } + + function build(o, err) { + + $('.fm-files').empty(); + $('#fm_table_head').remove(); + $("#fm_bar_play, #fm_bar_stop, #fm_bar_down, #fm_bar_del").button('disable'); + + if (o.data !== undefined && o.view == "table") { + + $('
' + + ' ' + + ' ' + + ' ' + + ' ' + + '
').insertAfter('.fm-path-div'); + + $('#fm_table_head_name').button({icons: {primary: "ui-icon-carat-2-n-s"}}).click(function () { + $('#fm_th_name').trigger('click'); + }); + $('#fm_table_head_type').button({icons: {primary: "ui-icon-carat-2-n-s"}}).click(function () { + $('#fm_th_type').trigger('click'); + }); + $('#fm_table_head_size').button({icons: {primary: "ui-icon-carat-2-n-s"}}).click(function () { + $('#fm_th_size_roh').trigger('click'); + }); + $('#fm_table_head_datum').button({icons: {primary: "ui-icon-carat-2-n-s"}}).click(function () { + $('#fm_th_datum').trigger('click'); + }); + + $('.fm-files').append( + '' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + fmTranslate('Name') + '' + + ' ' + fmTranslate('Type') + '' + + ' Size_roh' + + ' ' + fmTranslate('Size') + '' + + ' ' + fmTranslate('Datum') + '' + + ' ' + + '
'); + + $.each(o.data, function () { + if (this.file == '..') return; + function formatBytes(bytes) { + if (bytes < 1024) { + return bytes + " B"; + } + else if (bytes < 1048576) { + return(bytes / 1024).toFixed(0) + ' kb'; + } + else if (bytes < 1073741824) { + return(bytes / 1048576).toFixed(0) + ' Mb'; + } + else { + return(bytes / 1073741824).toFixed(0) + ' Gb'; + } + } + var date; + var time; + var type; + var filter; + + if (this.stats.nlink > 1 || this.isDir) { + date = this.stats.ctime.split('T')[0]; + time = this.stats.ctime.split('T')[1].split('.')[0]; + type = this.file.split('.')[1] || ""; + filter = "fm_folderFilter"; + + $('.fm_file_table').append( + '' + + '' + + '' + this.file + '' + + '' + type + '' + + '' + 0 + '' + + '' + + '' + date + ' ' + time + '' + + '' + + ''); + } else { + var icons = ['zip', 'prg', 'js', 'png', 'svg', 'jpg', 'gif', 'bmp', 'css', 'mp3', 'wav']; + var icon = 'undef'; + date = this.stats.ctime.split('T')[0]; + time = this.stats.ctime.split('T')[1].split('.')[0]; + type = this.file.split('.').pop() || ""; + filter = ''; + + if (icons.indexOf(type) > -1) icon = type; + + if (o.fileFilter && o.fileFilter.length && o.fileFilter.indexOf(type) == -1) filter = 'fm_fileFilter'; + + $('.fm_file_table').append( + '' + + '' + + '' + this.file + '' + + '' + type + '' + + '' + this.stats.size + '' + + '' + formatBytes(this.stats.size) + '' + + '' + date + ' ' + time + '' + + '' + + ''); + } + }); + + $('#fm_th_name, #fm_th_type, #fm_th_size, #fm_th_datum') + .mouseenter(function () { + $(this).addClass('ui-state-focus'); + }) + .mouseleave(function () { + $(this).removeClass('ui-state-focus'); + }) + .click(function () { + $(this).effect('highlight'); + }); + + // sort Table _____________________________________________________ + var table = $('#fm_table'); + $('#fm_th_name, #fm_th_type, #fm_th_size_roh, #fm_th_datum') + .wrapInner('') + .each(function () { + var th = $(this), + thIndex = th.index(), + inverse = false; + th.click(function () { + table.find('td').filter(function () { + return $(this).index() === thIndex; + }).sortElements(function (a, b) { + + if (parseInt($(a).text())) { + return parseInt($.text([a])) > parseInt($.text([b])) ? + inverse ? -1 : 1 + : inverse ? 1 : -1; + } else { + + return $.text([a]).toLowerCase() > $.text([b]).toLowerCase() ? + inverse ? -1 : 1 + : inverse ? 1 : -1; + } + + }, function () { + return this.parentNode; + }); + inverse = !inverse; + }); + }); + $('#fm_th_name').trigger('click'); + $('#fm_th_type').trigger('click'); + + // sort Table---------------------------------------------------------- + + $(".fm_tr > *").click(function (e) { + + $('.fm_table_selected').addClass("ui-state-default no_background"); + $('.fm_table_selected').removeClass("fm_table_selected ui-state-highlight"); + if ($(e.target).hasClass('fm_tr')) { + $(this).addClass("fm_table_selected ui-state-highlight"); + $(this).removeClass("ui-state-default no_background"); + } else { + $(this).parent('.fm_tr').addClass("fm_table_selected ui-state-highlight"); + $(this).parent('.fm_tr').removeClass("ui-state-default no_background"); + } + + var type = $($('.fm_table_selected').children().toArray()[2]).text(); + var name = $($('.fm_table_selected').children().toArray()[1]).text(); + + if (!type) { + selType = "folder"; + selFile = name; + $('#fm_bar_down').button('disable'); + $('#fm_bar_del').button('enable'); + + } else { + selType = "file"; + selFile = name; + $('#fm_inp_save').val(selFile.split('.')[0]); + $('#fm_bar_down').button('enable'); + $('#fm_bar_del').button('enable'); + } + + if (o.audio.indexOf(type) > -1) { + $("#fm_bar_play , #fm_bar_stop").button('enable'); + } else { + $("#fm_bar_play, #fm_bar_stop").button('disable'); + } + }); + + $('.fm_tr_folder').dblclick(function () { + o.path += $((this).children[1]).text() + "/"; + load(o.path); + }); + + if (document.getElementById('script_scrollbar')) { + $('.fm-files').css({ + height: "auto", + overflow: "visible" + }); + $('#fm_scroll_pane').css({ + height: "calc(100% - 187px) ", + scrollTop: 0 + }); + $('#fm_scroll_pane').scrollTop(0); + $('#fm_scroll_pane').perfectScrollbar('update'); + + } else { + $('.fm-files').css({ + height: "calc(100% - 188px) " + }); + } + } + + if (o.data !== undefined && o.view == 'prev') { + var path = o.root ? o.path.split(o.root)[1] : o.path; + + if (o.uploadDir) { + if (path.substring(0, o.uploadDir.length) == o.uploadDir) { + $('#fm_bar_add').button('enable'); + } else { + $('#fm_bar_add').button('disable').attr('title', fmTranslate('Upload possible only to ') + o.uploadDir); + } + } + + $.each(o.data, function () { + if (this.file == '..') return; + + if (this.stats.nlink > 1 || this.isDir) { + var type = "_"; + $('.fm-files').append( + '
' + + '
' + + '
' + this.file + '
' + + '
' + + '
'); + + } else { + var name = this.file.split('.')[0]; + var _type = (this.file.split('.')[1] || "").toLowerCase(); + var icon = "undef"; + var filter = ""; + if (o.fileFilter && o.fileFilter.length && o.fileFilter.indexOf(_type) == -1) { + filter = "fm_fileFilter"; + } + + if (name.length > 0) { + // if image + if (o.img.indexOf(_type) > -1) { + + $('.fm-files').append( + '
' + + '
' + + '
' + this.file + '
' + + '
' + + '
'); + + } else { + if (o.icons.indexOf(_type) > -1) { + icon = _type; + } + + $('.fm-files').append( + '
' + + '
' + + '
' + this.file + '
' + + '
' + + '
'); + } + } + } + }); + + var div = $('.fm-files'); + var listitems = div.children('.fm_prev_container').get(); + listitems.sort(function (a, b) { + + return ($(a).attr('data-sort') < $(b).attr('data-sort')) ? + -1 : ($(a).attr('data-sort') > $(b).attr('data-sort')) ? + 1 : 0; + }); + + $.each(listitems, function (idx, itm) { + div.append(itm); + }); + + if (document.getElementById('script_scrollbar')) { + + $('.fm-files').css({ + height: "auto", + overflow: "visible" + }); + $('#fm_scroll_pane').css({ + height: "calc(100% - 150px) ", + scrollTop: 0 + }); + $('#fm_scroll_pane').scrollTop(0); + $('#fm_scroll_pane').perfectScrollbar('update'); + + } else { + if (o.mode == 'show') { + $('.fm-files').css({ + height: "calc(100% - 80px)" + }); + + } else { + $('.fm-files').css({ + height: "calc(100% - 151px)" + }); + } + } + + $('.fm_prev_overlay').click(function () { + var type = $(this).parent().data('sort'); + + $('.fm_prev_selected').removeClass('fm_prev_selected'); + $(this).addClass('fm_prev_selected'); + + if (type == "_") { + selType = "folder"; + selFile = $(this).prev().text(); + + $('#fm_bar_down').button('disable'); + $('#fm_bar_del').button('enable'); + + } else { + selType = "file"; + selFile = $(this).prev().text(); + $('#fm_inp_save').val(selFile.split('.')[0]); + $('#fm_bar_down').button('enable'); + $('#fm_bar_del').button('enable'); + } + + if (o.audio.indexOf(type) > -1) { + $("#fm_bar_play , #fm_bar_stop").button('enable'); + } else { + $("#fm_bar_play, #fm_bar_stop").button('disable'); + } + }); + + $('.fm_prev_overlay').dblclick(function () { + var type = $(this).parent().data('sort'); + + if (type == "_") { + o.path += $(this).prev().text() + "/"; + load(o.path); + } else { + // Select immediately this image + $('#fm_btn_open').trigger('click'); + } + }); + } + + if ($('#fm_bar_all').hasClass('ui-state-error')) { + $('.fm_folderFilter').show(); + $('.fm_fileFilter').show(); + } else { + $('.fm_fileFilter').hide(); + if (o.folderFilter) { + $('.fm_folderFilter').hide(); + } + } + if ($('#fm_bar_background').hasClass('ui-state-error')) { + $('.fm-files').removeClass('fm-dark-background').addClass('fm-light-background'); + } else if ($('#fm_bar_background').hasClass('ui-state-highlight')) { + $('.fm-files').removeClass('fm-light-background').addClass('fm-dark-background'); + } + + if (o.view == "prev" && $('#fm_bar_all').hasClass('ui-state-error')) { + $('.fm_fileFilter').css({display: "inline-table"}); + } + // BF: Workaround against wrong path + if (o.path == o.root || + o.path == '/') { + + $('#fm_bar_back').trigger('mouseleave'); + $('#fm_bar_back').button("option", "disabled", true); + } else { + $('#fm_bar_back').button("option", "disabled", false); + } + + if (o.currentFile) { + $('.fm_prev_name').each(function () { + if ($(this).html() == o.currentFile) { + $(this).parent().find('.fm_prev_overlay').trigger('click'); + $(this).parent()[0].scrollIntoView( true ); + return false; + } + }); + o.currentFile = null; + } + + filter(o); + } + + function filter(o) { + var isAll = $('#fm_bar_all').hasClass('ui-state-error'); + $('.fm_prev_container').each(function () { + if (o.filter) { + var filter = o.filter.toLowerCase(); + var filename = $(this).find('.fm_prev_name').text(); + + if (filename.toLowerCase().indexOf(filter) == -1) { + $(this).hide(); + } else { + if (isAll || !$(this).hasClass('fm_fileFilter')) { + $(this).show(); + } else { + $(this).hide(); + } + } + } else { + if (isAll || !$(this).hasClass('fm_fileFilter')) { + $(this).show(); + } else { + $(this).hide(); + } + } + }); + } + + $('body').append( + '
' + + ' ' + + '
' + + '
' + + ' ' + + ' ' + + '
' + + '
' + fmTranslate('Path:') + '
' + + '
' + + '
' + + '
' + + '
' + fmTranslate('File name:') + '
' + + ' ' + + '
' + + '
' + + ' ' + + ' ' + + ' ' + + '
' + + '
' + + '
'); + + // hide show all button if no filter set + if (!o.fileFilter || !o.fileFilter.length) $('#fm_bar_all').hide(); + + $('#dialog_fm').dialog({ + height: $(window).height() - 100, + width: 835, + minWidth: 672, + minHeight: 300, + resizable: true, + modal: true, + close: function () { + $('#dialog_fm').remove(); + }, + resize: function () { + $('#fm_bar_filter').clearSearch('update'); + } + }); + + $('#fm_bar_filter').change(function () { + var timer = $(this).data('timer'); + if (timer) clearTimeout(timer); + + $(this).data('timer', setTimeout(function () { + o.filter = $('#fm_bar_filter').val(); + config.filter = o.filter; + + if (typeof storage != 'undefined') storage.set('visFM', JSON.stringify(config)); + + // Use filter + filter(o); + }), 500); + }).keyup(function () { + $(this).trigger('change'); + }).clearSearch().parent().css({display: 'inline'}); + + // Set z-index of dialog + if (o.zindex !== null) { + $('div[aria-describedby="dialog_fm"]').css({'z-index': o.zindex}); + } + + if (o.mode == "show") { + $('.fm-buttonbar').hide(); + } + if (o.mode == "save") { + $('#fm_btn_open').hide(); + } + if (o.mode == "open") { + $('#fm_save_wrap').hide(); + $('#fm_btn_save').hide(); + } + + $('.fm_bar_icon').button(); + $('#fm_bar_back') + .button() + .click(function () { + var path_arry = o.path.split('/'); + path_arry.pop(); + path_arry.pop(); + + if (path_arry.length === 0) { + o.path = ''; + } else { + o.path = path_arry.join('/') + '/'; + } + // Workaround for wrong path + if (o.path == o.root || + o.path == '/') { + $('#fm_bar_back').trigger('mouseleave'); + $('#fm_bar_back').button("option", "disabled", true); + } + + load(o.path); + }); + +// $("#fm_bar_play, #fm_bar_stop, #fm_bar_down").button('disable'); + + if (document.getElementById('script_scrollbar')) { + $('.fm-files').wrap('
'); + + $('.fm-files').css({ + minHeight: "100%", + height: "auto", + width: "calc(100% - 4px)", + border: "none" + }); + + $('#fm_scroll_pane').perfectScrollbar({ + wheelSpeed: 40, + suppressScrollX: true + }); + } + if (!o.folderFilter) { + $('#fm_bar_folder').addClass('ui-state-error'); + } + + load(o.path); + + $('#fm_bar_all') + .button({ + icons: { + primary: "ui-icon-gear" + } + }) + .click(function () { + + $(this).toggleClass('ui-state-error'); + if ($(this).hasClass('ui-state-error')) { + + $('.fm_fileFilter').show(); + $('.fm_folderFilter').show(); + if (o.view == "prev") { + $('.fm_fileFilter').css({display: "inline-table"}); + } + } else { + $('.fm_fileFilter').hide(); + if (o.folderFilter) { + $('.fm_folderFilter').hide(); + } + } + $(this).removeClass('ui-state-focus'); + }); + + $('#fm_bar_background') + .button({ + icons: { + primary: "ui-icon-alert" + } + }) + .click(function () { + if ($(this).hasClass('ui-state-error')) { + $('.fm-files').removeClass('fm-dark-background no_background').addClass('fm-light-background'); + $(this).removeClass('ui-state-error').addClass('ui-state-highlight'); + } else if ($(this).hasClass('ui-state-highlight')) { + $(this).removeClass('ui-state-error ui-state-highlight'); + $('.fm-files').removeClass('fm-light-background fm-dark-background').addClass('no_background'); + } else { + $(this).removeClass('ui-state-highlight').addClass('ui-state-error'); + $('.fm-files').removeClass('no_background fm-light-background').addClass('fm-dark-background'); + } + + config.background = $('#fm_bar_background').hasClass('ui-state-error') ? 'fm-dark-background' : ($('#fm_bar_background').hasClass('ui-state-highlight') ? 'fm-light-background' : ''); + if (typeof storage != 'undefined') storage.set('visFM', JSON.stringify(config)); + }); + if (config.background == 'fm-dark-background') { + $('#fm_bar_background').addClass('ui-state-error'); + $('.fm-files').addClass(config.background).removeClass('no_background'); + } else if (config.background == 'fm-light-background') { + $('#fm_bar_background').addClass('ui-state-highlight'); + $('.fm-files').addClass(config.background).removeClass('no_background'); + } + + if (config.all) { + $('#fm_bar_all').addClass('ui-state-error'); + } + + $('.fm_bar_icon') + .mouseenter(function () { + $(this).addClass('ui-state-focus'); + }) + .mouseleave(function () { + $(this).removeClass('ui-state-focus'); + }) + .click(function () { + var id = $(this).attr('id'); + + +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id == "fm_bar_refresh") { + load(o.path); + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id == "fm_bar_add") { + + $('#dialog_fm').append( + '
' + + '
' + + '

' + fmTranslate('Dropbox') + '
' + fmTranslate('Drop the files here') + '

' + + ' ' + + '
' + + '
' + + ' ' + + ' ' + + '
' + + '
'); + + $('#dialog_fm_add').dialog({ + dialogClass: "dialog_fm_add", + resizable: false, + draggable: false, + close: function () { + $('#dialog_fm_add').remove(); + load(o.path); + } + }); + + var files = []; + + $('.fm_dropbox_text').click(function () { + $('#fm_open_file').trigger('click'); + }); + $('#fm_open_file').change(function (event) { + try { + $.each(event.target.files, function () { + files.push(this); + }); + + if (files.length) { + read(o, files, uploadArray); + } + return false; + } + catch (err) { + alert(err); + return false; + } + }); + + $('#fm_add_dropzone').bind('drop', function (e) { + try { + + $.each(e.dataTransfer.files, function () { + files.push(this); + }); + + $('.dialog_fm_add > *').css({cursor: "wait"}); + + read(o, files, uploadArray); + return false; + } + catch (err) { + alert(err); + return false; + } + }); + try { + $('#btn_fm_add_ok').button().click(function () { + function upload() { + try { + var name = uploadArray[0].name.split('.'); + // convert extension to lower case + name[name.length - 1] = name[name.length - 1].toLowerCase(); + name = name.join('.'); + fmConn.writeFile64(o.path + name, uploadArray[0].value.split('base64,')[1], function (err, data) { + + // TODO Leerzeichem im Dateinmaen Berucksichtigen (da in classen keine leertzeichen sein dürfen) + var class_name = uploadArray[0].name.split('.')[0].replace(" ", "_"); + $("." + class_name).remove(); + + uploadArray.shift(); + if (uploadArray.length > 0) { + upload(); + } else { + $('.dialog_fm_add > *').css({cursor: "default"}); + } + + }); + + } catch + (err) { + console.log(err); + $('.dialog_fm_add > *').css({cursor: "default"}); + } + } + + $('.dialog_fm_add > *').css({cursor: "wait"}); + upload(); + }); + + $('#btn_fm_add_close').button().click(function () { + $('#dialog_fm_add').remove(); + load(o.path); + }); + } catch (err) { + alert(err); + } + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id == "fm_bar_addfolder") { + try { + + $('#dialog_fm').append( + '
' + + '
' + + '' + + '

' + + '
'); + + $('#dialog_fm_folder').dialog({ + dialogClass: "dialog_fm_rename", + resizable: false, + draggable: false, + modal: true, + close: function () { + $('#dialog_fm_folder').remove(); + } + }); + + $('#fm_btn_folder').button().click(function () { + var new_folder = $('#fm_inp_folder').val(); + $('#dialog_fm_folder').remove(); + + if (new_folder !== '' || new_folder !== undefined) { + fmConn.mkdir(o.path + new_folder, function (err) { + if (err) { + console.log(err); + alert(fmTranslate('Cannot create folder')); + } else { + load(o.path); + } + }); + } + }); + } catch (err) { + alert(err); + } + + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id === 'fm_bar_down') { + try { + fmConn.readFile64(o.path + selFile, function (err, data) { + console.log(data); + $('body').append(''); + document.getElementById('fm_download').click(); + document.getElementById('fm_download').remove(); + }); + } catch (err) { + alert(err); + } + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id === 'fm_bar_rename') { + try { + $('#dialog_fm').append( + '
' + + '
' + + '' + + '

' + + '
'); + + $('#dialog_fm_rename').dialog({ + dialogClass: "dialog_fm_rename", + resizable: false, + draggable: false, + modal: true, + close: function () { + $('#dialog_fm_rename').remove(); + } + }); + + $('#fm_btn_rename').button().click(function () { + var new_name = $('#fm_inp_rename').val(); + $('#dialog_fm_rename').remove(); + + if (new_name !== "" || new_name !== undefined) { + fmConn.renameFile(o.path + selFile, o.path + new_name, function (err) { + if (err) { + console.log(err); + alert(fmTranslate('Cannot rename')); + } else { + load(o.path); + } + }); + } + }); + } catch (err) { + alert(err); + } + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id === 'fm_bar_del') { + try { + fmConn.unlink(o.path + selFile, function (err) { + if (err) { + console.log(err); + alert(fmTranslate('Delete failed')); + } + load(o.path); + }); + } catch (err) { + alert('ordner \n' + err); + } + + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id === 'fm_bar_list') { + o.view = 'table'; + build(o); + } + if (id == "fm_bar_prev") { + o.view = "prev"; + build(o); + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + if (id === 'fm_bar_play') { + if (document.getElementById('fm_sound_play')) { + document.getElementById('fm_sound_play').remove(); + } + $('#dialog_fm').append(''); + document.getElementById('fm_sound_play').play(); + + } + if (id == 'fm_bar_stop') { + document.getElementById('fm_sound_play').remove(); + } +//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + + $(this).effect('highlight'); + }); + + + $('#fm_btn_cancel').button().click(function () { + config.path = o.path; + config.view = o.view; + config.all = $('#fm_bar_all').hasClass('ui-state-error'); + config.background = $('#fm_bar_background').hasClass('ui-state-error') ? 'fm-dark-background' : ($('#fm_bar_background').hasClass('ui-state-highlight') ? 'fm-light-background' : ''); + + if (typeof storage != 'undefined') storage.set('visFM', JSON.stringify(config)); + + $('#dialog_fm').remove(); + }); + + $('#fm_btn_open').button().click(function () { + $('#dialog_fm').remove(); + + config.path = o.path; + config.view = o.view; + config.all = $('#fm_bar_all').hasClass('ui-state-error'); + config.background = $('#fm_bar_background').hasClass('ui-state-error') ? 'fm-dark-background' : ($('#fm_bar_background').hasClass('ui-state-highlight') ? 'fm-light-background' : ''); + if (typeof storage != 'undefined') { + storage.set('visFM', JSON.stringify(config)); + } + + return callback({ + path: o.path, + file: selFile + }, o.userArg); + }); + $('#fm_btn_save').button().click(function () { + var file = $('#fm_inp_save').val(); + $('#dialog_fm').remove(); + + config.path = o.path; + config.view = o.view; + config.all = $('#fm_bar_all').hasClass('ui-state-error'); + config.background = $('#fm_bar_background').hasClass('ui-state-error') ? 'fm-dark-background' : ($('#fm_bar_background').hasClass('ui-state-highlight') ? 'fm-light-background' : ''); + + if (typeof storage != 'undefined') { + storage.set('visFM', JSON.stringify(config)); + } + + return callback({ + path: o.path, + file: file + }, o.userArg); + }); + }; +}) +(jQuery); + +jQuery.fn.sortElements = (function () { + var sort = [].sort; + return function (comparator, getSortable) { + getSortable = getSortable || function () { + return this; + }; + var placements = this.map(function () { + var sortElement = getSortable.call(this), + parentNode = sortElement.parentNode, + // Since the element itself will change position, we have + // to have some way of storing it's original position in + // the DOM. The easiest way is to have a 'flag' node: + nextSibling = parentNode.insertBefore( + document.createTextNode(''), + sortElement.nextSibling + ); + return function () { + if (parentNode === this) { + throw new Error( + "You can't sort elements if any one is a descendant of another." + ); + } +// Insert before flag: + parentNode.insertBefore(this, nextSibling); + // Remove flag: + parentNode.removeChild(nextSibling); + }; + }); + return sort.call(this, comparator).each(function (i) { + placements[i].call(getSortable.call(this)); + }); + }; +})(); + +//--------------- https://github.com/waslos/jquery-clearsearch/blob/master/src/jquery.clearsearch.js ---------------------- +/* ============================================================================ + * jquery.clearsearch.js v1.0.3 + * https://github.com/waslos/jquery-clearsearch + * ============================================================================ + * Copyright (c) 2012, Was los.de GmbH & Co. KG + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 3. Neither the name of the "Was los.de GmbH & Co. KG" nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * ========================================================================= */ +(function($) { + $.fn.clearSearch = function(options) { + if (options == 'update') { + return this.each(function() { + var $this = $(this); + var width = $this.outerWidth(), height = $this + .outerHeight(); + var btn = $this.next(); + btn.css({ + top : height / 2 - btn.height() / 2, + left : width - height / 2 - btn.height() / 2 + }); + }); + } + + var settings = $.extend({ + 'clearClass' : 'clear_input', + 'focusAfterClear' : true, + 'linkText' : '×' + }, options); + return this.each(function() { + var $this = $(this), btn, + divClass = settings.clearClass + '_div'; + + if (!$this.parent().hasClass(divClass)) { + $this.wrap('
' + $this.html() + '
'); + $this.after('' + settings.linkText + ''); + } + btn = $this.next(); + + function clearField() { + $this.val('').change(); + triggerBtn(); + if (settings.focusAfterClear) { + $this.focus(); + } + if (typeof (settings.callback) === "function") { + settings.callback(); + } + } + + function triggerBtn() { + if (hasText()) { + btn.show(); + } else { + btn.hide(); + } + update(); + } + + function hasText() { + return $this.val().replace(/^\s+|\s+$/g, '').length > 0; + } + + function update() { + var width = $this.outerWidth(), height = $this + .outerHeight(); + btn.css({ + top : height / 2 - btn.height() / 2, + left : width - height / 2 - btn.height() / 2 + }); + } + + btn.on('click', clearField); + $this.on('keyup keydown change focus', triggerBtn); + triggerBtn(); + }); + }; +})(jQuery); \ No newline at end of file diff --git a/www/js/fm/icon/actions/add.png b/www/js/fm/icon/actions/add.png new file mode 100644 index 0000000..d603ff1 Binary files /dev/null and b/www/js/fm/icon/actions/add.png differ diff --git a/www/js/fm/icon/actions/back.png b/www/js/fm/icon/actions/back.png new file mode 100644 index 0000000..4924e6f Binary files /dev/null and b/www/js/fm/icon/actions/back.png differ diff --git a/www/js/fm/icon/actions/delete.png b/www/js/fm/icon/actions/delete.png new file mode 100644 index 0000000..d986472 Binary files /dev/null and b/www/js/fm/icon/actions/delete.png differ diff --git a/www/js/fm/icon/actions/down.png b/www/js/fm/icon/actions/down.png new file mode 100644 index 0000000..2349d89 Binary files /dev/null and b/www/js/fm/icon/actions/down.png differ diff --git a/www/js/fm/icon/actions/edit-rename.png b/www/js/fm/icon/actions/edit-rename.png new file mode 100644 index 0000000..355d1b9 Binary files /dev/null and b/www/js/fm/icon/actions/edit-rename.png differ diff --git a/www/js/fm/icon/actions/folder-new-7.png b/www/js/fm/icon/actions/folder-new-7.png new file mode 100644 index 0000000..cb863e4 Binary files /dev/null and b/www/js/fm/icon/actions/folder-new-7.png differ diff --git a/www/js/fm/icon/actions/folder-new.png b/www/js/fm/icon/actions/folder-new.png new file mode 100644 index 0000000..0a6cca5 Binary files /dev/null and b/www/js/fm/icon/actions/folder-new.png differ diff --git a/www/js/fm/icon/actions/icons.png b/www/js/fm/icon/actions/icons.png new file mode 100644 index 0000000..25ca764 Binary files /dev/null and b/www/js/fm/icon/actions/icons.png differ diff --git a/www/js/fm/icon/actions/list.png b/www/js/fm/icon/actions/list.png new file mode 100644 index 0000000..942603a Binary files /dev/null and b/www/js/fm/icon/actions/list.png differ diff --git a/www/js/fm/icon/actions/play.png b/www/js/fm/icon/actions/play.png new file mode 100644 index 0000000..23964fe Binary files /dev/null and b/www/js/fm/icon/actions/play.png differ diff --git a/www/js/fm/icon/actions/refresh.png b/www/js/fm/icon/actions/refresh.png new file mode 100644 index 0000000..8a0b0e2 Binary files /dev/null and b/www/js/fm/icon/actions/refresh.png differ diff --git a/www/js/fm/icon/actions/stop.png b/www/js/fm/icon/actions/stop.png new file mode 100644 index 0000000..d83c404 Binary files /dev/null and b/www/js/fm/icon/actions/stop.png differ diff --git a/www/js/fm/icon/actions/up.png b/www/js/fm/icon/actions/up.png new file mode 100644 index 0000000..e68def0 Binary files /dev/null and b/www/js/fm/icon/actions/up.png differ diff --git a/www/js/fm/icon/circleLeftIcon.png b/www/js/fm/icon/circleLeftIcon.png new file mode 100644 index 0000000..4924e6f Binary files /dev/null and b/www/js/fm/icon/circleLeftIcon.png differ diff --git a/www/js/fm/icon/mine/128/JS.png b/www/js/fm/icon/mine/128/JS.png new file mode 100644 index 0000000..c280f5a Binary files /dev/null and b/www/js/fm/icon/mine/128/JS.png differ diff --git a/www/js/fm/icon/mine/128/bmp.png b/www/js/fm/icon/mine/128/bmp.png new file mode 100644 index 0000000..38a36e1 Binary files /dev/null and b/www/js/fm/icon/mine/128/bmp.png differ diff --git a/www/js/fm/icon/mine/128/css.png b/www/js/fm/icon/mine/128/css.png new file mode 100644 index 0000000..1734114 Binary files /dev/null and b/www/js/fm/icon/mine/128/css.png differ diff --git a/www/js/fm/icon/mine/128/folder-blue.png b/www/js/fm/icon/mine/128/folder-blue.png new file mode 100644 index 0000000..b083196 Binary files /dev/null and b/www/js/fm/icon/mine/128/folder-blue.png differ diff --git a/www/js/fm/icon/mine/128/folder-brown.png b/www/js/fm/icon/mine/128/folder-brown.png new file mode 100644 index 0000000..c78d038 Binary files /dev/null and b/www/js/fm/icon/mine/128/folder-brown.png differ diff --git a/www/js/fm/icon/mine/128/folder-green.png b/www/js/fm/icon/mine/128/folder-green.png new file mode 100644 index 0000000..8d927bd Binary files /dev/null and b/www/js/fm/icon/mine/128/folder-green.png differ diff --git a/www/js/fm/icon/mine/128/gif.png b/www/js/fm/icon/mine/128/gif.png new file mode 100644 index 0000000..38a36e1 Binary files /dev/null and b/www/js/fm/icon/mine/128/gif.png differ diff --git a/www/js/fm/icon/mine/128/img2.png b/www/js/fm/icon/mine/128/img2.png new file mode 100644 index 0000000..652156a Binary files /dev/null and b/www/js/fm/icon/mine/128/img2.png differ diff --git a/www/js/fm/icon/mine/128/jpg.png b/www/js/fm/icon/mine/128/jpg.png new file mode 100644 index 0000000..38a36e1 Binary files /dev/null and b/www/js/fm/icon/mine/128/jpg.png differ diff --git a/www/js/fm/icon/mine/128/misc.png b/www/js/fm/icon/mine/128/misc.png new file mode 100644 index 0000000..ee69b03 Binary files /dev/null and b/www/js/fm/icon/mine/128/misc.png differ diff --git a/www/js/fm/icon/mine/128/mp3.png b/www/js/fm/icon/mine/128/mp3.png new file mode 100644 index 0000000..5212bed Binary files /dev/null and b/www/js/fm/icon/mine/128/mp3.png differ diff --git a/www/js/fm/icon/mine/128/png.png b/www/js/fm/icon/mine/128/png.png new file mode 100644 index 0000000..38a36e1 Binary files /dev/null and b/www/js/fm/icon/mine/128/png.png differ diff --git a/www/js/fm/icon/mine/128/prg.png b/www/js/fm/icon/mine/128/prg.png new file mode 100644 index 0000000..ae4623c Binary files /dev/null and b/www/js/fm/icon/mine/128/prg.png differ diff --git a/www/js/fm/icon/mine/128/svg.png b/www/js/fm/icon/mine/128/svg.png new file mode 100644 index 0000000..38a36e1 Binary files /dev/null and b/www/js/fm/icon/mine/128/svg.png differ diff --git a/www/js/fm/icon/mine/128/undef.png b/www/js/fm/icon/mine/128/undef.png new file mode 100644 index 0000000..6750575 Binary files /dev/null and b/www/js/fm/icon/mine/128/undef.png differ diff --git a/www/js/fm/icon/mine/128/wav.png b/www/js/fm/icon/mine/128/wav.png new file mode 100644 index 0000000..5212bed Binary files /dev/null and b/www/js/fm/icon/mine/128/wav.png differ diff --git a/www/js/fm/icon/mine/128/zip.png b/www/js/fm/icon/mine/128/zip.png new file mode 100644 index 0000000..3655cbb Binary files /dev/null and b/www/js/fm/icon/mine/128/zip.png differ diff --git a/www/js/fm/icon/mine/24/bmp.png b/www/js/fm/icon/mine/24/bmp.png new file mode 100644 index 0000000..459ab03 Binary files /dev/null and b/www/js/fm/icon/mine/24/bmp.png differ diff --git a/www/js/fm/icon/mine/24/css.png b/www/js/fm/icon/mine/24/css.png new file mode 100644 index 0000000..58f03de Binary files /dev/null and b/www/js/fm/icon/mine/24/css.png differ diff --git a/www/js/fm/icon/mine/24/folder-blue.png b/www/js/fm/icon/mine/24/folder-blue.png new file mode 100644 index 0000000..118f000 Binary files /dev/null and b/www/js/fm/icon/mine/24/folder-blue.png differ diff --git a/www/js/fm/icon/mine/24/folder-brown.png b/www/js/fm/icon/mine/24/folder-brown.png new file mode 100644 index 0000000..36873d9 Binary files /dev/null and b/www/js/fm/icon/mine/24/folder-brown.png differ diff --git a/www/js/fm/icon/mine/24/folder-green.png b/www/js/fm/icon/mine/24/folder-green.png new file mode 100644 index 0000000..2ec1bad Binary files /dev/null and b/www/js/fm/icon/mine/24/folder-green.png differ diff --git a/www/js/fm/icon/mine/24/gif.png b/www/js/fm/icon/mine/24/gif.png new file mode 100644 index 0000000..459ab03 Binary files /dev/null and b/www/js/fm/icon/mine/24/gif.png differ diff --git a/www/js/fm/icon/mine/24/img2.png b/www/js/fm/icon/mine/24/img2.png new file mode 100644 index 0000000..55f1731 Binary files /dev/null and b/www/js/fm/icon/mine/24/img2.png differ diff --git a/www/js/fm/icon/mine/24/jpg.png b/www/js/fm/icon/mine/24/jpg.png new file mode 100644 index 0000000..459ab03 Binary files /dev/null and b/www/js/fm/icon/mine/24/jpg.png differ diff --git a/www/js/fm/icon/mine/24/js.png b/www/js/fm/icon/mine/24/js.png new file mode 100644 index 0000000..1e6ee25 Binary files /dev/null and b/www/js/fm/icon/mine/24/js.png differ diff --git a/www/js/fm/icon/mine/24/misc.png b/www/js/fm/icon/mine/24/misc.png new file mode 100644 index 0000000..fe37f5f Binary files /dev/null and b/www/js/fm/icon/mine/24/misc.png differ diff --git a/www/js/fm/icon/mine/24/mp3.png b/www/js/fm/icon/mine/24/mp3.png new file mode 100644 index 0000000..5de5b66 Binary files /dev/null and b/www/js/fm/icon/mine/24/mp3.png differ diff --git a/www/js/fm/icon/mine/24/png.png b/www/js/fm/icon/mine/24/png.png new file mode 100644 index 0000000..459ab03 Binary files /dev/null and b/www/js/fm/icon/mine/24/png.png differ diff --git a/www/js/fm/icon/mine/24/prg.png b/www/js/fm/icon/mine/24/prg.png new file mode 100644 index 0000000..d20efcf Binary files /dev/null and b/www/js/fm/icon/mine/24/prg.png differ diff --git a/www/js/fm/icon/mine/24/svg.png b/www/js/fm/icon/mine/24/svg.png new file mode 100644 index 0000000..459ab03 Binary files /dev/null and b/www/js/fm/icon/mine/24/svg.png differ diff --git a/www/js/fm/icon/mine/24/undef.png b/www/js/fm/icon/mine/24/undef.png new file mode 100644 index 0000000..c240ab2 Binary files /dev/null and b/www/js/fm/icon/mine/24/undef.png differ diff --git a/www/js/fm/icon/mine/24/wav.png b/www/js/fm/icon/mine/24/wav.png new file mode 100644 index 0000000..5de5b66 Binary files /dev/null and b/www/js/fm/icon/mine/24/wav.png differ diff --git a/www/js/fm/icon/mine/24/zip.png b/www/js/fm/icon/mine/24/zip.png new file mode 100644 index 0000000..5499e21 Binary files /dev/null and b/www/js/fm/icon/mine/24/zip.png differ diff --git a/www/js/vis.js b/www/js/vis.js new file mode 100644 index 0000000..554fd05 --- /dev/null +++ b/www/js/vis.js @@ -0,0 +1,3463 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2017 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + */ +/* jshint browser:true */ +/* global document */ +/* global console */ +/* global session */ +/* global window */ +/* global location */ +/* global setTimeout */ +/* global clearTimeout */ +/* global io */ +/* global visConfig */ +/* global systemLang:true */ +/* global _ */ +/* global can */ +/* global storage */ +/* global servConn */ +/* global systemDictionary */ +/* global $ */ +/* global app */ +/* global Audio */ +/* global cordova */ +/* global translateAll */ +/* global jQuery */ +/* global document */ +/* global moment */ +/* jshint -W097 */// jshint strict:false +'use strict'; + +if (typeof systemDictionary !== 'undefined') { + $.extend(systemDictionary, { + 'No connection to Server': {'en': 'No connection to Server', 'de': 'Keine Verbindung zum Server', 'ru': 'Нет соединения с сервером'}, + 'Loading Views...': {'en': 'Loading Views...', 'de': 'Lade Views...', 'ru': 'Загрузка пользовательских страниц...'}, + 'Connecting to Server...': {'en': 'Connecting to Server...', 'de': 'Verbinde mit dem Server...', 'ru': 'Соединение с сервером...'}, + 'Loading data objects...': {'en': 'Loading data...', 'de': 'Lade Daten...', 'ru': 'Загрузка данных...'}, + 'Loading data values...': {'en': 'Loading values...', 'de': 'Lade Werte...', 'ru': 'Загрузка значений...'}, + 'error - View doesn\'t exist': {'en': 'View doesn\'t exist!', 'de': 'View existiert nicht!', 'ru': 'Страница не существует!'}, + 'no views found!': {'en': 'No views found!', 'de': 'Keine Views gefunden!', 'ru': 'Не найдено страниц!'}, + 'No Views found on Server': { + 'en': 'No Views found on Server', + 'de': 'Keine Views am Server gefunden.', + 'ru': 'На сервере не найдено никаких страниц.' + }, + 'All changes are saved locally. To reset changes clear the cache.': { + 'en': 'All changes are saved locally. To reset changes clear the browser cache.', + 'de': 'Alle Änderungen sind lokal gespeichert. Um Änderungen zu löschen, lösche Browsercache.', + 'ru': 'Все изменения сохранены локально. Для отмены локальных изменений очистите кеш броузера.' + }, + 'please use /vis/edit.html instead of /vis/?edit': { + 'en': 'Please use /vis/edit.html instead of /vis/?edit', + 'de': 'Bitte geben Sie /vis/edit.html statt /vis/?edit', + 'ru': 'Используйте /vis/edit.html вместо /vis/?edit' + }, + 'no views found on server.\nCreate new %s ?': { + 'en': 'no views found on server.\nCreate new %s?', + 'de': 'Keine Views am Server gefunden am.\nErzeugen %s?', + 'ru': 'На сервере не найдено никаких страниц. Создать %s?' + }, + 'Update found, loading new Files...': { + 'en': 'Update found.
Loading new Files...', + 'de': 'Neue Version gefunden.
Lade neue Dateien...', + 'ru': 'Обнаружено Обновление.
Загружаю новые файлы...' + }, + 'Loading Widget-Sets...': { + 'en': 'Loading Widget-Sets...', + 'de': 'Lade Widget-Sätze...', + 'ru': 'Загрузка наборов элементов...' + }, + 'error: view not found.': { + 'en': 'Error: view not found', + 'de': 'Fehler: View wurde nicht gefunden', + 'ru': 'Ошибка: Страница не существует' + }, + 'error: view container recursion.': { + 'en': 'Error: view container recursion', + 'de': 'Fehler: View ist rekursiv', + 'ru': 'Ошибка: Страница вызывет саму себя' + }, + "Cannot execute %s for %s, because of insufficient permissions": { + "en": "Cannot execute %s for %s, because of insufficient permissions.", + "de": "Kann das Kommando \"%s\" für %s nicht ausführen, weil nicht genügend Zugriffsrechte vorhanden sind.", + "ru": "Не могу выполнить \"%s\" для %s, так как недостаточно прав." + }, + "Insufficient permissions": { + "en": "Insufficient permissions", + "de": "Nicht genügend Zugriffsrechte", + "ru": "Недостаточно прав" + }, + "View disabled for user %s": { + "en": "View disabled for user %s", + "de": "View ist für Anwender %s deaktiviert", + "ru": "Страница недоступна для пользователя %s" + } + }); +} + +if (typeof systemLang !== 'undefined' && typeof cordova === 'undefined') { + systemLang = visConfig.language || systemLang; +} + +var vis = { + version: '1.1.7', + requiredServerVersion: '0.0.0', + + storageKeyViews: 'visViews', + storageKeySettings: 'visSettings', + storageKeyInstance: 'visInstance', + + instance: null, + urlParams: {}, + settings: {}, + views: null, + widgets: {}, + activeView: '', + activeViewDiv: '', + widgetSets: visConfig.widgetSets, + initialized: false, + toLoadSetsCount: 0, // Count of widget sets that should be loaded + isFirstTime: true, + useCache: false, + authRunning: false, + cssChecked: false, + isTouch: 'ontouchstart' in document.documentElement, + binds: {}, + onChangeCallbacks: [], + viewsActiveFilter: {}, + projectPrefix: window.location.search ? window.location.search.slice(1) + '/' : 'main/', + navChangeCallbacks: [], + editMode: false, + language: (typeof systemLang !== 'undefined') ? systemLang : visConfig.language, + statesDebounce: {}, + visibility: {}, + signals: {}, + lastChanges: {}, + bindings: {}, + bindingsCache: {}, + subscribing: { + IDs: [], + byViews: {}, + active: [], + activeViews: [] + }, + commonStyle: null, + debounceInterval: 700, + user: '', // logged in user + loginRequired: false, + _setValue: function (id, state, isJustCreated) { + var that = this; + var oldValue = this.states.attr(id + '.val'); + this.conn.setState(id, state[id + '.val'], function (err) { + if (err) { + //state[id + '.val'] = oldValue; + that.showMessage(_('Cannot execute %s for %s, because of insufficient permissions', 'setState', id), _('Insufficient permissions'), 'alert', 600); + } + + if (that.states.attr(id) || that.states.attr(id + '.val') !== undefined) { + that.states.attr(state); + + // If error set value back, but we need generate the edge + if (err) { + if (isJustCreated) { + that.states.removeAttr(id + '.val'); + that.states.removeAttr(id + '.q'); + that.states.removeAttr(id + '.from'); + that.states.removeAttr(id + '.ts'); + that.states.removeAttr(id + '.lc'); + that.states.removeAttr(id + '.ack'); + } else { + state[id + '.val'] = oldValue; + that.states.attr(state); + } + } + + // Inform other widgets, that does not support canJS + for (var i = 0, len = that.onChangeCallbacks.length; i < len; i++) { + that.onChangeCallbacks[i].callback(that.onChangeCallbacks[i].arg, id, state); + } + } + }); + }, + setValue: function (id, val) { + if (!id) { + console.log('ID is null for val=' + val); + return; + } + + var d = new Date(); + var t = d.getFullYear() + '-' + ('0' + (d.getMonth() + 1)).slice(-2) + '-' + ('0' + d.getDate()).slice(-2) + " " + ('0' + d.getHours()).slice(-2) + ':' + ('0' + d.getMinutes()).slice(-2) + ':' + ('0' + d.getSeconds()).slice(-2); + var o = {}; + var created = false; + if (this.states.attr(id + '.val') != val) { + o[id + '.lc'] = t; + } else { + o[id + '.lc'] = this.states.attr(id + '.lc'); + } + o[id + '.val'] = val; + o[id + '.ts'] = t; + o[id + '.ack'] = false; + + // Create this value + if (this.states.attr(id + '.val') === undefined) { + created = true; + this.states.attr(o); + } + + var that = this; + + // if no de-bounce running + if (!this.statesDebounce[id]) { + // send control command + this._setValue(id, o, created); + // Start timeout + this.statesDebounce[id] = { + timeout: _setTimeout(function () { + if (that.statesDebounce[id]) { + if (that.statesDebounce[id].state) that._setValue(id, that.statesDebounce[id].state); + delete that.statesDebounce[id]; + } + }, 1000, id), + state: null + }; + } else { + // If some de-bounce running, change last value + this.statesDebounce[id].state = o; + } + }, + loadWidgetSet: function (name, callback) { + var url = './widgets/' + name + '.html?visVersion=' + this.version; + var that = this; + $.ajax({ + url: url, + type: 'GET', + dataType: 'html', + cache: this.useCache, + success: function (data) { + setTimeout(function () { + try { + $('head').append(data); + } catch (e) { + console.error('Cannot load widget set "' + name + '": ' + e); + } + that.toLoadSetsCount -= 1; + if (that.toLoadSetsCount <= 0) { + that.showWaitScreen(true, null, null, 100); + setTimeout(function () { + callback.call(that); + }, 100); + } else { + that.showWaitScreen(true, null, null, parseInt((100 - that.waitScreenVal) / that.toLoadSetsCount, 10)); + } + }, 0); + }, + error: function (jqXHR, textStatus, errorThrown) { + that.conn.logError('Cannot load widget set ' + name + ' ' + errorThrown); + } + }); + }, + // Return as array used widgetSets or null if no information about it + getUsedWidgetSets: function () { + var widgetSets = []; + + if (!this.views) { + console.log('Check why views are not yet loaded!'); + return null; + } + + // Convert visConfig.widgetSets to object for easier dependency search + var widgetSetsObj = {}; + for (var i = 0; i < visConfig.widgetSets.length; i++) { + if (typeof visConfig.widgetSets[i] === 'object') { + if (!visConfig.widgetSets[i].depends) { + visConfig.widgetSets[i].depends = []; + } + widgetSetsObj[visConfig.widgetSets[i].name] = visConfig.widgetSets[i]; + + } else { + widgetSetsObj[visConfig.widgetSets[i]] = {depends: []}; + } + } + + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + for (var id in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(id)) continue; + if (!this.views[view].widgets[id].widgetSet) { + + // Views are not yet converted and have no widgetSet information) + return null; + + } else if (widgetSets.indexOf(this.views[view].widgets[id].widgetSet) === -1) { + + var wset = this.views[view].widgets[id].widgetSet; + widgetSets.push(wset); + + // Add dependencies + if (widgetSetsObj[wset]) { + for (var u = 0, ulen = widgetSetsObj[wset].depends.length; u < ulen; u++) { + if (widgetSets.indexOf(widgetSetsObj[wset].depends[u]) === -1) { + widgetSets.push(widgetSetsObj[wset].depends[u]); + } + } + } + } + } + } + return widgetSets; + }, + // Return as array used widgetSets or null if no information about it + getUsedObjectIDs: function () { + var result = getUsedObjectIDs(this.views, !this.editMode); + if (!result) { + return result; + } + this.visibility = result.visibility; + this.bindings = result.bindings; + this.signals = result.signals; + this.lastChanges = result.lastChanges; + + return {IDs: result.IDs, byViews: result.byViews}; + }, + getWidgetGroup: function (view, widget) { + return getWidgetGroup(this.views, view, widget); + }, + loadWidgetSets: function (callback) { + this.showWaitScreen(true, '
' + _('Loading Widget-Sets...') + ' ', null, 20); + var arrSets = []; + + // If widgets are pre-loaded + if (this.binds && this.binds.stateful !== undefined) { + this.toLoadSetsCount = 0; + } else { + // Get list of used widget sets. if Edit mode list is null. + var widgetSets = this.editMode ? null : this.getUsedWidgetSets(); + + // First calculate how many sets to load + for (var i = 0; i < this.widgetSets.length; i++) { + var name = this.widgetSets[i].name || this.widgetSets[i]; + + // Skip unused widget sets in non-edit mode + if (!this.widgetSets[i].always) { + if (this.widgetSets[i].widgetSets && widgetSets.indexOf(name) === -1) { + continue; + } + } else { + if (widgetSets && widgetSets.indexOf(name) === -1) widgetSets.push(name); + } + + arrSets[arrSets.length] = name; + + if (this.editMode && this.widgetSets[i].edit) { + arrSets[arrSets.length] = this.widgetSets[i].edit; + } + } + this.toLoadSetsCount = arrSets.length; + $("#widgetset_counter").html("(" + (this.toLoadSetsCount) + ")"); + } + + var that = this; + if (this.toLoadSetsCount) { + for (var j = 0, len = this.toLoadSetsCount; j < len; j++) { + _setTimeout(function (_i) { + that.loadWidgetSet(arrSets[_i], callback); + }, 100, j); + } + } else { + if (callback) callback.call(this); + } + }, + bindInstance: function () { + if (typeof app !== 'undefined' && app.settings) { + this.instance = app.settings.instance; + } + if (typeof storage !== 'undefined') { + this.instance = this.instance || storage.get(this.storageKeyInstance); + } + if (this.editMode) { + this.bindInstanceEdit(); + } + this.states.attr({'instance.val': this.instance, 'instance': this.instance}); + }, + init: function (onReady) { + if (this.initialized) return; + + if (typeof storage !== 'undefined') { + var settings = storage.get(this.storageKeySettings); + if (settings) { + this.settings = $.extend(this.settings, settings); + } + } + + // Late initialization (used only for debug) + /*if (this.binds.hqWidgetsExt) { + this.binds.hqWidgetsExt.hqInit(); + }*/ + + var that = this; + //this.loadRemote(this.loadWidgetSets, this.initNext); + this.loadWidgetSets(function () { + that.initNext(onReady); + }); + }, + initNext: function (onReady) { + this.showWaitScreen(false); + var that = this; + // First start. + if (!this.views) { + this.initViewObject(); + } else { + this.showWaitScreen(false); + } + + var hash = decodeURIComponent(window.location.hash.substring(1)); + + // create demo states + if (this.views && this.views.DemoView) this.createDemoStates(); + + if (!this.views || (!this.views[hash] && typeof app !== 'undefined')) hash = null; + + // View selected? + if (!hash) { + // Take first view in the list + this.activeView = this.findNearestResolution(true); + this.activeViewDiv = this.activeView; + + // Create default view in demo mode + if (typeof io === 'undefined') { + if (!this.activeView) { + if (!this.editMode) { + window.alert(_('error - View doesn\'t exist')); + if (typeof app === 'undefined') { + // try to find first view + window.location.href = 'edit.html?' + this.projectPrefix.substring(0, this.projectPrefix.length - 1); + } + } else { + this.views.DemoView = this.createDemoView ? this.createDemoView() : { + settings: {style: {}}, + widgets: {} + }; + this.activeView = 'DemoView'; + this.activeViewDiv = this.activeView; + } + } + } else if (!this.activeView) { + if (!this.editMode) { + if (typeof app === 'undefined') { + window.alert(_('error - View doesn\'t exist')); + window.location.href = 'edit.html?' + this.projectPrefix.substring(0, this.projectPrefix.length - 1); + } + } else { + // All views were deleted, but file exists. Create demo View + //window.alert("unexpected error - this should not happen :("); + //$.error("this should not happen :("); + // create demoView + this.views.DemoView = this.createDemoView ? this.createDemoView() : { + settings: {style: {}}, + widgets: {} + }; + this.activeView = 'DemoView'; + this.activeViewDiv = this.activeView; + } + } + } else { + if (this.views[hash]) { + this.activeView = hash; + this.activeViewDiv = this.activeView; + } else { + window.alert(_('error - View doesn\'t exist')); + if (typeof app === 'undefined') window.location.href = 'edit.html?' + this.projectPrefix.substring(0, this.projectPrefix.length - 1); + $.error("vis Error can't find view"); + } + } + + if (this.views && this.views.___settings) { + if (this.views.___settings.reloadOnSleep !== undefined) this.conn.setReloadTimeout(this.views.___settings.reloadOnSleep); + if (this.views.___settings.darkReloadScreen) { + $('#server-disconnect').removeClass('disconnect-light').addClass('disconnect-dark'); + } + if (this.views.___settings.reconnectInterval !== undefined) this.conn.setReconnectInterval(this.views.___settings.reconnectInterval); + if (this.views.___settings.destroyViewsAfter !== undefined) this.views.___settings.destroyViewsAfter = parseInt(this.views.___settings.destroyViewsAfter, 10); + } + + // Navigation + $(window).bind('hashchange', function (/* e */) { + var view = window.location.hash.slice(1); + that.changeView(view, view); + }); + + this.bindInstance(); + + // EDIT mode + if (this.editMode) this.editInitNext(); + + this.initialized = true; + + // If this function called earlier, it makes problems under FireFox. + // render all views, that should be always rendered + var containers = []; + var cnt = 0; + if (this.views && !this.editMode) { + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + if (this.views[view].settings.alwaysRender) { + containers.push({view: view}); + } + } + if (containers.length) { + cnt++; + this.renderViews(that.activeViewDiv, containers, function () { + cnt--; + if (that.activeView) { + that.changeView(that.activeViewDiv, that.activeView, function () { + if (!cnt && onReady) { + onReady(); + } + }); + } + }); + } + } + + if (!containers.length && this.activeView) { + this.changeView(this.activeViewDiv, this.activeView, onReady); + } + }, + initViewObject: function () { + if (!this.editMode) { + if (typeof app !== 'undefined') { + this.showMessage(_('no views found!')); + } else { + window.location.href = 'edit.html?' + this.projectPrefix.substring(0, this.projectPrefix.length - 1); + } + } else { + if (window.confirm(_('no views found on server.\nCreate new %s ?', this.projectPrefix + 'vis-views.json'))) { + this.views = {}; + this.views.DemoView = this.createDemoView ? this.createDemoView() : { + settings: {style: {}}, + widgets: {} + }; + if (this.saveRemote) { + this.saveRemote(true, function () { + //window.location.reload(); + }); + } + } else { + window.location.reload(); + } + } + }, + setViewSize: function (viewDiv, view) { + var $view = $('#visview_' + viewDiv); + var width; + var height; + if (this.views[view]) { + // Because of background, set the width and height of the view + width = parseInt(this.views[view].settings.sizex, 10); + height = parseInt(this.views[view].settings.sizey, 10); + } + var $vis_container = $('#vis_container'); + if (!width || width < $vis_container.width()) width = '100%'; + if (!height || height < $vis_container.height()) height = '100%'; + $view.css({width: width, height: height}); + }, + updateContainers: function (viewDiv, view) { + var that = this; + // Set ths views for containers + $('#visview_' + viewDiv).find('.vis-view-container').each(function () { + var cview = $(this).attr('data-vis-contains'); + if (!that.views[cview]) { + $(this).html('' + _('error: view not found.') + ''); + } else if (cview === view || cview === viewDiv) { + $(this).html('' + _('error: view container recursion.') + ''); + } else { + if ($(this).find('.container-error').length) { + $(this).html(''); + } + var targetView = this; + if (!$(this).find('.vis-widget:first').length) { + that.renderView(cview, cview, function (_viewDiv) { + $('#visview_' + _viewDiv) + .appendTo(targetView) + .show(); + }); + } else { + $('#visview_' + cview) + .appendTo(targetView) + .show(); + } + } + }); + }, + renderViews: function (viewDiv, views, index, callback) { + if (typeof index === 'function') { + callback = index; + index = 0; + } + index = index || 0; + + if (!views || index >= views.length) { + if (callback) callback(viewDiv, views); + return; + } + var item = views[index]; + var that = this; + this.renderView(this.views[item.view] ? item.view : viewDiv, item.view, true, function () { + that.renderViews(viewDiv, views, index + 1, callback); + }); + }, + renderView: function (viewDiv, view, hidden, callback) { + var that = this; + + if (typeof hidden === 'function') { + callback = hidden; + hidden = undefined; + } + if (typeof view === 'boolean') { + callback = hidden; + hidden = undefined; + view = viewDiv; + } + if (!this.editMode && !$('#commonTheme').length) { + $('head').prepend(''); + } + + if (!this.views[view] || !this.views[view].settings) { + window.alert('Cannot render view ' + view + '. Invalid settings'); + if (callback) { + setTimeout(function () { + callback(viewDiv, view); + }, 0); + } + return false; + } + + // try to render background + + + // collect all IDs, used in this view and in containers + this.subscribeStates(view, function () { + var isViewsConverted = false; // Widgets in the views hav no information which WidgetSet they use, this info must be added and this flag says if that happens to store the views + + that.views[view].settings.theme = that.views[view].settings.theme || 'redmond'; + + if (that.views[view].settings.filterkey) { + that.viewsActiveFilter[view] = that.views[view].settings.filterkey.split(','); + } else { + that.viewsActiveFilter[view] = []; + } + //noinspection JSJQueryEfficiency + var $view = $('#visview_' + viewDiv); + + // apply group policies + if (!that.editMode && that.views[view].settings.group && that.views[view].settings.group.length) { + if (that.views[view].settings.group_action === 'hide') { + if (!that.isUserMemberOf(that.conn.getUser(), that.views[view].settings.group)) { + if (!$view.length) { + $('#vis_container').append('
'); + $view = $('#visview_' + viewDiv); + } + $view.html('
' + _('View disabled for user %s', that.conn.getUser()) + '
'); + if (callback) { + setTimeout(function () { + callback(viewDiv, view); + }, 0); + } + return; + } + } + } + if (!$view.length) { + $('#vis_container').append(''); + that.addViewStyle(viewDiv, view, that.views[view].settings.theme); + + $view = $('#visview_' + viewDiv); + + $view.css(that.views[view].settings.style); + + if (that.views[view].settings.style.background_class) { + $view.addClass(that.views[view].settings.style.background_class); + } + + var id; + if (viewDiv !== view && that.editMode) { + //noinspection JSJQueryEfficiency + var $widget = $('#' + viewDiv); + if (!$widget.length) { + that.renderWidget(view, view, viewDiv); + $widget = $('#' + viewDiv); + } + $view.append('
' + _('Edit group:') + ' ' + viewDiv + '
'); + $view.find('.group-edit-close').button({ + icons: { + primary: 'ui-icon-close' + }, + text: false + }).data('view', view).css({width: 20, height: 20}).click(function () { + var view = $(this).data('view'); + that.changeView(view, view); + }); + + $widget.appendTo($view); + $widget.css({top: 0, left: 0}); + /*$widget.unbind('click dblclick'); + $widget.find('.vis-widget').each(function () { + var id = $(this).attr('id'); + that.bindWidgetClick(view, id, true); + });*/ + } else { + that.setViewSize(viewDiv, view); + // Render all widgets + for (id in that.views[view].widgets) { + if (!that.views[view].widgets.hasOwnProperty(id)) continue; + // Try to complete the widgetSet information to optimize the loading of widgetSets + if (id[0] !== 'g' && !that.views[view].widgets[id].widgetSet) { + var obj = $('#' + that.views[view].widgets[id].tpl); + if (obj) { + that.views[view].widgets[id].widgetSet = obj.attr('data-vis-set'); + isViewsConverted = true; + } + } + + if (!that.views[view].widgets[id].renderVisible && !that.views[view].widgets[id].grouped) that.renderWidget(viewDiv, view, id); + } + } + + if (that.editMode) { + if (that.binds.jqueryui) that.binds.jqueryui._disable(); + that.droppable(viewDiv, view); + } + } + + // move views in container + var containers = []; + $view.find('.vis-view-container').each(function () { + var cview = $(this).attr('data-vis-contains'); + if (!that.views[cview]) { + $(this).append('error: view not found.'); + return false; + } else if (cview === view) { + $(this).append('error: view container recursion.'); + return false; + } + containers.push({thisView: this, view: cview}); + }); + // add view class + if (that.views[view].settings['class']) { + $view.addClass(that.views[view].settings['class']) + } + var wait = false; + if (containers.length) { + wait = true; + that.renderViews(viewDiv, containers, function (_viewDiv, _containers) { + for (var c = 0; c < _containers.length; c++) { + $('#visview_' + _containers[c].view) + .appendTo(_containers[c].thisView) + .show(); + } + if (!hidden) $view.show(); + + $('#visview_' + _viewDiv).trigger('rendered'); + if (callback) callback(_viewDiv, view); + }); + } + + // Store modified view + if (isViewsConverted && that.saveRemote) that.saveRemote(); + + if (that.editMode && $('#wid_all_lock_function').prop('checked')) { + $('.vis-widget').addClass('vis-widget-lock'); + if (viewDiv !== view) { + $('#' + viewDiv).removeClass('vis-widget-lock'); + } + } + + if (!wait) { + if (!hidden) $view.show(); + + setTimeout(function () { + $('#visview_' + viewDiv).trigger('rendered'); + if (callback) callback(viewDiv, view); + }, 0); + } + + // apply group policies + if (!that.editMode && that.views[view].settings.group && that.views[view].settings.group.length) { + if (that.views[view].settings.group_action !== 'hide') { + if (!that.isUserMemberOf(that.conn.getUser(), that.views[view].settings.group)) { + $view.addClass('vis-user-disabled'); + } + } + } + }); + }, + addViewStyle: function (viewDiv, view, theme) { + var _view = 'visview_' + viewDiv; + + if (this.calcCommonStyle() === theme) return; + + $.ajax({ + url: ((typeof app === 'undefined') ? '../../' : '') + 'lib/css/themes/jquery-ui/' + theme + '/jquery-ui.min.css', + cache: false, + success: function (data) { + $('#' + viewDiv + '_style').remove(); + data = data.replace('.ui-helper-hidden', '#' + _view + ' .ui-helper-hidden'); + data = data.replace(/(}.)/g, '}#' + _view + ' .'); + data = data.replace(/,\./g, ',#' + _view + ' .'); + data = data.replace(/images/g, ((typeof app === 'undefined') ? '../../' : '') + 'lib/css/themes/jquery-ui/' + theme + '/images'); + var $view = $('#' + _view); + $view.append(''); + + $('#' + viewDiv + '_style_common_user').remove(); + $view.append(''); + + $('#' + viewDiv + '_style_user').remove(); + $view.append(''); + + } + }); + }, + preloadImages: function (srcs) { + if (!this.preloadImages.cache) { + this.preloadImages.cache = []; + } + var img; + for (var i = 0; i < srcs.length; i++) { + img = new Image(); + img.src = srcs[i]; + this.preloadImages.cache.push(img); + } + }, + destroyWidget: function (viewDiv, view, widget) { + var $widget = $('#' + widget); + if ($widget.length) { + var widgets = this.views[view].widgets[widget].data.members; + + if (widgets) { + for (var w = 0; w < widgets.length; w++) { + if (widgets[w] !== widget) { + this.destroyWidget(viewDiv, view, widgets[w]); + } else { + console.warn('Cyclic structure in ' + widget + '!'); + } + } + } + + try { + // get array of bound OIDs + var bound = $widget.data('bound'); + if (bound) { + var bindHandler = $widget.data('bindHandler'); + for (var b = 0; b < bound.length; b++) { + if (typeof bindHandler === 'function') { + this.states.unbind(bound[b], bindHandler); + } else { + this.states.unbind(bound[b], bindHandler[b]); + } + } + $widget.data('bindHandler', null); + $widget.data('bound', null); + } + // If destroy function exists => destroy it + var destroy = $widget.data('destroy'); + if (typeof destroy === 'function') { + destroy(widget, $widget); + } + } catch (e) { + console.error('Cannot destroy "' + widget + '": ' + e); + } + } + }, + reRenderWidget: function (viewDiv, view, widget) { + var $widget = $('#' + widget); + var updateContainers = $widget.find('.vis-view-container').length; + view = view || this.activeView; + viewDiv = viewDiv || this.activeViewDiv; + + this.destroyWidget(viewDiv, view, widget); + this.renderWidget(viewDiv, view, widget, !this.views[viewDiv] && viewDiv !== widget ? viewDiv : null); + + if (updateContainers) this.updateContainers(viewDiv, view); + }, + changeFilter: function (view, filter, showEffect, showDuration, hideEffect, hideDuration) { + view = view || this.activeView; + // convert from old style + if (!this.views[view]) { + hideDuration = hideEffect; + hideEffect = showDuration; + showDuration = showEffect; + showEffect = filter; + filter = view; + view = this.activeView; + } + + var widgets = this.views[view].widgets; + var that = this; + var widget; + var mWidget; + if (!(filter || '').trim()) { + // show all + for (widget in widgets) { + if (!widgets.hasOwnProperty(widget)) continue; + if (widgets[widget] && widgets[widget].data && widgets[widget].data.filterkey) { + $('#' + widget).show(showEffect, null, parseInt(showDuration)); + } + } + // Show complex widgets + setTimeout(function () { + var mWidget; + for (var widget in widgets) { + if (!widgets.hasOwnProperty(widget)) continue; + mWidget = document.getElementById(widget); + if (widgets[widget] && + widgets[widget].data && + widgets[widget].data.filterkey && + mWidget && + mWidget._customHandlers && + mWidget._customHandlers.onShow) { + mWidget._customHandlers.onShow(mWidget, widget); + } + } + }, parseInt(showDuration) + 10); + + } else if (filter === '$') { + // hide all + for (widget in widgets) { + if (!widgets.hasOwnProperty(widget)) continue; + if (!widgets[widget] || !widgets[widget].data || !widgets[widget].data.filterkey) continue; + mWidget = document.getElementById(widget); + if (mWidget && + mWidget._customHandlers && + mWidget._customHandlers.onHide) { + mWidget._customHandlers.onHide(mWidget, widget); + } + $('#' + widget).hide(hideEffect, null, parseInt(hideDuration)); + } + } else { + this.viewsActiveFilter[this.activeView] = filter.split(','); + var vFilters = this.viewsActiveFilter[this.activeView]; + for (widget in widgets) { + if (!widgets.hasOwnProperty(widget) || !widgets[widget] || !widgets[widget].data) continue; + var wFilters = widgets[widget].data.filterkey; + + if (wFilters) { + if (typeof wFilters !== 'object') { + widgets[widget].data.filterkey = wFilters.split(/[;,]+/); + wFilters = widgets[widget].data.filterkey; + } + var found = false; + // optimization + if (wFilters.length === 1) { + found = vFilters.indexOf(wFilters[0]) !== -1; + } else if (vFilters.length === 1) { + found = wFilters.indexOf(vFilters[0]) !== -1; + } else { + for (var f = 0; f < wFilters.length; f++) { + if (vFilters.indexOf(wFilters[f]) !== -1) { + found = true; + break; + } + } + } + + if (!found) { + mWidget = document.getElementById(widget); + if (mWidget && + mWidget._customHandlers && + mWidget._customHandlers.onHide) { + mWidget._customHandlers.onHide(mWidget, widget); + } + $('#' + widget).hide(hideEffect, null, parseInt(hideDuration)); + } else { + mWidget = document.getElementById(widget); + if (mWidget && mWidget._customHandlers && mWidget._customHandlers.onShow) { + mWidget._customHandlers.onShow(mWidget, widget); + } + $('#' + widget).show(showEffect, null, parseInt(showDuration)); + } + } + } + setTimeout(function () { + var mWidget; + + // Show complex widgets like hqWidgets or bars + for (var widget in widgets) { + if (!widgets.hasOwnProperty(widget)) continue; + mWidget = document.getElementById(widget); + if (mWidget && + mWidget._customHandlers && + mWidget._customHandlers.onShow) { + if (widgets[widget] && widgets[widget].data && widgets[widget].data.filterkey) { + if (!(that.viewsActiveFilter[that.activeView].length > 0 && + that.viewsActiveFilter[that.activeView].indexOf(widgets[widget].data.filterkey) === -1)) { + mWidget._customHandlers.onShow(mWidget, widget); + } + } + } + } + }, parseInt(showDuration) + 10); + } + + if (this.binds.bars && this.binds.bars.filterChanged) { + this.binds.bars.filterChanged(view, filter); + } + }, + isSignalVisible: function (view, widget, index, val, widgetData) { + widgetData = widgetData || this.views[view].widgets[widget].data; + var oid = widgetData['signals-oid-' + index]; + + if (oid) { + if (val === undefined) val = this.states.attr(oid + '.val'); + + var condition = widgetData['signals-cond-' + index]; + var value = widgetData['signals-val-' + index]; + + if (val === undefined) return (condition === 'not exist'); + + if (!condition || value === undefined) return (condition === 'not exist'); + + if (val === 'null' && condition !== 'exist' && condition !== 'not exist') return false; + + var t = typeof val; + if (t === 'boolean' || val === 'false' || val === 'true') { + value = (value === 'true' || value === true || value === 1 || value === '1'); + } else + if (t === 'number') { + value = parseFloat(value); + } else + if (t === 'object') { + val = JSON.stringify(val); + } + + switch (condition) { + case '==': + value = value.toString(); + val = val.toString(); + if (val === '1') val = 'true'; + if (value === '1') value = 'true'; + if (val === '0') val = 'false'; + if (value === '0') value = 'false'; + return value === val; + case '!=': + value = value.toString(); + val = val.toString(); + if (val === '1') val = 'true'; + if (value === '1') value = 'true'; + if (val === '0') val = 'false'; + if (value === '0') value = 'false'; + return value !== val; + case '>=': + return val >= value; + case '<=': + return val <= value; + case '>': + return val > value; + case '<': + return val < value; + case 'consist': + value = value.toString(); + val = val.toString(); + return (val.toString().indexOf(value) !== -1); + case 'not consist': + value = value.toString(); + val = val.toString(); + return (val.toString().indexOf(value) === -1); + case 'exist': + return (value !== 'null'); + case 'not exist': + return (value === 'null'); + default: + console.log('Unknown signals condition for ' + widget + ': ' + condition); + return false; + } + } else { + return false; + } + }, + addSignalIcon: function (view, wid, data, index) { + // show icon + var display = (this.editMode || this.isSignalVisible(view, wid, index, undefined, data)) ? '' : 'none'; + if (this.editMode && data['signals-hide-edit-' + index]) display = 'none'; + + $('#' + wid).append(''); + }, + addGestures: function (id, wdata) { + // gestures + var gestures = ['swipeRight', 'swipeLeft', 'swipeUp', 'swipeDown', 'rotateLeft', 'rotateRight', 'pinchIn', 'pinchOut', 'swiping', 'rotating', 'pinching']; + var $$wid = $$('#' + id); + var $wid = $('#' + id); + var offsetX = parseInt(wdata['gestures-offsetX']) || 0; + var offsetY = parseInt(wdata['gestures-offsetY']) || 0; + var that = this; + + gestures.forEach(function (gesture) { + if (wdata && wdata['gestures-' + gesture + '-oid']) { + var oid = wdata['gestures-' + gesture + '-oid']; + if (oid) { + var val = wdata['gestures-' + gesture + '-value']; + var delta = parseInt(wdata['gestures-' + gesture + '-delta']) || 10; + var limit = parseFloat(wdata['gestures-' + gesture + '-limit']) || false; + var max = parseFloat(wdata['gestures-' + gesture + '-maximum']) || 100; + var min = parseFloat(wdata['gestures-' + gesture + '-minimum']) || 0; + var valState = that.states.attr(oid + '.val'); + var newVal = null; + var $indicator; + if (valState !== undefined) { + $wid.on('touchmove', function (evt) { + evt.preventDefault(); + }); + + $wid.css({ + '-webkit-user-select': 'none', + '-khtml-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none' + }); + $$wid[gesture](function (data) { + valState = that.states.attr(oid + '.val'); + if (val === 'toggle') { + if (valState === true) { + newVal = false; + } else if (valState === false) { + newVal = true; + } else { + newVal = null; + return; + } + } else if (gesture === 'swiping' || gesture === 'rotating' || gesture === 'pinching') { + if (newVal === null) { + $indicator = $('#' + wdata['gestures-indicator']); + // create default indicator + if (!$indicator.length) { + //noinspection JSJQueryEfficiency + $indicator = $('#gestureIndicator'); + if (!$indicator.length) { + $('body').append('
'); + $indicator = $('#gestureIndicator'); + + $indicator.on('gestureUpdate', function (event, evData) { + if (evData.val === null) { + $(this).hide(); + } else { + $(this).html(evData.val); + $(this).css({ + left: parseInt(evData.x) - $(this).width() / 2 + 'px', + top: parseInt(evData.y) - $(this).height() / 2 + 'px' + }).show(); + } + }); + } + } + + $('#vis_container').css({ + '-webkit-user-select': 'none', + '-khtml-user-select': 'none', + '-moz-user-select': 'none', + '-ms-user-select': 'none', + 'user-select': 'none' + }); + + $(document).on('mouseup.gesture touchend.gesture', function () { + if (newVal !== null) { + that.setValue(oid, newVal); + newVal = null; + } + $indicator.trigger('gestureUpdate', {val: null}); + $(document).off('mouseup.gesture touchend.gesture'); + + $('#vis_container').css({ + '-webkit-user-select': 'text', + '-khtml-user-select': 'text', + '-moz-user-select': 'text', + '-ms-user-select': 'text', + 'user-select': 'text' + }); + }); + } + var swipeDelta, indicatorX, indicatorY = 0; + switch (gesture) { + case 'swiping': + swipeDelta = Math.abs(data.touch.delta.x) > Math.abs(data.touch.delta.y) ? data.touch.delta.x : data.touch.delta.y * (-1); + swipeDelta = swipeDelta > 0 ? Math.floor(swipeDelta / delta) : Math.ceil(swipeDelta / delta); + indicatorX = data.touch.x; + indicatorY = data.touch.y; + break; + + case 'rotating': + swipeDelta = data.touch.delta; + swipeDelta = swipeDelta > 0 ? Math.floor(swipeDelta / delta) : Math.ceil(swipeDelta / delta); + if (data.touch.touches[0].y < data.touch.touches[1].y) { + indicatorX = data.touch.touches[1].x; + indicatorY = data.touch.touches[1].y; + } else { + indicatorX = data.touch.touches[0].x; + indicatorY = data.touch.touches[0].y; + } + break; + + case 'pinching': + swipeDelta = data.touch.delta; + swipeDelta = swipeDelta > 0 ? Math.floor(swipeDelta / delta) : Math.ceil(swipeDelta / delta); + if (data.touch.touches[0].y < data.touch.touches[1].y) { + indicatorX = data.touch.touches[1].x; + indicatorY = data.touch.touches[1].y; + } else { + indicatorX = data.touch.touches[0].x; + indicatorY = data.touch.touches[0].y; + } + break; + + default: + break; + } + + newVal = (parseFloat(valState) || 0) + (parseFloat(val) || 1) * swipeDelta; + newVal = Math.max(min, Math.min(max, newVal)); + $indicator.trigger('gestureUpdate', { + val: newVal, + x: indicatorX + offsetX, + y: indicatorY + offsetY + }); + return; + } else if (limit !== false) { + newVal = (parseFloat(valState) || 0) + (parseFloat(val) || 1); + if (parseFloat(val) > 0 && newVal > limit) { + newVal = limit; + } else if (parseFloat(val) < 0 && newVal < limit) { + newVal = limit; + } + } else { + newVal = val; + } + that.setValue(oid, newVal); + newVal = null; + }); + } + } + } + }); + }, + addLastChange: function (view, wid, data) { + // show last change + var border = (parseInt(data['lc-border-radius'], 10) || 0) + 'px'; + var css = { + background: 'rgba(182,182,182,0.6)', + 'font-family': 'Tahoma', + position: 'absolute', + 'z-index': 0, + 'border-radius': data['lc-position-horz'] === 'left' ? (border + ' 0 0 ' + border) : (data['lc-position-horz'] === 'right' ? '0 ' + border + ' ' + border + ' 0' : border), + 'white-space': 'nowrap' + }; + if (data['lc-font-size']) { + css['font-size'] = data['lc-font-size']; + } + if (data['lc-font-style']) { + css['font-style'] = data['lc-font-style']; + } + if (data['lc-font-family']) { + css['font-family'] = data['lc-font-family']; + } + if (data['lc-bkg-color']) { + css['background'] = data['lc-bkg-color']; + } + if (data['lc-color']) { + css['color'] = data['lc-color']; + } + if (data['lc-border-width']) { + css['border-width'] = parseInt(data['lc-border-width'], 10) || 0; + } + if (data['lc-border-style']) { + css['border-style'] = data['lc-border-style']; + } + if (data['lc-border-color']) { + css['border-color'] = data['lc-border-color']; + } + if (data['lc-padding']) { + css['padding'] = data['lc-padding']; + } else { + css['padding-top'] = 3; + css['padding-bottom'] = 3; + } + if (data['lc-zindex']) { + css['z-index'] = data['lc-zindex']; + } + if (data['lc-position-vert'] === 'top') { + css.top = parseInt(data['lc-offset-vert'], 10); + } else if (data['lc-position-vert'] === 'bottom') { + css.bottom = parseInt(data['lc-offset-vert'], 10); + } else if (data['lc-position-vert'] === 'middle') { + css.top = 'calc(50% + ' + (parseInt(data['lc-offset-vert'], 10) - 10) + 'px)'; + } + var offset = parseFloat(data['lc-offset-horz']) || 0; + if (data['lc-position-horz'] === 'left') { + css.right = 'calc(100% - ' + offset + 'px)'; + if (!data['lc-padding']) { + css['padding-right'] = 10; + css['padding-left'] = 10; + } + } else if (data['lc-position-horz'] === 'right') { + css.left = 'calc(100% + ' + offset + 'px)'; + if (!data['lc-padding']) { + css['padding-right'] = 10; + css['padding-left'] = 10; + } + } else if (data['lc-position-horz'] === 'middle') { + css.left = 'calc(50% + ' + offset + 'px)'; + } + var text = '
' + this.binds.basic.formatDate(this.states.attr(data['lc-oid'] + '.ts'), data['lc-format'], data['lc-is-interval'], data['lc-is-moment']) + '
'; + $('#' + wid).prepend($(text).css(css)).css('overflow', 'visible'); + }, + isUserMemberOf: function (user, userGroups) { + if (!this.userGroups) return true; + if (typeof userGroups !== 'object') userGroups = [userGroups]; + for (var g = 0; g < userGroups.length; g++) { + var group = this.userGroups['system.group.' + userGroups[g]]; + if (!group || !group.common || !group.common.members || !group.common.members.length) continue; + if (group.common.members.indexOf('system.user.' + user) !== -1) return true; + } + return false; + }, + renderWidget: function (viewDiv, view, id, groupId) { + var $view; + var that = this; + if (!groupId) { + $view = $('#visview_' + viewDiv); + } else { + $view = $('#' + groupId); + } + if (!$view.length) return; + + var widget = this.views[view].widgets[id]; + + if (groupId && widget) { + widget = JSON.parse(JSON.stringify(widget)); + var aCount = parseInt(this.views[view].widgets[groupId].data.attrCount, 10); + if (aCount) { + $.map(widget.data, function(val, key) { + var m; + if (typeof val === 'string' && (m = val.match(/^groupAttr(\d+)$/))) { + widget.data[key] = that.views[view].widgets[groupId].data[m[0]] || ''; + } + }); + } + } + + var isRelative = widget && widget.style && (widget.style.position === 'relative' || widget.style.position === 'static' || widget.style.position === 'sticky'); + + // if widget has relative position => insert it into relative div + if (this.editMode && isRelative && viewDiv === view) { + if (this.views[view].settings && this.views[view].settings.sizex) { + var $relativeView = $view.find('.vis-edit-relative'); + if (!$relativeView.length) { + var ww = this.views[view].settings.sizex; + var hh = this.views[view].settings.sizey; + if (parseFloat(ww).toString() === ww.toString()) ww = parseFloat(ww); + if (parseFloat(hh).toString() === hh.toString()) hh = parseFloat(hh); + + if (typeof ww === 'number' || ww[ww.length - 1] < '0' || ww[ww.length - 1] > '9') { + ww = ww + 'px'; + } + if (typeof hh === 'number' || hh[hh.length - 1] < '0' || hh[hh.length - 1] > '9') { + hh = hh + 'px'; + } + + $view.append('
'); + $view = $view.find('.vis-edit-relative'); + } else { + $view = $relativeView; + } + } + } + + // Add to the global array of widgets + try { + var userGroups; + if (!this.editMode && widget.data['visibility-groups'] && widget.data['visibility-groups'].length) { + userGroups = widget.data['visibility-groups']; + + if (widget.data['visibility-groups-action'] === 'hide') { + if (!this.isUserMemberOf(this.conn.getUser(), userGroups)) return; + userGroups = null; + } + } + + this.widgets[id] = { + wid: id, + data: new can.Map($.extend({ + wid: id + }, widget.data)) + }; + } catch (e) { + console.log('Cannot bind data of widget widget:' + id); + return; + } + // Register oid to detect changes + // if (widget.data.oid !== 'nothing_selected') + // $.homematic("advisState", widget.data.oid, widget.data.hm_wid); + + var widgetData = this.widgets[id].data; + + try { + //noinspection JSJQueryEfficiency + var $widget = $('#' + id); + if ($widget.length) { + var destroy = $widget.data('destroy'); + + if (typeof destroy === 'function') { + $widget.off('resize'); // remove resize handler + destroy(id, $widget); + $widget.data('destroy', null); + } + if (isRelative && !$view.find('#' + id).length) { + $widget.remove(); + $widget.length = 0; + } else { + $widget.html('
').attr('id', id + '_removed'); + } + } + + var canWidget; + // Append html element to view + if (widget.data && widget.data.oid) { + canWidget = can.view(widget.tpl, { + val: this.states.attr(widget.data.oid + '.val'), + data: widgetData, + viewDiv: viewDiv, + view: view + }); + if ($widget.length) { + if ($widget.parent().attr('id') !== $view.attr('id')) $widget.appendTo($view); + $widget.replaceWith(canWidget); + // shift widget to group if required + } else { + $view.append(canWidget); + } + } else if (widget.tpl) { + canWidget = can.view(widget.tpl, { + data: widgetData, + viewDiv: viewDiv, + view: view + }); + if ($widget.length) { + if ($widget.parent().attr('id') !== $view.attr('id')) $widget.appendTo($view); + $widget.replaceWith(canWidget); + // shift widget to group if required + } else { + $view.append(canWidget); + } + } else { + console.error('Widget "' + id + '" is invalid. Please delete it.'); + return; + } + var $wid = null; + + if (widget.style && !widgetData._no_style) { + $wid = $wid || $('#' + id); + + // fix position + for (var attr in widget.style) { + if (!widget.style.hasOwnProperty(attr)) continue; + if (attr === 'top' || attr === 'left' || attr === 'width' || attr === 'height') { + var val = widget.style[attr]; + if (val !== '0' && val !== 0 && val !== null && val !== '' && val.toString().match(/^[-+]?\d+$/)) { + widget.style[attr] = val + 'px'; + } + } + } + + $wid.css(widget.style); + } + + if (widget.data && widget.data.class) { + $wid = $wid || $('#' + id); + $wid.addClass(widget.data.class); + } + + var $tpl = $('#' + widget.tpl); + + $wid.addClass('vis-tpl-' + $tpl.data('vis-set') + '-' + $tpl.data('vis-name')); + + if (!this.editMode) { + if (this.isWidgetFilteredOut(view, id) || this.isWidgetHidden(view, id, undefined, widget.data)) { + var mWidget = document.getElementById(id); + $(mWidget).hide(); + if (mWidget && + mWidget._customHandlers && + mWidget._customHandlers.onHide) { + mWidget._customHandlers.onHide(mWidget, id); + } + } + + // Processing of gestures + if (typeof $$ !== 'undefined') this.addGestures(id, widget.data); + } + + // processing of signals + var s = 0; + while (widget.data['signals-oid-' + s]) { + this.addSignalIcon(view, id, widget.data, s); + s++; + } + if (widget.data['lc-oid']) { + this.addLastChange(view, id, widget.data); + } + + // If edit mode, bind on click event to open this widget in edit dialog + if (this.editMode) { + this.bindWidgetClick(viewDiv, view, id); + + // @SJ cannot select menu and dialogs if it is enabled + /*if ($('#wid_all_lock_f').hasClass("ui-state-active")) { + $('#' + id).addClass("vis-widget-lock") + }*/ + } + + $(document).trigger('wid_added', id); + + if (id[0] === 'g') { + for (var w = 0; w < widget.data.members.length; w++) { + if (widget.data.members[w] === id) continue; + + this.renderWidget(viewDiv, view, widget.data.members[w], id); + } + } + } catch (e) { + var lines = (e.toString() + e.stack.toString()).split('\n'); + this.conn.logError('can\'t render ' + widget.tpl + ' ' + id + ' on "' + view + '": '); + for (var l = 0; l < lines.length; l++) { + this.conn.logError(l + ' - ' + lines[l]); + } + } + + if (userGroups && $wid && $wid.length) { + if (!this.isUserMemberOf(this.conn.getUser(), userGroups)) { + $wid.addClass('vis-user-disabled'); + } + } + }, + changeView: function (viewDiv, view, hideOptions, showOptions, sync, callback) { + var that = this; + + if (typeof view === 'object') { + callback = sync; + sync = showOptions; + hideOptions = showOptions; + view = viewDiv; + } + + if (!view && viewDiv) view = viewDiv; + + if (typeof hideOptions === 'function') { + callback = hideOptions; + hideOptions = undefined; + } + if (typeof showOptions === 'function') { + callback = showOptions; + showOptions = undefined; + } + if (typeof sync === 'function') { + callback = sync; + sync = undefined; + } + + var effect = (hideOptions !== undefined) && (hideOptions.effect !== undefined) && hideOptions.effect; + if (!effect) { + effect = (showOptions !== undefined) && (showOptions.effect !== undefined) && showOptions.effect; + } + if (effect && ((showOptions === undefined) || !showOptions.effect)) { + showOptions = {effect: hideOptions.effect, options: {}, duration: hideOptions.duration}; + } + if (effect && ((hideOptions === undefined) || !hideOptions.effect)) { + hideOptions = {effect: showOptions.effect, options: {}, duration: showOptions.duration}; + } + hideOptions = $.extend(true, {effect: undefined, options: {}, duration: 0}, hideOptions); + showOptions = $.extend(true, {effect: undefined, options: {}, duration: 0}, showOptions); + if (hideOptions.effect === 'show') effect = false; + + if (this.editMode && this.activeView !== this.activeViewDiv) { + this.destroyGroupEdit(this.activeViewDiv, this.activeView); + } + + if (!this.views[view]) { + //noinspection JSUnusedAssignment + view = null; + for (var prop in this.views) { + if (prop === '___settings') continue; + view = prop; + break; + } + } + + // If really changed + if (this.activeView !== viewDiv) { + if (effect) { + this.renderView(viewDiv, view, true, function (_viewDiv, _view) { + var $view = $('#visview_' + _viewDiv); + + // Get the view, if required, from Container + if ($view.parent().attr('id') !== 'vis_container') $view.appendTo('#vis_container'); + + var oldView = that.activeView; + that.postChangeView(_viewDiv, _view, callback); + + // If hide and show at the same time + if (sync) { + $view.show(showOptions.effect, showOptions.options, parseInt(showOptions.duration, 10)).dequeue(); + } + + $('#visview_' + oldView).hide(hideOptions.effect, hideOptions.options, parseInt(hideOptions.duration, 10), function () { + // If first hide, than show + if (!sync) { + $view.show(showOptions.effect, showOptions.options, parseInt(showOptions.duration, 10), function () { + that.destroyUnusedViews(); + }); + } else { + that.destroyUnusedViews(); + } + }); + }); + } else { + var $oldView = $('#visview_' + that.activeViewDiv); + // disable view and show some action + $oldView.find('> .vis-view-disabled').show(); + this.renderView(viewDiv, view, true, function (_viewDiv, _view) { + var $oldView; + if (that.activeViewDiv !== _viewDiv) { + $oldView = $('#visview_' + that.activeViewDiv); + // hide old view + $oldView.hide(); + $oldView.find('.vis-view-disabled').hide(); + } + var $view = $('#visview_' + _viewDiv); + + // Get the view, if required, from Container + if ($view.parent().attr('id') !== 'vis_container') { + $view.appendTo('#vis_container'); + } + + // show new view + $view.show(); + $view.find('.vis-view-disabled').hide(); + + if (that.activeViewDiv !== _viewDiv) { + if ($oldView.hasClass('vis-edit-group')) { + that.destroyView(that.activeViewDiv, that.activeView); + } else { + $oldView.hide(); + } + } + + that.postChangeView(_viewDiv, _view, callback); + that.destroyUnusedViews(); + }); + } + // remember last click for de-bounce + this.lastChange = Date.now(); + } else { + this.renderView(viewDiv, view, false, function (_viewDiv, _view) { + var $view = $('#visview_' + _viewDiv); + + // Get the view, if required, from Container + if ($view.parent().attr('id') !== 'vis_container') $view.appendTo('#vis_container'); + $view.show(); + + that.postChangeView(_viewDiv, _view, callback); + that.destroyUnusedViews(); + }); + } + }, + postChangeView: function (viewDiv, view, callback) { + this.activeView = view; + this.activeViewDiv = viewDiv; + /*$('#visview_' + viewDiv).find('.vis-view-container').each(function () { + $('#visview_' + $(this).attr('data-vis-contains')).show(); + });*/ + + this.updateContainers(viewDiv, view); + + if (!this.editMode) { + this.conn.sendCommand(this.instance, 'changedView', this.projectPrefix ? (this.projectPrefix + this.activeView) : this.activeView); + $(window).trigger('viewChanged', viewDiv); + } + + if (window.location.hash.slice(1) !== view) { + if (history && history.pushState) { + history.pushState({}, '', '#' + viewDiv); + } + } + + // Navigation-Widgets + for (var i = 0; i < this.navChangeCallbacks.length; i++) { + this.navChangeCallbacks[i](viewDiv, view); + } + + // --------- Editor ----------------- + if (this.editMode) { + this.changeViewEdit(viewDiv, view, false, callback); + } else if (typeof callback === 'function') { + callback(viewDiv, view); + } + this.updateIframeZoom(); + }, + loadRemote: function (callback, callbackArg) { + var that = this; + if (!this.projectPrefix) { + if (callback) callback.call(that, callbackArg); + return; + } + this.conn.readFile(this.projectPrefix + 'vis-views.json', function (err, data) { + if (err) { + window.alert(that.projectPrefix + 'vis-views.json ' + err); + if (err === 'permissionError') { + that.showWaitScreen(true, '', _('Loading stopped', location.protocol + '//' + location.host, location.protocol + '//' + location.host), 0); + // do nothing any more + return; + } + } + if (typeof app !== 'undefined' && app.replaceFilesInViewsWeb) { + data = app.replaceFilesInViewsWeb(data); + } + + if (data) { + if (typeof data === 'string') { + try { + that.views = JSON.parse(data.trim()); + } catch (e) { + console.log('Cannot parse views file "' + that.projectPrefix + 'vis-views.json"'); + window.alert('Cannot parse views file "' + that.projectPrefix + 'vis-views.json'); + that.views = null; + } + } else { + that.views = data; + } + var _data = that.getUsedObjectIDs(); + that.subscribing.IDs = _data.IDs; + that.subscribing.byViews = _data.byViews; + } else { + that.views = null; + } + + if (callback) callback.call(that, callbackArg); + }); + }, + wakeUpCallbacks: [], + initWakeUp: function () { + var that = this; + var oldTime = Date.now(); + setInterval(function () { + var currentTime = Date.now(); + //console.log("checkWakeUp "+ (currentTime - oldTime)); + if (currentTime > (oldTime + 10000)) { + oldTime = currentTime; + for (var i = 0; i < that.wakeUpCallbacks.length; i++) { + //console.log("calling wakeUpCallback!"); + that.wakeUpCallbacks[i](); + } + } else { + oldTime = currentTime; + } + }, 2500); + }, + onWakeUp: function (callback) { + this.wakeUpCallbacks.push(callback); + }, + showMessage: function (message, title, icon, width, callback) { + // load some theme to show message + if (!this.editMode && !$('#commonTheme').length) { + $('head').prepend(''); + } + if (typeof icon === 'number') { + callback = width; + width = icon; + icon = null; + } + if (typeof title === 'function') { + callback = title; + title = null; + } else if (typeof icon === 'function') { + callback = icon; + icon = null; + } else if (typeof width === 'function') { + callback = width; + width = null; + } + + if (!this.$dialogMessage) { + this.$dialogMessage = $('#dialog-message'); + this.$dialogMessage.dialog({ + autoOpen: false, + modal: true, + open: function () { + $(this).parent().css({'z-index': 1003}); + var callback = $(this).data('callback'); + if (callback) { + $(this).find('#dialog_message_cancel').show(); + } else { + $(this).find('#dialog_message_cancel').hide(); + } + }, + buttons: [ + { + text: _('Ok'), + click: function () { + var callback = $(this).data('callback'); + $(this).dialog('close'); + if (typeof callback === 'function') { + callback(true); + $(this).data('callback', null); + } + } + }, + { + id: 'dialog_message_cancel', + text: _('Cancel'), + click: function () { + var callback = $(this).data('callback'); + $(this).dialog('close'); + if (typeof callback === 'function') { + callback(false); + $(this).data('callback', null); + } + } + } + ] + }); + } + this.$dialogMessage.dialog('option', 'title', title || _('Message')); + if (width) { + this.$dialogMessage.dialog('option', 'width', width); + } else { + this.$dialogMessage.dialog('option', 'width', 300); + } + $('#dialog-message-text').html(message); + + this.$dialogMessage.data('callback', callback ? callback : null); + + if (icon) { + $('#dialog-message-icon') + .show() + .attr('class', '') + .addClass('ui-icon ui-icon-' + icon); + } else { + $('#dialog-message-icon').hide(); + } + this.$dialogMessage.dialog('open'); + }, + showError: function (error) { + this.showMessage(error, _('Error'), 'alert', 400); + }, + waitScreenVal: 0, + showWaitScreen: function (isShow, appendText, newText, step) { + var waitScreen = document.getElementById("waitScreen"); + if (!waitScreen && isShow) { + $('body').append('
'); + waitScreen = document.getElementById("waitScreen"); + this.waitScreenVal = 0; + } + + $('.vis-progressbar').progressbar({value: this.waitScreenVal}).height(19); + + if (isShow) { + $(waitScreen).show(); + if (newText !== null && newText !== undefined) { + $('#waitText').html(newText); + } + if (appendText !== null && appendText !== undefined) { + $('#waitText').append(appendText); + } + if (step !== undefined) { + this.waitScreenVal += step; + _setTimeout(function (_val) { + $('.vis-progressbar').progressbar('value', _val); + }, 0, this.waitScreenVal); + + } + } else if (waitScreen) { + $(waitScreen).remove(); + } + }, + registerOnChange: function (callback, arg) { + for (var i = 0, len = this.onChangeCallbacks.length; i < len; i++) { + if (this.onChangeCallbacks[i].callback === callback && + this.onChangeCallbacks[i].arg === arg) { + return; + } + } + this.onChangeCallbacks[this.onChangeCallbacks.length] = {callback: callback, arg: arg}; + }, + unregisterOnChange: function (callback, arg) { + for (var i = 0, len = this.onChangeCallbacks.length; i < len; i++) { + if (this.onChangeCallbacks[i].callback === callback && + (arg === undefined || this.onChangeCallbacks[i].arg === arg)) { + this.onChangeCallbacks.slice(i, 1); + return; + } + } + }, + isWidgetHidden: function (view, widget, val, widgetData) { + widgetData = widgetData || this.views[view].widgets[widget].data; + var oid = widgetData['visibility-oid']; + var condition = widgetData['visibility-cond']; + if (oid) { + if (val === undefined) val = this.states.attr(oid + '.val'); + if (val === undefined) return (condition === 'not exist'); + + var value = widgetData['visibility-val']; + + if (!condition || value === undefined) return (condition === 'not exist'); + + if (val === 'null' && condition !== 'exist' && condition !== 'not exist') return false; + + var t = typeof val; + if (t === 'boolean' || val === 'false' || val === 'true') { + value = (value === 'true' || value === true || value === 1 || value === '1'); + } else + if (t === 'number') { + value = parseFloat(value); + } else + if (t === 'object') { + val = JSON.stringify(val); + } + + // Take care: return true if widget is hidden! + switch (condition) { + case '==': + value = value.toString(); + val = val.toString(); + if (val === '1') val = 'true'; + if (value === '1') value = 'true'; + if (val === '0') val = 'false'; + if (value === '0') value = 'false'; + return value !== val; + case '!=': + value = value.toString(); + val = val.toString(); + if (val === '1') val = 'true'; + if (value === '1') value = 'true'; + if (val === '0') val = 'false'; + if (value === '0') value = 'false'; + return value === val; + case '>=': + return val < value; + case '<=': + return val > value; + case '>': + return val <= value; + case '<': + return val >= value; + case 'consist': + value = value.toString(); + val = val.toString(); + return (val.toString().indexOf(value) === -1); + case 'not consist': + value = value.toString(); + val = val.toString(); + return (val.toString().indexOf(value) !== -1); + case 'exist': + return val === 'null'; + case 'not exist': + return val !== 'null'; + default: + console.log('Unknown visibility condition for ' + widget + ': ' + condition); + return false; + } + } else { + return (condition === 'not exist'); + } + }, + isWidgetFilteredOut: function (view, widget) { + var w = this.views[view].widgets[widget]; + var v = this.viewsActiveFilter[view]; + return (w && + w.data && + w.data.filterkey && + widget && + widget.data && + v.length > 0 && + v.indexOf(widget.data.filterkey) === -1); + }, + calcCommonStyle: function (recalc) { + if (!this.commonStyle || recalc) { + if (this.editMode) { + this.commonStyle = this.config.editorTheme || 'redmond'; + return this.commonStyle; + } + var styles = {}; + if (this.views) { + for (var view in this.views) { + if (!this.views.hasOwnProperty(view)) continue; + if (view === '___settings') continue; + if (!this.views[view] || !this.views[view].settings.theme) continue; + if (this.views[view].settings.theme && styles[this.views[view].settings.theme]) { + styles[this.views[view].settings.theme]++; + } else { + styles[this.views[view].settings.theme] = 1; + } + } + } + var max = 0; + this.commonStyle = ''; + for (var s in styles) { + if (styles[s] > max) { + max = styles[s]; + this.commonStyle = s; + } + } + } + return this.commonStyle; + }, + formatValue: function formatValue(value, decimals, _format) { + if (typeof decimals !== 'number') { + decimals = 2; + _format = decimals; + } + + //format = (_format === undefined) ? (that.isFloatComma) ? ".," : ",." : _format; + // does not work... + // using default german... + var format = (_format === undefined) ? ".," : _format; + + if (typeof value !== "number") value = parseFloat(value); + return isNaN(value) ? "" : value.toFixed(decimals || 0).replace(format[0], format[1]).replace(/\B(?=(\d{3})+(?!\d))/g, format[0]); + }, + formatDate: function formatDate(dateObj, isDuration, _format) { + // copied from js-controller/lib/adapter.js + if ((typeof isDuration === 'string' && isDuration.toLowerCase() === 'duration') || isDuration === true) { + isDuration = true; + } + if (typeof isDuration !== 'boolean') { + _format = isDuration; + isDuration = false; + } + + if (!dateObj) return ''; + var type = typeof dateObj; + if (type === 'string') dateObj = new Date(dateObj); + + if (type !== 'object') { + var j = parseInt(dateObj, 10); + if (j == dateObj) { + // may this is interval + if (j < 946681200) { + isDuration = true; + dateObj = new Date(dateObj); + } else { + // if less 2000.01.01 00:00:00 + dateObj = (j < 946681200000) ? new Date(j * 1000) : new Date(j); + } + } else { + dateObj = new Date(dateObj); + } + } + var format = _format || this.dateFormat || 'DD.MM.YYYY'; + + if (isDuration) dateObj.setMilliseconds(dateObj.getMilliseconds() + dateObj.getTimezoneOffset() * 60 * 1000); + + var validFormatChars = 'YJГMМDTДhSчmмsс'; + var s = ''; + var result = ''; + + function put(s) { + var v = ''; + switch (s) { + case 'YYYY': + case 'JJJJ': + case 'ГГГГ': + case 'YY': + case 'JJ': + case 'ГГ': + v = dateObj.getFullYear(); + if (s.length === 2) v %= 100; + break; + case 'MM': + case 'M': + case 'ММ': + case 'М': + v = dateObj.getMonth() + 1; + if ((v < 10) && (s.length === 2)) v = '0' + v; + break; + case 'DD': + case 'TT': + case 'D': + case 'T': + case 'ДД': + case 'Д': + v = dateObj.getDate(); + if ((v < 10) && (s.length === 2)) v = '0' + v; + break; + case 'hh': + case 'SS': + case 'h': + case 'S': + case 'чч': + case 'ч': + v = dateObj.getHours(); + if ((v < 10) && (s.length === 2)) v = '0' + v; + break; + case 'mm': + case 'm': + case 'мм': + case 'м': + v = dateObj.getMinutes(); + if ((v < 10) && (s.length === 2)) v = '0' + v; + break; + case 'ss': + case 's': + case 'cc': + case 'c': + v = dateObj.getSeconds(); + if ((v < 10) && (s.length === 2)) v = '0' + v; + v = v.toString(); + break; + case 'sss': + case 'ссс': + v = dateObj.getMilliseconds(); + if (v < 10) { + v = '00' + v; + } else if (v < 100) { + v = '0' + v; + } + v = v.toString(); + } + return result += v; + } + + for (var i = 0; i < format.length; i++) { + if (validFormatChars.indexOf(format[i]) >= 0) + s += format[i]; + else { + put(s); + s = ''; + result += format[i]; + } + } + put(s); + return result; + }, + extractBinding: function (format) { + if (this.editMode || !format) return null; + if (this.bindingsCache[format]) return JSON.parse(JSON.stringify(this.bindingsCache[format])); + + var result = extractBinding(format); + + // cache bindings + if (result) { + this.bindingsCache = this.bindingsCache || {}; + this.bindingsCache[format] = JSON.parse(JSON.stringify(result)); + } + + return result; + }, + getSpecialValues: function (name, view, wid, widget) { + switch (name) { + case 'username.val': + return this.user; + case 'login.val': + return this.loginRequired; + case 'instance.val': + return this.instance; + case 'language.val': + return this.language; + case 'wid.val': + return wid; + case 'wname.val': + return widget && (widget.data.name || wid); + case 'view.val': + return view; + default: + return undefined; + } + }, + formatBinding: function (format, view, wid, widget) { + var oids = this.extractBinding(format); + for (var t = 0; t < oids.length; t++) { + var value; + if (oids[t].visOid) { + value = this.getSpecialValues(oids[t].visOid, view, wid, widget); + if (value === undefined) { + value = this.states.attr(oids[t].visOid); + } + } + if (oids[t].operations) { + for (var k = 0; k < oids[t].operations.length; k++) { + switch (oids[t].operations[k].op) { + case 'eval': + var string = '';//'(function() {'; + for (var a = 0; a < oids[t].operations[k].arg.length; a++) { + if (!oids[t].operations[k].arg[a].name) continue; + value = this.getSpecialValues(oids[t].operations[k].arg[a].visOid, view, wid, widget); + if (value === undefined) { + value = this.states.attr(oids[t].operations[k].arg[a].visOid); + } + string += 'var ' + oids[t].operations[k].arg[a].name + ' = "' + value + '";'; + } + var formula = oids[t].operations[k].formula; + if (formula && formula.indexOf('widget.') !== -1) { + string += 'var widget = ' + JSON.stringify(widget) + ';'; + } + string += 'return ' + oids[t].operations[k].formula + ';'; + //string += '}())'; + try { + value = new Function(string)(); + } catch (e) { + console.error('Error in eval[value] : ' + format); + console.error('Error in eval[script]: ' + string); + console.error('Error in eval[error] : ' + e); + value = 0; + } + break; + case '*': + if (oids[t].operations[k].arg !== undefined) { + value = parseFloat(value) * oids[t].operations[k].arg; + } + break; + case '/': + if (oids[t].operations[k].arg !== undefined) { + value = parseFloat(value) / oids[t].operations[k].arg; + } + break; + case '+': + if (oids[t].operations[k].arg !== undefined) { + value = parseFloat(value) + oids[t].operations[k].arg; + } + break; + case '-': + if (oids[t].operations[k].arg !== undefined) { + value = parseFloat(value) - oids[t].operations[k].arg; + } + break; + case '%': + if (oids[t].operations[k].arg !== undefined) { + value = parseFloat(value) % oids[t].operations[k].arg; + } + break; + case 'round': + if (oids[t].operations[k].arg === undefined) { + value = Math.round(parseFloat(value)); + } else { + value = parseFloat(value).toFixed(oids[t].operations[k].arg); + } + break; + case 'pow': + if (oids[t].operations[k].arg === undefined) { + value = Math.pow(parseFloat(value), 2); + } else { + value = Math.pow(parseFloat(value), oids[t].operations[k].arg); + } + break; + case 'sqrt': + value = Math.sqrt(parseFloat(value)); + break; + case 'hex': + value = Math.round(parseFloat(value)).toString(16); + break; + case 'hex2': + value = Math.round(parseFloat(value)).toString(16); + if (value.length < 2) value = '0' + value; + break; + case 'HEX': + value = Math.round(parseFloat(value)).toString(16).toUpperCase(); + break; + case 'HEX2': + value = Math.round(parseFloat(value)).toString(16).toUpperCase(); + if (value.length < 2) value = '0' + value; + break; + case 'value': + value = this.formatValue(value, parseInt(oids[t].operations[k].arg, 10)); + break; + case 'array': + value = oids[t].operations[k].arg [~~value]; + break; + case 'date': + value = this.formatDate(value, oids[t].operations[k].arg); + break; + case 'min': + value = parseFloat(value); + value = (value < oids[t].operations[k].arg) ? oids[t].operations[k].arg : value; + break; + case 'max': + value = parseFloat(value); + value = (value > oids[t].operations[k].arg) ? oids[t].operations[k].arg : value; + break; + case 'random': + if (oids[t].operations[k].arg === undefined) { + value = Math.random(); + } else { + value = Math.random() * oids[t].operations[k].arg; + } + break; + case 'floor': + value = Math.floor(parseFloat(value)); + break; + case 'ceil': + value = Math.ceil(parseFloat(value)); + break; + } //switch + } + } //if for + format = format.replace(oids[t].token, value); + }//for + format = format.replace(/{{/g, '{').replace(/}}/g, '}'); + return format; + }, + findNearestResolution: function (resultRequiredOrX, height) { + var w; + var h; + if (height !== undefined) { + w = resultRequiredOrX; + h = height; + resultRequiredOrX = false; + } else { + w = $(window).width(); + h = $(window).height(); + } + var result = null; + var views = []; + var difference = 10000; + + // First find all with best fitting width + for (var view in this.views) { + if (!this.views.hasOwnProperty(view)) continue; + if (view === '___settings') continue; + if (this.views[view].settings && this.views[view].settings.useAsDefault) { + // If difference less than 20% + if (Math.abs(this.views[view].settings.sizex - w) / this.views[view].settings.sizex < 0.2) { + views.push(view); + } + } + } + + for (var i = 0; i < views.length; i++) { + if (Math.abs(this.views[views[i]].settings.sizey - h) < difference) { + result = views[i]; + difference = Math.abs(this.views[views[i]].settings.sizey - h); + } + } + + // try to find by ratio + if (!result) { + var ratio = w / h; + difference = 10000; + + for (var view_ in this.views) { + if (!this.views.hasOwnProperty(view_)) continue; + if (view_ === '___settings') continue; + if (this.views[view_].settings && this.views[view_].settings.useAsDefault) { + // If difference less than 20% + if (this.views[view_].settings.sizey && Math.abs(ratio - (this.views[view_].settings.sizex / this.views[view_].settings.sizey)) < difference) { + result = view_; + difference = Math.abs(ratio - (this.views[view_].settings.sizex / this.views[view_].settings.sizey)); + } + } + } + } + + if (!result && resultRequiredOrX) { + for (var view__ in this.views) { + if (!this.views.hasOwnProperty(view__)) continue; + if (view__ === '___settings') continue; + return view__; + } + } + + return result; + }, + orientationChange: function () { + if (this.resolutionTimer) return; + var that = this; + this.resolutionTimer = setTimeout(function () { + that.resolutionTimer = null; + var view = that.findNearestResolution(); + if (view && view !== that.activeView) { + that.changeView(view, view); + } + }, 200); + }, + detectBounce: function (el, isUp) { + if (!this.isTouch) return false; + + // Protect against two events + var now = Date.now(); + //console.log('gclick: ' + this.lastChange + ' ' + (now - this.lastChange)); + if (this.lastChange && now - this.lastChange < this.debounceInterval) { + //console.log('gclick: filtered'); + return true; + } + var $el = $(el); + var tag = $(el).prop('tagName').toLowerCase(); + while (tag !== 'div') { + $el = $el.parent(); + tag = $el.prop('tagName').toLowerCase(); + } + var lastClick = $el.data(isUp ? 'lcu' : 'lc'); + //console.log('click: ' + lastClick + ' ' + (now - lastClick)); + if (lastClick && now - lastClick < this.debounceInterval) { + //console.log('click: filtered'); + return true; + } + $el.data(isUp ? 'lcu' : 'lc', now); + return false; + }, + createDemoStates: function () { + // Create demo variables + this.states.attr({'demoTemperature.val': 25.4}); + this.states.attr({'demoHumidity.val': 55}); + }, + getHistory: function (id, options, callback) { + // Possible options: + // - **instance - (mandatory) sql.x or history.y + // - **start** - (optional) time in ms - *Date.now()*' + // - **end** - (optional) time in ms - *Date.now()*', by default is (now + 5000 seconds) + // - **step** - (optional) used in aggregate (m4, max, min, average, total) step in ms of intervals + // - **count** - number of values if aggregate is 'onchange' or number of intervals if other aggregate method. Count will be ignored if step is set. + // - **from** - if *from* field should be included in answer + // - **ack** - if *ack* field should be included in answer + // - **q** - if *q* field should be included in answer + // - **addId** - if *id* field should be included in answer + // - **limit** - do not return more entries than limit + // - **ignoreNull** - if null values should be include (false), replaced by last not null value (true) or replaced with 0 (0) + // - **aggregate** - aggregate method: + // - *minmax* - used special algorithm. Splice the whole time range in small intervals and find for every interval max, min, start and end values. + // - *max* - Splice the whole time range in small intervals and find for every interval max value and use it for this interval (nulls will be ignored). + // - *min* - Same as max, but take minimal value. + // - *average* - Same as max, but take average value. + // - *total* - Same as max, but calculate total value. + // - *count* - Same as max, but calculate number of values (nulls will be calculated). + // - *none* - no aggregation + + this.conn.getHistory(id, options, callback); + }, + destroyView: function (viewDiv, view) { + var $view = $('#visview_' + viewDiv); + + console.debug('Destroy ' + view); + + // Get all widgets and try to destroy them + for (var wid in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(wid)) continue; + this.destroyWidget(viewDiv, view, wid); + } + + $view.remove(); + this.unsubscribeStates(view); + }, + findAndDestroyViews: function () { + if (this.destroyTimeout) { + clearTimeout(this.destroyTimeout); + this.destroyTimeout = null; + } + var containers = []; + var $createdViews = $('.vis-view'); + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + if (this.views[view].settings.alwaysRender || view === this.activeView) { + if (containers.indexOf(view) === -1) containers.push(view); + var $containers = $('#visview_' + view).find('.vis-view-container'); + $containers.each(function () { + var cview = $(this).attr('data-vis-contains'); + if (containers.indexOf(cview) === -1) containers.push(cview); + }); + // check dialogs too + var $dialogs = $('.vis-widget-dialog'); + $dialogs.each(function () { + if ($(this).is(':visible')) { + var $containers = $(this).find('.vis-view-container'); + $containers.each(function () { + var cview = $(this).attr('data-vis-contains'); + if (containers.indexOf(cview) === -1) containers.push(cview); + }); + } + }); + } + } + var that = this; + $createdViews.each(function () { + var $this = $(this); + var view = $this.data('view'); + var viewDiv = $this.attr('id').substring('visview_'.length); + // If this view is used as container + if (containers.indexOf(viewDiv) !== -1) return; + if ($this.hasClass('vis-edit-group')) return; + + if ($this.data('persistent')) return; + + that.destroyView(viewDiv, view); + }); + }, + destroyUnusedViews: function () { + if (this.destroyTimeout) clearTimeout(this.destroyTimeout); + var timeout = 30000; + if (this.views.___settings && this.views.___settings.destroyViewsAfter !== undefined) { + timeout = this.views.___settings.destroyViewsAfter * 1000; + } + if (timeout) { + this.destroyTimeout = _setTimeout(function (that) { + that.destroyTimeout = null; + that.findAndDestroyViews(); + }, timeout, this); + } + }, + generateInstance: function () { + if (typeof storage !== 'undefined') { + this.instance = (Math.random() * 4294967296).toString(16); + this.instance = '0000000' + this.instance; + this.instance = this.instance.substring(this.instance.length - 8); + $('#vis_instance').val(this.instance); + storage.set(this.storageKeyInstance, this.instance); + } + }, + subscribeStates: function (view, callback) { + if (!view || this.editMode) { + if (callback) callback(); + return; + } + + // view yet active + if (this.subscribing.activeViews.indexOf(view) !== -1) { + if (callback) callback(); + return; + } + + this.subscribing.activeViews.push(view); + + this.subscribing.byViews[view] = this.subscribing.byViews[view] || []; + + // subscribe + var oids = []; + for (var i = 0; i < this.subscribing.byViews[view].length; i++) { + if (this.subscribing.active.indexOf(this.subscribing.byViews[view][i]) === -1) { + this.subscribing.active.push(this.subscribing.byViews[view][i]); + oids.push(this.subscribing.byViews[view][i]); + } + } + if (oids.length) { + var that = this; + console.debug('[' + Date.now() + '] Request ' + oids.length + ' states.'); + this.conn.getStates(oids, function (error, data) { + if (error) that.showError(error); + + that.updateStates(data); + that.conn.subscribe(oids); + if (callback) callback(); + }); + } else { + if (callback) callback(); + } + }, + unsubscribeStates: function (view) { + if (!view || this.editMode) return; + + // view yet active + var pos = this.subscribing.activeViews.indexOf(view); + if (pos === -1) return; + this.subscribing.activeViews.splice(pos, 1); + + // unsubscribe + var oids = []; + // check every OID + for (var i = 0; i < this.subscribing.byViews[view].length; i++) { + var id = this.subscribing.byViews[view][i]; + + pos = this.subscribing.active.indexOf(id); + if (pos !== -1) { + var isUsed = false; + // Is OID is used something else + for (var v = 0; v < this.subscribing.activeViews.length; v++) { + if (this.subscribing.byViews[this.subscribing.activeViews[v]].indexOf(id) !== -1) { + isUsed = true; + break; + } + } + if (!isUsed) { + oids.push(id); + this.subscribing.active.splice(pos, 1); + } + } + } + if (oids.length) this.conn.unsubscribe(oids); + }, + updateState: function (id, state) { + if (this.editMode) { + this.states[id + '.val'] = state.val; + this.states[id + '.ts'] = state.ts; + this.states[id + '.ack'] = state.ack; + this.states[id + '.lc'] = state.lc; + if (state.q !== undefined) this.states[id + '.q'] = state.q; + } else { + var o = {}; + // Check new model + o[id + '.val'] = state.val; + o[id + '.ts'] = state.ts; + o[id + '.ack'] = state.ack; + o[id + '.lc'] = state.lc; + if (state.q !== undefined) o[id + '.q'] = state.q; + try { + this.states.attr(o); + } catch (e) { + this.conn.logError('Error: can\'t create states object for ' + id + '(' + e + '): ' + JSON.stringify(e.stack)); + } + } + + if (!this.editMode && this.visibility[id]) { + for (var k = 0; k < this.visibility[id].length; k++) { + var mmWidget = document.getElementById(this.visibility[id][k].widget); + if (!mmWidget) continue; + if (this.isWidgetHidden(this.visibility[id][k].view, this.visibility[id][k].widget, state.val) || + this.isWidgetFilteredOut(this.visibility[id][k].view, this.visibility[id][k].widget)) { + $(mmWidget).hide(); + if (mmWidget && + mmWidget._customHandlers && + mmWidget._customHandlers.onHide) { + mmWidget._customHandlers.onHide(mmWidget, id); + } + } else { + $(mmWidget).show(); + if (mmWidget && + mmWidget._customHandlers && + mmWidget._customHandlers.onShow) { + mmWidget._customHandlers.onShow(mmWidget, id); + } + } + } + } + + // process signals + if (!this.editMode && this.signals[id]) { + for (var s = 0; s < this.signals[id].length; s++) { + var signal = this.signals[id][s]; + var mWidget = document.getElementById(signal.widget); + + if (!mWidget) continue; + + if (this.isSignalVisible(signal.view, signal.widget, signal.index, state.val)) { + $(mWidget).find('.vis-signal[data-index="' + signal.index + '"]').show(); + } else { + $(mWidget).find('.vis-signal[data-index="' + signal.index + '"]').hide(); + } + } + } + + // Process last update + if (!this.editMode && this.lastChanges[id]) { + for (var l = 0; l < this.lastChanges[id].length; l++) { + var update = this.lastChanges[id][l]; + var uWidget = document.getElementById(update.widget); + if (uWidget) { + var $lc = $(uWidget).find('.vis-last-change'); + $lc.html(this.binds.basic.formatDate($lc.data('type') === 'last-change' ? state.lc : state.ts, $lc.data('format'), $lc.data('interval') === 'true')); + } + } + } + + // Bindings on every element + if (!this.editMode && this.bindings[id]) { + for (var i = 0; i < this.bindings[id].length; i++) { + var widget = this.views[this.bindings[id][i].view].widgets[this.bindings[id][i].widget]; + var value = this.formatBinding(this.bindings[id][i].format, this.bindings[id][i].view, this.bindings[id][i].widget, widget); + + widget[this.bindings[id][i].type][this.bindings[id][i].attr] = value; + if (this.widgets[this.bindings[id][i].widget] && this.bindings[id][i].type === 'data') { + this.widgets[this.bindings[id][i].widget][this.bindings[id][i].type + '.' + this.bindings[id][i].attr] = value; + } + this.reRenderWidget(this.bindings[id][i].view, this.bindings[id][i].view, this.bindings[id][i].widget); + } + } + + // Inform other widgets, that do not support canJS + for (var j = 0, len = this.onChangeCallbacks.length; j < len; j++) { + this.onChangeCallbacks[j].callback(this.onChangeCallbacks[j].arg, id, state.val, state.ack); + } + if (this.editMode && $.fn.selectId) $.fn.selectId('stateAll', id, state); + }, + updateStates: function (data) { + if (data) { + for (var id in data) { + if (!data.hasOwnProperty(id)) continue; + var obj = data[id]; + if (!obj) continue; + + try { + if (this.editMode) { + this.states[id + '.val'] = obj.val; + this.states[id + '.ts'] = obj.ts; + this.states[id + '.ack'] = obj.ack; + this.states[id + '.lc'] = obj.lc; + if (obj.q !== undefined) this.states[id + '.q'] = obj.q; + } else { + var oo = {}; + oo[id + '.val'] = obj.val; + oo[id + '.ts'] = obj.ts; + oo[id + '.ack'] = obj.ack; + oo[id + '.lc'] = obj.lc; + if (obj.q !== undefined) oo[id + '.q'] = obj.q; + this.states.attr(oo); + } + } catch (e) { + this.conn.logError('Error: can\'t create states object for ' + id + '(' + e + ')'); + } + + if (!this.editMode && this.bindings[id]) { + for (var i = 0; i < this.bindings[id].length; i++) { + var widget = this.views[this.bindings[id][i].view].widgets[this.bindings[id][i].widget]; + widget[this.bindings[id][i].type][this.bindings[id][i].attr] = this.formatBinding(this.bindings[id][i].format, this.bindings[id][i].view, this.bindings[id][i].widget, widget); + } + } + } + } + }, + updateIframeZoom: function (zoom) { + if (zoom === undefined) zoom = document.body.style.zoom; + if (zoom) { + $('iframe').each(function () { + if (this.contentWindow.document.body) { + this.contentWindow.document.body.style.zoom = zoom; + } + }).unbind('onload').load(function () { + if (this.contentWindow.document.body) { + this.contentWindow.document.body.style.zoom = zoom; + } + }); + } + } +}; + +// WebApp Cache Management +if ('applicationCache' in window) { + window.addEventListener('load', function (/* e */) { + window.applicationCache.addEventListener('updateready', function (e) { + if (window.applicationCache.status === window.applicationCache.UPDATEREADY) { + vis.showWaitScreen(true, null, _('Update found, loading new Files...'), 100); + $('#waitText').attr('id', 'waitTextDisabled'); + $('.vis-progressbar').hide(); + try { + window.applicationCache.swapCache(); + } catch (_e) { + servConn.logError('Cannot execute window.applicationCache.swapCache - ' + _e); + } + setTimeout(function () { + window.location.reload(); + }, 1000); + } + }, false); + }, false); +} + +// Parse Querystring +window.onpopstate = function () { + var match, + pl = /\+/g, + search = /([^&=]+)=?([^&]*)/g, + decode = function (s) { + return decodeURIComponent(s.replace(pl, ' ')); + }, + query = window.location.search.substring(1); + vis.urlParams = {}; + + while ((match = search.exec(query))) { + vis.urlParams[decode(match[1])] = decode(match[2]); + } + + vis.editMode = ( + window.location.href.indexOf('edit.html') !== -1 || + window.location.href.indexOf('edit.full.html') !== -1 || + window.location.href.indexOf('edit.src.html') !== -1 || + vis.urlParams.edit === ''); +}; +window.onpopstate(); + +if (!vis.editMode) { + // Protection after view change + $(window).on('click touchstart mousedown', function (e) { + if (Date.now() - vis.lastChange < vis.debounceInterval) { + e.stopPropagation(); + e.preventDefault(); + return false; + } + }); + /*$(window).on('touchend mouseup', function () { + vis.lastChange = null; + var $log = $('#w00039'); + var $log1 = $('#w00445'); + $log.append('
gclick touchend: ' + vis.lastChange); + $log1.append('
gclick touchend: ' + vis.lastChange); + });*/ +} + +function main($, onReady) { + // parse arguments + var args = document.location.href.split('?')[1]; + vis.args = {}; + if (args) { + vis.projectPrefix = 'main/'; + var pos = args.indexOf('#'); + if (pos !== -1) { + args = args.substring(0, pos); + } + args = args.split('&'); + for (var a = 0; a < args.length; a++) { + var parts = args[a].split('='); + vis.args[parts[0]] = parts[1]; + if (!parts[1]) vis.projectPrefix = parts[0] + '/'; + } + if (vis.args.project) vis.projectPrefix = vis.args.project + '/'; + } + // If cordova project => take cordova project name + if (typeof app !== 'undefined') vis.projectPrefix = app.settings.project ? app.settings.project + '/' : null; + + // On some platforms, the can.js is not immediately ready + vis.states = new can.Map({ + 'nothing_selected.val': null + }); + + if (vis.editMode) { + vis.states.__attrs = vis.states.attr; + vis.states.attr = function (attr, val) { + var type = typeof attr; + if (type !== 'string' && type !== 'number') { + for (var o in attr) { + // allow only dev1, dev2, ... to be bound + if (o && attr.hasOwnProperty(o) && o.match(/^dev\d+(.val|.ack|.tc|.lc)+/)) { + return this.__attrs(attr, val); + } + } + } else if (arguments.length === 1 && attr) { + if (attr.match(/^dev\d+(.val|.ack|.tc|.lc)+/)) { + can.__reading(this, attr); + return this._get(attr); + } else { + return vis.states[attr]; + } + } else { + console.log('This is ERROR!'); + this._set(attr, val); + return this; + } + }; + + // binding + vis.states.___bind = vis.states.bind; + vis.states.bind = function (id, callback) { + // allow only dev1, dev2, ... to be bound + if (id && id.match(/^dev\d+(.val|.ack|.tc|.lc)+/)) { + return vis.states.___bind(id, callback); + } + //console.log('ERROR: binding in edit mode is not allowed on ' + id); + }; + } + + // für iOS Safari - wirklich notwendig? + $('body').on('touchmove', function (e) { + if (!$(e.target).closest('body').length) e.preventDefault(); + }); + + vis.preloadImages(['img/disconnect.png']); + + /*$('#server-disconnect').dialog({ + modal: true, + closeOnEscape: false, + autoOpen: false, + dialogClass: 'noTitle', + width: 400, + height: 90 + });*/ + + $('.vis-version').html(vis.version); + + vis.showWaitScreen(true, null, _('Connecting to Server...') + '
', 0); + + function compareVersion(instVersion, availVersion) { + var instVersionArr = instVersion.replace(/beta/, '.').split('.'); + var availVersionArr = availVersion.replace(/beta/, '.').split('.'); + + var updateAvailable = false; + + for (var k = 0; k < 3; k++) { + instVersionArr[k] = parseInt(instVersionArr[k], 10); + if (isNaN(instVersionArr[k])) instVersionArr[k] = -1; + availVersionArr[k] = parseInt(availVersionArr[k], 10); + if (isNaN(availVersionArr[k])) availVersionArr[k] = -1; + } + + if (availVersionArr[0] > instVersionArr[0]) { + updateAvailable = true; + } else if (availVersionArr[0] === instVersionArr[0]) { + if (availVersionArr[1] > instVersionArr[1]) { + updateAvailable = true; + } else if (availVersionArr[1] === instVersionArr[1]) { + if (availVersionArr[2] > instVersionArr[2]) { + updateAvailable = true; + } + } + } + return updateAvailable; + } + + vis.conn = servConn; + + // old !!! + // First of all load project/vis-user.css + //$('#project_css').attr('href', '/' + vis.conn.namespace + '/' + vis.projectPrefix + 'vis-user.css'); + if (typeof app === 'undefined') { + $.ajax({ + url: 'css/vis-common-user.css', + type: 'GET', + dataType: 'html', + cache: vis.useCache, + success: function (data) { + if (data && typeof app !== 'undefined' && app.replaceFilesInViewsWeb) { + data = app.replaceFilesInViewsWeb(data); + } + + if (data || vis.editMode) $('head').append(''); + $(document).trigger('vis-common-user'); + }, + error: function (jqXHR, textStatus, errorThrown) { + vis.conn.logError('Cannot load vis-common-user.css - ' + errorThrown); + $('head').append(''); + $(document).trigger('vis-common-user'); + } + }); + + $.ajax({ + url: '/' + vis.conn.namespace + '/' + vis.projectPrefix + 'vis-user.css', + type: 'GET', + dataType: 'html', + cache: vis.useCache, + success: function (data) { + if (data && typeof app !== 'undefined' && app.replaceFilesInViewsWeb) { + data = app.replaceFilesInViewsWeb(data); + } + if (data || vis.editMode) { + $('head').append(''); + } + $(document).trigger('vis-user'); + }, + error: function (jqXHR, textStatus, errorThrown) { + vis.conn.logError('Cannot load /' + vis.conn.namespace + '/' + vis.projectPrefix + 'vis-user.css - ' + errorThrown); + $('head').append(''); + $(document).trigger('vis-user'); + } + }); + } + + function createIds(IDs, index, callback) { + if (typeof index === 'function') { + callback = index; + index = 0; + } + index = index || 0; + var j; + var now = Date.now(); + var obj = {}; + for (j = index; j < vis.subscribing.IDs.length && j < index + 100; j++) { + var _id = vis.subscribing.IDs[j]; + if (vis.states[_id + '.val'] === undefined) { + if (!_id || !_id.match(/^dev\d+$/)) { + console.log('Create inner vis object ' + _id); + } + if (vis.editMode) { + vis.states[_id + '.val'] = 'null'; + vis.states[_id + '.ts'] = now; + vis.states[_id + '.ack'] = false; + vis.states[_id + '.lc'] = now; + } else { + obj[_id + '.val'] = 'null'; + obj[_id + '.ts'] = now; + obj[_id + '.ack'] = false; + obj[_id + '.lc'] = now; + } + + if (!vis.editMode && vis.bindings[_id]) { + for (var k = 0; k < vis.bindings[_id].length; k++) { + var _widget = vis.views[vis.bindings[_id][k].view].widgets[vis.bindings[_id][k].widget]; + _widget[vis.bindings[_id][k].type][vis.bindings[_id][k].attr] = vis.formatBinding(vis.bindings[_id][k].format, vis.bindings[_id][k].view, vis.bindings[_id][k].widget, _widget); + } + } + } + } + try { + vis.states.attr(obj); + } catch (e) { + vis.conn.logError('Error: can\'t create states objects (' + e + ')'); + } + + if (j < vis.subscribing.IDs.length) { + setTimeout(function () { + createIds(IDs, j, callback); + }, 0) + } else { + callback(); + } + } + + function afterInit(error, onReady) { + if (error) { + console.log('Possibly not authenticated, wait for request from server'); + // Possibly not authenticated, wait for request from server + } else { + // Get user groups info + vis.conn.getGroups(function (err, userGroups) { + vis.userGroups = userGroups || {}; + // Get Server language + vis.conn.getConfig(function (err, config) { + systemLang = vis.args.lang || config.language || systemLang; + vis.language = systemLang; + vis.dateFormat = config.dateFormat; + vis.isFloatComma = config.isFloatComma; + // set moment language + if (typeof moment !== 'undefined') { + //moment.lang(vis.language); + moment.locale(vis.language); + } + translateAll(); + if (vis.isFirstTime) { + // Init edit dialog + if (vis.editMode && vis.editInit) vis.editInit(); + vis.isFirstTime = false; + vis.init(onReady); + } + }); + }); + + // If metaIndex required, load it + if (vis.editMode) { + /* socket.io */ + if (vis.isFirstTime) vis.showWaitScreen(true, _('Loading data objects...'), null, 20); + + // Read all data objects from server + vis.conn.getObjects(function (err, data) { + vis.objects = data; + // Detect if objects are loaded + for (var ob in data) { + if (data.hasOwnProperty(ob)) { + vis.objectSelector = true; + break; + } + } + if (vis.editMode && vis.objectSelector) { + vis.inspectWidgets(vis.activeViewDiv, vis.activeView, true); + } + }); + } + + //console.log((new Date()) + " socket.io reconnect"); + if (vis.isFirstTime) { + setTimeout(function () { + if (vis.isFirstTime) { + // Init edit dialog + if (vis.editMode && vis.editInit) vis.editInit(); + vis.isFirstTime = false; + vis.init(onReady); + } + }, 1000); + } + } + } + + vis.conn.init(null, { + mayReconnect: typeof app !== 'undefined' ? app.mayReconnect : null, + onAuthError: typeof app !== 'undefined' ? app.onAuthError : null, + onConnChange: function (isConnected) { + //console.log("onConnChange isConnected="+isConnected); + if (isConnected) { + //$('#server-disconnect').dialog('close'); + if (vis.isFirstTime) { + vis.conn.getVersion(function (version) { + if (version) { + if (compareVersion(version, vis.requiredServerVersion)) { + vis.showMessage(_('Warning: requires Server version %s - found Server version %s - please update Server.', vis.requiredServerVersion, version)); + } + } + //else { + // Possible not authenticated, wait for request from server + //} + }); + + vis.showWaitScreen(true, _('Loading data values...') + '
', null, 20); + } + + vis.conn.getLoggedUser(function (authReq, user) { + vis.user = user; + vis.loginRequired = authReq; + vis.states.attr({ + 'username.val' : vis.user, + 'login.val' : vis.loginRequired, + 'username' : vis.user, + 'login' : vis.loginRequired + }); + // first of all try to load views + vis.loadRemote(function () { + vis.subscribing.IDs = vis.subscribing.IDs || []; + vis.subscribing.byViews = vis.subscribing.byViews || {}; + + vis.conn.subscribe([vis.conn.namespace + '.control.instance', vis.conn.namespace + '.control.data', vis.conn.namespace + '.control.command']); + + // first of all add custom scripts + if (!vis.editMode && vis.views && vis.views.___settings) { + if (vis.views.___settings.scripts) { + var script = document.createElement('script'); + script.innerHTML = vis.views.___settings.scripts; + document.head.appendChild(script); + } + } + + // Read all states from server + console.debug('Request ' + (vis.editMode ? 'all' : vis.subscribing.active.length) + ' states.'); + vis.conn.getStates(vis.editMode ? null : vis.subscribing.active, function (error, data) { + if (error) vis.showError(error); + + vis.updateStates(data); + + if (vis.subscribing.active.length) { + vis.conn.subscribe(vis.subscribing.active); + } + // Create non-existing IDs + if (vis.subscribing.IDs) { + createIds(vis.subscribing.IDs, function () { + afterInit(error, onReady); + }); + } else { + afterInit(error, onReady); + } + }); + }); + }); + } else { + //console.log((new Date()) + " socket.io disconnect"); + //$('#server-disconnect').dialog('open'); + } + }, + onRefresh: function () { + window.location.reload(); + }, + onUpdate: function (id, state) { + _setTimeout(function (_id, _state) { + vis.updateState(_id, _state); + }, 0, id, state); + }, + onAuth: function (message, salt) { + if (vis.authRunning) { + return; + } + vis.authRunning = true; + var users; + if (visConfig.auth.users && visConfig.auth.users.length) { + users = ''; + } else { + users = ''; + } + + var text = ''; + + // Add the mask to body + $('body') + .append(text) + .append('
'); + + var loginBox = $('#login-box'); + + //Fade in the Popup + $(loginBox).fadeIn(300); + + //Set the center alignment padding + border see css style + var popMargTop = ($(loginBox).height() + 24) / 2; + var popMargLeft = ($(loginBox).width() + 24) / 2; + + $(loginBox).css({ + 'margin-top': -popMargTop, + 'margin-left': -popMargLeft + }); + + $('#login-mask').fadeIn(300); + // When clicking on the button close or the mask layer the popup closed + $('#login-password').keypress(function (e) { + if (e.which === 13) { + $('.login-button').trigger('click'); + } + }); + $('.login-button').bind('click', function () { + var user = $('#login-username').val(); + var pass = $('#login-password').val(); + $('#login_mask , .login-popup').fadeOut(300, function () { + $('#login-mask').remove(); + $('#login-box').remove(); + }); + setTimeout(function () { + vis.authRunning = false; + console.log('user ' + user + ', ' + pass + ' ' + salt); + vis.conn.authenticate(user, pass, salt); + }, 500); + return true; + }); + }, + onCommand: function (instance, command, data) { + var parts; + if (!instance || (instance !== vis.instance && instance !== 'FFFFFFFF' && instance.indexOf('*') === -1)) return false; + if (command) { + if (vis.editMode && command !== 'tts' && command !== 'playSound') return; + // external Commands + switch (command) { + case 'alert': + parts = data.split(';'); + vis.showMessage(parts[0], parts[1], parts[2]); + break; + case 'changedView': + // Do nothing + return false; + case 'changeView': + parts = data.split('/'); + if (parts[1]) { + // detect actual project + var actual = vis.projectPrefix ? vis.projectPrefix.substring(0, vis.projectPrefix.length - 1) : 'main'; + if (parts[0] !== actual) { + document.location.href = 'index.html?' + actual + '#' + parts[1]; + return; + } + } + var view = parts[1] || parts[0]; + vis.changeView(view, view); + break; + case 'refresh': + case 'reload': + setTimeout(function () { + window.location.reload(); + }, 1); + break; + case 'dialog': + case 'dialogOpen': + //noinspection JSJQueryEfficiency + $('#' + data + '_dialog').dialog('open'); + break; + case 'dialogClose': + //noinspection JSJQueryEfficiency + $('#' + data + '_dialog').dialog('close'); + break; + case 'popup': + window.open(data); + break; + case 'playSound': + setTimeout(function () { + var href; + if (data && data.match(/^http(s)?:\/\//)) { + href = data; + } else { + href = location.protocol + '//' + location.hostname + ':' + location.port + data; + } + // force read from server + href += '?' + Date.now(); + + if (typeof Audio !== 'undefined') { + var snd = new Audio(href); // buffers automatically when created + snd.play(); + } else { + //noinspection JSJQueryEfficiency + var $sound = $('#external_sound'); + if (!$sound.length) { + $('body').append(''); + $sound = $('#external_sound'); + } + $sound.attr('src', href); + document.getElementById('external_sound').play(); + } + }, 1); + break; + case 'tts': + if (typeof app !== 'undefined') { + app.tts(data); + } + break; + default: + vis.conn.logError('unknown external command ' + command); + } + } + + return true; + }, + onObjectChange: function(id, obj) { + if (!vis.objects || !vis.editMode) return; + if (obj) { + vis.objects[id] = obj; + } else { + if (vis.objects[id]) delete vis.objects[id]; + } + + if ($.fn.selectId) $.fn.selectId('objectAll', id, obj); + }, + onError: function (err) { + if (err.arg === 'vis.0.control.instance' || err.arg === 'vis.0.control.data' || err.arg === 'vis.0.control.command') { + console.warn('Cannot set ' + err.arg + ', because of insufficient permissions'); + } else { + vis.showMessage(_('Cannot execute %s for %s, because of insufficient permissions', err.command, err.arg), _('Insufficient permissions'), 'alert', 600); + } + } + }, vis.editMode, vis.editMode); + + if (!vis.editMode) { + // Listen for resize changes + window.addEventListener('orientationchange', function () { + vis.orientationChange(); + }, false); + window.addEventListener('resize', function () { + vis.orientationChange(); + }, false); + } + + //vis.preloadImages(["../../lib/css/themes/jquery-ui/redmond/images/modalClose.png"]); + vis.initWakeUp(); +} + +// Start of initialisation: main () +if (typeof app === 'undefined') { + $(document).ready(function () { + main(jQuery); + }); +} + +// IE8 indexOf compatibility +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (obj, start) { + for (var i = (start || 0), j = this.length; i < j; i++) { + if (this[i] === obj) { + return i; + } + } + return -1; + }; +} + +function _setTimeout(func, timeout, arg1, arg2, arg3, arg4, arg5, arg6) { + return setTimeout(function () { + func(arg1, arg2, arg3, arg4, arg5, arg6); + }, timeout); +} +function _setInterval(func, timeout, arg1, arg2, arg3, arg4, arg5, arg6) { + return setInterval(function () { + func(arg1, arg2, arg3, arg4, arg5, arg6); + }, timeout); +} + +/*if (window.location.search === '?edit') { + window.alert(_('please use /vis/edit.html instead of /vis/?edit')); + location.href = './edit.html' + window.location.hash; + }*/ + +// TODO find out if iPad 1 has map or not. +// Production steps of ECMA-262, Edition 5, 15.4.4.19 +// Reference: http://es5.github.io/#x15.4.4.19 +if (!Array.prototype.map) { + Array.prototype.map = function(callback, thisArg) { + + var T, A, k; + + if (this === null || this === undefined || this === 0) { + throw new TypeError('this is null or not defined'); + } + + // 1. Let O be the result of calling ToObject passing the |this| + // value as the argument. + var O = Object(this); + + // 2. Let lenValue be the result of calling the Get internal + // method of O with the argument "length". + // 3. Let len be ToUint32(lenValue). + var len = O.length >>> 0; + + // 4. If IsCallable(callback) is false, throw a TypeError exception. + // See: http://es5.github.com/#x9.11 + if (typeof callback !== 'function') { + throw new TypeError(callback + ' is not a function'); + } + + // 5. If thisArg was supplied, let T be thisArg; else let T be undefined. + if (arguments.length > 1) { + T = thisArg; + } + + // 6. Let A be a new array created as if by the expression new Array(len) + // where Array is the standard built-in constructor with that name and + // len is the value of len. + A = new Array(len); + + // 7. Let k be 0 + k = 0; + + // 8. Repeat, while k < len + while (k < len) { + + var kValue, mappedValue; + + // a. Let Pk be ToString(k). + // This is implicit for LHS operands of the in operator + // b. Let kPresent be the result of calling the HasProperty internal + // method of O with argument Pk. + // This step can be combined with c + // c. If kPresent is true, then + if (k in O) { + + // i. Let kValue be the result of calling the Get internal + // method of O with argument Pk. + kValue = O[k]; + + // ii. Let mappedValue be the result of calling the Call internal + // method of callback with T as the this value and argument + // list containing kValue, k, and O. + mappedValue = callback.call(T, kValue, k, O); + + // iii. Call the DefineOwnProperty internal method of A with arguments + // Pk, Property Descriptor + // { Value: mappedValue, + // Writable: true, + // Enumerable: true, + // Configurable: true }, + // and false. + + // In browsers that support Object.defineProperty, use the following: + // Object.defineProperty(A, k, { + // value: mappedValue, + // writable: true, + // enumerable: true, + // configurable: true + // }); + + // For best browser support, use the following: + A[k] = mappedValue; + } + // d. Increase k by 1. + k++; + } + + // 9. return A + return A; + }; +} diff --git a/www/js/visAbout.js b/www/js/visAbout.js new file mode 100644 index 0000000..15e02c9 --- /dev/null +++ b/www/js/visAbout.js @@ -0,0 +1,17 @@ +function fillAbout() { + var html = ''; + html += ''; + + html += '

Copyright © 2013-2016 Bluefox,'; + html += ' hobbyquaker

'; + + html += '

CC BY-NC License 4.0

'; + html += '

' + _('license5') + '

'; + html += '

' + _('icons8') + '

'; + return html; +} diff --git a/www/js/visEdit.js b/www/js/visEdit.js new file mode 100644 index 0000000..16a3e87 --- /dev/null +++ b/www/js/visEdit.js @@ -0,0 +1,7001 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ + +// visEdit - the vis Editor +/* jshint browser:true */ +/* global document */ +/* global console */ +/* global session */ +/* global window */ +/* global location */ +/* global setTimeout */ +/* global clearTimeout */ +/* global systemLang:true */ +/* global io */ +/* global $ */ +/* global vis:true */ +/* global local */ +/* global can */ +/* global colorSelect */ +/* global storage */ +/* global html2canvas */ +/* global translateAll */ +/* global ace */ +/* global _ */ +/* jshint -W097 */// jshint strict:false + +'use strict'; + +vis = $.extend(true, vis, { + $copyWidgetSelectView: null, + undoHistoryMaxLength: 50, + $selectView: null, + $selectActiveWidgets: null, + activeWidgets: [], + oldActiveWidgets: [], + isStealCss: false, + gridWidth: undefined, + clipboard: null, + undoHistory: [], + selectable: true, + groupsState: {'fixed': true, 'common': true}, + // Array with all objects (Descriptions of objects) + objects: {}, + config: {}, + objectSelector: false, // if object select ID activated + alignIndex: 0, + alignType: '', + widgetAccordeon: false, + saveRemoteActive: 0, + editIcons: { + filter: 'vis-preview-filter', + ctrl: 'vis-preview-control', + control: 'vis-preview-control', + navigation: 'vis-preview-navigation', + nav: 'vis-preview-navigation', + timestamp: 'vis-preview-timestamp', + dialog: 'vis-preview-dialog', + static: 'vis-preview-static', + val: 'vis-preview-val', + value: 'vis-preview-val', + container: 'vis-preview-container', + rgb: 'vis-preview-rgb', + stateful: 'vis-preview-stateful', + table: 'vis-preview-table', + tools: 'vis-preview-tools', + bar: 'vis-preview-bar', + temperature: 'vis-preview-temperature', + window: 'vis-preview-window', + shutter: 'vis-preview-shutter', + door: 'vis-preview-door', + lamp: 'vis-preview-lamp', + checkbox: 'vis-preview-checkbox', // boolean value with control + dimmer: 'vis-preview-dimmer', + state: 'vis-preview-state', // boolean value + lock: 'vis-preview-lock' + }, + removeUnusedFields: function () { + var regExp = /^gestures-/; + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + for (var id in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(id)) continue; + // Check all attributes + var data = this.views[view].widgets[id].data; + for (var attr in data) { + if (!data.hasOwnProperty(attr)) continue; + if ((data[attr] === '' || data[attr] === null) && regExp.test(attr)) { + delete data[attr]; + } + } + } + } + }, + saveRemote: function (mode, callback) { + // remove all unused fields + this.removeUnusedFields(); + + if (typeof mode === 'function') { + callback = mode; + mode = null; + } + if (typeof app !== 'undefined') { + console.warn('Do not allow save of views from Cordova!'); + if (typeof callback === 'function') callback(); + return; + } + + var that = this; + if (this.permissionDenied) { + if (this.showHint) this.showHint(_('Cannot save file "%s": ', that.projectPrefix + 'vis-views.json') + _('permissionError'), + 5000, 'ui-state-error'); + if (typeof callback === 'function') callback(); + return; + } + + if (this.saveRemoteActive % 10) { + this.saveRemoteActive--; + setTimeout(function () { + that.saveRemote(mode, callback); + }, 1000); + } else { + if (!this.saveRemoteActive) this.saveRemoteActive = 30; + if (this.saveRemoteActive === 10) { + console.log('possible no connection'); + this.saveRemoteActive = 0; + return; + } + // Sync widget before it will be saved + if (this.activeWidgets) { + for (var t = 0; t < this.activeWidgets.length; t++) { + if (this.activeWidgets[t].indexOf('_') !== -1 && this.syncWidgets) { + this.syncWidgets(this.activeWidgets); + break; + } + } + } + // sort view names + var keys = []; + var k; + for (k in this.views) { + if (!this.views.hasOwnProperty(k)) continue; + if (k === '___settings') continue; + keys.push(k); + } + + // case insensitive sorting + keys.sort(function (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }); + var views = {}; + views.___settings = this.views.___settings; + for (k = 0; k < keys.length; k++) { + views[keys[k]] = this.views[keys[k]]; + } + this.views = views; + + // replace all bounded variables with initial values + var viewsToSave = JSON.parse(JSON.stringify(this.views)); + for (var b in this.bindings) { + if (!this.bindings.hasOwnProperty(b)) continue; + for (var h = 0; h < this.bindings[b].length; h++) { + try { + if (this.bindings[b][h].systemOid && this.bindings[b][h].systemOid.match(/^dev\d+$/)) { + // if widget still exists + if (viewsToSave[this.bindings[b][h].view].widgets[this.bindings[b][h].widget]) { + viewsToSave[this.bindings[b][h].view].widgets[this.bindings[b][h].widget][this.bindings[b][h].type][this.bindings[b][h].attr] = this.bindings[b][h].format; + } + } + } catch (e) { + console.warn('error by saving of binding: ' + this.bindings[b][h].view) + } + } + } + viewsToSave = JSON.stringify(viewsToSave, null, 2); + if (this.lastSave === viewsToSave) { + if (typeof callback === 'function') callback(null); + return; + } + + this.conn.writeFile(this.projectPrefix + 'vis-views.json', viewsToSave, mode, function (err) { + if (err) { + if (err === 'permissionError') { + that.permissionDenied = true; + } + that.showMessage(_('Cannot save file "%s": ', that.projectPrefix + 'vis-views.json') + _(err), _('Error'), 'alert', 430); + } else { + that.lastSave = viewsToSave; + } + that.saveRemoteActive = 0; + if (typeof callback === 'function') callback(err); + + // If not yet checked => check if project css file exists + if (!that.cssChecked) { + that.conn.readFile(that.projectPrefix + 'vis-user.css', function (_err, data) { + that.cssChecked = true; + // Create vis-user.css file if not exist + if (err !== 'permissionError' && (_err || data === null || data === undefined)) { + // Create empty css file + that.conn.writeFile(that.projectPrefix + 'vis-user.css', '', function (___err) { + if (___err) { + that.showMessage(_('Cannot create file %s: ', 'vis-user.css') + _(___err), _('Error'), 'alert'); + } + }); + } + }); + } + }); + } + }, + editShowHideViewBackground: function (view, isInit) { + if (!this.views[view].settings) { + this.views[view].settings = {}; + } + if (this.groupsState['view-css-background']) { + var $back = $('#inspect_view_css_background'); + if ($('#inspect_view_css_only_background').prop('checked')) { + this.views[view].settings.useBackground = true; + var that = this; + $back.parent().parent().show(); + $('.vis-inspect-view-css').each(function () { + var attr = $(this).attr('id').slice(17); + if (attr.match(/^background-/)) { + $(this).parent().parent().hide(); + if (that.views[view].settings.style) { + delete that.views[view].settings.style[attr]; + } + } + }); + if (!isInit) { + $back.val($('#visview_' + view).css('background')); + } + } else { + this.views[view].settings.useBackground = false; + $back.parent().parent().hide(); + var $view; + if (!isInit) { + $view = $('#visview_' + view); + } + $('.vis-inspect-view-css').each(function () { + var attr = $(this).attr('id').slice(17); + if (attr.match(/^background-/)) { + $(this).parent().parent().show(); + if (!isInit) { + $(this).val($view.css(attr)); + } + } + }); + if (this.views[view].settings.style) { + delete this.views[view].settings.style.background; + } + } + } + + }, + editInit: function () { + var that = this; + // Create debug variables + this.states.attr({'dev1.val': 0}); + this.states.attr({'dev2.val': 0}); + this.states.attr({'dev3.val': 0}); + this.states.attr({'dev4.val': 0}); + this.states.attr({'dev6.val': 'string'}); + this.editLoadConfig(); + + // create settings view if not exists + if (this.views && !this.views.___settings) { + this.views.___settings = { + reloadOnSleep: 30, // seconds + reconnectInterval: 10000, // milliseconds + darkReloadScreen: false, + destroyViewsAfter: 30 // seconds + }; + } + this.$selectView = $('#select_view'); + this.$copyWidgetSelectView = $('#rib_wid_copy_view'); + this.$selectActiveWidgets = $('#select_active_widget'); + + this.editInitDialogs(); + this.editInitMenu(); + this.editInitCSSEditor(); + this.editInitScriptEditor(); + + var $panAttr = $('#pan_attr'); + $panAttr.tabs({ + //activate: function(event, ui) { + // // Find out index + // //var i = 0; + // //$(this).find('a').each(function () { + // // if ($(this).attr('href') === ui.newPanel.selector) { + // // return false; + // // } + // // i++; + // //}); + // //that.editSaveConfig('tabs/pan_attr', i); + //} + }).resizable({ + handles: 'w', + maxWidth: 670, + minWidth: 100, + resize: function () { + $(this).css('left', 'auto'); + } + + }); + var $panAddWidget = $('#pan_add_wid'); + $panAddWidget.resizable({ + handles: 'e', + maxWidth: 570, + minWidth: 190, + resize: function () { + $('#filter_set').clearSearch('update'); + } + }); + + if (this.config['size/pan_add_wid']) $panAddWidget.width(this.config['size/pan_add_wid']); + if (this.config['size/pan_attr']) $panAttr.width(this.config['size/pan_attr']); + + $(window).resize(layout); + + function layout() { + $('#panel_body').height(parseInt($(window).height() - $('#menu_body').height() - 3)); + var panWidth = $('#pan_add_wid').width(); + $('#vis_wrap').width(parseInt($(window).width() - panWidth - $panAttr.width() - 1)); + that.editSaveConfig('size/pan_add_wid', panWidth); + that.editSaveConfig('size/pan_attr', $panAttr.width()); + if (that.css_editor) that.css_editor.resize(); + } + + layout(); + + $('#vis-version').html(this.version); + if (typeof visConfig !== 'undefined' && visConfig.license === false) { + $('#vis-version').addClass('vis-license-error').attr('title', _('License error! Please check logs for details.')); + } + + $('#button_undo').button({ + icons: {primary: 'ui-icon ui-icon-arrowreturnthick-1-w'}, + text: false + }) + .css({height: 28}) + .click(function () { + that.undo(); + }) + .addClass('ui-state-disabled').attr('title', _('Undo')) + .hover( + function () { + $(this).addClass('ui-state-hover'); + }, + function () { + $(this).removeClass('ui-state-hover'); + }); + + $('.widget-helper').remove(); + + $('input.vis-editor').button(); + + $('button.vis-editor').button(); + + $('select.vis-editor').each(function () { + $(this).multiselect({ + multiple: false, + classes: $(this).attr('id'), + header: false, + selectedList: 1, + minWidth: $(this).attr('data-multiselect-width'), + height: $(this).attr('data-multiselect-height'), + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + noneSelectedText: _('Select options') + }); + }); + + $('select.vis-editor-large').each(function () { + $(this).multiselect({ + multiple: false, + header: false, + //noneSelectedText: false, + selectedList: 1, + minWidth: 250, + height: 410, + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + noneSelectedText: _('Select options') + }); + + }); + + $('select.vis-editor-xlarge').each(function () { + $(this).multiselect({ + multiple: false, + header: false, + // noneSelectedText: false, + selectedList: 1, + minWidth: 420, + height: 340, + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + noneSelectedText: _('Select options') + }); + }); + + this.$selectActiveWidgets.multiselect({ + classes: this.$selectActiveWidgets.attr('id'), + header: true, + selectedList: 2, + minWidth: this.$selectActiveWidgets.attr('data-multiselect-width'), + height: this.$selectActiveWidgets.attr('data-multiselect-height'), + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + noneSelectedText: _('none selected') + }).change(function () { + var widgets = []; + $(this).multiselect('getChecked').each(function () { + widgets.push(this.value); + }); + for (var i = that.activeWidgets.length - 1; i >= 0; i--) { + var pos = widgets.indexOf(that.activeWidgets[i]); + if (pos === -1) that.activeWidgets.splice(i, 1); + } + for (var j = 0; j < widgets.length; j++) { + if (that.activeWidgets.indexOf(widgets[j]) === -1) { + that.activeWidgets.push(widgets[j]); + that.actionHighlightWidget(widgets[j]); + } + } + that.inspectWidgets(that.activeViewDiv, that.activeView); + }); + // Button Click Handler + + $('#export_view').click(function () { + that.exportView(that.activeViewDiv, that.activeView, false); + }); + + $('#export_widgets').click(function () { + that.exportWidgets(); + }); + + $('#import_widgets').click(function () { + that.importWidgets(); + }); + + if (this.conn.getType() === 'local') { + // @SJ cannot select menu and dialogs if it is enabled + //$('#wid_all_lock_function').trigger('click'); + $('#ribbon_tab_datei').show(); + } + + $('#start_import_view').button(); + $('#start_import_widgets').button(); + + $('#name_import_view').keyup(function (e) { + if (e.which === 13 && $(this).val()) { + $('#start_import_view').trigger('click'); + } + $(this).trigger('change'); + }).change(function () { + if ($(this).val()) { + $('#start_import_view').button('enable'); + } else { + $('#start_import_view').button('disable'); + } + }); + + $('#import_view').click(function () { + $('#textarea_import_view').val(''); + if ($('#name_import_view').val()) { + $('#start_import_view').button('enable'); + } else { + $('#start_import_view').button('disable'); + } + $('#dialog_import_view').dialog({ + autoOpen: true, + width: 800, + height: 600, + modal: true, + open: function (event, ui) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_import_view"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + $('#start_import_view').unbind('click').click(function () { + that.importView(); + $('#dialog_import_view').dialog('close'); + }); + $('#name_import_view').show(); + } + }); + }); + + $('#create_instance').button({icons: {primary: 'ui-icon-plus'}}).click(this.generateInstance); + + $('#vis_access_mode').change(function () { + that.conn.chmodProject(that.projectPrefix, $(this).prop('checked') ? 0x644 : 0x600, function (err, files) { + if (err) { + that.showError(err); + var $mode = $('#vis_access_mode'); + $mode.prop('checked', !$mode.prop('checked')).prop('disabled'); + } + }); + }); + + this.initStealHandlers(); + + $('#inspect_view_css_only_background').change(function () { + that.editShowHideViewBackground(that.activeView); + that.save(); + }); + + $('.vis-inspect-view-css').change(function () { + var $this = $(this); + var attr = $this.attr('id').slice(17); + var val = $this.val(); + var $view = $('#visview_' + that.activeViewDiv); + $view.css(attr, val); + + if (!that.views[that.activeView].settings.style) { + that.views[that.activeView].settings.style = {}; + } + that.views[that.activeView].settings.style[attr] = val; + that.save(); + }).keyup(function () { + $(this).trigger('change'); + }).each(function () { + var options = $(this).data('options'); + if (options) { + var values = options.split(';'); + $(this).autocomplete({ + minLength: 0, + source: function (request, response) { + var _data = $.grep(values, function (value) { + return value.substring(0, request.term.length).toLowerCase() === request.term.toLowerCase(); + }); + + response(_data); + }, + select: function (event, ui) { + $(this).val(ui.item.value); + $(this).trigger('change', ui.item.value); + } + }).focus(function () { + // Show dropdown menu + $(this).autocomplete('search', ''); + }); + } + }); + + $('.vis-inspect-view').change(function () { + var $this = $(this); + var attr = $this.attr('id').slice(13); + that.views[that.activeView].settings[attr] = $this.val(); + that.save(); + }).keyup(function () { + $(this).trigger('change'); + }); + + $('#screen_size').selectmenu({ + change: function () { + var val = $(this).val(); + if (!val) { + $('#screen_size_x').prop('disabled', true).val('').trigger('change'); + $('#screen_size_y').prop('disabled', true).val('').trigger('change'); + $('.vis-screen-default').prop('disabled', true).prop('checked', false); + $('.rib_tool_resolution_toggle').button('disable'); + } else if (val === 'user') { + $('#screen_size_x').prop('disabled', false); + $('#screen_size_y').prop('disabled', false); + $('.vis-screen-default').prop('disabled', false); + $('.rib_tool_resolution_toggle').button('enable'); + $('#rib_tools_resolution_fix').toggle(); + $('#rib_tools_resolution_manuel').toggle(); + } else { + var size = val.split('x'); + $('.rib_tool_resolution_toggle').button('enable'); + $('.vis-screen-default').prop('disabled', false); + $('#screen_size_x').val(size[0]).trigger('change').prop('disabled', true); + $('#screen_size_y').val(size[1]).trigger('change').prop('disabled', true); + } + }, + width: '100%' + }); + + $('#screen_size-menu').css({'max-height': '400px'}); + + $('#screen_size_x').change(function () { + var x = $('#screen_size_x').val(); + var y = $('#screen_size_y').val(); + var $sizeX = $('#size_x'); + if (x <= 0) { + $sizeX.hide(); + } else { + $sizeX.css('left', (parseInt(x, 10) + 1) + 'px').show(); + $('#size_y').css('width', (parseInt(x, 10) + 3) + 'px'); + if (y > 0) { + $sizeX.css('height', (parseInt(y, 10) + 3) + 'px'); + } + } + if (that.views[that.activeView].settings.sizex != x) { + that.views[that.activeView].settings.sizex = x; + that.setViewSize(that.activeView); + that.save(); + } + }).keyup(function () { + $(this).trigger('change'); + }).keydown(function (e) { + // Allow: backspace, delete, tab, escape, enter and . + if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || + // Allow: Ctrl+A, Command+A + (e.keyCode === 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || + // Allow: home, end, left, right, down, up + (e.keyCode >= 35 && e.keyCode <= 40)) { + // let it happen, don't do anything + return; + } + // Ensure that it is a number and stop the keypress + if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { + e.preventDefault(); + } + }); + + $('.vis-screen-default').change(function () { + if (that.views[that.activeView].settings.useAsDefault != $(this).prop('checked')) { + that.views[that.activeView].settings.useAsDefault = $(this).prop('checked'); + $('.vis-screen-default').prop('checked', $(this).prop('checked')); + that.save(); + } + }); + + $('.vis-screen-render-always').change(function () { + if (that.views[that.activeView].settings.alwaysRender != $(this).prop('checked')) { + that.views[that.activeView].settings.alwaysRender = $(this).prop('checked'); + $('.vis-screen-render-always').prop('checked', $(this).prop('checked')); + that.save(); + } + }); + + $('#screen_size_y').change(function () { + var x = $('#screen_size_x').val(); + var y = $('#screen_size_y').val(); + var $sizeY = $('#size_y'); + if (y > 0) { + $sizeY.css('top', (parseInt(y, 10) + 1) + 'px').show(); + $('#size_x').css('height', (parseInt(y, 10) + 3) + 'px'); + if (x > 0) { + $sizeY.css('width', (parseInt(x, 10) + 3) + 'px'); + } + } else { + $sizeY.hide(); + } + if (that.views[that.activeView].settings.sizey != y) { + that.views[that.activeView].settings.sizey = y; + that.setViewSize(that.activeView); + that.save(); + } + + }).keyup(function () { + $(this).trigger('change'); + }).keydown(function (e) { + // Allow: backspace, delete, tab, escape, enter and . + if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || + // Allow: Ctrl+A, Command+A + (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) || + // Allow: home, end, left, right, down, up + (e.keyCode >= 35 && e.keyCode <= 40)) { + // let it happen, don't do anything + return; + } + // Ensure that it is a number and stop the keypress + if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { + e.preventDefault(); + } + }); + + $('#grid_size').change(function () { + var gridSize = $(this).val(); + if (that.views[that.activeView].settings.gridSize != gridSize) { + var aw = JSON.stringify(that.activeWidgets); + that.views[that.activeView].settings.gridSize = gridSize; + that.save(that.activeViewDiv, that.activeView); + that.inspectWidgets(that.activeViewDiv, that.activeView, []); + that.editSetGrid(that.activeViewDiv, that.activeView); + setTimeout(function () { + that.inspectWidgets(that.activeViewDiv, that.activeView, JSON.parse(aw)); + }, 200); + } + }).keyup(function () { + $(this).trigger('change'); + }); + + $('#snap_type').selectmenu({ + change: function () { + var aw = JSON.stringify(that.activeWidgets); + that.views[that.activeView].settings.snapType = parseInt($(this).val(), 10); + var $gridSize = $('#grid_size'); + + $gridSize.prop('disabled', that.views[that.activeView].settings.snapType !== 2); + + if (that.views[that.activeView].settings.snapType === 2 && !$gridSize.val()) $gridSize.val(10).trigger('change'); + that.editSetGrid(that.activeViewDiv, that.activeView); + that.save(that.activeViewDiv, that.activeView); + that.inspectWidgets(that.activeViewDiv, that.activeView, []); + setTimeout(function () { + that.inspectWidgets(that.activeViewDiv, that.activeView, JSON.parse(aw)); + }, 200); + }, + width: '100%' + }); + + $('#dev_show_html').button({}).click(function () { + var text = ''; + for (var i = 0; i < that.activeWidgets.length; i++) { + var widID = $('#' + that.activeWidgets[i]).attr('id'); + + var xid = (new Date()).valueOf().toString(32); + + var $target = $('#' + widID); + var $clone = $target.clone(); + $clone.wrap('
'); + var html = $clone.parent().html(); + + html = html + .replace(/id="[-_\w\d]+"/, '') + .replace(/data-[\w+]="[-_\w\d]+"/, '') + .replace('vis-widget ', 'vis-widget_prev ') + .replace('vis-widget-body', 'vis-widget-prev-body') + .replace('vis-widget-lock', ' ') + .replace('ui-selectee', ' ') + .replace('ui-draggable-handle', ' ') + .replace('ui-draggable', ' ') + .replace('ui-resizable', ' ') + .replace('
', '') + //.replace(/(id=")[A-Za-z0-9\[\]._]+"/g, '') + .replace(/w([0-9]){5}/g, xid) + .replace(/(?:\r\n|\r|\n)/g, '') + .replace(/\t/g, ' ') + .replace(/[ ]{2,}/g, ' '); + + html = html + .replace('
', '') + .replace('
', '') + .replace('
', '') + .replace('
', ''); + + html = '
' + html.toString() + '
'; + text += html; + } + $('body').append('
'); + $('#dec_html_code').dialog({ + width: 800, + height: 600, + open: function (event) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $(this).parent().css({'z-index': 1001}); + }, + close: function () { + $('#dec_html_code').remove(); + } + }); + }); + + $('#btn_accordeon'). + button({icons: {primary: 'ui-icon-grip-dotted-horizontal', secondary: null}, text: false}). + css({width: 18, height: 18}). + click(function () { + that.widgetAccordeon = !that.widgetAccordeon; + that.editUpdateAccordeon(); + }); + + if (this.config.widgetAccordeon) { + this.widgetAccordeon = true; + this.editUpdateAccordeon(); + } + + // Bug in firefox or firefox is too slow or too fast + /*setTimeout(function() { + + if (document.getElementById('select_active_widget')._isOpen === undefined) { + $('#select_active_widget').html(''); + if (this.activeView && this.views && this.views[this.activeView] && this.views[this.activeView].widgets) { + for (var widget in this.views[this.activeView].widgets) { + var obj = $('#' + this.views[this.activeView].widgets[widget].tpl); + $('#select_active_widget').append('"); + } + } + $('#select_active_widget').multiselect('refresh'); + } + + }, 10000);*/ + + // Instances (Actually not used) + /*if (typeof storage !== 'undefined' && local === false) { + // Show what's new + if (storage.get('lastVersion') !== this.version) { + // Read + storage.set('lastVersion', this.version); + // Read io-addon.json + $.ajax({ + url: 'io-addon.json', + cache: false, + success: function (data) { + + try { + var ioaddon = data; + if (ioaddon.whatsNew) { + for (var i = 0; i < ioaddon.whatsNew.length; i++) { + var text = ioaddon.whatsNew[i]; + if (typeof text !== 'string') { + text = ioaddon.whatsNew[i][that.language] || ioaddon.whatsNew[i]['en']; + } + // Remove modifier information like (Bluefox) or (Hobbyquaker) + if (text[0] === '(') { + var j = text.indexOf(')'); + if (j !== -1) { + text = text.substring(j + 1); + } + } + that.showHint('' + _('New:') + '' + text, 30000, 'info'); + } + } + } catch (e) { + that.conn.logError('Cannot parse io-addon.json ' + e); + } + } + }); + } + }*/ + if (this.config.groupsState) this.groupsState = this.config.groupsState; + }, + editSetGrid: function (viewDiv, view) { + var grid = parseInt(this.views[view].settings.gridSize, 10); + var $container = $('#vis_container'); + if (this.views[view].settings.snapType === 2 && grid > 2) { + var $grid = $container.find('.vis-grid'); + if (!$grid.length) { + $container.prepend('
'); + $grid = $container.find('.vis-grid'); + } + + var img; + if (grid <= 6) { + img = 'bg-dots-5.svg'; + } else if (grid <= 12) { + img = 'bg-dots-10.svg'; + } else if (grid <= 17) { + img = 'bg-dots-15.svg'; + } else if (grid <= 25) { + img = 'bg-dots-20.svg'; + } else if (grid <= 35) { + img = 'bg-dots-30.svg'; + } else if (grid <= 45) { + img = 'bg-dots-40.svg'; + } else { + img = 'bg-dots-50.svg'; + } + + $grid + .addClass('vis-grid') + .css({ + 'background-size': this.views[view].settings.gridSize + 'px ' + this.views[view].settings.gridSize + 'px', + 'background-image': 'url(img/' + img + ')' + }); + } else { + $container.find('.vis-grid').remove(); + } + }, + editShowLeadingLines: function (view, isHide) { + view = view || this.activeView; + if (!this.views[view]) view = this.getViewOfWidget(this.activeWidgets[0]); + + var $container = $('#vis_container'); + $container.find('.vis-leading-line').remove(); + if (isHide) return; + var viewOffset = this.editGetViewOffset(view); + + // there are following lines + // horz-top + // horz-bottom + // horz-middle + // vert-left + // vert-right + // vert-center + var line = 0; + var l; + for (var i = 0; i < this.activeWidgets.length; i++) { + var $awid = $('#' + this.activeWidgets[i]); + var aData = $awid.offset(); + aData.top -= viewOffset.top; + aData.left -= viewOffset.left; + + aData.top = parseInt(aData.top, 10); + aData.bottom = aData.top + parseInt($awid.height(), 10); + aData.middle = (aData.bottom + aData.top) / 2; + + aData.left = parseInt(aData.left, 10); + aData.right = aData.left + parseInt($awid.width(), 10); + aData.center = (aData.left + aData.right) / 2; + + var lines = { + horz: [], + vert: [] + }; + var isLeft = false; + var isRight = false; + var isTop = false; + var isBottom = false; + for (var wid in this.views[view].widgets) { + if (this.activeWidgets.indexOf(wid) === -1 && !this.views[view].widgets[wid].grouped) { + var $wid = $('#' + wid); + if (!$wid.length) continue; + var data = $wid.offset(); + if (!data) continue; + + data.top -= viewOffset.top; + data.left -= viewOffset.left; + + isLeft = false; + isRight = false; + isTop = false; + isBottom = false; + + data.top = parseInt(data.top, 10); + data.bottom = data.top + parseInt($wid.height(), 10); + data.middle = (data.bottom + data.top) / 2; + + data.left = parseInt(data.left, 10); + data.right = data.left + parseInt($wid.width(), 10); + data.center = (data.left + data.right) / 2; + + if (aData.left === data.left) { + if (lines.horz.indexOf(aData.left) === -1) lines.horz.push(aData.left); + isLeft = true; + } + if (aData.left === data.right) { + if (lines.horz.indexOf(aData.left) === -1) lines.horz.push(aData.left); + isLeft = true; + } + if (aData.left === data.center) { + if (lines.horz.indexOf(aData.left) === -1) lines.horz.push(aData.left); + isLeft = true; + } + + if (aData.right === data.left) { + if (lines.horz.indexOf(aData.right) === -1) lines.horz.push(aData.right); + isRight = true; + } + if (aData.right === data.right) { + if (lines.horz.indexOf(aData.right) === -1) lines.horz.push(aData.right); + isRight = true; + } + if (aData.right === data.center) { + if (lines.horz.indexOf(aData.right) === -1) lines.horz.push(aData.right); + isRight = true; + } + + if (!isRight || !isLeft) { + if (aData.center === data.left) { + if (lines.horz.indexOf(aData.center) === -1) lines.horz.push(aData.center); + } + if (aData.center === data.right) { + if (lines.horz.indexOf(aData.center) === -1) lines.horz.push(aData.center); + } + if (aData.center === data.center) { + if (lines.horz.indexOf(aData.center) === -1) lines.horz.push(aData.center); + } + } + + if (aData.top === data.top) { + if (lines.vert.indexOf(aData.top) === -1) lines.vert.push(aData.top); + isTop = true; + } + if (aData.top === data.bottom) { + if (lines.vert.indexOf(aData.top) === -1) lines.vert.push(aData.top); + isTop = true; + } + if (aData.top === data.middle) { + if (lines.vert.indexOf(aData.top) === -1) lines.vert.push(aData.top); + isTop = true; + } + + if (aData.bottom === data.top) { + if (lines.vert.indexOf(aData.bottom) === -1) lines.vert.push(aData.bottom); + isBottom = true; + } + if (aData.bottom === data.bottom) { + if (lines.vert.indexOf(aData.bottom) === -1) lines.vert.push(aData.bottom); + isBottom = true; + } + if (aData.bottom === data.middle) { + if (lines.vert.indexOf(aData.bottom) === -1) lines.vert.push(aData.bottom); + isBottom = true; + } + + if (!isTop || !isBottom) { + if (aData.middle === data.top) { + if (lines.vert.indexOf(aData.middle) === -1) lines.vert.push(aData.middle); + } + if (aData.middle === data.bottom) { + if (lines.vert.indexOf(aData.middle) === -1) lines.vert.push(aData.middle); + } + if (aData.middle === data.middle) { + if (lines.vert.indexOf(aData.middle) === -1) lines.vert.push(aData.middle); + } + } + } + } + for (l = 0; l < lines.horz.length; l++) { + $container.append('
'); + } + for (l = 0; l < lines.vert.length; l++) { + $container.append('
'); + } + } + }, + editUpdateAccordeon: function () { + var that = this; + + if (that.widgetAccordeon) { + $('#btn_accordeon').addClass('ui-state-error'); + var opened = ''; + $('.group-control').each(function () { + var group = $(this).attr('data-group'); + if (that.groupsState[group]) { + if (!opened) { + opened = group; + } else { + that.groupsState[group] = false; + $(this).button('option', { + icons: {primary: that.groupsState[group] ? 'ui-icon-triangle-1-n' : 'ui-icon-triangle-1-s'} + }); + if (that.groupsState[group]) { + $('.group-' + group).show(); + } else { + $('.group-' + group).hide(); + } + } + } + + that.editSaveConfig('groupsState', that.groupsState); + }); + } else { + $('#btn_accordeon').removeClass('ui-state-error'); + } + that.editSaveConfig('widgetAccordeon', that.widgetAccordeon); + }, + editInitDialogs: function () { + var $pbody = $('#panel_body'); + + if (typeof fillAbout !== 'undefined') { + $('#dialog_about') + .html(fillAbout()) + .dialog({ + autoOpen: false, + width: 600, + height: 550, + open: function (event /* , ui*/) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_about"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + }, + position: { + my: 'center', + at: 'center', + of: $pbody + } + }); + } + + $('#dialog_shortcuts').dialog({ + autoOpen: false, + width: 600, + height: 500, + open: function (event /* , ui*/) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_shortcuts"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + }, + position: {my: 'center', at: 'center', of: $pbody} + }); + + }, + editFileHandler: function(event) { + event.preventDefault(); + var file = event.dataTransfer ? event.dataTransfer.files[0] : event.target.files[0]; + + var $dz = $('.vis-drop-zone').show(); + if (!file || !file.name || !file.name.match(/\.zip$/)) { + $('.vis-drop-text').html(_('Invalid file extenstion!')); + $dz.addClass('vis-dropzone-error').animate({opacity: 0}, 1000, function () { + $dz.hide().removeClass('vis-dropzone-error').css({opacity: 1}); + $('.vis-drop-text').html(_('Drop the files here')); + }); + return false; + } + + if (file.size > 50000000) { + $('.vis-drop-text').html(_('File is too big!')); + $dz.addClass('vis-dropzone-error').animate({opacity: 0}, 1000, function () { + $dz.hide().removeClass('vis-dropzone-error').css({opacity: 1}); + $('.vis-drop-text').html(_('Drop the files here')); + }); + return false; + } + $dz.hide(); + var that = this; + var reader = new FileReader(); + reader.onload = function (evt) { + var $name = $('.vis-file-name'); + var $project = $('#name_import_project'); + $name.html('
[' + that.editGetReadableSize(file.size) + ']
' + file.name + ''); + // string has form data:;base64,TEXT== + $name.data('file', evt.target.result.split(',')[1]); + + $('.vis-import-text-drop-plus').hide(); + // try to extract project name from 2016-05-09-project.zip + var m = file.name.match(/^\d{4}-\d{2}-\d{2}-([\w\d_-]+)\.zip$/); + if (m && !$project.val()) $project.val(m[1]); + + $('#start_import_project').prop('disabled', !$name.data('file') || !$project.val()); + }; + reader.readAsDataURL(file); + }, + editFillProjects: function () { + var that = this; + // fill projects + this.conn.readProjects(function (err, projects) { + var text = ''; + if (projects.length) { + for (var d = 0; d < projects.length; d++) { + text += '\n'; + if (projects[d].name + '/' === that.projectPrefix) { + $('#vis_access_mode').prop('checked', projects[d].mode & 0x60); + } + } + $('#menu_projects').html(text); + $('.project-select').unbind('click').click(function () { + window.location.href = 'edit.html?' + $(this).attr('data-project'); + }); + } else { + $('#li_menu_projects').hide(); + } + }); + }, + editGetReadableSize: function (bytes) { + var text; + if (bytes < 1024) { + text = bytes + ' ' + _('bytes'); + } else if (bytes < 1024 * 1024) { + text = Math.round(bytes * 10 / 1024) / 10 + ' ' + _('Kb'); + } else { + text = Math.round(bytes * 10 / (1024 * 1024)) / 10 + ' ' + _('Mb'); + } + if (this.isFloatComma) text = text.replace('.', ','); + return text; + }, + editGetViewOffset: function (view, viewDiv, widget) { + view = view || this.activeView; + viewDiv = viewDiv || this.activeViewDiv || this.activeView; + var viewOffset; + if (viewDiv !== view) { + viewOffset = $('#' + viewDiv).offset(); + } else { + viewOffset = $('#visview_' + viewDiv).offset(); + } + if (!widget) return viewOffset; + var aData = $('#' + widget).offset(); + if (!aData) return null; + aData.left -= viewOffset.left; + aData.top -= viewOffset.top; + return aData; + }, + editInitMenu: function () { + var that = this; + $('#menu.sf-menu').superclick({ + hoverClass: 'sfHover', + uiClass: 'ui-state-hover', // jQuery-UI modified + pathLevels: 1, + cssArrows: false, + disableHI: false + }); + + $('li.ui-state-default').hover( + function () { + $(this).addClass('ui-state-hover'); + }, + function () { + $(this).removeClass('ui-state-hover'); + } + ); + + $('#menu_body').tabs({ + active: this.config['tabs/menu_body'] === undefined ? 2 : this.config['tabs/menu_body'], + collapsible: true, + activate: function (event, ui) { + // Find out index + var i = 0; + $(this).find('a').each(function () { + if ($(this).attr('href') === ui.newPanel.selector) { + return false; + } + i++; + }); + that.editSaveConfig('tabs/menu_body', i); + } + }); + + // Tabs open Close + $('#menu_body > ul > li').click(function () { + // TODO store if collapsed or not + if (!$('#menu_body').tabs('option', 'active')) that.editSaveConfig('tabs/menu_body', false); + $(window).trigger('resize'); + }); + + if (this.config['show/ribbon_tab_dev']) $('#ribbon_tab_dev').toggle(); + + // Theme select Editor + if (this.config.editorTheme) { + $('#commonTheme').remove(); + $('head').prepend(''); + $('li .menu-item [data-theme=' + this.config.editorTheme + ']').addClass('ui-state-active'); + } + + $('#ul_theme li a').click(function () { + var theme = $(this).data('info'); + // deselect all + $('#ul_theme li').removeClass('ui-state-active'); + $('#commonTheme').remove(); + $('head').prepend(''); + //that.additionalThemeCss(theme); + + var oldValue = that.config.editorTheme; + that.editSaveConfig('editorTheme', theme); + that.calcCommonStyle(true); + // We must re-render all opened views + for (var view in that.views) { + if (view === '___settings') continue; + if ($('.vis-view #visview' + view).length && + (that.views[view].settings.theme === theme || that.views[view].settings.theme === oldValue)) { + that.renderView(view); + } + } + + setTimeout(function () { + $('#scrollbar_style').remove(); + $('head').prepend(''); + }, 300); + + // Select active theme in menu + $('li .menu-item [data-theme=' + theme + ']').addClass('ui-state-active'); + + that.save(); + }); + + //language + $('[data-language=' + ((typeof this.language === 'undefined') ? 'en' : (this.language || 'en')) + ']').addClass('ui-state-active'); + + $('.language-select').click(function () { + $('[data-language=' + that.language + ']').removeClass('ui-state-active'); + that.language = $(this).data('language'); + $(this).addClass('ui-state-active'); + if (typeof systemLang !== 'undefined') { + systemLang = that.language; + } + // set moment language + if (typeof moment !== 'undefined') { + moment.lang(that.language); + } + setTimeout(function () { + translateAll(); + }, 0); + }); + + + $('#m_about').click(function () { + $('#dialog_about').dialog('open'); + }); + $('#m_shortcuts').click(function () { + $('#dialog_shortcuts').dialog('open'); + }); + //$('#m_setup').click(function () { + // $('#dialog_setup').dialog('open'); + //}); + + // fill projects + this.editFillProjects(); + + $('#new-project-name').keypress(function (e) { + if (e.which === 13) { + $('#dialog-new-project').parent().find('#ok').trigger('click'); + } + }); + $('.project-new').click(function () { + $('#dialog-new-project').dialog({ + autoPen: true, + width: 400, + height: 190, + modal: true, + draggable: false, + resizable: false, + open: function (event) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog-new-project"]').css('z-index', 1002); + //$('.ui-widget-overlay').css('z-index', 1001); + }, + buttons: [ + { + id: 'ok', + text: _('Ok'), + click: function () { + var name = $('#new-project-name').val(); + if (!name) { + window.alert(_('Empty name is not allowed!')); + return; + } + $('.project-select').each(function () { + if ($(this).data('project') === name) { + window.alert(_('Project yet exists!')); + } + }); + + window.location.href = 'edit.html?' + name; + + $('#dialog-new-project').dialog('close'); + } + }, + { + text: _('Cancel'), + click: function () { + $('#dialog-new-project').dialog('close'); + } + } + ] + }); + }); + $('.setup-settings').click(function () { + $('#reloadOnSleep').val(that.views.___settings.reloadOnSleep); + $('#darkReloadScreen').prop('checked', that.views.___settings.darkReloadScreen); + $('#reconnectInterval').val(that.views.___settings.reconnectInterval); + if (that.views.___settings.destroyViewsAfter === undefined) that.views.___settings.destroyViewsAfter = 30; + $('#destroyViewsAfter').val(that.views.___settings.destroyViewsAfter); + $('#dialog-settings').dialog({ + autoPen: true, + width: 800, + height: 300, + modal: true, + draggable: false, + resizable: false, + open: function (event) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog-settings"]').css('z-index', 1002); + //$('.ui-widget-overlay').css('z-index', 1001); + }, + buttons: [ + { + id: 'ok', + text: _('Ok'), + click: function () { + var changed = false; + var val = $('#reloadOnSleep').val(); + if (that.views.___settings.reloadOnSleep != val) { + that.views.___settings.reloadOnSleep = val; + changed = true; + } + val = $('#destroyViewsAfter').val(); + if (that.views.___settings.destroyViewsAfter != val) { + that.views.___settings.destroyViewsAfter = val; + changed = true; + } + val = $('#reconnectInterval').val(); + if (that.views.___settings.reconnectInterval != val) { + that.views.___settings.reconnectInterval = val; + that.conn.setReconnectInterval(that.views.___settings.reconnectInterval); + changed = true; + } + val = $('#darkReloadScreen').prop('checked'); + if (that.views.___settings.darkReloadScreen != val) { + that.views.___settings.darkReloadScreen = val; + changed = true; + } + if (changed) { + that.conn.setReloadTimeout(that.views.___settings.reloadOnSleep); + that.save(); + } + $('#dialog-settings').dialog('close'); + } + }, + { + text: _('Cancel'), + click: function () { + $('#dialog-settings').dialog('close'); + } + } + ] + }); + }); + + $('.export-normal').click(function () { + that.conn.readDirAsZip(that.projectPrefix, false, function (err, data) { + if (err) { + that.showError(err); + } else { + var d = new Date(); + var date = d.getFullYear(); + var m = d.getMonth() + 1; + if (m < 10) m = '0' + m; + date += '-' + m; + m = d.getDate(); + if (m < 10) m = '0' + m; + date += '-' + m + '-'; + $('body').append(''); + document.getElementById('zip_download').click(); + document.getElementById('zip_download').remove(); + } + }); + }); + $('.export-anonymized').click(function () { + that.conn.readDirAsZip(that.projectPrefix, true, function (err, data) { + if (err) { + that.showError(err); + } else { + var d = new Date(); + var date = d.getFullYear(); + var m = d.getMonth() + 1; + if (m < 10) m = '0' + m; + date += '-' + m; + m = d.getDate(); + if (m < 10) m = '0' + m; + date += '-' + m + '-'; + $('body').append(''); + document.getElementById('zip_download').click(); + document.getElementById('zip_download').remove(); + } + }); + }); + $('#name_import_project').on('change', function () { + $('#start_import_project').prop('disabled', !$('.vis-file-name').data('file') || !$(this).val()); + }).keyup(function () { + $(this).trigger('change'); + }); + $('.vis-drop-file').change(function (e) { + that.editFileHandler(e); + }); + $('.vis-import-text-drop').click(function () { + $('.vis-drop-file').trigger('click'); + }); + $('#start_import_project').button(); + $('.import-normal').click(function () { + $('#dialog_import_project').dialog({ + autoOpen: true, + resizable: false, + width: 600, + height: 320, + modal: true, + open: function (event, ui) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_import_project"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + $('#name_import_project').val(''); + $('.vis-file-name').data('file', null).html(_('Drop files here or click to select one')); + $('#start_import_project').prop('disabled', true); + $('.vis-drop-file').val(''); + $('.vis-import-text-drop-plus').show(); + + var $dropZone = $('#dialog_import_project'); + if (typeof(window.FileReader) !== 'undefined' && !$dropZone.data('installed')) { + $dropZone.data('installed', true); + var $dz = $('.vis-drop-zone'); + $('.vis-drop-text').html(_('Drop the files here')); + $dropZone[0].ondragover = function() { + $dz.unbind('click'); + $dz.show(); + return false; + }; + $dz.click(function () { + $dz.hide(); + }); + + $dz[0].ondragleave = function() { + $dz.hide(); + return false; + }; + + $dz[0].ondrop = function (e) { + that.editFileHandler(e); + } + } + } + }); + }); + $('#start_import_project').click(function () { + $('#dialog_import_project').dialog('close'); + // Check if the name exists + that.conn.readProjects(function (err, projects){ + var text = ''; + var name = $('#name_import_project').val(); + if (projects.length) { + for (var d = 0; d < projects.length; d++) { + if (projects[d].name === name) { + that.confirmMessage(_('Project "%s" yet exists. Do you want to overwrite it?', name), null, null, 700, function (result) { + if (result) { + that.conn.writeDirAsZip(name, $('.vis-file-name').data('file'), function (err) { + $('.vis-file-name').data('file', null); + if (err) { + that.showError(err); + } else { + if (name === that.projectPrefix.substring(0, that.projectPrefix.length - 1)) { + // reload project + window.location.reload(); + } else { + that.confirmMessage(_('Project "%s" was succseffully imported. Open it?', name), null, null, 700, function (result) { + if (result) { + var url = window.location.href.split('#')[0].split('?')[0]; + window.location = url + '?' + name; + } else { + // fill projects + that.editFillProjects(); + } + }); + } + } + }); + } + }); + return; + } + } + } + that.conn.writeDirAsZip(name, $('.vis-file-name').data('file'), function (err) { + $('.vis-file-name').data('file', null); + if (err) { + that.showError(err); + } else { + that.confirmMessage(_('Project "%s" was succseffully imported. Open it?', name), null, null, 700, function (result) { + if (result) { + var url = window.location.href.split('#')[0].split('?')[0]; + window.location = url + '?' + name; + } else { + // fill projects + that.editFillProjects(); + } + }); + } + }); + }); + }); + + if ($.fm) { + $('#li_menu_file_manager').click(function () { + var defPath = ('/' + (that.conn.namespace ? that.conn.namespace + '/' : '') + that.projectPrefix + 'img/'); + + $.fm({ + lang: that.language, + defaultPath: defPath, + path: that.lastUserPath || defPath, + uploadDir: '/' + (that.conn.namespace ? that.conn.namespace + '/' : ''), + fileFilter: [], + folderFilter: false, + mode: 'show', + view: 'prev', + conn: that.conn, + zindex: 1001 + }, function (_data) { + that.lastUserPath = _data.path; + }); + }); + } else { + $('#li_menu_file_manager').hide(); + } + + $('#li_menu_object_browser').click(function () { + var $dlg = $('#dialog-select-member-object-browser'); + if (!$dlg.length) { + $('body').append(''); + $dlg = $('#dialog-select-member-object-browser'); + $dlg.selectId('init', { + texts: { + select: _('Select'), + cancel: _('Cancel'), + all: _('All'), + id: _('ID'), + name: _('Name'), + role: _('Role'), + room: _('Room'), + value: _('Value'), + selectid: _('Select ID'), + enum: _('Members'), + from: _('from'), + lc: _('lc'), + ts: _('ts'), + ack: _('ack'), + expand: _('expand'), + collapse: _('collapse'), + refresh: _('refresh'), + edit: _('edit'), + ok: _('ok'), + wait: _('wait'), + list: _('list'), + tree: _('tree'), + copyToClipboard: _('Copy to clipboard') + }, + noMultiselect: true, + columns: ['image', 'name', 'type', 'role', 'enum', 'room', 'value'], + imgPath: '/lib/css/fancytree/', + objects: that.objects, + states: that.states, + zindex: 1001 + }); + } + + $dlg.selectId('show', function (newId, oldId) { + var $temp = $(''); + $dlg.append($temp); + $temp.val(newId).select(); + document.execCommand('copy'); + $temp.remove(); + that.showHint(_('Object ID "%s" copied to clipboard', newId) + '.', 15000); + }); + }); + + // Ribbon icons Global + + $('.icon-on-iconbar') + .hover( + function () { + $(this).parent().addClass('ui-state-hover'); + }, + function () { + $(this).parent().removeClass('ui-state-hover'); + }) + .click(function () { + $(this).stop(true, true).effect('highlight'); + }); + + // Widget ---------------------------------------------------------------- + + $('#rib_wid_del').button({icons: {primary: 'ui-icon-trash', secondary: null}, text: false}).click(function () { + that.delWidgets(that.activeViewDiv, that.activeView); + }); + + $('#rib_wid_doc').button({icons: {primary: 'ui-icon-info', secondary: null}, text: false}).click(function () { + if (that.activeWidgets[0]) { + var tpl = that.views[that.activeView].widgets[that.activeWidgets[0]].tpl; + var widgetSet = $('#' + tpl).attr('data-vis-set'); + var docUrl = 'widgets/' + widgetSet + '/doc.html#' + tpl; + window.open(docUrl, 'WidgetDoc', 'height=640,width=500,menubar=no,resizable=yes,scrollbars=yes,status=yes,toolbar=no,location=no'); + } + }); + + // Copy Widget to ----------------- + $('#rib_wid_copy').button({icons: {primary: 'ui-icon-copy', secondary: null}, text: false}).click(function () { + $('#rib_wid').hide(); + $('#rib_wid_copy_tr').show(); + }); + $('#rib_wid_copy_cancel').button({icons: {primary: 'ui-icon-cancel', secondary: null}, text: false}).click(function () { + $('#rib_wid').show(); + $('#rib_wid_copy_tr').hide(); + }); + + $('#rib_wid_copy_ok').button({icons: {primary: 'ui-icon-check', secondary: null}, text: false}).click(function () { + var widgets = that.dupWidgets($('#rib_wid_copy_view').val(), $('#rib_wid_copy_view').val()); + that.save($('#rib_wid_copy_view').val(), $('#rib_wid_copy_view').val()); + that.inspectWidgets(that.activeViewDiv, that.activeView, widgets); + $('#rib_wid').show(); + $('#rib_wid_copy_tr').hide(); + }); + + // Widget Align --------------------- + $('#wid_align_left').click(function () { + var data = []; + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + data.push({ + wid: that.activeWidgets[w], + pos: parseInt($('#' + that.activeWidgets[w]).offset().left, 10) - viewOffset.left + }); + } + + data.sort(function (a, b) { + var aName = a.pos; + var bName = b.pos; + return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); + }); + var pos = data.shift().pos; + + for (var ww = 0; ww < data.length; ww++) { + $('#' + data[ww].wid).css('left', pos + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, null, pos); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + + that.save(); + }); + $('#wid_align_right').click(function () { + var data = []; + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + var $w = $('#' + that.activeWidgets[w]); + var obj = { + wid: that.activeWidgets[w], + pos: parseInt($w.offset().left, 10) - viewOffset.left, + size: $w.width() + }; + obj.pos += obj.size; + data.push(obj); + } + + data.sort(function (a, b) { + var aName = a.pos; + var bName = b.pos; + return ((aName < bName) ? 1 : ((aName > bName) ? -1 : 0)); + }); + var pos = data.shift().pos; + + for (var ww = 0; ww < data.length; ww++) { + var $ww = $('#' + data[ww].wid); + $ww.css('left', pos - data[ww].size); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, null, (pos - data[ww].size)); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + that.save(); + }); + $('#wid_align_top').click(function () { + var data = []; + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + data.push({ + wid: that.activeWidgets[w], + pos: parseInt($('#' + that.activeWidgets[w]).offset().top, 10) - viewOffset.top + }); + } + + data.sort(function (a, b) { + var aName = a.pos; + var bName = b.pos; + return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); + }); + var pos = data.shift().pos; + + for (var ww = 0; ww < data.length; ww++) { + $('#' + data[ww].wid).css('top', pos + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, pos, null); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + + that.save(); + }); + $('#wid_align_bottom').click(function () { + var data = []; + + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + var $w = $('#' + that.activeWidgets[w]); + var obj = { + wid: that.activeWidgets[w], + pos: parseInt($w.offset().top, 10) - viewOffset.top, + size: $w.height() + }; + obj.pos += obj.size; + data.push(obj); + } + + data.sort(function (a, b) { + var aName = a.pos; + var bName = b.pos; + return ((aName < bName) ? 1 : ((aName > bName) ? -1 : 0)); + }); + + var pos = data.shift().pos; + + for (var ww = 0; ww < data.length; ww++) { + var $ww = $('#' + data[ww].wid); + $ww.css('top', pos - data[ww].size); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, (pos - data[ww].size), null); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + + that.save(); + }); + $('#wid_align_vc').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var min = 99990; + var max = -90000; + var data = []; + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + var $w = $('#' + that.activeWidgets[w]); + var obj = { + $w: $w, + wid: that.activeWidgets[w], + pos: parseInt($w.offset().top, 10) - viewOffset.top, + size: $w.height() + }; + if (min > obj.pos) min = obj.pos; + obj.pos += obj.size; + if (max < obj.pos) max = obj.pos; + data.push(obj); + } + + var middle = (max + min) / 2; + + for (var ww = 0; ww < data.length; ww++) { + var pos = middle - (data[ww].size / 2); + data[ww].$w.css('top', pos + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, pos, null); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + that.save(); + }); + $('#wid_align_hc').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var min = 99990; + var max = -90000; + var data = []; + var viewOffset = that.editGetViewOffset(); + + for (var w = 0; w < that.activeWidgets.length; w++) { + var $w = $('#' + that.activeWidgets[w]); + var obj = { + $w: $w, + wid: that.activeWidgets[w], + pos: parseInt($w.offset().left, 10) - viewOffset.left, + size: $w.width() + }; + if (min > obj.pos) min = obj.pos; + obj.pos += obj.size; + if (max < obj.pos) max = obj.pos; + data.push(obj); + } + + var middle = (max + min) / 2; + + for (var ww = 0; ww < data.length; ww++) { + var pos = middle - (data[ww].size / 2); + data[ww].$w.css('left', pos + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, data[ww].wid, null, pos); + that.showWidgetHelper(that.activeViewDiv, that.activeView, data[ww].wid, true); + } + }); + $('#wid_dis_h').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var data = []; + var min_left = 9999; + var max_right = 0; + var cont_size = 0; + var between; + $.each(that.activeWidgets, function () { + var left = parseInt($('#' + this).css('left')); + var right = left + $('#' + this).width(); + cont_size = cont_size + $('#' + this).width(); + if (min_left > left) min_left = left; + if (max_right < right) max_right = right; + var _data = { + wid: this, + left: left + }; + data.push(_data); + }); + + between = (max_right - min_left - cont_size) / (that.activeWidgets.length - 1); + + if (between < 0 ) between = 0; + + function sortByLeft(a, b) { + var aName = a.left; + var bName = b.left; + return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); + } + + data.sort(sortByLeft); + var first = data.shift(); + var left = first.left + $('#' + first.wid).width(); + + $.each(data, function(){ + left = left + between; + var $wid = $('#' + this.wid).css('left', left + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, this.wid, null, left); + left = left + $wid.width(); + that.showWidgetHelper(that.activeViewDiv, that.activeView, this.wid, true); + }); + that.save(); + }); + $('#wid_dis_v').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + + var data = []; + var min_top = 9999; + var max_bottom = 0; + var cont_size = 0; + var between; + + $.each(that.activeWidgets, function () { + var $this = $('#' + this); + var top = parseInt($this.css('top')); + var bottom = top + $this.height(); + cont_size = cont_size + $this.height(); + if (min_top > top) min_top = top; + if (max_bottom < bottom) max_bottom = bottom; + + var _data = { + wid: this, + top: top + }; + data.push(_data); + }); + + between = (max_bottom - min_top - cont_size) / (that.activeWidgets.length - 1); + if (between < 0 ) between = 0; + function sortByTop(a, b) { + var aName = a.top; + var bName = b.top; + return ((aName < bName) ? -1 : ((aName > bName) ? 1 : 0)); + } + + data.sort(sortByTop); + var first = data.shift(); + var top = first.top + $('#' + first.wid).height(); + + $.each(data, function () { + top = top + between; + var $wid = $('#' + this.wid).css('top', top + 'px'); + that.editApplyPosition(that.activeViewDiv, that.activeView, this.wid, top, null); + top = top + $wid.height(); + that.showWidgetHelper(that.activeViewDiv, that.activeView, this.wid, true); + }); + that.save(); + }); + $('#wid_align_width').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + if (that.alignType !== 'wid_align_width') { + that.alignIndex = 0; + that.alignValues = []; + for (var t = 0; t < that.activeWidgets.length; t++) { + var w = $('#' + that.activeWidgets[t]).width(); + if (that.alignValues.indexOf(w) === -1) + that.alignValues.push(w); + } + + that.alignType = 'wid_align_width'; + } + that.alignIndex++; + if (that.alignIndex >= that.alignValues.length) that.alignIndex = 0; + + for (var k = 0; k < that.activeWidgets.length; k++) { + $('#' + that.activeWidgets[k]).width(that.alignValues[that.alignIndex]); + that.editApplySize(that.activeViewDiv, that.activeView, that.activeWidgets[k], that.alignValues[that.alignIndex], null); + that.showWidgetHelper(that.activeViewDiv, that.activeView, that.activeWidgets[k], true); + } + that.save(); + }); + $('#wid_align_height').click(function () { + if (that.activeWidgets.length < 2) { + that.showMessage(_('Select more than one widget and try again.'), _('Too less widgets'), 'info', 500); + return; + } + if (that.alignType !== 'wid_align_height') { + that.alignIndex = 0; + that.alignValues = []; + for (var t = 0; t < that.activeWidgets.length; t++) { + var h = $('#' + that.activeWidgets[t]).height(); + if (that.alignValues.indexOf(h) === -1) + that.alignValues.push(h); + } + + that.alignType = 'wid_align_height'; + } + that.alignIndex++; + if (that.alignIndex >= that.alignValues.length) that.alignIndex = 0; + + for (var u = 0; u < that.activeWidgets.length; u++) { + $('#' + that.activeWidgets[u]).height(that.alignValues[that.alignIndex]); + that.editApplySize(that.activeViewDiv, that.activeView, that.activeWidgets[u], null, that.alignValues[that.alignIndex]); + that.showWidgetHelper(that.activeViewDiv, that.activeView, that.activeWidgets[u], true); + } + that.save(); + }); + + // All Widget --------------------- + $('#wid_all_lock_function').button({icons: {primary: 'ui-icon-locked', secondary: null}, text: false}).click(function () { + var lock = $('#wid_all_lock_function').prop('checked'); + if (lock) { + $('#vis_container').find('.vis-widget').addClass('vis-widget-lock'); + $('#wid_all_lock_f').addClass('ui-state-focus'); + if (that.activeView !== that.activeViewDiv) { + $('#' + that.activeViewDiv).removeClass('vis-widget-lock'); + } + } else { + $('#vis_container').find('.vis-widget').removeClass('vis-widget-lock'); + $('#wid_all_lock_f').removeClass('ui-state-focus'); + } + that.editSaveConfig('button/wid_all_lock_function', lock); + }); + + // Enable by default widget lock function + if (this.config['button/wid_all_lock_function'] === undefined || + this.config['button/wid_all_lock_function']) { + setTimeout(function () { + $('#wid_all_lock_function').prop('checked', true); + $('#vis_container').find('.vis-widget').addClass('vis-widget-lock'); + $('#wid_all_lock_f').addClass('ui-state-focus ui-state-active'); + }, 200); + } + + $('#wid_all_lock_drag').button({icons: {primary: 'ui-icon-extlink', secondary: null}, text: false}).click(function () { + $('#wid_all_lock_d').removeClass('ui-state-focus'); + that.inspectWidgets(that.activeViewDiv, that.activeView, []); + //that.editSaveConfig('checkbox/wid_all_lock_function', $('#wid_all_lock_function').prop('checked')); + }); + + // View ---------------------------------------------------------------- + + // Add View ----------------- + $('#rib_view_add').button({icons: {primary: 'ui-icon-plusthick', secondary: null}, text: false}).click(function () { + $('#rib_view').hide(); + $('#rib_view_add_tr').show(); + $('#rib_view_addname').val('').focus(); + }); + $('#rib_view_add_cancel').button({icons: {primary: 'ui-icon-cancel', secondary: null}, text: false}).click(function () { + $('#rib_view').show(); + $('#rib_view_add_tr').hide(); + }); + $('#rib_view_addname').keyup(function (e) { + // On enter + if (e.which === 13) $('#rib_view_add_ok').trigger('click'); + // esc + if (e.which === 27) $('#rib_view_add_cancel').trigger('click'); + }); + + $('#rib_view_add_ok').button({icons: {primary: 'ui-icon-check', secondary: null}, text: false}).click(function () { + var name = that.checkNewViewName($('#rib_view_addname').val().trim()); + if (name !== false) { + setTimeout(function () { + that.addView(name); + $('#rib_view').show(); + $('#rib_view_add_tr').hide(); + }, 0); + } + }); + + // Delete View ----------------- + $('#rib_view_del').button({icons: {primary: 'ui-icon-trash', secondary: null}, text: false}).click(function () { + that.delView(that.activeView); + }); + // Rename View ----------------- + + $('#rib_view_rename').button({icons: {primary: 'ui-icon-pencil', secondary: null}, text: false}).click(function () { + $('#rib_view').hide(); + $('#rib_view_rename_tr').show(); + $('#rib_view_newname').val(that.activeView).focus(); + }); + $('#rib_view_rename_cancel').button({icons: {primary: 'ui-icon-cancel', secondary: null}, text: false}).click(function () { + $('#rib_view').show(); + $('#rib_view_rename_tr').hide(); + }); + $('#rib_view_newname').keyup(function (e) { + // On enter + if (e.which === 13) $('#rib_view_rename_ok').trigger('click'); + // esc + if (e.which === 27) $('#rib_view_rename_cancel').trigger('click'); + }); + $('#rib_view_rename_ok').button({icons: {primary: 'ui-icon-check', secondary: null}, text: false}).click(function () { + var name = that.checkNewViewName($('#rib_view_newname').val().trim()); + if (name === false) return; + that.renameView(that.activeView, name); + $('#rib_view').show(); + $('#rib_view_rename_tr').hide(); + }); + + // Copy View ----------------- + $('#rib_view_copy').button({icons: {primary: 'ui-icon-copy', secondary: null}, text: false}).click(function () { + $('#rib_view').hide(); + $('#rib_view_copy_tr').show(); + $('#rib_view_copyname').val(that.activeView + '_new').focus(); + }); + $('#rib_view_copy_cancel').button({icons: {primary: 'ui-icon-cancel', secondary: null}, text: false}).click(function () { + $('#rib_view').show(); + $('#rib_view_copy_tr').hide(); + }); + $('#rib_view_copyname').keyup(function (e) { + // On enter + if (e.which === 13) $('#rib_view_copy_ok').trigger('click'); + // esc + if (e.which === 27) $('#rib_view_copy_cancel').trigger('click'); + }); + $('#rib_view_copy_ok').button({icons: {primary: 'ui-icon-check', secondary: null}, text: false}).click(function () { + var name = that.checkNewViewName($('#rib_view_copyname').val().trim()); + if (name === false) return; + that.dupView(that.activeView, name); + $('#rib_view').show(); + $('#rib_view_copy_tr').hide(); + }); + + // Tools ---------------------------------------------------------------- + // Resolution ----------------- + + $('.rib_tool_resolution_toggle').button({ + text: false, + icons: {primary: 'ui-icon-refresh'} + }).css({width: 22, height: 22}).click(function () { + $('#rib_tools_resolution_fix').toggle(); + $('#rib_tools_resolution_manuel').toggle(); + }); + + $('#saving_progress').button({ + text: false, + icons: {primary: 'ui-icon-disk'} + }).click(function () { + that._saveToServer(); + }).hide().addClass('ui-state-active'); + + this.config['button/closeMode'] = this.config['button/closeMode'] || 'close'; + + $('#exit_button').button({ + text: false, + icons: { + primary: 'ui-icon-' + this.config['button/closeMode'] + } + }).click(function () { + that.saveRemote(function () { + if (that._saveTimer) { + $('#saving_progress').hide(); + clearTimeout(that._saveTimer); + that._saveTimer = null; + } + + if (that.config['button/closeMode'] === 'refresh') { + that.conn.sendCommand('*', 'refresh', null, false); + } else if (that.config['button/closeMode'] === 'play') { + try { + var win = window.open(document.location.protocol + '//' + document.location.host + document.location.pathname.replace('edit', 'index') + window.location.search + '#' + that.activeView, 'vis-runtime'); + if (win) { + if (navigator.userAgent.indexOf("Firefox") > 0) { + // give to firefox time to update location + setTimeout(function () { + win.location.reload(); + win.focus(); + }, 1000); + } else { + win.location.reload(); + win.focus(); + } + } else { + that.showError(_('Popup window blocked!'), _('Cannot open new window'), 'alert'); + } + } catch (err) { + that.showError(_('Popup window blocked: %s!', err), _('Cannot open new window'), 'alert'); + } + } else { + // Show hint how to get back to edit mode + if (!that.config['dialog/isEditHintShown']) { + that.editSaveConfig('dialog/isEditHintShown', true); + window.alert(_('To get back to edit mode just call "%s" in browser', location.href)); + } + + setTimeout(function () { + // Some systems (e.g. offline mode) show here the content of directory if called without index.html + location.href = 'index.html' + window.location.search + '#' + that.activeView; + }, 100); + } + }); + }); + + $('#exit_button_select').button({ + text: false, + icons: { + primary: 'ui-icon-triangle-1-s' + } + }).click(function () { + var $menu = $('#exit_button_select_menu').show().position({ + my: 'left top', + at: 'left bottom', + of: this + }); + + $(document).one('click', function() { + $menu.hide(); + }); + + return false; + }).css({width: 16, height: 26}).parent().buttonset(); + + $('#exit_button_select_menu').menu({ + select: function (event, ui) { + that.editSaveConfig('button/closeMode', ui.item.data('value')); + + $('#exit_button').button('option', 'icons', { + primary: 'ui-icon-' + that.config['button/closeMode'] + }).trigger('click'); + } + }); + + if (this.conn.getIsLoginRequired && this.conn.getIsLoginRequired()) { + $('#logout_button').button({ + text: false, + icons: {primary: 'ui-icon-logout'} + }).click(function () { + that.saveRemote(function () { + if (that._saveTimer) { + $('#saving_progress').hide(); + clearTimeout(that._saveTimer); + that._saveTimer = null; + } + that.conn.logout(function () { + location.reload(); + }); + }); + }).show().css({width: '26px', height: '26px'}); + } + + if (this.conn.getUser) { + var user = this.conn.getUser(); + $('#current-user').html(user ? user[0].toUpperCase() + user.substring(1).toLowerCase() : ''); + } + + // Dev ---------------------------------------------------------------- + $('.oid-dev').change(function () { + var timer = $(this).data('timer'); + if (timer) clearTimeout(timer); + var $that = $(this); + $that.data('timer', setTimeout(function () { + $that.data('timer', null); + var val = $that.val(); + if ($that.attr('type') === 'number') { + if ($that.attr('step') == '0.1') { + val = val.replace(',', '.'); + that.setValue($that.attr('id').split('_')[1], parseFloat(val)); + } else { + that.setValue($that.attr('id').split('_')[1], parseInt(val, 10)); + } + } else { + that.setValue($that.attr('id').split('_')[1], $that.val()); + } + }, 500)); + }).keyup(function () { + $(this).trigger('change'); + }); + + $('#vis_container').on('contextmenu click', function (e) { + // Workaround for OSX. Ignore clicks without ctrl + if (!e.button && !e.ctrlKey && !e.metaKey) return; + + if (!e.shiftKey && !e.altKey) { + var parentOffset = $(this).offset(); + //or $(this).offset(); if you really just want the current element's offset + var options = { + left: e.pageX - parentOffset.left, + top: e.pageY - parentOffset.top + }; + + options.scrollLeft = $(this).scrollLeft(); + options.scrollTop = $(this).scrollTop(); + + options.left += options.scrollLeft; + options.top += options.scrollTop; + + that.showContextMenu(that.activeViewDiv, that.activeView, options); + + e.preventDefault(); + } + }); + + // show current project + $('#current-project').html(that.projectPrefix.substring(0, that.projectPrefix.length - 1)); + }, + editOneWidgetPreview: function (tplElem) { + var tpl = $(tplElem).attr('id'); + var $tpl = $('#' + tpl); + var type = $tpl.data('vis-type') || ''; + var beta = ''; + var classTypes = ''; + var behaviorIcons = []; + var types; + + if (type) { + types = type.split(','); + if (types.length < 2) types = type.split(';'); + var noIconTypes = []; + + for (var z = 0; z < types.length; z++) { + types[z] = types[z].trim(); + classTypes += types[z] + ' '; + + if (!this.editIcons[types[z]]) { + noIconTypes.push(types[z]); + } else { + behaviorIcons.push('
'); + } + types[z] = _(types[z]); + } + type = '
' + noIconTypes.join(',') + '
'; + } else { + types = []; + } + + if ($tpl.data('vis-beta')) { + beta = '
!!! BETA !!!
'; + } + + var set = $tpl.data('vis-set'); + classTypes += set + ' ' + $tpl.data('vis-name'); + classTypes = classTypes.toLowerCase().replace('ctrl', 'control').replace('val', 'value'); + + return '
' + type + '
' + $tpl.data('vis-name') + '
' + beta + '
' + behaviorIcons.join('') + '
'; + }, + editInitWidgetPreview: function () { + var that = this; + $('#btn_prev_zoom').hover( + function () { + $(this).addClass('ui-state-hover'); + }, + function () { + $(this).removeClass('ui-state-hover'); + } + ).click(function () { + if ($(this).hasClass('ui-state-active')) { + that.editSaveConfig('button/btn_prev_zoom', false); + $(this).removeClass('ui-state-active'); + $('.wid-prev').removeClass('wid-prev-k'); + $('.wid-prev-content').css('zoom', 1); + } else { + that.editSaveConfig('button/btn_prev_zoom', true); + $(this).addClass('ui-state-active'); + $('.wid-prev').addClass('wid-prev-k'); + $('.wid-prev-content').css('zoom', 0.5); + } + }); + + $('#btn_prev_type').hover( + function () { + $(this).addClass('ui-state-hover'); + }, + function () { + $(this).removeClass('ui-state-hover'); + } + ).click(function () { + if ($(this).hasClass('ui-state-active')) { + that.editSaveConfig('button/btn_prev_type', false); + $(this).removeClass('ui-state-active'); + $('.wid-prev-type').hide(); + } else { + that.editSaveConfig('button/btn_prev_type', true); + $(this).addClass('ui-state-active'); + $('.wid-prev-type').show(); + } + }); + + var $panel = $('#panel_body'); + var $toolbox = $('#toolbox'); + // create widget sets + $.each(this.widgetSets, function () { + var set = this.name || this; + var tplList = $('.vis-tpl[data-vis-set="' + set + '"]'); + + for (var i = 0; i < tplList.length; i++) { + var tpl = $(tplList[i]).attr('id'); + if (tpl === '_tplGroup') continue; // do not show group widget + var text = that.editOneWidgetPreview(tplList[i]); + var $preview = $(text); + $toolbox.append($preview); + + var $tpl = $('#' + tpl); + var $prev = $tpl.data('vis-prev'); + + if ($prev) { + var content = $preview.append($prev); + $(content).children().last().addClass('wid-prev-content'); + } + + $preview.draggable({ + helper: 'clone', + appendTo: $panel, + containment: $panel, + zIndex: 10000, + cursorAt: {top: 0, left: 0}, + + start: function (event, ui) { + if (ui.helper.children().length < 3) { + $(ui.helper).addClass('ui-state-highlight ui-corner-all').css({padding: '2px', 'font-size': '12px'}); + } else { + $(ui.helper).find('.wid-prev-type').remove(); + $(ui.helper).find('.wid-prev-name').remove(); + $(ui.helper).css('border', 'none'); + $(ui.helper).css('width', 'auto'); + } + } + }); + // Add widget by double click + /*$('#prev_container_' + tpl).dblclick(function () { + var tpl = $(this).data('tpl'); + var $tpl = $('#' + tpl); + var renderVisible = $tpl.attr('data-vis-render-visible'); + + // Widget attributes default values + var attrs = $tpl.attr('data-vis-attrs'); + // Combine attributes from data-vis-attrs, data-vis-attrs0, data-vis-attrs1, ... + var t = 0; + var attr; + while ((attr = $tpl.attr('data-vis-attrs' + t))) { + attrs += attr; + t++; + } + var data = {}; + if (attrs) { + attrs = attrs.split(';'); + if (attrs.indexOf('oid') !== -1) data.oid = 'nothing_selected'; + } + if (renderVisible) data.renderVisible = true; + + var widgetId = that.addWidget({tpl: tpl, data: data}); + + that.$selectActiveWidgets.append('') + .multiselect('refresh'); + + setTimeout(function () { + that.inspectWidgets(); + }, 50); + });*/ + } + }); + + $('.wid-prev').dblclick(function () { + that.editShowWizard(that.activeViewDiv, that.activeView, $(this).clone()); + }); + + if (this.config['button/btn_prev_type']) { + $('#btn_prev_type').trigger('click'); + } + + if (this.config['button/btn_prev_type'] === undefined) { + $('#btn_prev_type').trigger('click'); + } + + if (this.config['button/btn_prev_zoom']) { + $('#btn_prev_zoom').trigger('click'); + } + }, + editBuildSelectView: function () { + var keys = []; + var k; + for (k in this.views) { + if (!this.views.hasOwnProperty(k)) continue; + if (k === '___settings') continue; + keys.push(k); + } + + // case insensitive sorting + keys.sort(function (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }); + + var text = ''; + for (var view = 0; view < keys.length; view++) { + text += '
'; + //$('#view_select_tabs').append('
' + k + '
'); + text += '
' + keys[view] + '
'; + } + text += '
'; + $('#view_select_tabs').html(text); + $('#view_tab_' + this.activeView).addClass('ui-tabs-active ui-state-active'); + }, + editInitSelectView: function () { + var that = this; + $('#view_select_tabs_wrap').resize(function () { + var o = { + parent_w: $('#view_select_tabs_wrap').width(), + self_w: $('#view_select_tabs').width(), + self_l: parseInt($('#view_select_tabs').css('left')) + }; + if (o.parent_w >= (o.self_w + o.self_l)) { + $('#view_select_tabs').css('left', (o.parent_w - o.self_w) + 'px'); + } + }); + + $('#view_select_left').button({ + icons: { + primary: 'ui-icon-carat-1-w' + }, + text: false + }).click(function () { + var o = { + parent_w: $('#view_select_tabs_wrap').width(), + self_w: $('#view_select_tabs').width(), + self_l: parseInt($('#view_select_tabs').css('left')) + }; + + if (o.self_w != o.parent_w) { + if ((o.self_l + 50) <= 0) { + $('#view_select_tabs').css('left', o.self_l + 50 + 'px'); + } else { + $('#view_select_tabs').css('left', 0); + } + } + }); + + $('#view_select_list').button({ + icons: { + primary: 'ui-icon-clipboard' + }, + text: false + }).click(function () { + var tempList = that.$selectView.clone(); + tempList.val(that.activeView); + tempList.selectmenu({ + position: { my: "left top", at: "left bottom", of: "#view_select_list", collision: "none" }, + change: function (event, ui) { + var view = $(this).val(); + that.changeView(view, view); + }, + close: function( event, ui ) { + tempList.selectmenu('destroy'); + tempList.remove(); + } + }); + tempList.selectmenu('menuWidget').css('max-height', '400px') + .parent() + .css('max-height', 'calc(100vh - 135px)') + .css('overflow-x', 'hidden') + .css('overflow-y', 'scroll'); + tempList.selectmenu('open'); + }); + + $('#view_select_right').button({ + icons: { + primary: 'ui-icon-carat-1-e' + }, + text: false + }).click(function () { + var o = { + parent_w: $('#view_select_tabs_wrap').width(), + self_w: $('#view_select_tabs').width(), + self_l: parseInt($('#view_select_tabs').css('left')) + }; + + if (o.self_w != o.parent_w) { + if ((o.parent_w - o.self_w) <= (o.self_l - 50)) { + $('#view_select_tabs').css('left', o.self_l - 50 + 'px'); + } else { + $('#view_select_tabs').css('left', (o.parent_w - o.self_w) + 'px'); + } + } + }); + + $('#view_select').bind('mousewheel DOMMouseScroll', function (event) { + var o = { + parent_w: $('#view_select_tabs_wrap').width(), + self_w: $('#view_select_tabs').width(), + self_l: parseInt($('#view_select_tabs').css('left')) + }; + if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0) { + + if (o.self_w != o.parent_w) { + if ((o.parent_w - o.self_w) <= (o.self_l - 20)) { + $('#view_select_tabs').css('left', o.self_l - 20 + 'px'); + } else { + $('#view_select_tabs').css('left', (o.parent_w - o.self_w) + 'px'); + } + } + } else { + if (o.self_w != o.parent_w) { + if ((o.self_l + 20) <= 0) { + $('#view_select_tabs').css('left', o.self_l + 20 + 'px'); + } else { + $('#view_select_tabs').css('left', 0); + } + } + } + }); + + $('#view_select_tabs').unbind('click').on('click', '.view-select-tab', function () { + var view = $(this).attr('id').replace('view_tab_', ''); + $('.view-select-tab').removeClass('ui-tabs-active ui-state-active'); + $(this).addClass('ui-tabs-active ui-state-active'); + that.changeView(view, view); + }); + this.editBuildSelectView(); + }, + editInitCSSEditor: function () { + var that = this; + + var file = 'vis-common-user'; + var editor = ace.edit('css_editor'); + var timer = null; + var selecting = false; + + //editor.setTheme('ace/theme/monokai'); + editor.getSession().setMode('ace/mode/css'); + editor.setOptions({ + enableBasicAutocompletion: true, + enableLiveAutocompletion: true + }); + editor.$blockScrolling = Infinity; + editor.getSession().setUseWrapMode(true); + + if (that.config['select/select_css_file']) { + file = that.config['select/select_css_file']; + $('#select_css_file').val(file); + } + + $('#select_css_file').selectmenu({ + change: function (event, ui) { + // Save file + if (file === 'vis-user') { + that.conn.writeFile(that.projectPrefix + 'vis-user.css' , editor.getValue(), function () { + $('#css_file_save').button('disable'); + }); + } else if (file === 'vis-common-user') { + that.conn.writeFile('/vis/css/vis-common-user.css', editor.getValue(), function () { + $('#css_file_save').button('disable'); + }); + } + file = $(this).val(); + // Ignore next onchange + selecting = true; + editor.setValue($('#' + file).text()); + editor.navigateFileEnd(); + editor.focus(); + that.editSaveConfig('select/select_css_file', file); + // enable flag again in 500 ms + setTimeout(function () { + selecting = false; + }, 500); + } + }); + + editor.setValue($('#' + file).text()); + + editor.getSession().on('change', function(e) { + if (selecting) { + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + if (timer !== null) return; + timer = setTimeout(function () { + timer = null; + $('.' + file).text(editor.getValue()); + $('#css_file_save').button('enable'); + + // Trigger autosave after 2 seconds + setTimeout(function () { + $('#css_file_save').trigger('click'); + }, 2000); + }, 400); + }); + + $(document).bind('vis-common-user', function (e) { + editor.setValue($('#vis-common-user').text()); + editor.navigateFileEnd(); + }) + .bind('vis-user', function (e) { + editor.setValue($('#vis-user').text()); + editor.navigateFileEnd(); + }); + + $('#cssEditor_tab').click(function(){ + editor.focus(); + }); + + $('#pan_attr').resize(function(){ + editor.resize(); + }); + + $('#css_find').change(function(){ + editor.find($(this).val(),{ + backwards: false, + wrap: false, + caseSensitive: false, + wholeWord: false, + regExp: false + }); + }); + + $('#css_find_prev').button({ + icons: { + primary: 'ui-icon-arrowthick-1-n' + }, + text: false + }).click(function(){ + editor.findPrevious(); + }); + + $('#css_find_next').button({ + icons: { + primary: 'ui-icon-arrowthick-1-s' + }, + text: false + }).click(function(){ + editor.findNext(); + }); + + $('#css_file_save').button({ + icons: { + primary: 'ui-icon-disk' + }, + text: false + }).click(function() { + var val = $('#select_css_file').val(); + if (val === 'vis-user') { + that.conn.writeFile(that.projectPrefix + 'vis-user.css' , editor.getValue(), function () { + $('#css_file_save').button('disable'); + }); + } else if (val === 'vis-common-user') { + that.conn.writeFile('/vis/css/vis-common-user.css', editor.getValue(), function () { + $('#css_file_save').button('disable'); + }); + } + }).button('disable'); + }, + editInitScriptEditor: function () { + var that = this; + var editor = ace.edit('script_editor'); + var timer = null; + + //editor.setTheme('ace/theme/monokai'); + editor.getSession().setMode('ace/mode/javascript'); + editor.setOptions({ + enableBasicAutocompletion: true, + enableLiveAutocompletion: true + }); + editor.$blockScrolling = Infinity; + editor.getSession().setUseWrapMode(true); + + if (this.views && this.views.___settings && this.views.___settings.scripts) { + editor.setValue(this.views.___settings.scripts); + } + + editor.getSession().on('change', function(e) { + if (timer !== null) return; + timer = setTimeout(function () { + timer = null; + $('#script_file_save').button('enable'); + + // Trigger autosave after 2 seconds + setTimeout(function () { + $('#script_file_save').trigger('click'); + }, 2000); + }, 400); + }); + + $('#script_editor_tab').click(function(){ + editor.focus(); + }); + + $('#pan_attr').resize(function(){ + editor.resize(); + }); + + $('#script_find').change(function(){ + editor.find($(this).val(),{ + backwards: false, + wrap: false, + caseSensitive: false, + wholeWord: false, + regExp: false + }); + }); + + $('#script_find_prev').button({ + icons: { + primary: 'ui-icon-arrowthick-1-n' + }, + text: false + }).click(function(){ + editor.findPrevious(); + }); + + $('#script_find_next').button({ + icons: { + primary: 'ui-icon-arrowthick-1-s' + }, + text: false + }).click(function(){ + editor.findNext(); + }); + + $('#script_file_save').button({ + icons: { + primary: 'ui-icon-disk' + }, + text: false + }).click(function() { + that.views.___settings = !that.views.___settings || {}; + that.views.___settings.scripts = editor.getValue(); + + that.saveRemote(function () { + $('#script_file_save').button('disable'); + }); + }).button('disable'); + }, + editInitNext: function () { + // vis Editor Init + var that = this; + + this.editInitSelectView(); + this.updateViewLists(); + + $('#select_view-menu').css('max-height', '400px'); + + $('#inspect_view_theme').selectmenu({ + width: '100%', + change: function () { + var theme = $(this).val(); + that.views[that.activeView].settings.theme = theme; + that.addViewStyle(that.activeViewDiv, that.activeView, theme); + //that.additionalThemeCss(theme); + that.save(); + } + }); + // set max height of select menu and autocomplete + $('#inspect_view_theme-menu').css('max-height', '300px'); + + var $inspectGroups = $('#inspect_view_group'); + + $inspectGroups.multiselect({ + maxWidth: 180, + height: 260, + noneSelectedText: _('All groups'), + selectedText: function (numChecked, numTotal, checkedItems) { + var text = ''; + for (var i = 0; i < checkedItems.length; i++) { + text += (!text ? '' : ',') + checkedItems[i].title; + } + return text; + }, + multiple: true, + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + close: function () { + if ($inspectGroups.data('changed')) { + $inspectGroups.data('changed', false); + that.save(); + } + } + //noneSelectedText: _("Select options") + }).change(function () { + that.views[that.activeView].settings.group = $(this).val(); + that.save(); + }).data('changed', false); + + $inspectGroups.next().css('width', '100%'); + + $('#inspect_view_group-menu').css('max-height', '300px'); + + $('#inspect_view_group_action').change(function () { + that.views[that.activeView].settings.group_action = $(this).val(); + that.save(); + }); + + // end old select View xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + var $selectSet = $('#select_set'); + //$select_set.html(''); + $selectSet.append(''); + this.widgetSets.sort(function (a, b) { + if ((a.name || a) > (b.name || b)) return 1; + if ((a.name || a) < (b.name || b)) return -1; + return 0; + }); + for (var i = 0; i < this.widgetSets.length; i++) { + // skip empty sets, like google fonts + if (!$('.vis-tpl[data-vis-set="' + (this.widgetSets[i].name || this.widgetSets[i]) + '"]').length) continue; + + if (this.widgetSets[i].name !== undefined ) { + $selectSet.append(''); + } else { + $selectSet.append(''); + } + } + + if (this.config['select/select_set']) { + $selectSet.find('option[value="' + this.config['select/select_set'] + '"]').prop('selected', true); + } + + this.editInitWidgetPreview(); + + $selectSet.selectmenu({ + change: function (event, ui) { + var tpl = ui.item.value; + that.editSaveConfig('select/select_set', tpl); + if (tpl === 'all') { + $('.wid-prev').css('display', 'inline-block'); + } else { + $('.wid-prev').hide(); + $('.' + tpl + '_prev').css('display', 'inline-block'); + + // Remove filter + if ($filter_set.val() && $filter_set.val() !== '*') { + $filter_set.val('*'); + var textToShow = $filter_set.find(':selected').text(); + $filter_set.parent().find('span').find('input').val(textToShow); + filterWidgets(); + } + } + } + }); + + if (this.editTemplatesInit) { + this.editTemplatesInit(); + } + + // set maximal height + $('#select_set-menu').css('max-height', '400px'); + + // Create list of filters + this.filterList = []; + $('.widget-filters').each(function () { + var keywords = $(this).data('keywords').split(' '); + for (var k = 0; k < keywords.length; k++) { + if (that.filterList.indexOf(keywords[k]) === -1) that.filterList.push(keywords[k]); + } + }); + + var $filter_set = $('#filter_set'); + + function filterWidgets () { + if ($filter_set.data('timeout')) return; + $filter_set.data('timeout', setTimeout(function () { + $filter_set.data('timeout', null); + var value = $filter_set.val().toLowerCase(); + that.editSaveConfig('select/filter_set', value); + $('.widget-filters').each(function () { + if (value !== '' && value !== '*' && $selectSet.val() !== 'all') { + $selectSet.val('all'); + $selectSet.selectmenu('refresh'); + } + var keywords = $(this).data('keywords'); + if (value === '' || value === '*' || keywords.indexOf(value) !== -1) { + $(this).show(); + } else { + $(this).hide(); + } + }); + }, 400)); + } + + $filter_set.autocomplete({ + minLength: 0, + source: function (request, response) { + var data = $.grep(that.filterList, function (value) { + return value.substring(0, request.term.length).toLowerCase() === request.term.toLowerCase(); + }); + data = data.slice(0, 50); + response(data); + }, + select: filterWidgets, + change: filterWidgets + }).focus(function () { + $(this).autocomplete('search', ''); + }).keyup(function (e) { + if (e.keyCode == 13) { + $filter_set.autocomplete('close'); + } + filterWidgets(); + }).bind('dblclick', function () { + if ($filter_set.val() && $filter_set.val() !== '*') { + $filter_set.val('*'); + var textToShow = $filter_set.find(':selected').text(); + $filter_set.parent().find('span').find('input').val(textToShow); + filterWidgets(); + } + }).clearSearch(); + + if (this.config['select/select_set'] !== 'all' && this.config['select/select_set']) { + $('.wid-prev').hide(); + $('.' + this.config['select/select_set'] + '_prev').show(); + } + + if (this.config['select/filter_set'] && this.config['select/filter_set'] !== '*') { + $filter_set.val(this.config['select/filter_set']); + var textToShow = $filter_set.find(':selected').text(); + $filter_set.parent().find('span').find('input').val(textToShow); + setTimeout(filterWidgets, 500); + } + + // Expand/Collapse view settings + $('.view-group').each(function () { + $(this).button({ + icons: { + primary: 'ui-icon-triangle-1-s' + }, + text: false + }).css({width: 22, height: 22}).click(function () { + var group = $(this).attr('data-group'); + that.groupsState[group] = !that.groupsState[group]; + $(this).button('option', { + icons: {primary: that.groupsState[group] ? 'ui-icon-triangle-1-n' : 'ui-icon-triangle-1-s'} + }); + if (that.groupsState[group]) { + $('.group-' + group).show(); + } else { + $('.group-' + group).hide(); + } + that.editSaveConfig('groupsState', that.groupsState); + }); + var group = $(this).attr('data-group'); + if (that.groupsState && !that.groupsState[group]) $('.group-' + group).hide(); + }); + + // Init inspect view settings buttons + $('.view-edit-button').each(function () { + var type = $(this).attr('data-type'); + + if (type === 'color') { + if ((typeof colorSelect !== 'undefined' && $().farbtastic)) { + $(this).button({ + text: false, + icons: { + primary: 'ui-icon-note' + } + }).click(function () { + var attr = $(this).attr('data-attr'); + var _settings = { + current: $('#inspect_' + attr).val(), + onselectArg: attr, + onselect: function (img, _data) { + var value = colorSelect.GetColor(); + $('#inspect_' + _data).css('background-color', value || '').val(value).trigger('change'); + that._editSetFontColor('inspect_' + _data); + } + }; + colorSelect.show(_settings); + }).css({width: 22, height: 22}).attr('title', _('Select color')); + } + } + }); + + // Create background_class property if does not exist + if (this.views[this.activeView] !== undefined) { + if (this.views[this.activeView].settings === undefined) { + this.views[this.activeView].settings = {}; + } + if (this.views[this.activeView].settings.style === undefined) { + this.views[this.activeView].settings.style = {}; + } + if (this.views[this.activeView].settings.style.background_class === undefined) { + this.views[this.activeView].settings.style.background_class = ''; + } + } + + if (this.fillWizard) this.fillWizard(); + + // Deselect active widget if click nowhere. Not required if selectable is active + if (!this.selectable) { + $('#vis_container').click(function () { + that.inspectWidgets(that.activeViewDiv, that.activeView, []); + }); + } + + if (this.conn.getType() === 'local') { + $('#export_local_view').click(function () { + that.exportView(that.activeViewDiv, that.activeView, true); + }).show(); + $('#import_local_view').click(function () { + $('#textarea_import_view').val(''); + $('#name_import_view').show(); + $('#dialog_import_view').dialog({ + autoOpen: true, + width: 800, + height: 600, + modal: true, + open: function (event, ui) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_import_view"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + $('#start_import_view').unbind('click').click(function () { + that.importView(true); + }); + $('#name_import_view').hide(); + } + }); + }).show(); + $('#clear_local_view').click(function () { + if (typeof storage !== 'undefined') { + localStorage.clear(); + window.location.reload(); + } + }).show(); + $('#local_view').show(); + } + + this.showWaitScreen(false); + $('#menu_body').show(); + $('#panel_body').show(); + $('head').prepend(''); + + $filter_set.clearSearch('update'); + }, + editLoadConfig: function () { + // Read all positions, selected widgets for every view, + // Selected view, selected menu page, + // Selected widget or view page + // Selected filter + if (typeof storage !== 'undefined') { + try { + var stored = storage.get('visConfig'); + this.config = stored ? JSON.parse(stored) : {}; + } catch (e) { + console.log('Cannot load edit config'); + this.config = {}; + } + } + }, + editSaveConfig: function (attr, value) { + if (attr) this.config[attr] = value; + + if (typeof storage !== 'undefined') { + storage.set('visConfig', JSON.stringify(this.config)); + } + }, + /** + * Change order of widgets in th e view. + * + * @view {string} view name. If empty then activeView + * @wid {string} widget name. + * @direction {string} "next" or "prev". If no orderWid will be given, so the order will change according to actual position. + * @orderWid {string} optional name of widget after (next) or before (prev) of which + */ + editWidgetOrder: function (view, wid, direction, orderWid) { + var w; + view = view || this.activeView; + if (!orderWid) { + if (direction === 'next' || direction === 'n') { + for (w in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(w)) continue; + if (orderWid === true) { + var position = this.views[view].widgets[w].style.position; + if (position === 'relative' || position === 'static' || position === 'sticky') { + orderWid = w; + break; + } + } + if (w === wid) orderWid = true; + } + } else { + for (w in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(w)) continue; + if (w === wid) break; + + var position = this.views[view].widgets[w].style.position; + if (position === 'relative' || position === 'static' || position === 'sticky') { + orderWid = w; + } + } + } + } + + if (orderWid && orderWid !== true && this.views[view].widgets[orderWid]) { + var newOrder = {}; + for (w in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(w)) continue; + if (w === wid) continue; + if (w === orderWid) { + if (direction === 'next' || direction === 'n') { + newOrder[w] = this.views[view].widgets[w]; + newOrder[wid] = this.views[view].widgets[wid]; + $('#' + wid).detach().insertAfter('#' + w); + } else { + newOrder[wid] = this.views[view].widgets[wid]; + newOrder[w] = this.views[view].widgets[w]; + $('#' + wid).detach().insertBefore('#' + w); + } + } else { + newOrder[w] = this.views[view].widgets[w]; + } + } + this.views[view].widgets = null; + this.views[view].widgets = newOrder; + } + }, + confirmMessage: function (message, title, icon, width, callback) { + if (typeof width === 'function') { + callback = width; + width = '400'; + } + + if (!this.$dialogConfirm) { + this.$dialogConfirm = $('#dialog-confirm'); + this.$dialogConfirm.dialog({ + autoOpen: false, + modal: true, + open: function (event) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $(this).parent().css({'z-index': 1001}); + }, + width: width, + buttons: [ + { + text: _('Ok'), + click: function () { + var cb = $(this).data('callback'); + $(this).dialog('close'); + if (cb) cb(true); + } + }, + { + text: _('Cancel'), + click: function () { + var cb = $(this).data('callback'); + $(this).dialog('close'); + if (cb) cb(false); + } + } + ] + }); + } + this.$dialogConfirm.dialog('option', 'title', title || _('Confirm')); + $('#dialog-confirm-text').html(message); + if (icon) { + $('#dialog-confirm-icon') + .show() + .attr('class', '') + .addClass('ui-icon ui-icon-' + icon); + } else { + $('#dialog-confirm-icon').hide(); + } + this.$dialogConfirm.data('callback', callback); + this.$dialogConfirm.dialog('open'); + }, + addView: function (view) { + var _view = view.replace(/\s/g, '_').replace(/\./g, '_'); + if (this[_view]) return false; + + this.views[_view] = {settings: {style: {}}, widgets: {}, name: view}; + var that = this; + this.saveRemote(function () { + //$(window).off('hashchange'); + //window.location.hash = '#' + view; + + //noinspection JSJQueryEfficiency + $('#view_tab_' + that.activeView).removeClass('ui-tabs-active ui-state-active'); + that.changeView(_view, _view); + + that.editBuildSelectView(); + //noinspection JSJQueryEfficiency + $('#view_tab_' + that.activeView).addClass('ui-tabs-active ui-state-active'); + + that.updateViewLists(); + }); + }, + renameView: function (oldName, newName) { + var _newName = newName.replace(/\s/g, '_').replace(/\./g, '_'); + this.views[_newName] = $.extend(true, {}, this.views[oldName]); + this.views[_newName].name = newName; + + $('#vis_container').html(''); + delete this.views[oldName]; + this.activeView = _newName; + this.activeViewDiv = this.activeView; + var that = this; + this.renderView(_newName, _newName, function () { + that.changeView(_newName, _newName, function (_viewName, _view) { + // Rebuild tabs, select, selectCopyTo + $('#view_tab_' + oldName).attr('id', 'view_tab_' + _newName); + $('#view_tab_' + _newName).removeClass('sel_opt_' + oldName).addClass('ui-tabs-active ui-state-active sel_opt_' + _newName).html(newName); + var $opt = that.$selectView.find('option[value="' + oldName + '"]'); + $opt.html(newName).attr('value', _newName); + that.$selectView.val(_newName); + that.$selectView.selectmenu('refresh'); + + $opt = that.$copyWidgetSelectView.find('option[value="' + oldName + '"]'); + $opt.html(newName).attr('value', _newName); + that.$copyWidgetSelectView.val(_newName); + that.$copyWidgetSelectView.selectmenu('refresh'); + that.saveRemote(); + }); + }); + }, + updateViewLists: function () { + var keys = []; + var i; + var k; + for (k in this.views) { + if (!this.views.hasOwnProperty(k)) continue; + if (k === '___settings') continue; + keys.push(k); + } + var len = keys.length; + + // case insensitive sorting + keys.sort(function (a, b) { + return a.toLowerCase().localeCompare(b.toLowerCase()); + }); + var text = ''; + for (i = 0; i < len; i++) { + text += ''; + } + this.$selectView.html(text); + this.$selectView.val(this.activeView); + + // if not yet created + if (!this.$selectView.data('inited')) { + this.$selectView.data('inited', true); + var that = this; + this.$selectView.selectmenu({ + change: function (event, ui) { + var view = $(this).val(); + that.changeView(view, view); + } + }).selectmenu('menuWidget').parent().addClass('view-select-menu'); + } else { + this.$selectView.selectmenu('refresh'); + } + + this.$copyWidgetSelectView.html(text); + this.$copyWidgetSelectView.val(this.activeView); + + // if not yet created + if (!this.$copyWidgetSelectView.data('inited')) { + this.$copyWidgetSelectView.data('inited', true); + this.$copyWidgetSelectView.selectmenu(); + } else { + this.$copyWidgetSelectView.selectmenu('refresh'); + } + }, + delView: function (view) { + var that = this; + this.confirmMessage(_('Really delete view %s?', view), null, 'help', function (result) { + if (result) { + if (view === that.activeView) that.nextView(); + + if (that.views[view]) delete that.views[view]; + that.saveRemote(function () { + $('#view_tab_' + view).remove(); + $('#visview_' + view).remove(); + + that.$selectView.find('option[value="' + view + '"]').remove(); + that.$copyWidgetSelectView.find('option[value="' + view + '"]').remove(); + if (!that.$selectView.find('option').length) { + that.$selectView.append(''); + that.$copyWidgetSelectView.append(''); + that.$selectView.val(''); + that.$copyWidgetSelectView.val(''); + } + + that.$selectView.selectmenu('refresh'); + that.$copyWidgetSelectView.selectmenu('refresh'); + }); + } + }); + }, + dupView: function (source, dest) { + var _dest = dest.replace(/\s/g, '_').replace(/\./g, '_'); + this.views[_dest] = $.extend(true, {}, this.views[source]); + this.views[_dest].name = dest; + + // Give to all widgets new IDs... + var that = this; + + var rename = function(widget, force) { + if (!force && that.views[_dest].widgets[widget].grouped) return widget; + if (that.views[_dest].widgets[widget].data.members) { + var members_new = []; + for (var i = 0; i < that.views[_dest].widgets[widget].data.members.length; i++) { + var member = that.views[_dest].widgets[widget].data.members[i]; + members_new.push(rename(member, true)); + } + var group_new = that.nextGroup(); + that.views[_dest].widgets[widget].data.members = members_new; + that.views[_dest].widgets[group_new] = that.views[_dest].widgets[widget]; + delete that.views[_dest].widgets[widget]; + return group_new; + } else { + var name_new = that.nextWidget(); + that.views[_dest].widgets[name_new] = that.views[_dest].widgets[widget]; + delete that.views[_dest].widgets[widget]; + return name_new; + } + }; + for (var widget in this.views[_dest].widgets) { + if (!this.views[_dest].widgets.hasOwnProperty(widget)) continue; + rename(widget, false); + } + + + this.saveRemote(function () { + that.renderView(_dest, _dest, function (_view) { + that.changeView(_view, _view); + $('.view-select-tab').removeClass('ui-tabs-active ui-state-active'); + + that.editBuildSelectView(); + $('#view_tab_' + _view).addClass('ui-tabs-active ui-state-active'); + + that.$selectView.append(''); + that.$selectView.val(_view); + that.$selectView.selectmenu('refresh'); + + that.$copyWidgetSelectView.append(''); + that.$copyWidgetSelectView.val(_view); + that.$copyWidgetSelectView.selectmenu('refresh'); + }); + }); + }, + nextView: function () { + var $select = $('.view-select-tab.ui-state-active'); + var $next = $select.parent().next().children().first(); + + if ($next.hasClass('view-select-tab')) { + $next.trigger('click'); + } else { + $select.parent().parent().children().first().children().first().trigger('click'); + } + }, + prevView: function () { + var $select = $('.view-select-tab.ui-state-active'); + var $prev = $select.parent().prev().children().first(); + + if ($prev.hasClass('view-select-tab')) { + $prev.trigger('click'); + } else { + $select.parent().parent().children().last().children().first().trigger('click'); + } + }, + editGetWidgets: function (view, widget, _result) { + view = view || this.activeView; + _result = _result || []; + if (_result.indexOf(widget) === -1) _result.push(widget); + if (widget[0] === 'g') { + var wid = this.views[view].widgets[widget]; + for (var j = 0; j < wid.data.members.length; j++) { + this.editGetWidgets(view, wid.data.members[j], _result); + } + } + return _result; + }, + exportWidgetsAsZip: function (view, widgets) { + // create image, get all widgets into widgets.txt + }, + exportWidgets: function (widgets) { + this.removeUnusedFields(); + + var exportW = []; + widgets = widgets || this.activeWidgets; + + for (var i = 0; i < widgets.length; i++) { + var list = this.editGetWidgets(null, widgets[i]); + for (var j = 0; j < list.length; j++) { + var obj = JSON.parse(JSON.stringify(this.views[this.activeView].widgets[list[j]])); + if (this.activeView !== this.activeViewDiv && obj.grouped) { + delete obj.grouped; + } else if (obj.grouped) { + obj.groupName = list[j]; + } + + exportW.push(obj); + } + } + + $('#textarea_export_widgets').val(JSON.stringify(exportW)).select(); + + $('#dialog_export_widgets').dialog({ + autoOpen: true, + width: 800, + height: 600, + modal: true, + open: function (event /*, ui*/) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_export_widgets"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + } + }); + }, + importWidgets: function (viewDiv, view) { + $('#textarea_import_widgets').val(''); + var that = this; + viewDiv = viewDiv || this.activeViewDiv; + view = view || this.activeView; + + $('#dialog_import_widgets').dialog({ + autoOpen: true, + width: 800, + height: 600, + modal: true, + open: function (event, ui) { + $('[aria-describedby="dialog_import_widgets"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + + $('#start_import_widgets').unbind('click').click(function () { + $('#dialog_import_widgets').dialog('close'); + var importObject; + try { + var text = $('#textarea_import_widgets').val(); + importObject = JSON.parse(text); + } catch (e) { + that.showMessage(_('invalid JSON') + '\n\n' + e, _('Error')); + return; + } + + var widgets = []; + var mapping = {}; + + // inverted order because of groups + for (var widget = importObject.length - 1; widget >= 0; widget--) { + if (that.binds.bars && that.binds.bars.convertOldBars && importObject[widget].data.baroptions) { + importObject[widget] = that.binds.bars.convertOldBars(importObject[widget]); + } + + if (importObject[widget].tpl === '_tplGroup') { + // try to convert members + for (var d = 0; d < importObject[widget].data.members.length; d++) { + if (mapping[importObject[widget].data.members[d]]) { + importObject[widget].data.members[d] = mapping[importObject[widget].data.members[d]]; + } else { + console.error('Unexpected error: widget "' + importObject[widget].data.members[d] + '" not found in export.'); + } + } + } + + var widgetId = that.addWidget(viewDiv, view, { + widgetSet: importObject[widget].widgetSet, + tpl: importObject[widget].tpl, + data: importObject[widget].data, + style: importObject[widget].style, + grouped: importObject[widget].grouped, + noSave: true, + noAnimate: true + }, true); + + if (importObject[widget].groupName) { + mapping[importObject[widget].groupName] = widgetId; + } + + // (tpl, data, style, wid, view, noSave, noAnimate) + if (!importObject[widget].grouped) widgets.push(widgetId); + } + // update widget select + that.updateSelectWidget(viewDiv, view); + + that.saveRemote(function () { + //that.renderView(viewDiv, view, function (viewDiv, view) {that.inspectWidgets(viewDiv, view, activeWidgets);}); + that.inspectWidgets(viewDiv, view, widgets); + }); + }); + } + }); + }, + exportView: function (viewDiv, view, isAll) { + var exportView = $.extend(true, {}, isAll ? this.views : this.views[view]); + // Set to all widgets the new ID... + var num = 1; + var wid; + if (!isAll) { + for (var widget in exportView.widgets) { + wid = 'e' + (('0000' + num).slice(-5)); + num += 1; + exportView.widgets[wid] = exportView.widgets[widget]; + delete exportView.widgets[widget]; + } + if (exportView.activeWidgets) delete exportView.activeWidgets; + } + $('#textarea_export_view').html(JSON.stringify(exportView, null, ' ')); + + document.getElementById('textarea_export_view').select(); + + $('#dialog_export_view').dialog({ + autoOpen: true, + width: 800, + height: 600, + modal: true, + open: function (event /* , ui*/) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_export_view"]').css('z-index', 1002); + $('.ui-widget-overlay').css('z-index', 1001); + } + }); + }, + importView: function (isAll) { + var that = this; + var name = this.checkNewViewName($('#name_import_view').val()); + var importObject; + if (name === false) { + that.showMessage(_('View yet exists or name of view is empty')); + return; + } + try { + var text = $('#textarea_import_view').val(); + importObject = JSON.parse(text); + } catch (e) { + that.showMessage(_('invalid JSON') + '\n\n' + e, _('Error'), 'alert'); + return; + } + if (isAll) { + for (var v in importObject) { + for (var w in importObject[v]) { + if (vis.binds.bars && vis.binds.bars.convertOldBars && importObject[v][w].data.baroptions) { + importObject[v][w] = vis.binds.bars.convertOldBars(importObject[v][w]); + } + if (vis.binds.hqwidgets && vis.binds.hqwidgets.convertOldWidgets && importObject[v][w].data.hqoptions) { + importObject[v][w] = vis.binds.hqwidgets.convertOldWidgets(importObject[v][w]); + } + } + // Remove active widgets + if (importObject[v].activeWidgets) delete importObject[v].activeWidgets; + } + + this.views = importObject; + this.saveRemote(function () { + window.location.reload(); + }); + } else { + var _name = name.replace(/\s/g, '_').replace(/\./g, '_'); + this.addView(_name); + this.views[_name] = importObject; + this.views[_name].name = name; + + // Set for all widgets the new ID... + for (var widget in this.views[_name].widgets) { + if (this.binds.bars && this.binds.bars.convertOldBars && this.views[_name].widgets[widget].data.baroptions) { + this.views[_name].widgets[widget] = this.binds.bars.convertOldBars(this.views[_name].widgets[widget]); + } + if (vis.binds.hqwidgets && vis.binds.hqwidgets.convertOldWidgets && this.views[_name].widgets[widget].data.hqoptions) { + this.views[_name].widgets[widget] = vis.binds.hqwidgets.convertOldWidgets(this.views[_name].widgets[widget]); + } + + this.views[_name].widgets[this.nextWidget()] = this.views[_name].widgets[widget]; + delete this.views[_name].widgets[widget]; + } + // Remove active widgets + if (this.views[_name].activeWidgets) delete this.views[_name].activeWidgets; + this.saveRemote(function () { + that.renderView(_name, _name, function (_viewDiv, _view) { + that.changeView(_viewDiv, _view); + }); + }); + } + }, + checkNewViewName: function (name) { + if (name === undefined || name === null) name = ''; + if (name === 0) name = '0'; + + name = name.trim(); + name = name.replace(/\s/g, '_').replace(/\./g, '_'); + if (!name && name !== 0) { + this.showMessage(_('Please enter the name for the new view!')); + return false; + } else if (this.views[name] || name === '___settings') { + this.showMessage(_('The view with the same name yet exists!')); + return false; + } else { + return name; + } + }, + nextWidget: function () { + var next = 1; + var used = []; + var key = 'w' + (('000000' + next).slice(-5)); + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + for (var wid in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(wid)) continue; + wid = wid.split('_'); + wid = wid[0]; + used.push(wid); + } + while (used.indexOf(key) > -1) { + next += 1; + key = 'w' + (('000000' + next).slice(-5)); + } + } + return key; + }, + nextGroup: function () { + var next = 1; + var used = []; + var key = 'g' + (('000000' + next).slice(-5)); + for (var view in this.views) { + if (!this.views.hasOwnProperty(view) || view === '___settings') continue; + for (var wid in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(wid)) continue; + wid = wid.split('_'); + wid = wid[0]; + used.push(wid); + } + while (used.indexOf(key) > -1) { + next++; + key = 'g' + (('000000' + next).slice(-5)); + } + } + return key; + }, + getViewOfWidget: function (id) { + // find view of this widget + var view = null; + for (var v in this.views) { + if (v === '___settings') continue; + if (this.views[v] && this.views[v].widgets && this.views[v].widgets[id]) { + view = v; + break; + } + } + return view; + }, + getViewsOfWidget: function (id) { + if (id.indexOf('_') === -1) { + var view = this.getViewOfWidget(id); + if (view) { + return [view]; + } else { + return []; + } + } else { + var wids = id.split('_', 2); + var wid = wids[0]; + var result = []; + for (var v in this.views) { + if (v === '___settings') continue; + if (this.views[v].widgets[wid + '_' + v] !== undefined) { + result[result.length] = v; + } + } + return result; + } + }, + getUserGroups: function () { + return this.userGroups; + }, + delWidgetHelper: function (viewDiv, view, id, isAll, groupId) { + if (!id) return; + + if (isAll && id.indexOf('_') !== -1) { + var views = this.getViewsOfWidget(id); + var wids = id.split('_', 2); + for (var i = 0; i < views.length; i++) { + var viewDivs = viewDiv.split('_', 2); + this.delWidgetHelper(viewDivs[0] + '_' + views[i], views[i], wids[0] + '_' + views[i], false); + } + this.inspectWidgets(viewDiv, view, []); + return; + } + + // Remove widget from the list + this.updateSelectWidget(viewDiv, view, null, id); + + var widgetDiv = document.getElementById(id); + if (widgetDiv && widgetDiv.visCustomEdit && widgetDiv.visCustomEdit['delete']) { + widgetDiv.visCustomEdit['delete'](id); + } + + if (widgetDiv && widgetDiv._customHandlers && widgetDiv._customHandlers.onDelete) { + widgetDiv._customHandlers.onDelete(widgetDiv, id); + } + if (this.views[view].widgets[id] && this.views[view].widgets[id].data.members) { + var list = this.views[view].widgets[id].data.members.slice(); + for (var m = 0; m < list.length; m++) { + if (list[m] !== id) { + this.delWidgetHelper(viewDiv, view, list[m], isAll, id); + } + } + } + + this.destroyWidget(viewDiv, view, id); + + $('#' + id).remove(); + if (this.views[view].widgets[id] && this.views[view].widgets[id].grouped) { + // find group + var pos = -1; + if (!groupId && viewDiv == view) { + var widgets = this.views[view].widgets; + for (var w in widgets) { + if (!widgets.hasOwnProperty(w)) continue; + var members = this.views[view].widgets[w].data.members; + if (members && ((pos = members.indexOf(id)) !== -1)) { + groupId = w; + } + } + } + else { + pos = this.views[view].widgets[groupId || viewDiv].data.members.indexOf(id); + } + + if (pos !== -1) this.views[view].widgets[groupId || viewDiv].data.members.splice(pos, 1); + } + if (view) delete this.views[view].widgets[id]; + + if (this.widgets[id]) delete this.widgets[id]; + + var pos = this.activeWidgets.indexOf(id); + if (pos !== -1) this.activeWidgets.splice(pos, 1); + }, + delWidgets: function (viewDiv, view, widgets, noSave) { + if (typeof widgets !== 'object') widgets = null; + + if (!widgets) { + // Store array, because it will be modified in delWidgetHelper + widgets = JSON.parse(JSON.stringify(this.activeWidgets)); + } + + for (var j = 0; j < widgets.length; j++) { + this.delWidgetHelper(viewDiv, view, widgets[j], true); + } + if (!noSave) this.save(viewDiv, view); + + this.inspectWidgets(viewDiv, view, []); + }, + bindWidgetClick: function (viewDiv, view, id) { + var that = this; + if (!this.views[view] || !this.views[view].widgets[id]) { + console.warn('View:' + view + ', id: ' + id + ' not found'); + return; + } + var $wid = $('#' + id); + + if (viewDiv === view && this.views[view].widgets[id].grouped) return; + + if (id === viewDiv) return; + + if (!this.views[view].widgets[id].data.locked) { + $wid.unbind('click dblclick').bind('click', function (e) { + if (that.dragging) return; + + var widgetId = $(this).attr('id'); + // if shift or control pressed + if (e.shiftKey || e.ctrlKey || e.metaKey) { + var pos = that.activeWidgets.indexOf(widgetId); + + // Add to list + if (pos === -1) { + that.inspectWidgets(viewDiv, view, widgetId); + } else { + // Remove from list + that.inspectWidgets(viewDiv, view, null, widgetId); + } + } else { + // Simple click on some widget + if (that.activeWidgets.length !== 1 || that.activeWidgets[0] !== widgetId) { + that.inspectWidgets(viewDiv, view, [widgetId]); + } + } + + e.preventDefault(); + e.stopPropagation(); + return false; + }); + + if (id[0] === 'g') { + $wid.bind('dblclick', function (e) { + if (that.dragging) return; + var widgetId = $(this).attr('id'); + if (widgetId[0] !== 'g') return; + + that.changeView(widgetId, view, undefined, undefined, true, function (_viewDiv, _view) { + // deselect all + that.inspectWidgets(_viewDiv, _view, []); + }); + }); + } + } else { + $wid.addClass('vis-widget-edit-locked').removeClass('ui-selectee').unbind('click'); + } + }, + addWidget: function (viewDiv, view, options, isCopied) { + // tpl, data, style, wid, view, noSave, noAnimate + var isSelectWidget = (options.wid === undefined); + var $view = $('#visview_' + viewDiv); + var renderVisible = options.data.renderVisible; + + if (renderVisible) delete options.data.renderVisible; + + if (isSelectWidget && !$view.length) { + var that = this; + this.renderView(viewDiv, view, false, function (_viewDiv, _view) { + that.addWidget(_viewDiv, _view, options, isCopied); + }); + return; + } + + var widgetId; + if (options.data.members) { + widgetId = options.wid || this.nextGroup(); + } else { + widgetId = options.wid || this.nextWidget(); + } + var $tpl; + $tpl = $('#' + options.tpl); + + // call custom init function + if (!options.noSave && $tpl.attr('data-vis-init')) { + var init = $tpl.attr('data-vis-init'); + if (this.binds[$tpl.attr('data-vis-set')][init]) { + this.binds[$tpl.attr('data-vis-set')][init](options.tpl, options.data); + } + } + + this.widgets[widgetId] = { + wid: widgetId, + data: new can.Map($.extend({ + 'wid': widgetId + }, options.data)) + }; + + if (renderVisible) this.widgets[widgetId].renderVisible = true; + + this.views[view].widgets = this.views[view].widgets || {}; + this.views[view].widgets[widgetId] = this.views[view].widgets[widgetId] || {}; + + var findPos = !options.style; + options.style = options.style || {}; + + if (this.views[view].widgets[widgetId].data !== undefined) { + options.data = $.extend(options.data, this.views[view].widgets[widgetId].data, true); + } + + this.views[view].widgets[widgetId] = { + tpl: options.tpl, + data: options.data, + style: options.style, + widgetSet: options.tpl === '_tplGroup' ? null : ($tpl ? $tpl.attr('data-vis-set') : undefined) + }; + + if (options.grouped || viewDiv !== view) this.views[view].widgets[widgetId].grouped = true; + // if group edit + if (viewDiv !== view) { + this.views[view].widgets[viewDiv].data.members.push(widgetId); + } + + if (renderVisible) this.views[view].widgets[widgetId].renderVisible = true; + + //if (options.style) $jWidget.css(options.style); + + if ($view.length) { + /*var position = options.style ? options.style.position : ''; + // if widget has relative position => insert it into relative div + if (this.editMode && (position === 'relative' || position === 'static' || position === 'sticky')) { + if (this.views[options.view].settings && this.views[options.view].settings.sizex) { + var $relativeView = $view.find('.vis-edit-relative'); + if (!$relativeView.length) { + $view.append('
'); + $view = $view.find('.vis-edit-relative'); + } else { + $view = $relativeView; + } + } + } + + var obj = { + //ts: this.states.attr(this.widgets[widgetId].data.oid + '.ts'), + // ack: this.states.attr(this.widgets[widgetId].data.oid + '.ack'), + // lc: this.states.attr(this.widgets[widgetId].data.oid + '.lc'), + data: this.widgets[widgetId].data, + view: options.view + }; + if (this.states[this.widgets[widgetId].data.oid + '.val'] !== undefined) { + obj.val = this.states.attr(this.widgets[widgetId].data.oid + '.val'); + } + $view.append(can.view(options.tpl, obj));*/ + this.reRenderWidgetEdit(viewDiv, view, widgetId); + + if (viewDiv === view || viewDiv !== widgetId) { + $('#' + widgetId).addClass('vis-widget-lock'); + } + + if (findPos) { + var $widget = $('#' + widgetId); + + var pos = this.findFreePosition(view, widgetId, null, $widget.width(), $widget.height()); + $widget.css(pos); + this.views[view].widgets[widgetId].style.top = pos.top; + this.views[view].widgets[widgetId].style.left = pos.left; + } + + // if group edit + if (view !== viewDiv) { + // convert all coordinates and sizes into % + var wRect = this.editConvertToPercent(viewDiv, view, widgetId, viewDiv); + this.views[view].widgets[widgetId].style.top = wRect.top; + this.views[view].widgets[widgetId].style.left = wRect.left; + this.views[view].widgets[widgetId].style.width = wRect.width; + this.views[view].widgets[widgetId].style.height = wRect.height; + } + } + if (isSelectWidget) { + this.activeWidgets = [widgetId]; + if (!options.noAnimate) { + this.actionHighlightWidget(widgetId); + } + } + + if (!isCopied) { + // mark all groups as disabled + options.data.g_fixed = false; + options.data.g_visibility = false; + options.data.g_css_font_text = false; + options.data.g_css_background = false; + options.data.g_css_shadow_padding = false; + options.data.g_css_border = false; + options.data.g_gestures = false; + options.data.g_signals = false; + options.data.g_last_change = false; + } + + if (!options.noSave) this.save(); + + this.bindWidgetClick(viewDiv, view, widgetId); + + return widgetId; + }, + dupWidgets: function (targetViewDiv, targetView, widgets, offsetX, offsetY, grouped) { + // make a copy + if (widgets) widgets = JSON.parse(JSON.stringify(widgets)); + + if (typeof widgets === 'string') { + try { + widgets = JSON.parse(widgets); + } catch (e) { + console.error('Cannot parse clipboard'); + return; + } + } + if (typeof offsetX === 'boolean') { + grouped = offsetX; + offsetX = undefined; + } + + if (!widgets) { + widgets = JSON.parse(JSON.stringify(this.activeWidgets)); + } + + var srcViewDiv; + var srcView; + var tpl; + var data; + var style; + var newWidgets = []; + var firstOffsetX = null; + var firstOffsetY = null; + + for (var i = 0; i < widgets.length; i++) { + var objWidget; + if (widgets[i].wid) continue; + + // if from clipboard + if (widgets[i].widget) { + objWidget = widgets[i].widget; + tpl = objWidget.tpl; + data = objWidget.data; + style = objWidget.style; + grouped = objWidget.grouped && grouped; + srcView = widgets[i].view; + srcViewDiv = widgets[i].viewDiv; + } else { + srcViewDiv = this.activeViewDiv; + srcView = this.activeView; + // From active view + tpl = this.views[srcView].widgets[widgets[i]].tpl; + data = $.extend({}, this.views[srcView].widgets[widgets[i]].data); + style = $.extend({}, this.views[srcView].widgets[widgets[i]].style); + grouped = this.views[srcView].widgets[widgets[i]].grouped && grouped; + } + + if (offsetX !== undefined && typeof offsetX !== 'boolean') { + if (firstOffsetX === null) { + firstOffsetX = parseInt(style.left, 10); + firstOffsetY = parseInt(style.top, 10); + + style.left = offsetX; + style.top = offsetY; + } else { + style.top = parseInt(style.top, 10); + style.left = parseInt(style.left, 10); + + style.top = firstOffsetY - style.top + offsetY; + style.left = firstOffsetX - style.left + offsetX; + } + } + var obj = { + tpl: tpl, + data: data, + style: style, + noSave: true + }; + if (srcViewDiv === targetViewDiv) { + if (!grouped && offsetX === undefined) { + style.top = parseInt(style.top, 10); + style.left = parseInt(style.left, 10); + + style.top += 10; + style.left += 10; + } + + // Store new settings + if (widgets[i].widget) { + // If after copy to clipboard, the copied widget was changed, so the new modified version will be pasted and not the original one. + // So use JSON. + widgets[i].widget = JSON.parse(JSON.stringify(objWidget)); + } + } else { + if (!$('#vis_container').find('#visview_' + targetViewDiv).length) { + this.renderView(targetViewDiv, targetView, true); + } + obj.wid = this.nextWidget(); + obj.view = targetView; + obj.viewDiv = targetViewDiv; + } + if (grouped) obj.grouped = grouped; + + // if group + if (obj.data.members) { + var ws = []; + for (var w = 0; w < obj.data.members.length; w++) { + var found = false; + for (var f = 0; f < widgets.length; f++) { + if (widgets[f].wid && widgets[f].wid === obj.data.members[w]) { + widgets[f].wid = false; + widgets[f].view = srcView; + widgets[f].viewDiv = srcViewDiv; + ws.push(widgets[f]); + found = true; + break; + } + } + if (!found && this.views[srcView].widgets[obj.data.members[w]]) { + ws.push({ + view: srcView, + viewDiv: srcViewDiv, + widget: this.views[srcView].widgets[obj.data.members[w]] + }); + } + } + + obj.data.members = this.dupWidgets(targetViewDiv, targetView, ws, true); + obj.wid = ''; + } + newWidgets.push(this.addWidget(targetViewDiv, targetView, obj, true)); + } + + if (this.activeView === targetViewDiv && !grouped) { + this.updateSelectWidget(targetViewDiv, targetView, newWidgets); + } + + if (widgets[0] && !widgets[0].widget) { + this.showHint(_('Widget(s) copied to view %s', targetViewDiv) + '.', 30000); + } + + return newWidgets; + }, + renameWidget: function (viewDiv, view, oldId, newId) { + var widgetData = this.views[view].widgets[oldId]; + var obj = { + tpl: widgetData.tpl, + data: $.extend(true, {}, widgetData.data), + style: widgetData.style, + wid: newId, + noSave: true + }; + if (widgetData.grouped){ + obj.grouped = true; + // get viewDiv + if (viewDiv == view) { + var widgets = this.views[view].widgets; + for (var w in widgets) { + if (!widgets.hasOwnProperty(w)) continue; + var members = this.views[view].widgets[w].data.members; + var pos; + if (members && ((pos = members.indexOf(oldId)) !== -1)) { + viewDiv = w; + } + } + } + } + + this.addWidget(viewDiv, view, obj, true); + + if (viewDiv === this.activeView) this.updateSelectWidget(view, view, newId); + delete this.views[view].widgets[oldId].data.members; + this.delWidgetHelper(viewDiv, view, oldId, false); + + if (viewDiv === this.activeView) this.inspectWidgets(viewDiv, view, [newId]); + this.save(); + }, + reRenderWidgetEdit: function (viewDiv, view, wid) { + this.reRenderWidget(viewDiv, view, wid); + this.editApplyDragAndMove(viewDiv, view, wid); + }, + editApplyDragAndMove: function (viewDiv, view, wid) { + var editGroup = (viewDiv !== view); + + if (this.activeWidgets.indexOf(wid) !== -1) { + var $wid = $('#' + wid); + + // User interaction + if (!$('#wid_all_lock_d').hasClass('ui-state-active') && + !this.widgets[wid].data._no_move && + (editGroup || !this.widgets[wid].grouped) + ) { + this.draggable(viewDiv, view, $wid); + } + if ($('#wid_all_lock_function').prop('checked')) { + if (viewDiv === view || viewDiv !== wid) $wid.addClass('vis-widget-lock'); + } + + // If only one selected + if (this.activeWidgets.length === 1 && + !this.widgets[wid].data._no_resize && + !this.widgets[wid].grouped) { + this.resizable(viewDiv, view, $wid); + } + } + }, + getObjDesc: function (id) { + if (this.objects[id] && this.objects[id].common && this.objects[id].common.name) { + return this.objects[id].common.name || id; + } + return id; + }, + // find this wid in all views, + // delete where it is no more exist, + // create where it should exist and + // sync data + syncWidgets: function (widgets, views) { + for (var i = 0; i < widgets.length; i++) { + // find view of this widget + var view = this.getViewOfWidget(widgets[i]); + + if (views === undefined) { + views = this.getViewsOfWidget(widgets[i]); + } + + if (view) { + //if widget is a group first sync widgets within this group + if (this.views[view].widgets[widgets[i]].data.members && this.views[view].widgets[widgets[i]].data.members.length) { + this.syncWidgets(this.views[view].widgets[widgets[i]].data.members.slice(), views); + if (this.activeView == this.activeViewDiv) this.reRenderWidgetEdit(view, view, widgets[i]); + } + + if (views === null) views = []; + + var isFound = false; + for (var l = 0; l < views.length; l++) { + if (views[l] === view) { + isFound = true; + break; + } + } + + if (!isFound) views[views.length] = view; + + var wids = widgets[i].split('_', 2); + var wid = wids[0]; + + // First sync views + for (var v_ in this.views) { + if (!this.views.hasOwnProperty(v_)) continue; + if (v_ === '___settings') continue; + isFound = false; + if (v_ === view) { + continue; + } + + for (var k = 0; k < views.length; k++) { + if (views[k] === v_) { + isFound = true; + break; + } + } + + if (this.views[v_].widgets[wid + '_' + v_] !== undefined) { + if (isFound) { + //do not delete members + delete this.views[v_].widgets[wid + '_' + v_].data.members; + } + this.delWidgetHelper(v_, v_, wid + '_' + v_, false); + } + + if (isFound) { + var data = null; + if (this.views[view].widgets[widgets[i]].data.members) { + data = $.extend(true, {}, this.views[view].widgets[widgets[i]].data); + for (var j = 0; j < data.members.length; j++) { + data.members[j] = data.members[j].split('_', 2)[0] + '_' + v_; + } + } + // Create + this.addWidget(this.views[v_] ? v_: this.getViewOfWidget(v_), v_, { + tpl: this.views[view].widgets[widgets[i]].tpl, + data: data || this.views[view].widgets[widgets[i]].data, + style: this.views[view].widgets[widgets[i]].style, + wid: wid + '_' + v_, + view: v_, + noSave: true, + grouped:this.views[view].widgets[widgets[i]].grouped || false + }, true); + } + } + + + if (views.length < 2 && (widgets[i].indexOf('_') !== -1)) { + // rename this widget from "wid_view" to "wid" + var _wids = widgets[i].split('_', 2); + this.renameWidget(view, view, widgets[i], _wids[0]); + } else if (views.length > 1 && (widgets[i].indexOf('_') === -1)) { + this.renameWidget(view, view, widgets[i], widgets[i] + '_' + view); + } + } + } + }, + // adds extracted attributes to array + getWidgetName: function (view, widget) { + if (view && !widget) { + widget = view; + view = null; + } + if (!view || !this.views[view]) view = this.getViewOfWidget(widget); + + var widgetData = this.views[view].widgets[widget]; + var name = (widgetData && widgetData.data ? widgetData.data.name : ''); + name = name ? (name + '[' + widget + ']') : widget; + if (widgetData) { + if (widget[0] === 'g') { + name += ' (' + _('Group') + ')'; + } else { + name += ' (' + widgetData.widgetSet + ' - ' + $('#' + widgetData.tpl).attr('data-vis-name') + ')'; + } + } + return name; + }, + showWidgetHelper: function (viewDiv, view, wid, isShow) { + if (typeof view === 'boolean' || !wid) { + wid = viewDiv; + isShow = view; + view = this.activeView; + viewDiv = this.activeViewDiv; + } + var $widget = $('#' + wid); + + if ($widget.attr('data-vis-hide-helper') === 'true') isShow = false; + + // noinspection JSJQueryEfficiency + var $helper = $('#widget_helper_' + wid); + if (isShow) { + if ($widget && !$widget.length) { + console.log('Cannot find in DOM ' + wid); + return; + } + // disable transform while editing + if ($widget.css('transform')) { + $widget.css('transform', '').attr('data-tmodified', true); + } + + var pos = this.editWidgetsRect(viewDiv, view, wid); + + if (!$helper.length) { + $('#visview_' + viewDiv).append('
'); + $helper = $('#widget_helper_' + wid); + } + + $helper.css({ + left: parseInt(pos.left) - 2 + 'px', + top: parseInt(pos.top) - 2 + 'px', + height: parseInt(pos.height) + 3 + 'px', + width: parseInt(pos.width) + 3 + 'px' + } + ).show(); + } else { + $helper.remove(); + } + return $widget; + }, + installSelectable: function (viewDiv, view, isDestroy) { + var that = this; + + if (this.selectable) { + if (isDestroy) $('.vis-view.ui-selectable').selectable('destroy'); + + $('#visview_' + viewDiv).selectable({ + filter: 'div.vis-widget:not(.vis-widget-edit-locked)', + tolerance: 'fit', + cancel: 'div.vis-widget:not(.vis-widget-edit-locked)', + stop: function (e, ui) { + var $selected = $('.ui-selected'); + + if (!$selected.length) { + that.inspectWidgets(viewDiv, view, []); + } else { + var newWidgets = []; + $selected.each(function () { + var id = $(this).attr('id'); + if (id && !$(this).hasClass('vis-widget-edit-locked') && + that.views[view].widgets[id] && + (viewDiv !== view || !that.views[view].widgets[id].grouped)) { + if (viewDiv !== view && id === viewDiv) return; + newWidgets.push(id); + } + }); + that.inspectWidgets(viewDiv, view, newWidgets); + } + //$('#allwidgets_helper').hide(); + }, + selecting: function (e, ui) { + if (ui.selecting.id && + that.activeWidgets.indexOf(ui.selecting.id) === -1 && + that.views[view].widgets[ui.selecting.id] && + (viewDiv !== view || !that.views[view].widgets[ui.selecting.id].grouped) && // group edit + !that.views[view].widgets[ui.selecting.id].data.locked) { + + // if edit group and it is group itself + if (viewDiv !== view && ui.selecting.id === viewDiv) return; + + that.activeWidgets.push(ui.selecting.id); + that.showWidgetHelper(viewDiv, view, ui.selecting.id, true); + } + }, + unselecting: function (e, ui) { + var pos = that.activeWidgets.indexOf(ui.unselecting.id); + if (pos !== -1) { + that.activeWidgets.splice(pos, 1); + that.showWidgetHelper(viewDiv, view, ui.unselecting.id, false); + } + /*if ($('#widget_helper_' + ui.unselecting.id).html()) { + $('#widget_helper_' + ui.unselecting.id).remove(); + that.activeWidgets.splice(that.activeWidgets.indexOf(ui.unselecting.id), 1); + }*/ + } + }); + + $('.vis-widget-edit-locked').removeClass('ui-selectee'); + } + }, + // Init all edit fields for one view + changeViewEdit: function (viewDiv, view, noChange, callback) { + //always save changes when changing views to ensure views are synced + if (this._saveTimer) { + clearTimeout(this._saveTimer); + this._saveTimer = null; + } + this._saveToServer(this.activeViewDiv, this.activeView); + $('#saving_progress').hide(); + + var that = this; + this.installSelectable(viewDiv, view, true); + + // remove all binds from all views + $('.vis-widget').unbind('click').unbind('dblclick'); + + var $view = $('#visview_' + viewDiv); + if (viewDiv !== view) { + $view + .removeClass('.vis-widget-lock') + .find('#' + viewDiv) + .addClass('vis-edit-group-widget') + .find('> .vis-widget').each(function () { + that.bindWidgetClick(viewDiv, view, $(this).attr('id')); + }); + } else { + $view.find('> .vis-widget').each(function () { + that.bindWidgetClick(viewDiv, view, $(this).attr('id')); + }); + // install on relative widgets too + $view.find('.vis-edit-relative').find('> .vis-widget').each(function () { + that.bindWidgetClick(viewDiv, view, $(this).attr('id')); + }); + } + + if (!noChange) { + this.undoHistory = [$.extend(true, {}, this.views[view])]; + $('#button_undo').addClass('ui-state-disabled').removeClass('ui-state-hover'); + this.inspectWidgets(viewDiv, view, viewDiv !== view || !this.views[view] ? [] : (this.views[view].activeWidgets || [])); + } + + // Disable rename if enabled + $('#rib_view_copy_cancel').trigger('click'); + $('#rib_view_rename_cancel').trigger('click'); + $('#rib_view_add_cancel').trigger('click'); + + // Load meta data if not yet loaded + if (!this.objects) { + // Read all data objects from server + this.conn.getObjects(function (data) { + that.objects = data; + }); + } + + // Init background selector + if (this.styleSelect && this.views[view] && this.views[view].settings) { + this.styleSelect.show({ + width: '100%', + name: 'inspect_view_bkg_def', + filterName: 'background', + //filterFile: "backgrounds.css", + style: this.views[view].settings.style.background_class, + parent: $('#inspect_view_bkg_parent'), + onchange: function (newStyle) { + var $view = $('#visview_' + viewDiv); + if (that.views[view].settings.style.background_class) { + $view.removeClass(that.views[view].settings.style.background_class); + } + that.views[view].settings.style.background_class = newStyle; + if (newStyle) $('#inspect_view_css_background').val('').trigger('change'); + + $view.addClass(that.views[view].settings.style.background_class); + that.save(); + } + }); + } + + var viewGroups; + if (viewDiv === view) { + $('#ribbon_view').find('.ribbon_tab_content').show(); + $('#view_inspector').show(); + var $screenSize = $('#screen_size'); + var $screenSizeX = $('#screen_size_x'); + var $screenSizeY = $('#screen_size_y'); + // View (Resolution) settings + if (this.views[view] && this.views[view].settings) { + // Try to find this resolution in the list + var res = this.views[view].settings.sizex + 'x' + this.views[view].settings.sizey; + $screenSize.find('option').each(function () { + if ($(this).attr('value') === res) { + $(this).attr('selected', true); + res = null; + return false; + } + }); + if (!res) { + $screenSizeX.prop('disabled', true); + $screenSizeY.prop('disabled', true); + } else if (res === 'x') { + $screenSizeX.prop('disabled', true); + $screenSizeY.prop('disabled', true); + $screenSize.val(''); + } else { + $screenSize.val('user'); + } + + $screenSize.selectmenu('refresh').selectmenu('enable'); + + $screenSizeX.val(this.views[view].settings.sizex || '').trigger('change').prop('disabled', false); + $screenSizeY.val(this.views[view].settings.sizey || '').trigger('change').prop('disabled', false); + $('.rib_tool_resolution_toggle').button((res === 'x') ? 'disable' : 'enable'); + + $('#grid_size') + .val(this.views[view].settings.gridSize || '') + .trigger('change') + .prop('disabled', this.views[view].settings.snapType !== 2); + + $('#snap_type').val(this.views[view].settings.snapType || 0).selectmenu('refresh'); + + if (this.views[view].settings.sizex) { + $('.vis-screen-default').prop('checked', this.views[view].settings.useAsDefault); + } else { + $('.vis-screen-default').prop('checked', false).prop('disabled', true); + } + $('.vis-screen-render-always').prop('checked', this.views[view].settings.alwaysRender); + + this.editSetGrid(viewDiv, view); + + // show userGroups + viewGroups = this.views[view].settings.group || []; + $('#inspect_view_group_action').val(this.views[view].settings.group_action); + } else { + $screenSize.val('').selectmenu('refresh').selectmenu('enable'); + $screenSizeX.val(this.views[view].settings.sizex || '').trigger('change').prop('disabled', false); + $screenSizeY.val(this.views[view].settings.sizey || '').trigger('change').prop('disabled', false); + viewGroups = []; + } + } else { + $('#ribbon_view').find('.ribbon_tab_content').hide(); + $('#view_inspector').hide(); + } + + // fill userGroups + var $inspectGroups = $('#inspect_view_group'); + $inspectGroups.html(''); + if (viewDiv === view) { + var userGroups = this.getUserGroups(); + for (var g in userGroups) { + if (!userGroups.hasOwnProperty(g)) continue; + var val = g.substring('system.group.'.length); + $inspectGroups.append(''); + } + $inspectGroups.multiselect('refresh'); + } else { + $inspectGroups.multiselect('disable'); + } + $inspectGroups.next().css('width', 'calc(100% - 5px)'); + + this.updateSelectWidget(viewDiv, view); + + if (viewDiv === view) { + // Show current view + if (this.$selectView.val() !== viewDiv) { + this.$selectView.val(viewDiv); + this.$selectView.selectmenu('refresh'); + } + this.$copyWidgetSelectView.val(view); + this.$copyWidgetSelectView.selectmenu('refresh'); + + // Show tab + $('.view-select-tab').removeClass('ui-tabs-active ui-state-active'); + $('#view_tab_' + view).addClass('ui-tabs-active ui-state-active'); + + if (that.views[view] && that.views[view].settings) { + $('#inspect_view_css_only_background').prop('checked', that.views[view].settings.useBackground); + } + that.editShowHideViewBackground(view, true); + + // View CSS Inspector + $('.vis-inspect-view-css').each(function () { + var $this = $(this); + var attr = $this.attr('id').slice(17); + + var css; + if (that.views[view] && that.views[view].settings && that.views[view].settings.style) { + css = that.views[view].settings.style[attr]; + $this.val(css); + } else { + css = $view.css(attr); + } + $this.val(css || ''); + if (attr.match(/color$/)) { + $this.css('background-color', css || ''); + that._editSetFontColor($this.attr('id')); + } + }); + + var $themeSelect = $('#inspect_view_theme'); + if (this.views[view] && this.views[view].settings) { + $('.vis-inspect-view').each(function () { + var $this = $(this); + var attr = $this.attr('id').slice(13); + $('#' + $this.attr('id')).val(that.views[view].settings[attr]); + }); + + this.views[view].settings.theme = this.views[view].settings.theme || 'redmond'; + + $themeSelect.val(this.views[view].settings.theme); + } + $themeSelect.selectmenu('refresh'); + } else { + this.editResizeGroup(viewDiv, view); + } + if (typeof callback === 'function') callback(viewDiv, view); + }, + destroyGroupEdit: function (viewDiv, view) { + // destroy group view and view of group + this.views[view].activeWidgets = [viewDiv]; + this.activeWidgets = [viewDiv]; + // change size of group + //var rect = this.editWidgetsRect(viewDiv, view, viewDiv); + this.destroyView(viewDiv, view); + this.destroyView(view, view); + + // group has percent as position + //this.editApplySize(viewDiv, view, viewDiv, rect.width, rect.height); + }, + editApplyPosition: function (viewDiv, view, wid, top, left) { + var oldT = this.views[view].widgets[wid].style.top; + var oldL = this.views[view].widgets[wid].style.left; + + var posT = oldT.toString().indexOf('%') !== -1; + var posL = oldL.toString().indexOf('%') !== -1; + if (posT || posL) { + var wRect = this.editConvertToPercent(viewDiv, view, wid, viewDiv !== view ? viewDiv : null); + if (posL && left !== null) left = wRect.left; + if (posT && top !== null) top = wRect.top; + } + + if (left !== null) { + if (!posL) { + if (typeof left === 'string' && left.indexOf('px') === -1) { + left += 'px'; + } else { + left = Math.round(left) + 'px'; + } + } + this.views[view].widgets[wid].style.left = left; + } + if (top !== null) { + if (!posT) { + if (typeof top === 'string' && top.indexOf('px') === -1) { + top += 'px'; + } else { + top = Math.round(top) + 'px'; + } + } + + this.views[view].widgets[wid].style.top = top; + } + }, + editApplySize: function (viewDiv, view, wid, width, height) { + var oldW = this.views[view].widgets[wid].style.width; + var oldH = this.views[view].widgets[wid].style.height; + var posH; + var posW; + + // Convert to percent if required + if (oldW !== undefined && oldH !== undefined) { + posW = oldW.toString().indexOf('%') !== -1; + posH = oldH.toString().indexOf('%') !== -1; + if (posW || posH) { + var wRect = this.editConvertToPercent(viewDiv, view, wid, viewDiv !== view ? viewDiv : null); + if (posH && height !== null) height = wRect.height; + if (posW && width !== null) width = wRect.width; + } + } else { + posH = false; + posW = false; + } + if (width !== null) { + if (!posW && width.toString().indexOf('px') === -1) width += 'px'; + this.views[view].widgets[wid].style.width = width; + } + if (height !== null) { + if (!posH && height.toString().indexOf('px') === -1) height += 'px'; + this.views[view].widgets[wid].style.height = height; + } + }, + dragging: false, + draggable: function (viewDiv, view, obj) { + var origX, origY; + var that = this; + var draggableOptions; + viewDiv = viewDiv || this.activeView; + view = view || viewDiv; + + draggableOptions = { + cancel: false, + start: function (event, ui) { + $('#context_menu').hide(); + $('#context_menu_template').hide(); + + that.gridWidth = parseInt(that.views[view].settings.gridSize, 10); + if (that.gridWidth < 1 || isNaN(that.gridWidth)) that.gridWidth = 10; + that.views[view].settings.snapType = parseInt(that.views[view].settings.snapType, 10); + + origX = ui.position.left; + origY = ui.position.top; + that.dragging = true; + }, + stop: function (event, ui) { + var grid; + if (that.views[view].settings.snapType === 2) { + grid = parseInt(that.views[view].settings.gridSize, 10); + } else { + grid = 0; + } + + for (var i = 0; i < that.activeWidgets.length; i++) { + var wid = that.activeWidgets[i]; + var $wid = $('#' + that.activeWidgets[i]); + var pos = { + left: parseInt($wid.css('left'), 10), + top: parseInt($wid.css('top'), 10) + }; + // if grid enabled + if (grid) { + var xDiff = pos.left % grid; + var yDiff = pos.top % grid; + if (xDiff) { + if (xDiff < grid / 2) { + pos.left -= xDiff; + } else { + pos.left += grid - xDiff; + } + $wid.css('left', pos.left); + } + + if (yDiff) { + if (yDiff < grid / 2) { + pos.top -= yDiff; + } else { + pos.top += grid - yDiff; + } + $wid.css('top', pos.top); + } + } + if (!that.views[view].widgets[wid]) continue; + if (!that.views[view].widgets[wid].style) that.views[view].widgets[wid].style = {}; + + if ($wid[0]._customHandlers && $wid[0]._customHandlers.onMoveEnd) { + $wid[0]._customHandlers.onMoveEnd($wid[0], wid); + } + $('#widget_helper_' + wid).css({ + left: pos.left - 2 + 'px', + top: pos.top - 2 + 'px' + }); + + that.editApplyPosition(viewDiv, view, wid, pos.top, pos.left); + + $('#vis_container').find('.vis-leading-line').remove(); + } + $('#inspect_css_top').val(that.findCommonValue(view, that.activeWidgets, 'top', true)); + $('#inspect_css_left').val(that.findCommonValue(view, that.activeWidgets, 'left', true)); + that.save(); + setTimeout(function () { + that.dragging = false; + }, 20); + + }, + drag: function (event, ui) { + var grid; + if (that.views[view].settings.snapType === 2) { + grid = parseInt(that.views[view].settings.gridSize, 10); + } else { + grid = 0; + } + + var elementPosition = ui.offset; + var parentPosition = ui.helper.parent().offset(); + if (!parentPosition) return; + var position = {left: elementPosition.left - parentPosition.left, top: elementPosition.top - parentPosition.top}; + + var moveX = position.left - origX; + var moveY = position.top - origY; + + var xDiff; + var yDiff; + // if grid enabled + if (grid) { + xDiff = position.left % grid; + yDiff = position.top % grid; + if (xDiff) { + if (xDiff < grid / 2) { + position.left += xDiff; + } else { + position.left += grid - xDiff; + } + } + + if (yDiff) { + if (yDiff < grid / 2) { + position.top += yDiff; + } else { + position.top += grid - yDiff; + } + } + } + + origX = position.left; + origY = position.top; + + for (var i = 0; i < that.activeWidgets.length; i++) { + if (!that.views[view].widgets[that.activeWidgets[i]]) { + console.error('Something is wrong! "' + that.activeWidgets[i] + '" is not in "' + view + '"'); + continue; + } + var _position = that.views[view].widgets[that.activeWidgets[i]].style['position']; + if (_position === 'relative' || _position === 'static' || _position === 'sticky') continue; + var mWidget = document.getElementById(that.activeWidgets[i]); + var $mWidget = $(mWidget); + var pos = { + left: parseInt($mWidget.css('left'), 10), + top: parseInt($mWidget.css('top'), 10) + }; + var x = pos.left + moveX; + var y = pos.top + moveY; + + // if grid enabled + if (grid) { + xDiff = x % grid; + yDiff = y % grid; + if (xDiff) { + if (xDiff < grid / 2) { + x -= xDiff; + } else { + x += grid - xDiff; + } + } + + if (yDiff) { + if (yDiff < grid / 2) { + y -= yDiff; + } else { + y += grid - yDiff; + } + } + } + + $('#widget_helper_' + that.activeWidgets[i]).css({left: x - 2, top: y - 2}); + + if (grid || ui.helper.attr('id') !== that.activeWidgets[i]) $mWidget.css({left: x, top: y}); + + if (mWidget._customHandlers && mWidget._customHandlers.onMove) { + mWidget._customHandlers.onMove(mWidget, that.activeWidgets[i]); + } + } + that.editShowLeadingLines(viewDiv, view); + } + }; + if (this.views[view].settings.snapType === 1) { + draggableOptions.snap = '#vis_container div.vis-widget'; + } else + if (this.views[view].settings.snapType === 2) { + this.gridWidth = parseInt(this.views[view].settings.gridSize, 10); + if (this.gridWidth < 1 || isNaN(this.gridWidth)) this.gridWidth = 10; + + draggableOptions.grid = [this.gridWidth, this.gridWidth]; + } + + obj.each(function () { + var $this = $(this); + var wid = $this.attr('id'); + if (that.views[view].widgets[wid].style['position'] === 'relative') return; + + if ($this.attr('data-vis-draggable')) draggableOptions = JSON.parse($this.attr('data-vis-draggable')); + if (!draggableOptions) draggableOptions = {}; + + if (draggableOptions.disabled) return; + + $this.draggable(draggableOptions); + }); + }, + editResizeGroup: function (viewDiv, view) { + var that = this; + var $group = $('#' + viewDiv).addClass('vis-resize-group'); + + var stop = function (event, ui) { + var w = ui.element.width(); + var h = ui.element.height(); + if (typeof w === 'string' && w.indexOf('px') === -1) { + w += 'px'; + } else { + w = w.toFixed(0) + 'px'; + } + if (typeof h === 'string' && h.indexOf('px') === -1) { + h += 'px'; + } else { + h = h.toFixed(0) + 'px'; + } + + if (!that.views[view].widgets[viewDiv]) return; + + if (!that.views[view].widgets[viewDiv].style) that.views[view].widgets[viewDiv].style = {}; + + w = parseInt(ui.element.innerWidth(), 10); + h = parseInt(ui.element.innerHeight(), 10); + that.views[view].widgets[viewDiv].style.width = w; + that.views[view].widgets[viewDiv].style.height = h; + that.save(); + }; + + $group.resizable({stop: stop}); + }, + resizable: function (viewDiv, view, obj) { + var that = this; + + if (!view) { + obj = viewDiv; + view = this.activeView; + viewDiv = this.activeViewDiv; + } + if (!obj) { + console.warn('obj is null'); + return; + } + + this.gridWidth = parseInt(this.views[view].settings.gridSize, 10); + if (this.gridWidth < 1 || isNaN(this.gridWidth)) this.gridWidth = 10; + + var stop = function (event, ui) { + var widget = ui.helper.attr('id'); + if (!that.views[view].widgets[widget]) return; + + if (!that.views[view].widgets[widget].style) that.views[view].widgets[widget].style = {}; + + var elementPosition = ui.element.offset(); + var parentPosition = ui.element.parent().offset(); + var position = {left: elementPosition.left - parentPosition.left, top: elementPosition.top - parentPosition.top}; + + position.top = parseInt(position.top, 10); + position.left = parseInt(position.left, 10); + var w = parseInt(ui.element.innerWidth(), 10); + var h = parseInt(ui.element.innerHeight(), 10); + + $('.widget-helper').css({ + top: position.top - 2, + left: position.left - 2, + width: ui.size.width + 3, + height: ui.size.height + 3 + }); + + that.editApplySize(viewDiv, view, widget, w, h); + that.editApplyPosition(viewDiv, view, widget, position.top, position.left); + + if ($('#' + that.views[view].widgets[widget].tpl).attr('data-vis-update-style')) { + that.reRenderWidgetEdit(viewDiv, view, widget); + } + $('#inspect_css_width').val(that.views[view].widgets[widget].style.width); + $('#inspect_css_height').val(that.views[view].widgets[widget].style.height); + $('#inspect_css_top').val(that.views[view].widgets[widget].style.top); + $('#inspect_css_left').val(that.views[view].widgets[widget].style.left); + + that.save(); + $('#vis_container').find('.vis-leading-line').remove(); + }; + var resize = function (event, ui) { + var grid = parseInt(that.views[view].settings.gridSize, 10); + + var elementPosition = ui.element.offset(); + var parentPosition = ui.element.parent().offset(); + var position = {left: elementPosition.left - parentPosition.left, top: elementPosition.top - parentPosition.top}; + + // if grid enabled + if (that.views[view].settings.snapType === 2 && grid) { + var oldSize = ui.oldSize || ui.originalSize; + + var pos = position; + // Check if size or position was changed + /*if (position.top !== oldSize.top || position.left !== oldSize.left) { + var lDiff = pos.left % grid; + var tDiff = pos.top % grid; + + if (lDiff && oldSize.left !== position.left) { + if (lDiff < grid / 2) { + ui.element.css({left: position.left - lDiff, width: ui.size.width + lDiff}); + } else { + ui.element.css({left: position.left + grid - lDiff, width: ui.size.width + grid - lDiff}); + } + } + if (tDiff && oldSize.top !== position.top) { + if (lDiff < grid / 2) { + ui.element.css('top', position.top - tDiff); + } else { + ui.element.css('top', position.top + grid - tDiff); + } + } + } else */{ + // snap size to grid + var wDiff = (ui.size.width + pos.left) % grid; + var hDiff = (ui.size.height + pos.top) % grid; + + if (wDiff && oldSize.width !== oldSize.width) { + if (wDiff < grid / 2) { + ui.element.width(oldSize.width - wDiff); + } else { + ui.element.width(oldSize.width + grid - wDiff); + } + } + + if (hDiff && oldSize.height !== oldSize.height) { + if (hDiff < grid / 2) { + ui.element.height(oldSize.height - hDiff); + } else { + ui.element.height(oldSize.height + grid - hDiff); + } + } + } + + } + $('.widget-helper').css({ + top: position.top - 2, + left: position.left - 2, + width: ui.size.width + 3, + height: ui.size.height + 3 + }); + ui.oldSize = {width: ui.size.width, height: ui.size.height, top: position.top, left: position.left}; + that.editShowLeadingLines(viewDiv, view); + }; + obj.each(function () { + var $this = $(this); + var wid = $this.attr('id'); + var position = that.views[view].widgets[wid].style['position']; + var resizableOptions; + if (obj.attr('data-vis-resizable')) resizableOptions = JSON.parse(obj.attr('data-vis-resizable')); + + if (!resizableOptions) resizableOptions = {}; + if (resizableOptions.disabled !== true) resizableOptions.disabled = false; + if (resizableOptions.disabled) return; + + // Why resizable brings the flag position: relative within? + $this.css({position: position || 'absolute'}); + + resizableOptions.stop = stop; + resizableOptions.resize = resize; + if ((position !== 'relative' && position !== 'static' && position !== 'sticky')) { + resizableOptions.handles = 'n, e, s, w, nw, ne, sw, se'; + } + $this.resizable(resizableOptions); + }); + }, + droppable: function (viewDiv, view) { + var $view = $('#visview_' + viewDiv); + var that = this; + + $view.droppable({ + accept: '.wid-prev', + drop: function (event, ui) { + var $container = $('#vis_container'); + var viewPos = $container.position(); + var addPos = { + left: ui.position.left - $('#toolbox').width() + $container.scrollLeft() + 5, + top: ui.position.top - viewPos.top + $container.scrollTop() + 8 + }; + + addPos.left = addPos.left.toFixed(0) + 'px'; + addPos.top = addPos.top.toFixed(0) + 'px'; + + var widgetId; + var template = $(ui.draggable).data('template'); + + if (!template) { + var tpl = $(ui.draggable).data('tpl'); + var $tpl = $('#' + tpl); + var renderVisible = $tpl.attr('data-vis-render-visible'); + + // Widget attributes default values + var attrs = $tpl.attr('data-vis-attrs'); + // Combine attributes from data-vis-attrs, data-vis-attrs0, data-vis-attrs1, ... + var t = 0; + var attr; + while ((attr = $tpl.attr('data-vis-attrs' + t))) { + attrs += attr; + t++; + } + var data = {}; + if (attrs) { + attrs = attrs.split(';'); + if (attrs.indexOf('oid') !== -1) data.oid = 'nothing_selected'; + } + + if (renderVisible) data.renderVisible = true; + + //tpl, data, style, wid, view, noSave, noAnimate + widgetId = that.addWidget(viewDiv, view, { + tpl: tpl, + data: data, + style: addPos, + noAnimate: true + }, false); + } else { + if (that.editTemplatesShowWarning) { + that.editTemplatesShowWarning(); + } + widgetId = that.dupWidgets(viewDiv, view, that.views.___settings.templates[template].widgets, addPos.left, addPos.top); + } + + if (viewDiv === that.activeView) { + that.updateSelectWidget(viewDiv, view, widgetId); + } + + setTimeout(function () { + that.inspectWidgets(viewDiv, view, [widgetId]); + }, 50); + } + }); + + }, + // Find free place for new widget + findFreePosition: function (view, id, field, widgetWidth, widgetHeight) { + var editPos = $('.ui-dialog:first').position(); + field = $.extend({x: 0, y: 0, width: editPos.left}, field); + widgetWidth = (widgetWidth || 60); + widgetHeight = (widgetHeight || 60); + + if (widgetWidth > field.width) field.width = widgetWidth + 1; + + var step = 20; + var y = field.y; + var x = field.x || step; + + // Prepare coordinates + var positions = []; + for (var w in this.views[view].widgets) { + if (w === id || !this.views[view].widgets[w].tpl) continue; + + if (this.views[view].widgets[w].tpl.indexOf('Image') === -1 && + this.views[view].widgets[w].tpl.indexOf('image') === -1) { + var $jW = $('#' + w); + if ($jW.length) { + var s = $jW.position(); + s.width = $jW.width(); + s.height = $jW.height(); + + if (s.width > 300 && s.height > 300) continue; + + positions[positions.length] = s; + } + } + } + + while (!this.checkPosition(positions, x, y, widgetWidth, widgetHeight)) { + x += step; + if (x + widgetWidth > field.x + field.width) { + x = field.x; + y += step; + } + } + + // No free place on the screen + if (y >= $(window).height()) { + x = 50; + y = 50; + } + + return {left: x, top: y}; + }, + // Check overlapping + checkPosition: function (positions, x, y, widgetWidth, widgetHeight) { + for (var i = 0; i < positions.length; i++) { + var s = positions[i]; + + if (((s.left <= x && (s.left + s.width) >= x) || + (s.left <= x + widgetWidth && (s.left + s.width) >= x + widgetWidth)) && + ((s.top <= y && (s.top + s.height) >= y) || + (s.top <= y + widgetHeight && (s.top + s.height) >= y + widgetHeight))) { + return false; + } + if (((x <= s.left && s.left <= x + widgetWidth) || + (x <= (s.left + s.width) && (s.left + s.width) <= x + widgetWidth)) && + ((y <= s.top && s.top <= y + widgetHeight) || + (y <= (s.top + s.height) && (s.top + s.height) <= y + widgetHeight))) { + return false; + } + } + return true; + }, + actionHighlightWidget: function (viewDiv, view, id) { + if (id === 'none') return; + + var $jWidget = $('#' + id); + if (!$jWidget.length) return; + if ($jWidget.attr('data-vis-hide-helper') === 'false') return; + var s = $jWidget.position(); + s.width = $jWidget.width(); + s.height = $jWidget.height(); + s.radius = parseInt($jWidget.css('border-radius')); + + var _css1 = { + left: s.left - 3.5, + top: s.top - 3.5, + height: s.height, + width: s.width, + opacity: 1, + borderRadius: 15 + }; + + //noinspection JSJQueryEfficiency + var $action1 = $('#' + id + '__action1'); + var text = ''; + if (!$action1.length) { + text = '
'; + $('#visview_' + viewDiv).append(text); + //noinspection JSJQueryEfficiency + $action1 = $('#' + id + '__action1'); + } + var _css2 = { + left: s.left - 4 - s.width, + top: s.top - 4 - s.height, + height: s.height * 3, + width: s.width * 3, + opacity: 0, + //borderWidth: 1, + borderRadius: s.radius + (s.height > s.width) ? s.width : s.height + }; + $action1. + addClass('vis-show-new'). + css(_css2). + animate(_css1, 1500, 'swing', function () { + $(this).remove(); + }).click(function () { + $(this).stop().remove(); + }); + + //noinspection JSJQueryEfficiency + var $action2 = $('#' + id + '__action2'); + if (!$action2.length) { + text = text.replace('action1', 'action2'); + $('#visview_' + viewDiv).append(text); + //noinspection JSJQueryEfficiency + $action2 = $('#' + id + '__action2'); + } + $action2. + addClass('vis-show-new'). + css(_css2). + animate(_css1, 3000, 'swing', function () { + $(this).remove(); + }); + }, + // collect all filter keys for given view + updateFilter: function (view) { + if (view && this.views && this.views[view]) { + var widgets = this.views[view].widgets; + this.views[view].filterList = []; + + for (var widget in widgets) { + if (widgets.hasOwnProperty(widget) && + widgets[widget] && + widgets[widget].data && + widgets[widget].data.filterkey) { + var isFound = false; + for (var z = 0; z < this.views[view].filterList.length; z++) { + if (this.views[this.activeView].filterList[z] === widgets[widget].data.filterkey) { + isFound = true; + break; + } + } + if (!isFound) { + this.views[view].filterList[this.views[view].filterList.length] = widgets[widget].data.filterkey; + } + } + } + return this.views[view].filterList; + } else { + return []; + } + }, + getWidgetIds: function (view, tpl) { + if (view && this.views && this.views[view]) { + var widgets = this.views[view].widgets; + var list = []; + for (var widget in widgets) { + if (!widgets.hasOwnProperty(widget)) continue; + if (widgets[widget] && widgets[widget].data) { + if (tpl === undefined || tpl === null || tpl === widgets[widget].tpl) { + list.push(widget); + } + } + } + return list; + } else { + return []; + } + }, + initStealHandlers: function () { + var that = this; + $('.vis-steal-css').each(function () { + $(this).button({ + icons: { + primary: 'ui-icon-star' + }, + text: false + }).click(function (e) { + if (!$(this).attr('checked')) { + $(this).attr('checked', true).button('refresh'); + } else { + $(this).removeAttr('checked').button('refresh'); + } + var isSelected = false; + $('.vis-steal-css').each(function () { + if ($(this).attr('checked')) { + isSelected = true; + } + }); + + if (isSelected && !that.isStealCss) { + that.stealCssMode(); + } else if (!isSelected && that.isStealCss) { + that.stealCssModeStop(); + } + + e.stopPropagation(); + e.preventDefault(); + return false; + }); + }); + }, + stealCssModeStop: function (viewDiv, view) { + this.isStealCss = false; + $('#stealmode_content').remove(); + + if (this.selectable) $('#visview_' + viewDiv).selectable('enable'); + + $('.vis-steal-css').removeAttr('checked').button('refresh'); + $('#vis_container').removeClass('vis-steal-cursor'); + + }, + stealCssMode: function (viewDiv, view) { + var that = this; + if (this.selectable) $('#visview_' + viewDiv).selectable('disable'); + + this.isStealCss = true; + + //noinspection JSJQueryEfficiency + if (!$('#stealmode_content').length) { + $('body').append(''); + $('#stealmode_content').fadeIn('fast') + .click(function () { + $(this).fadeOut('slow'); + }); + } + + $('.vis-widget').one('click', function (e) { + e.stopImmediatePropagation(); + e.stopPropagation(); + e.preventDefault(); + + that.stealCss(e, viewDiv, view); + }); + $('#vis_container').addClass('vis-steal-cursor'); + }, + stealCss: function (e, viewDiv, view) { + if (this.isStealCss) { + var that = this; + var src = '#' + e.currentTarget.id; + + $('.vis-steal-css').each(function () { + if ($(this).attr('checked')) { + $(this).removeAttr('checked').button('refresh'); + var cssAttribute = $(this).attr('data-vis-steal'); + var val; + if (cssAttribute.match(/border-/) || cssAttribute.match(/padding/)) { + val = that.combineCssShorthand($(src), cssAttribute); + } else { + val = $(src).css(cssAttribute); + } + + for (var i = 0; i < that.activeWidgets.length; i++) { + $('#' + that.activeWidgets[i]).css(cssAttribute, val); + that.views[view].widgets[that.activeWidgets[i]].style[cssAttribute] = val; + that.showWidgetHelper(viewDiv, view, that.activeWidgets[i], true); + } + } + }); + + this.save(function () { + that.stealCssModeStop(viewDiv, view); + that.inspectWidgets(viewDiv, view); + }); + } + }, + combineCssShorthand: function (that, attr) { + var css; + var parts = attr.split('-'); + var baseAttr = parts[0]; + var cssTop; + var cssRight; + var cssBottom; + var cssLeft; + + if (attr === 'border-radius') { + // TODO second attribute + cssTop = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-top-left')); + cssRight = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-top-right')); + cssBottom = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-bottom-right')); + cssLeft = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-bottom-left')); + } else { + cssTop = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-top')); + cssRight = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-right')); + cssBottom = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-bottom')); + cssLeft = that.css(attr.replace(new RegExp(baseAttr), baseAttr + '-left')); + } + if (cssLeft == cssRight && cssLeft == cssTop && cssLeft == cssBottom) { + css = cssLeft; + } else if (cssTop == cssBottom && cssRight == cssLeft) { + css = cssTop + ' ' + cssLeft; + } else if (cssRight == cssLeft) { + css = cssTop + ' ' + cssLeft + ' ' + cssBottom; + } else { + css = cssTop + ' ' + cssRight + ' ' + cssBottom + ' ' + cssLeft; + } + return css; + }, + _saveTimer: null, // Timeout to save the configuration + _saveToServer: function (viewDiv, view) { + if (!this.undoHistory || !this.undoHistory.length || + (JSON.stringify(this.views[view]) !== JSON.stringify(this.undoHistory[this.undoHistory.length - 1]))) { + this.undoHistory = this.undoHistory || []; + $('#button_undo').removeClass('ui-state-disabled'); + if (this.undoHistory.push($.extend(true, {}, this.views[view])) > this.undoHistoryMaxLength) { + this.undoHistory.splice(0, 1); + } + } + var that = this; + this.saveRemote(function () { + that._saveTimer = null; + $('#saving_progress').hide(); + }); + }, + save: function (viewDiv, view, cb) { + if (this._saveTimer) { + clearTimeout(this._saveTimer); + this._saveTimer = null; + } + if (typeof viewDiv === 'function') { + cb = viewDiv; + viewDiv = null; + } + + if (!viewDiv) { + viewDiv = this.activeViewDiv; + view = this.activeView; + } + + var that = this; + // Store the changes if nothing changed during next 2 seconds + this._saveTimer = setTimeout(function () { + that._saveToServer(viewDiv, view); + }, 2000); + + $('#saving_progress').show(); + if (cb) cb(viewDiv, view); + }, + undo: function (viewDiv, view) { + if (this.undoHistory.length <= 1) return; + + if (!viewDiv) { + viewDiv = this.activeViewDiv; + view = this.activeView; + } + + var activeWidgets = this.activeWidgets; + + this.inspectWidgets(viewDiv, view, []); + $('#visview_' + viewDiv).remove(); + + this.undoHistory.pop(); + this.views[view] = $.extend(true, {}, this.undoHistory[this.undoHistory.length - 1]); + this.saveRemote(); + + if (this.undoHistory.length <= 1) { + $('#button_undo').addClass('ui-state-disabled').removeClass('ui-state-hover'); + } + + var that = this; + this.renderView(viewDiv, view, function (viewDiv, view) { + that.changeViewEdit(viewDiv, view, true); + that.inspectWidgets(viewDiv, view, activeWidgets); + }); + }, + getWidgetThumbnail: function (widget, maxWidth, maxHeight, callback) { + var widObj = document.getElementById(widget); + if (!widObj || !callback) { + return; + } + maxWidth = maxWidth || 200; + maxHeight = maxHeight || 40; + + if (!widObj.innerHTML || widObj.innerHTML.length > 20000) { + var $elem = $(widObj); + var newCanvas = document.createElement('canvas'); + newCanvas.height = maxHeight; + newCanvas.width = Math.ceil($elem.width() / $elem.height() * newCanvas.height); + if (newCanvas.width > maxWidth) { + newCanvas.width = maxWidth; + newCanvas.height = Math.ceil($elem.height / $elem.width * newCanvas.width); + } + + var ctx = newCanvas.getContext('2d'); + ctx.clearRect(0, 0, newCanvas.width, newCanvas.height); + ctx.fillStyle = '#FF0000'; + ctx.fillRect(0, 0, newCanvas.width, newCanvas.height); + ctx.font = '5px Arial'; + ctx.fillText('Cannot render', 0, 0); + callback(newCanvas); + } else { + html2canvas(widObj, { + onrendered: function (canvas) { + var newCanvas = document.createElement('canvas'); + newCanvas.height = maxHeight; + newCanvas.width = Math.ceil(canvas.width / canvas.height * newCanvas.height); + if (newCanvas.width > maxWidth) { + newCanvas.width = maxWidth; + newCanvas.height = Math.ceil(canvas.height / canvas.width * newCanvas.width); + } + var ctx = newCanvas.getContext('2d'); + ctx.clearRect(0, 0, newCanvas.width, newCanvas.height); + ctx.drawImage(canvas, 0, 0, newCanvas.width, newCanvas.height); + callback(newCanvas); + } + }); + } + }, + showHint: function (content, life, type, onShow) { + if (!$.jGrowl) { + this.showMessage(content); + return; + } + if (!this.growlInited) { + this.growlInited = true; + // Init jGrowl + $.jGrowl.defaults.closer = true; + $.jGrowl.defaults.check = 1000; + } + + $('#growl_informator').jGrowl(content, { + theme: type, + life: (life === undefined) ? 10000 : life, + sticky: (life === undefined) ? false : !life, + afterOpen: function (e, m, o) { + e.click(function () { + $(this).find('.jGrowl-close').trigger('jGrowl.close'); + }); + if (onShow) { + onShow(content); + } + } + }); + }, + selectAll: function (viewDiv, view) { + // Select all widgets on view + var $focused = $(':focus'); + + if (!view) view = this.activeView; + if (!viewDiv) viewDiv = this.activeViewDiv; + + // Workaround + if (!$focused.length && viewDiv) { + var newWidgets = []; + + if (viewDiv !== view) { + newWidgets = JSON.parse(JSON.stringify(this.views[view].widgets[viewDiv].data.members)); + } else { + // Go through all widgets + for (var widget in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(widget)) continue; + if (!this.views[view].widgets[widget].grouped) newWidgets.push(widget); + } + } + this.inspectWidgets(viewDiv, view, newWidgets); + return true; + } else { + return false; + } + }, + deselectAll: function (viewDiv, view) { + // Select all widgets on view + var $focused = $(':focus'); + if (!$focused.length && viewDiv) { + if (!view) view = this.activeView; + if (!viewDiv) viewDiv = this.activeViewDiv; + this.inspectWidgets(viewDiv, view, []); + return true; + } else { + return false; + } + }, + paste: function (viewDiv, view) { + var $focused = $(':focus'); + if (!$focused.length) { + if (this.clipboard && this.clipboard.length) { + if (!view) view = this.activeView; + if (!viewDiv) viewDiv = this.activeViewDiv; + + var widgets = this.dupWidgets(viewDiv, view, this.clipboard); + this.save(viewDiv, view); // Select main widget and add to selection the secondary ones + this.inspectWidgets(viewDiv, view, widgets); + } + } + }, + copyWidgets: function (viewDiv, view, isCut, widget, clipboard, index, wid) { + if (this.views[view].widgets[widget]) { + var w = this.views[view].widgets[widget]; + var members; + if (w.data && w.data.members) { + members = []; + for (var m = 0; m < w.data.members.length; m++) { + index++; + index = this.copyWidgets(viewDiv, view, isCut, w.data.members[m], clipboard, index, index); + members.push(index); + } + } + var obj = { + widget: $.extend(true, {}, w), + view: isCut ? '---copied---' : view, + viewDiv: isCut ? '---copied---' : viewDiv + }; + if (wid) { + obj.wid = wid; + } + if (members) { + obj.widget.data.members = members; + } + clipboard.push(obj); + } + return index; + }, + copy: function (viewDiv, view, isCut, widgets) { + var $focused = $(':focus'); + if (!view) view = this.activeView; + if (!viewDiv) viewDiv = this.activeViewDiv; + + if (widgets || (!$focused.length && this.activeWidgets.length)) { + //noinspection JSJQueryEfficiency + var $clipboard_content = $('#clipboard_content'); + if (!$clipboard_content.length) { + $('body').append(''); + $clipboard_content = $('#clipboard_content'); + } + + this.clipboard = []; + var widgetNames = ''; + widgets = widgets || this.activeWidgets; + if (widgets.length) { + var index = 0; + for (var i = 0, len = widgets.length; i < len; i++) { + widgetNames += (widgetNames ? ', ' : '') + widgets[i]; + index = this.copyWidgets(viewDiv, view, isCut, widgets[i], this.clipboard, index); + } + } + + /* this.showHint('
' + _('Clipboard:') + ' ' + widgetNames + '
', 0, null, function () { + if (html2canvas) { + this.getWidgetThumbnail(this.activeWidget, 0, 0, function (canvas) { + $('#thumbnail').html(canvas); + }); + } + + }); + */ + $clipboard_content.html('
' + _('Clipboard:') + ' ' + widgetNames + '
'); + + var that = this; + if (typeof html2canvas !== 'undefined') { + this.getWidgetThumbnail(widgets[0], 0, 0, function (canvas) { + $('#thumbnail').html(canvas); + if (isCut) { + that.delWidgets(viewDiv, view, widgets); + that.inspectWidgets(viewDiv, view, []); + } + }); + } else { + if (isCut) { + this.delWidgets(viewDiv, view, widgets); + this.inspectWidgets(viewDiv, view, []); + } + } + + $clipboard_content.css({left: ($(document).width() - $clipboard_content.width()) / 2}) + .click(function () { + $(this).slideUp('slow'); + }) + .fadeIn('fast'); + } else { + $('#clipboard_content').remove(); + } + }, + onButtonDelete: function (widgets) { + var $focused = $(':focus'); + if (widgets || (!$focused.length && this.activeWidgets.length)) { + widgets = widgets || JSON.parse(JSON.stringify(this.activeWidgets)); + var isHideDialog = this.config['dialog/delete_is_show'] || false; + + var viewDiv = this.activeViewDiv; + var view = this.activeView; + + if (!isHideDialog) { + if (widgets.length > 1) { + $('#dialog_delete_content').html(_('Do you want delete %s widgets?', widgets.length)); + } else { + $('#dialog_delete_content').html(_('Do you want delete widget %s?', widgets[0])); + } + + var dialog_buttons = {}; + + var delText = _('Delete').replace('ö', 'ö'); + var that = this; + dialog_buttons[delText] = function () { + if ($('#dialog_delete_is_show').prop('checked')) { + that.editSaveConfig('dialog/delete_is_show', true); + } + $(this).dialog('close'); + that.delWidgets(viewDiv, view, widgets); + that.inspectWidgets(viewDiv, view, []); + }; + dialog_buttons[_('Cancel')] = function () { + $(this).dialog('close'); + }; + + $('#dialog_delete').dialog({ + autoOpen: true, + width: 500, + height: 220, + modal: true, + title: _('Confirm widget deletion'), + open: function (event, ui) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_delete"]').css('z-index', 11002); + $('.ui-widget-overlay').css('z-index', 1001); + }, + buttons: dialog_buttons + }); + } else { + this.delWidgets(viewDiv, view, widgets); + this.inspectWidgets(viewDiv, view, []); + } + return true; + } else { + return false; + } + }, + onButtonArrows: function (key, isSize, factor) { + factor = factor || 1; + var $focused = $(':focus'); + if (!$focused.length && this.activeWidgets.length) { + var what = null; + var shift = 0; + var direction = 'n'; + key = parseInt(key, 10); + if (isSize) { + if (key === 39) { + //Right + what = 'width'; + shift = 1; + } else if (key === 37) { + // Left + what = 'width'; + shift = -1; + } else if (key === 40) { + // Down + what = 'height'; + shift = 1; + } else if (key === 38) { + // Up + what = 'height'; + shift = -1; + } + } else { + if (key === 39) { + //Right + what = 'left'; + shift = 1; + } else if (key === 37) { + // Left + what = 'left'; + shift = -1; + direction = 'p'; + } else if (key === 40) { + // Down + what = 'top'; + shift = 1; + } else if (key === 38) { + // Up + what = 'top'; + shift = -1; + direction = 'p'; + } + } + + shift = shift * factor; + + var viewDiv = this.activeViewDiv; + var view = this.activeView; + var viewOffset = this.editGetViewOffset(); + + for (var i = 0, len = this.activeWidgets.length; i < len; i++) { + var widgetId = this.activeWidgets[i]; + var $actualWidget = $('#' + widgetId); + var position = this.views[view].widgets[widgetId].style.position; + if (!isSize && (position === 'relative' || position === 'static' || position === 'sticky')) { + this.editWidgetOrder(null, widgetId, direction); + this.showWidgetHelper(viewDiv, view, widgetId, true); + } else { + if (this.views[view].widgets[widgetId].style[what] === undefined && $actualWidget.length) { + this.views[view].widgets[widgetId].style[what] = $actualWidget.css(what); + } + var value; + var oldValue; + + if (what === 'width') { + oldValue = $actualWidget.innerWidth(); + if (shift > 0) { + value = Math.ceil(oldValue + shift); + } else { + value = Math.floor(oldValue + shift); + } + $actualWidget.css(what, value); + if ($actualWidget.innerWidth() === oldValue) { + value += shift; + $actualWidget.css(what, value); + } + this.editApplySize(viewDiv, view, widgetId, value, null); + } else + if (what === 'height') { + oldValue = $actualWidget.innerHeight(); + if (shift > 0) { + value = Math.ceil(oldValue + shift) + } else { + value = Math.floor(oldValue + shift); + } + $actualWidget.css(what, value); + if ($actualWidget.innerHeight() === oldValue) { + value += shift; + $actualWidget.css(what, value); + } + this.editApplySize(viewDiv, view, widgetId, null, value); + } else + if (what === 'top') { + oldValue = $actualWidget.offset().top - viewOffset.top; + if (shift > 0) { + value = Math.ceil(oldValue + shift) + } else { + value = Math.floor(oldValue + shift); + } + $actualWidget.css(what, value); + if ($actualWidget.offset().top - viewOffset.top === oldValue) { + value += shift; + $actualWidget.css(what, value); + } + this.editApplyPosition(viewDiv, view, widgetId, value, null); + } else + if (what === 'left') { + oldValue = $actualWidget.offset().left - viewOffset.left; + if (shift > 0) { + value = Math.ceil(oldValue + shift); + } else { + value = Math.floor(oldValue + shift); + } + $actualWidget.css(what, value); + if ($actualWidget.offset().left - viewOffset.left === oldValue) { + value += shift; + $actualWidget.css(what, value); + } + this.editApplyPosition(viewDiv, view, widgetId, null, value); + } + if ($actualWidget.length) { + var setCss = {}; + setCss[what] = this.views[view].widgets[widgetId].style[what]; + $actualWidget.css(setCss); + this.showWidgetHelper(viewDiv, view, widgetId, true); + } + } + } + this.editShowLeadingLines(); + + if (this.delayedSettings) clearTimeout(this.delayedSettings); + + var that = this; + this.delayedSettings = setTimeout(function () { + that.editShowLeadingLines(null, true); // hide lines + // Save new settings + var activeWidgets = JSON.parse(JSON.stringify(that.activeWidgets)); + that.activeWidgets = []; + for (var i = 0, len = activeWidgets.length; i < len; i++) { + var mWidget = document.getElementById(activeWidgets[i]); + + if ((what === 'top' || what === 'left') && mWidget._customHandlers && mWidget._customHandlers.onMoveEnd) { + mWidget._customHandlers.onMoveEnd(mWidget, activeWidgets[i]); + } else if (mWidget._customHandlers && mWidget._customHandlers.onCssEdit) { + mWidget._customHandlers.onCssEdit(mWidget, activeWidgets[i]); + } + + if (mWidget._customHandlers && mWidget._customHandlers.isRerender) that.reRenderWidgetEdit(that.activeViewDiv, that.activeView, activeWidgets[i]); + } + that.delayedSettings = null; + that.activeWidgets = activeWidgets; + that.inspectWidgets(viewDiv, view, true); + }, 1000); + + this.save(viewDiv, view); + + return true; + } else { + return false; + } + }, + onPageClosing: function () { + // If not saved + if (this._saveTimer || !$('#css_file_save').prop('disabled')) { + if (window.confirm(_('Changes are not saved. Are you sure?'))) { + return null; + } else { + return _('Configuration not saved.'); + } + } + return null; + }, + bindInstanceEdit: function () { + var that = this; + if (!this.instance) this.generateInstance(); + + $('#vis_instance').change(function () { + that.instance = $(this).val(); + if (typeof storage !== 'undefined') storage.set(that.storageKeyInstance, that.instance); + }).val(this.instance); + }, + lockWidgets: function (viewDiv, view, widgets) { + // Disable selectee for all widgets + widgets = widgets || this.activeWidgets; + + if (widgets.length && !this.views[view]) { + view = this.getViewOfWidget(widgets[0]); + } + + if (widgets.length) { + for (var w = 0; w < widgets.length; w++) { + $('#' + widgets[w]).addClass('vis-widget-edit-locked').removeClass('ui-selectee ui-selected').unbind('click dblclick'); + this.views[view].widgets[widgets[w]].data.locked = true; + } + this.inspectWidgets(viewDiv, view, widgets); + } + }, + unlockWidgets: function (viewDiv, view, widgets) { + // Disable selectee for all widgets + widgets = widgets || this.activeWidgets; + + if (widgets.length && !this.views[view]) { + view = this.getViewOfWidget(widgets[0]); + } + if (widgets.length) { + // Enable select for all widgets + for (var w = 0; w < widgets.length; w++) { + $('#' + widgets[w]).removeClass('vis-widget-edit-locked').addClass('ui-selectee'); + if (this.views[view].widgets[widgets[w]].data.locked !== undefined) { + delete this.views[view].widgets[widgets[w]].data.locked; + } + this.bindWidgetClick(viewDiv, view, widgets[w]); + } + this.inspectWidgets(viewDiv, view, widgets); + } + }, + bringTo: function (viewDiv, view, widgets, isToFront) { + widgets = widgets || this.activeWidgets; + var x = {min: 10000, max: -10000}; + var y = {min: 10000, max: -10000}; + var z = {min: 10000, max: -10000}; + var offset; + var $wid; + var zindex; + var w; + var viewObj = this.views[view]; + + // Calculate biggest square + for (w = 0; w < widgets.length; w++) { + $wid = $('#' + widgets[w]); + offset = $wid.position(); + var width = $wid.outerWidth(); + var height = $wid.outerHeight(); + if (viewObj.widgets[widgets[w]].style['z-index'] === undefined || + viewObj.widgets[widgets[w]].style['z-index'] === null || + viewObj.widgets[widgets[w]].style['z-index'] === '') { + viewObj.widgets[widgets[w]].style['z-index'] = 0; + $wid.css({'z-index': 0}); + } + zindex = parseInt(viewObj.widgets[widgets[w]].style['z-index'], 10) || 0; + if (offset.left < x.min) x.min = offset.left; + if (offset.left + width > x.max) x.max = offset.left + width; + if (offset.top < y.min) y.min = offset.top; + if (offset.top + height > y.max) y.max = offset.top + height; + if (zindex < z.min) z.min = zindex; + if (zindex > z.max) z.max = zindex; + } + var minZ = 10000; + var maxZ = -10000; + + console.log('Square (x.min ' + x.min + ', y.min ' + y.min + '; x.max ' + x.max + ', y.max ' + y.max + ') z.min: '+ z.min + ', z.max: ' + z.max); + + // Find all widgets in this square + var $list = $('#visview_' + viewDiv + ' .vis-widget').filter(function() { + var wid = $(this).attr('id'); + if (widgets.indexOf(wid) !== -1) return false; + if (!viewObj.widgets[wid]) return false; + var offset = $(this).position(); + var tl = {x: offset.left, y: offset.top}; // top left + var br = {x: offset.left + $(this).outerWidth(), y: offset.top + $(this).outerHeight()}; // bottom right + + var isInside = false; + if ((x.min <= tl.x && tl.x <= x.max) && + (y.min <= tl.y && tl.y <= y.max)) { + isInside = true; + } else + if ((x.min <= br.x && br.x <= x.max) && + (y.min <= tl.y && tl.y <= y.max)) { + isInside = true; + } else + if ((x.min <= tl.x && tl.x <= x.max) && + (y.min <= br.y && br.y <= y.max)) { + isInside = true; + } else + if ((x.min <= br.x && br.x <= x.max) && + (y.min <= br.y && br.y <= y.max)) { + isInside = true; + } else + if ((tl.x <= x.min && x.min <= br.x) && + (tl.y <= y.min && y.min <= br.y)) { + isInside = true; + } else + if ((tl.x <= x.max && x.max <= br.x) && + (tl.y <= y.min && y.min <= br.y)) { + isInside = true; + } else + if ((tl.x <= x.max && x.max <= br.x) && + (tl.y <= y.max && y.max <= br.y)) { + isInside = true; + } else + if ((tl.x <= x.min && x.min <= br.x) && + (tl.y <= y.max && y.max <= br.y)) { + isInside = true; + } + + if (isInside) { + var z = viewObj.widgets[wid] ? parseInt(viewObj.widgets[wid].style['z-index'], 10) || 0 : 0; + if (minZ > z) minZ = z; + if (maxZ < z) maxZ = z; + console.log('Widget in square: ' + $(this).attr('id') + ', zindex ' + z); + } + + return isInside; + }); + + if (!$list.length) { + //reset z-index + for (var w = 0; w < widgets.length; w++) { + $wid = $('#' + widgets[w]); + zindex = undefined; + console.log('reset z-index of ' + widgets[w]); + $wid.css('z-index', zindex); + viewObj.widgets[widgets[w]].style['z-index'] = zindex; + } + this.inspectWidgets(viewDiv, view, true); + return; + } + + var that = this; + // Move all widgets + if (isToFront) { + // If z-index will be over 900 + if (z.max - z.min >= 700 - maxZ) { + offset = z.max - z.min - (700 - maxZ) + 1; + // Move all widgets to let place under them + $list.each(function () { + var zindex = parseInt(viewObj.widgets[$(this).attr('id')].style['z-index'], 10) || 0; + zindex = zindex - offset < 0 ? 0 : zindex - offset; + $(this).css('z-index', zindex); + viewObj.widgets[$(this).attr('id')].style['z-index'] = zindex; + }); + maxZ -= offset; + } + + // If everything is OK + if (maxZ < z.min) return; + if (maxZ === z.min) maxZ++; + for (var w = 0; w < widgets.length; w++) { + $wid = $('#' + widgets[w]); + zindex = parseInt(viewObj.widgets[widgets[w]].style['z-index'], 10) || 0; + console.log('Move ' + widgets[w] + ' from ' + zindex + ' to ' + (maxZ + zindex - z.min)); + zindex = maxZ + zindex - z.min + 1; + $wid.css('z-index', zindex); + viewObj.widgets[widgets[w]].style['z-index'] = zindex; + } + } else { + // If z-index will be negative + if (z.max - z.min >= minZ) { + offset = z.max - z.min - minZ + 1; + // Move all widgets to let place under them + $list.each(function () { + var zindex = parseInt(viewObj.widgets[$(this).attr('id')].style['z-index'], 10) || 0; + zindex = zindex + offset > 700 ? 700 : zindex + offset; + $(this).css('z-index', zindex); + viewObj.widgets[$(this).attr('id')].style['z-index'] = zindex; + }); + minZ += offset; + } + if (z.max < minZ) return; + + for (var w = 0; w < widgets.length; w++) { + $wid = $('#' + widgets[w]); + zindex = parseInt(viewObj.widgets[widgets[w]].style['z-index'], 10) || 0; + console.log('Move ' + widgets[w] + ' from ' + zindex + ' to ' + (maxZ + zindex - z.min)); + zindex = minZ - z.max + zindex - 1; + $wid.css('z-index', zindex); + viewObj.widgets[widgets[w]].style['z-index'] = zindex; + } + } + this.inspectWidgets(viewDiv, view, true); + }, + hideContextMenu: function (e, viewDiv, view) { + if (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + } + if (!viewDiv) viewDiv = this.activeViewDiv; + if (!view) view = this.activeView; + + var $contextMenu = $('#context_menu'); + + if ($contextMenu.parent().attr('id') !== 'vis_container') { + try { + $contextMenu.appendTo($('#vis_container')); + } catch (e) { + + } + } + + if ($contextMenu.is(':visible')) { + $contextMenu.hide(); + + $('#visview_' + viewDiv) + .unbind('click', this.editOnClickInMenu) + .find('.vis-widget') + .removeClass('vis-widgets-highlight'); + + this.installSelectable(viewDiv, view); + } + }, + editOnClickInMenu: function (e) { + // called by jQuery and this is not vis + vis.hideContextMenu(); + }, + editGetWidgetsUnderCursor: function ($viewDiv, view, options) { + var viewDiv = $viewDiv.attr('id').substring('visview_'.length); + var that = this; + return $viewDiv.find('.vis-widget').filter(function() { + var offset = $(this).position(); + + if (!$(this).length) { + return false; + } + //if ($(this).hasClass('vis-widget-edit-locked')) return false; + var id = $(this).attr('id'); + if (viewDiv === id) { + return false; + } + + if (that.views[view].widgets[id] && that.views[view].widgets[id].grouped) { + return false; + } + + var range = { + x: [offset.left + options.scrollLeft, offset.left + options.scrollLeft + $(this).outerWidth()], + y: [offset.top + options.scrollTop, offset.top + options.scrollTop + $(this).outerHeight()] + }; + return (options.left >= range.x[0] && options.left <= range.x[1]) && (options.top >= range.y[0] && options.top <= range.y[1]); + }); + }, + showContextMenu: function (viewDiv, view, options) { + var that = this; + var offset; + var range; + var wid; + var $listSelected = []; + var $listToSelect; + var $contextMenu = $('#context_menu'); + var $view = $('#visview_' + viewDiv); + + if (this.editTemplatesHideMenu) { + this.editTemplatesHideMenu(); + } + // Remove selectable to prevent widgets selection after click + if (this.selectable && $view.hasClass('ui-selectable')) $view.selectable('destroy'); + + $view.click(this.editOnClickInMenu); + var $contextMenuPaste = $('#context_menu_paste'); + + // remember position of click + + $contextMenuPaste.data('posX', options.left); + $contextMenuPaste.data('posY', options.top); + + if (!$contextMenuPaste.data('inited')) { + $contextMenuPaste + .data('inited', true) + .click(function (e) { + that.hideContextMenu(e, viewDiv, view); + var x = $(this).data('posX'); + var y = $(this).data('posY'); + // modify position of widget + var widgets = that.dupWidgets(viewDiv, view, that.clipboard, x, y); + that.save(viewDiv, view); // Select main widget and add to selection the secondary ones + that.inspectWidgets(viewDiv, view, widgets); + }); + + $('#context_menu_import').click(function (e) { + that.hideContextMenu(e, viewDiv, view); + that.importWidgets(viewDiv, view); + }); + } + $contextMenu.unbind('blur').blur(this.editOnClickInMenu); + + $('.context-menu-ul').remove(); + $('.context-menu-wid').remove(); + var $contextSubmenu = $('.context-submenu').unbind('click'); + var $contextMenuWid = $('#context_menu_wid').html('').hide(); + + // If some widgets selected => find out if click on some widget + if (this.activeWidgets && this.activeWidgets.length) { + var isHit = false; + + // Find if some active widgets clicked + for (var w = 0; w < this.activeWidgets.length; w++) { + var $wid = $('#' + this.activeWidgets[w]); + if (!$wid.length) continue; + offset = $wid.position(); + range = { + x: [offset.left + options.scrollLeft, offset.left + options.scrollLeft + $wid.outerWidth() ], + y: [offset.top + options.scrollTop, offset.top + options.scrollTop + $wid.outerHeight()] + }; + if ((options.left >= range.x[0] && options.left <= range.x[1]) && + (options.top >= range.y[0] && options.top <= range.y[1])) { + isHit = true; + break; + } + } + + if (isHit) { + $listSelected = $view.find('.vis-widget').filter(function() { + return that.activeWidgets.indexOf($(this).attr('id')) !== -1; + }); + } else { + // Check if one widget clicked + // Find all widgets under the cursor + $listToSelect = this.editGetWidgetsUnderCursor($view, view, options); + + if ($listToSelect.length === 1) { + // Select one + this.inspectWidgets(viewDiv, view, [$($listToSelect[0]).attr('id')]); + $listSelected = $listToSelect; + $listToSelect = []; + } else { + // Remove selection + this.inspectWidgets(viewDiv, view, []); + } + } + + if ($listSelected.length > 1) { + $('#context_menu_group').show(); + } else { + $('#context_menu_group').hide(); + } + } else { + $('#context_menu_group').hide(); + } + + // Find all widgets under the cursor + if (!$listToSelect) { + $listToSelect = this.editGetWidgetsUnderCursor($view, view, options); + } + + // If no active widgets clicked, but only one other clicked => select it + if (!$listSelected.length && $listToSelect.length === 1) { + // Select one + this.inspectWidgets(viewDiv, view, [$($listToSelect[0]).attr('id')]); + $listSelected = $listToSelect; + $listToSelect = []; + } + + // If selected only one and it is group => show ungroup + if ($listSelected.length === 1 && $($listSelected[0]).attr('id')[0] === 'g' && this.editTemplatesCreate) { + $('#context_menu_ungroup').show(); + $('#context_menu_group2template').show(); + } else { + $('#context_menu_ungroup').hide(); + $('#context_menu_group2template').hide(); + } + + // show title of menu + if ($listSelected.length === 1) { + $contextMenuWid.append(that.getWidgetName($($listSelected[0]).attr('id'))).show(); + } else if ($listSelected.length > 1) { + $contextMenuWid.append(_('%s widgets', $listSelected.length)).show(); + } else { + $contextMenuWid.hide(); + } + + if ($listToSelect.length) { + var allSelected = true; + // If yet selected => do not show menu element + if ($listSelected && $listSelected.length) { + $listToSelect.each(function () { + var wid = $(this).attr('id'); + var found = false; + $listSelected.each(function () { + if ($(this).attr('id') === wid) { + found = true; + return false; + } + }); + if (!found) { + allSelected = false; + return false; + } + }); + } + + if ($listSelected && $listSelected.length && allSelected) { + $('#context_menu_select').hide(); + } else { + var widgets = []; + var text = ''; + + $listToSelect.each(function () { + var wid = $(this).attr('id'); + text += '
  • ' + that.getWidgetName(wid) + '
  • '; + widgets.push(wid); + }); + text = '
  • ' + _('all') + '
  • ' + text; + $('#context_menu_select').show(); + + $contextSubmenu.append('...
      ' + text + '
    '); + } + } else { + $('#context_menu_select').hide(); + } + + if (($listSelected && $listSelected.length > 0) || $listToSelect.length > 0) { + $contextSubmenu.removeClass('ui-state-disabled'); + if ($listSelected.length > 1) { + $('#context-menu-action').show(); + } else { + $('#context-menu-action').hide(); + } + + $('.context-menu-common-item').click(function (e) { + that.hideContextMenu(e, viewDiv, view); + var widgets = that.activeWidgets; + var action = $(this).data('action'); + if (!action) action = $(this).parent().parent().data('action'); + + switch(action) { + case 'lock': + that.lockWidgets(viewDiv, view, widgets); + break; + case 'unlock': + that.unlockWidgets(viewDiv, view, widgets); + break; + case 'export': + that.exportWidgets(widgets); + break; + case 'bringToBack': + that.bringTo(viewDiv, view, widgets, false); + break; + case 'bringToFront': + that.bringTo(viewDiv, view, widgets, true); + break; + case 'copy': + that.copy(viewDiv, view, false, widgets); + break; + case 'select': + that.inspectWidgets(viewDiv, view, $(e.target).data('wid') ? $(e.target).data('wid').split(' ') : []); + break; + case 'delete': + that.onButtonDelete(widgets); + break; + case 'cut': + that.copy(viewDiv, view, true, widgets); + break; + case 'group': + that.editCreateGroup(viewDiv, view, widgets); + break; + case 'ungroup': + that.editDestroyGroup(viewDiv, view, widgets[0]); + break; + case 'group2template': + that.editTemplatesCreate(viewDiv, view, widgets[0]); + break; + } + }); + } + + // Enable paste if something in clipboard + if (this.clipboard && this.clipboard.length) { + $contextMenuPaste.removeClass('ui-state-disabled'); + } else { + $contextMenuPaste.addClass('ui-state-disabled'); + } + if (!$contextMenu.data('inited')) { + $contextMenu.data('inited', true); + } else { + $contextMenu.menu('destroy'); + } + + $contextMenu.css(options) + .appendTo($view) + .show() + .menu({ + focus: function (event, ui) { + $('#visview_' + viewDiv).find('.vis-widgets-highlight').removeClass('vis-widgets-highlight'); + var widgets = ui.item.data('wid'); + if (!widgets) return; + widgets = widgets.split(' '); + for (var i = 0; i < widgets.length; i++) { + $('#' + widgets[i]).addClass('vis-widgets-highlight'); + } + }, + blur: function (/* event, ui */) { + $('#visview_' + viewDiv).find('.vis-widgets-highlight').removeClass('vis-widgets-highlight'); + } + }); + + // var pos = $contextMenu.position(); + var h = $contextMenu.height(); + var ww = $contextMenu.width(); + + if (options.top - h > options.scrollTop) { + $contextMenu.css({top: options.top - h}); + } + if (options.left - ww > options.scrollLeft) { + $contextMenu.css({left: options.left - ww}); + } + + $contextMenu.focus(); + }, + editShowWizard: function (viewDiv, view, $tplElem) { + var tpl = $tplElem.attr('id').substring('prev_container_'.length); + $tplElem.attr('id', ''); + var that = this; + + //noinspection JSJQueryEfficiency + var $dlg = $('#dialog_wizard'); + if (!$dlg.length) { + $('body').append(''); + $dlg = $('#dialog_wizard'); + $dlg.selectId('init', { + texts: { + select: _('Select'), + cancel: _('Cancel'), + all: _('All'), + id: _('ID'), + name: _('Name'), + role: _('Role'), + room: _('Room'), + value: _('Value'), + selectid: _('Select ID'), + enum: _('Members'), + from: _('from'), + lc: _('lc'), + ts: _('ts'), + ack: _('ack'), + expand: _('expand'), + collapse: _('collapse'), + refresh: _('refresh'), + edit: _('edit'), + ok: _('ok'), + wait: _('wait'), + list: _('list'), + tree: _('tree'), + copyToClipboard: _('Copy to clipboard') + }, + noDialog: false, + noMultiselect: false, + filter: {type: 'state'}, + roleExactly: true, + columns: ['image', 'name', 'role', 'room', 'value'], + imgPath: '/lib/css/fancytree/', + objects: this.objects, + states: this.states, + zindex: 1001 + }); + } + + $dlg.selectId('show', function (newIds) { + if (!newIds || !newIds.length) return; + var $tpl = $('#' + tpl); + var renderVisible = $tpl.attr('data-vis-render-visible'); + var widgets = []; + // Go through all selected OIDs + for (var i = 0; i < newIds.length; i++) { + var data = {}; + var attrs = $dlg.data('attrs'); + var onlyAttrs = $dlg.data('onlyAttrs'); + if (attrs.indexOf('oid') !== -1) data.oid = 'nothing_selected'; + if (renderVisible) data.renderVisible = true; + var oid = $dlg.find('.dialog-wizard-select').val(); + var found = false; + + if (oid) { + data[oid] = newIds[i]; + // Try to find onChange handler + for (var j = 0; j < attrs.length; j++) { + var pos = attrs[j].indexOf('['); + found = false; + if (pos !== -1 && oid === attrs[j].substring(0, pos)) { + found = true; + } else { + pos = attrs[j].indexOf('/'); + if (pos !== -1 && oid === attrs[j].substring(0, pos)) { + found = true; + } + } + if (found) { + found = attrs[j].split('/')[2]; + break; + } + } + } + // Try to + /*if (that.objects[newIds[i]].common && that.objects[newIds[i]].common.name) { + if (attrs.indexOf('title') !== -1) data.title = that.objects[newIds[i]].common.name; + if (attrs.indexOf('descriptionLeft') !== -1) data.descriptionLeft = that.objects[newIds[i]].common.name; + data.name = that.objects[newIds[i]].common.name; + }*/ + + var widgetId = that.addWidget(viewDiv, view, {tpl: tpl, data: data}); + + // call default onChange handler + if (found) { + if (vis.binds[$tpl.data('vis-set')] && vis.binds[$tpl.data('vis-set')][found]) { + vis.binds[$tpl.data('vis-set')][found](widgetId, view, newIds[i], oid, false); + } + } + + widgets.push(widgetId); + } + + that.updateSelectWidget(viewDiv, view, widgets); + + setTimeout(function () { + that.inspectWidgets(viewDiv, view, widgets); + }, 50); + }); + var $realDlg = $('[aria-describedby="dialog_wizard"]'); + $realDlg.find('.ui-dialog-title').html(_('Wizard to create widgets...')); + $realDlg.find('.ui-button-text').each(function () { + var id = $(this).parent().attr('id'); + if (id && id.indexOf('button-ok') !== -1) { + $(this).html(_('Generate')); + } + }); + if (!$dlg.find('.dialog-wizard-preview').length) { + $dlg.find('div').first().css('height', 'calc(100% - 140px)'); + $dlg.dialog('option', 'height', 700); + $dlg.prepend('
    ' + + '' + + '
    ' + + '
    '); + } + + $dlg.find('.dialog-wizard-preview').html($tplElem); + var $widgetTpl = $('#' + tpl); + // fill attributes in select + var widgetAttrs = $widgetTpl.attr('data-vis-attrs'); + // Combine attributes from data-vis-attrs, data-vis-attrs0, data-vis-attrs1, ... + var t = 0; + var attr; + while ((attr = $widgetTpl.attr('data-vis-attrs' + t))) { + widgetAttrs += attr; + t++; + } + if (widgetAttrs) { + widgetAttrs = widgetAttrs.split(';'); + } else { + widgetAttrs = []; + } + $dlg.data('attrs', JSON.parse(JSON.stringify(widgetAttrs))); + + var options = ''; + attr = null; + for (var w = 0; w < widgetAttrs.length; w++) { + var pos = widgetAttrs[w].indexOf('/'); + if (pos !== -1) widgetAttrs[w] = widgetAttrs[w].substring(0, pos); + pos = widgetAttrs[w].indexOf('['); + if (pos !== -1) widgetAttrs[w] = widgetAttrs[w].substring(0, pos); + if (widgetAttrs[w] === 'systemOid' || + widgetAttrs[w] === 'oidTrueValue' || + widgetAttrs[w] === 'oidFalseValue' || + widgetAttrs[w].match(/oid\d{0,2}$/) || + widgetAttrs[w].match(/^oid/) || widgetAttrs[w].match(/^signals-oid-/)) { + if (!attr) attr = widgetAttrs[w]; + options += ''; + } + } + $dlg.find('.dialog-wizard-select').html(options); + if (attr) $dlg.find('.dialog-wizard-select').val(attr); + }, + editWidgetsRect: function (viewDiv, view, widgets, groupId) { + if (typeof widgets !== 'object') widgets = [widgets]; + var pos = { + top: null, + left: null, + width: null, + height: null + }; + var viewOffset; + if (groupId) { + viewOffset = $('#' + groupId).offset(); + } else { + viewOffset = $('#visview_' + viewDiv).offset(); + } + // find common coordinates + for (var w = 0; w < widgets.length; w++) { + var $w = $('#' + widgets[w]); + if (!$w.length) continue; + var offset = $w.offset(); + var top = offset.top - viewOffset.top; + var left = offset.left - viewOffset.left; + // May be bug? + if (!left && !top) { + left = parseInt($w[0].style.left || '0', 10) + parseInt($w[0].offsetLeft, 10); + top = parseInt($w[0].style.top || '0', 10) + parseInt($w[0].offsetTop, 10); + left = left || 0; + top = top || 0; + } + var height = $w.innerHeight(); + var width = $w.innerWidth(); + + if (pos.top === null) { + pos.top = top; + pos.left = left; + pos.height = top + height; + pos.width = left + width; + } else { + if (top < pos.top) pos.top = top; + if (left < pos.left) pos.left = left; + if (top + height > pos.height) pos.height = top + height; + if (left + width > pos.width) pos.width = left + width; + } + } + pos.width = Math.round(pos.width - pos.left); + pos.height = Math.round(pos.height - pos.top); + return pos; + }, + editConvertToPercent: function (viewDiv, view, wid, groupId, pRect, isShift) { + if (!pRect) { + var $v; + if (groupId) { + //pRect = this.editWidgetsRect(viewDiv, view, this.views[view].widgets[groupId].data.members, groupId); + $v = $('#' + viewDiv); + } else { + $v = $('#visview_' + viewDiv); + } + pRect = $v.offset(); + pRect.height = $v.innerHeight(); + pRect.width = $v.innerWidth(); + } + var wRect = this.editWidgetsRect(viewDiv, view, wid, groupId); + if (isShift) { + wRect.top -= pRect.top; + wRect.left -= pRect.left; + } + wRect.top = wRect.top * 100 / pRect.height; + wRect.left = wRect.left * 100 / pRect.width; + wRect.width = (wRect.width / pRect.width) * 100; + wRect.height = (wRect.height / pRect.height) * 100; + wRect.top = Math.round(wRect.top * 100) / 100 + '%'; + wRect.left = Math.round(wRect.left * 100) / 100 + '%'; + wRect.width = Math.round(wRect.width * 100) / 100 + '%'; + wRect.height = Math.round(wRect.height * 100) / 100 + '%'; + return wRect; + }, + editConvertToPx: function (viewDiv, view, wid, groupId) { + var wRect = this.editWidgetsRect(viewDiv, view, wid, groupId); + wRect.top = Math.round(wRect.top) + 'px'; + wRect.left = Math.round(wRect.left) + 'px'; + wRect.width = Math.round(wRect.width) + 'px'; + wRect.height = Math.round(wRect.height) + 'px'; + return wRect; + }, + editCreateGroup: function (viewDiv, view, widgets, groupId) { + if (!groupId) groupId = this.nextGroup(); + + var rect = this.editWidgetsRect(viewDiv, view, widgets); + for (var w = 0; w < widgets.length; w++) { + var wRect = this.editConvertToPercent(viewDiv, view, widgets[w], null, rect, true); + this.views[view].widgets[widgets[w]].style.top = wRect.top; + this.views[view].widgets[widgets[w]].style.left = wRect.left; + this.views[view].widgets[widgets[w]].style.width = wRect.width; + this.views[view].widgets[widgets[w]].style.height = wRect.height; + + $('#' + widgets[w]).remove(); + this.views[view].widgets[widgets[w]].grouped = true; + } + this.views[view].widgets[groupId] = { + tpl: '_tplGroup', + data: { + members: widgets + }, + widgetSet: null, + style: { + top: rect.top, + left: rect.left, + width: rect.width, + height: rect.height + } + }; + if (this.activeView === viewDiv) this.updateSelectWidget(viewDiv, view); + this.renderWidget(viewDiv, view, groupId); + this.inspectWidgets(viewDiv, view, [groupId]); + this.save(viewDiv, view); + }, + editDestroyGroup: function (viewDiv, view, groupId) { + if (groupId && this.views[view].widgets[groupId]) { + var widgets = this.views[view].widgets[groupId].data.members; + delete this.views[view].widgets[groupId]; + + var w; + //var rect = this.editWidgetsRect(viewDiv, view, groupId); + for (w = 0; w < widgets.length; w++) { + if (!this.views[view].widgets[widgets[w]]) continue; + if (this.views[view].widgets[widgets[w]].grouped !== undefined) delete this.views[view].widgets[widgets[w]].grouped; + var wRect = this.editWidgetsRect(viewDiv, view, widgets[w]); + this.views[view].widgets[widgets[w]].style.top = wRect.top + 'px'; + this.views[view].widgets[widgets[w]].style.left = wRect.left + 'px'; + this.views[view].widgets[widgets[w]].style.width = wRect.width + 'px'; + this.views[view].widgets[widgets[w]].style.height = wRect.height + 'px'; + } + $('#' + groupId).remove(); + + for (w = 0; w < widgets.length; w++) { + this.renderWidget(viewDiv, view, widgets[w]); + } + if (this.activeView === viewDiv) { + this.updateSelectWidget(viewDiv, view, null); + this.inspectWidgets(viewDiv, view, widgets); + } + } + }, + updateSelectWidget: function (viewDiv, view, added, removed) { + if (!viewDiv) viewDiv = this.activeViewDiv; + if (!view) view = this.activeView; + + if (added && typeof added === 'string') added = [added]; + if (removed && typeof removed === 'string') removed = [removed]; + + if (removed) { + for (var r = 0; r < removed.length; r++) { + this.$selectActiveWidgets.find('option[value="' + removed[r] + '"]').remove(); + } + } + if (added) { + for (var a = 0; a < added.length; a++) { + this.$selectActiveWidgets.append('') + } + } + if (!added && !removed) { + this.$selectActiveWidgets.html(''); + if (viewDiv !== view) { + if (this.views[view] && this.views[view].widgets && this.views[view].widgets[viewDiv]) { + var _widgets = this.views[view].widgets[viewDiv].data.members; + for (var i = 0; i < _widgets.length; i++) { + this.$selectActiveWidgets.append(''); + } + } + } else { + if (this.views[view] && this.views[view].widgets) { + var widgets = this.views[view].widgets; + for (var w in widgets) { + if (!widgets.hasOwnProperty(w)) continue; + if (widgets[w].grouped) continue; + this.$selectActiveWidgets.append(''); + } + } + } + } + this.sortSelectWidget(); + this.$selectActiveWidgets.multiselect('refresh'); + }, + sortSelectWidget: function() { + this.$selectActiveWidgets.append(this.$selectActiveWidgets.find("option").remove().sort(function(a, b) { + var at = $(a).text().toLowerCase(); + var bt = $(b).text().toLowerCase(); + return (at > bt) ? 1 : ((at < bt) ? - 1 : 0); + })); + } +}); + +$(document).keydown(function (e) { + // Keycodes + // + // | backspace 8 | e 69 | numpad 8 104 + // | tab 9 | f 70 | numpad 9 105 + // | enter 13 | g 71 | multiply 106 + // | shift 16 | h 72 | add 107 + // | ctrl 17 | i 73 | subtract 109 + // | alt 18 | j 74 | decimal point 110 + // | pause/break 19 | k 75 | divide 111 + // | caps lock 20 | l 76 | f1 112 + // | escape 27 | m 77 | f2 113 + // | page up 33 | n 78 | f3 114 + // | page down 34 | o 79 | f4 115 + // | end 35 | p 80 | f5 116 + // | home 36 | q 81 | f6 117 + // | left arrow 37 | r 82 | f7 118 + // | up arrow 38 | s 83 | f8 119 + // | right arrow 39 | t 84 | f9 120 + // | down arrow 40 | u 85 | f10 121 + // | insert 45 | v 86 | f11 122 + // | delete 46 | w 87 | f12 123 + // | 0 48 | x 88 | num lock 144 + // | 1 49 | y 89 | scroll lock 145 + // | 2 50 | z 90 | semi-colon 186 + // | 3 51 | left window key 91 | equal sign 187 + // | 4 52 | right window key 92 | comma 188 + // | 5 53 | select key 93 | dash 189 + // | 6 54 | numpad 0 96 | period 190 + // | 7 55 | numpad 1 97 | forward slash 191 + // | 8 56 | numpad 2 98 | grave accent 192 + // | 9 57 | numpad 3 99 | open bracket 219 + // | a 65 | numpad 4 100 | back slash 220 + // | b 66 | numpad 5 101 | close braket 221 + // | c 67 | numpad 6 102 | single quote 222 + // | d 68 | numpad 7 103 | + // Capture ctrl-z (Windows/Linux) and cmd-z (MacOSX) + if (e.which === 90 && (e.ctrlKey || e.metaKey)) { + vis.undo(); + e.preventDefault(); + } else + if (e.which === 65 && (e.ctrlKey || e.metaKey)) { + // Ctrl+A + if (vis.selectAll()) e.preventDefault(); + } else + if (e.which === 83 && (e.ctrlKey || e.metaKey)) { + // Ctrl+S + e.preventDefault(); + vis.saveRemote(); + } else + if (e.which === 27) { + // Esc + if (vis.deselectAll()) e.preventDefault(); + } else if (e.which === 46) { + // Capture Delete button + if (vis.onButtonDelete()) e.preventDefault(); + } else + if (e.which === 37 || e.which === 38 || e.which === 40 || e.which === 39) { + // Capture down, up, left, right for shift + if (vis.onButtonArrows(e.which, e.shiftKey, (e.ctrlKey || e.metaKey ? 10 : 1))) { + e.preventDefault(); + } + } else + if (e.which === 113) { + var $ribbon = $('#ribbon_tab_dev'); + $ribbon.toggle(); + vis.editSaveConfig(['show/ribbon_tab_dev'], $ribbon.is(':visible')); + e.preventDefault(); + } else if (e.which === 114) { + // Full screen + var $container = $('#vis_container'); + var $attrWrap = $('#attr_wrap'); + var $panAttr = $('#pan_attr'); + var delay; + + if ($container.hasClass('fullscreen')) { + $attrWrap.unbind('mouseenter').unbind('mouseleave'); + $panAttr.show(); + $container.addClass('vis_container'); + $container.removeClass('fullscreen').appendTo('#vis_wrap'); + $attrWrap.removeClass('fullscreen-pan-attr').appendTo('#panel_body'); + } else { + $container.removeClass('vis_container'); + $container.prependTo('body').addClass('fullscreen'); + $attrWrap.prependTo('body').addClass('fullscreen-pan-attr'); + + $attrWrap + .bind('mouseenter', function () { + clearTimeout(delay); + $panAttr.show('slide', {direction: 'right'}); + }) + .bind('mouseleave', function () { + delay = setTimeout(function () { + if ($attrWrap.hasClass('fullscreen-pan-attr')){ + $panAttr.hide('slide', {direction: 'right'}); + } + }, 750); + }); + $panAttr.hide(); + } + + e.preventDefault(); + } else if (e.which === 33) { + // Next View + vis.nextView(); + e.preventDefault(); + } else + if (e.which === 34) { + // Prev View + vis.prevView(); + e.preventDefault(); + } +}); + +// Copy paste mechanism +$(window).on('paste', function (/*e*/) { + vis.paste(); +}).on('copy cut', function (e) { + vis.copy(null, null, e.type === 'cut'); +}); + +window.onbeforeunload = function () { + return vis.onPageClosing(); +}; + + diff --git a/www/js/visEditExt.js b/www/js/visEditExt.js new file mode 100644 index 0000000..8baf34e --- /dev/null +++ b/www/js/visEditExt.js @@ -0,0 +1,411 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ + +// visEdit - the ioBroker.vis Editor extensions + +/* jshint browser:true */ +/* global _ */ +/* global $ */ +/* global jQuery */ +/* global console */ +/* global systemDictionary */ +/* global vis:true */ +/* jshint -W097 */// jshint strict:false +'use strict'; + +// Add words for bars +$.extend(systemDictionary, { + "Select" : {"en" : "Select", "de": "Auswählen", "ru": "Выбрать"}, + "Cancel" : {"en" : "Cancel", "de": "Abbrechen", "ru": "Отмена"}, + "None" : {"en": "None", "de": "Vorgegeben", "ru": "---"}, + "Default" : {"en": "Default", "de": "Vorgegeben", "ru": "По умолчанию"}, + "Name" : {"en" : "Name", "de": "Name", "ru": "Имя"}, + "Location" : {"en" : "Location", "de": "Raum", "ru": "Комната"}, + "Interface" : {"en" : "Interface", "de": "Schnittstelle", "ru": "Интерфейс"}, + "Type" : {"en" : "Type", "de": "Typ", "ru": "Тип"}, + "Address" : {"en" : "Address", "de": "Adresse", "ru": "Адрес"}, + "Function" : {"en" : "Function", "de": "Gewerk", "ru": "Функционал"}, + "Disable device filter:" : { + "en": "Disable device filter:", + "de": "Schalte Gerätefilter aus:", + "ru": "Убрать фильтр по устройствам:" + }, + "Rooms" : {"en" : "Rooms", "de": "Räume", "ru": "Комнаты"}, + "Functions" : {"en" : "Functions", "de": "Gewerke", "ru": "Функции"}, + "Selected image: " : {"en" : "Selected file: ","de": "Ausgewählte Datei: ","ru": "Выбраный файл: "}, + "Programs" : {"en" : "Programs", "de": "Programme", "ru": "Программы"}, + "Variables" : {"en" : "Variables", "de": "Variablen", "ru": "Переменные"}, + "Devices" : {"en" : "Devices", "de": "Geräte", "ru": "Устройства"} +}); + +vis.styleSelect = { + // local variables + _internalList: null, + // Functions + collectClasses: function () { + var result = []; + var sSheetList = document.styleSheets; + for (var sSheet = 0; sSheet < sSheetList.length; sSheet++) { + if (!document.styleSheets[sSheet]) continue; + try { + var ruleList = document.styleSheets[sSheet].cssRules; + if (ruleList) { + for (var rule = 0; rule < ruleList.length; rule ++) { + if (!ruleList[rule].selectorText) continue; + var _styles = ruleList[rule].selectorText.split(','); + for (var s = 0; s < _styles.length; s++) { + var substyles = _styles[s].trim().split(' '); + var _style = substyles[substyles.length - 1].replace('::before', '').replace('::after', '').replace(':before', '').replace(':after', ''); + + if (!_style || _style[0] !== '.' || _style.indexOf(':') !== -1) continue; + + var name = _style; + name = name.replace(',', ''); + name = name.replace(/^\./, ''); + + var val = name; + name = name.replace(/^hq-background-/, ''); + name = name.replace(/^hq-/, ''); + name = name.replace(/^ui-/, ''); + name = name.replace(/[-_]/g, ' '); + + if (name.length > 0) { + name = name[0].toUpperCase() + name.substring(1); + var fff = document.styleSheets[sSheet].href; + + if (fff && fff.indexOf('/') !== -1) { + fff = fff.substring(fff.lastIndexOf('/') + 1); + } + + if (!result[val]) { + if (substyles.length > 1) { + result[val] = {name: name, file: fff, attrs: ruleList[rule].style, parentClass: substyles[0].replace('.', '')}; + } else { + result[val] = {name: name, file: fff, attrs: ruleList[rule].style}; + } + } + } + } + } + } + } catch (e) { + console.error(e); + } + } + return result; + }, + show: function (options) { + // Fill the list of styles + if (!this._internalList) this._internalList = vis.styleSelect.collectClasses(); + + options.filterName = options.filterName || ''; + options.filterAttrs = options.filterAttrs || ''; + options.filterFile = options.filterFile || ''; + + var styles = {}; + + if (options.styles) { + styles = $.extend(styles, options.styles); + } else { + // IF filter defined + if (options.filterFile || options.filterName) { + var filters = (options.filterName) ? options.filterName.split(' ') : null; + var attrs = (options.filterAttrs) ? options.filterAttrs.split(' ') : null; + var files = (options.filterFile) ? options.filterFile.split(' ') : ['']; + + for (var style in this._internalList) { + if (!this._internalList.hasOwnProperty(style)) continue; + for (var f = 0; f < files.length; f++) { + if (!options.filterFile || + (this._internalList[style].file && this._internalList[style].file.indexOf(files[f]) !== -1)) { + var isFound = !filters; + if (!isFound) { + for (var k = 0; k < filters.length; k++) { + if (style.indexOf(filters[k]) !== -1) { + isFound = true; + break; + } + } + } + if (isFound) { + isFound = !attrs; + if (!isFound) { + for (var u = 0; u < attrs.length; u++) { + var t = this._internalList[style].attrs[attrs[u]]; + if (t || t === 0) { + isFound = true; + break; + } + } + } + } + + if (isFound) { + var n = this._internalList[style].name; + if (options.removeName) { + n = n.replace(options.removeName, ''); + n = n[0].toUpperCase() + n.substring(1).toLowerCase(); + } + styles[style] = { + name: n, + file: this._internalList[style].file, + parentClass: this._internalList[style].parentClass + }; + } + } + } + } + } else { + styles = $.extend(styles, this._internalList); + } + } + + var text = ''; + //noinspection JSJQueryEfficiency + if (!$('#' + options.name + '_styles').length) { + text = ''; + } + + if (!$.fn.iconselectmenu) { + $.widget('custom.iconselectmenu', $.ui.selectmenu, { + _renderItem: function (ul, item) { + var li = $('
  • ', {text: item.label}); + var styles = ul.data('styles'); + + if (item.disabled) { + li.addClass('ui-state-disabled'); + } + + $('', { + style: 'padding: 0px; margin; 0px; z-index: auto; display: inline-block; margin-right: 10px; position: relative; width: 50px; height: 20px;', + 'class': 'ui-corner-all ' + item.value + }).prependTo(li); + + li.css('font-size', '16px'); + + if (styles[item.value] && styles[item.value].parentClass) li.addClass(styles[item.value].parentClass); + + return li.appendTo( ul ); + } + }); + } + + $('#' + options.name).hide().after(text); + + var $styles = $('#' + options.name + '_styles'); + $styles.iconselectmenu({ + width: '100%', + style: 'dropdown', + change: function (event, ui) { + if (options.onchange) options.onchange(ui.item.value); + + var $text = $('#' + options.name + '_styles-button').find('.ui-selectmenu-text'); + $('', { + style: 'padding: 0px; margin; 0px; z-index: auto; display: inline-block; margin-right: 10px; position: relative; width: 50px; height: 20px;', + 'class': 'ui-corner-all vis-current-style ' + ui.item.value + }).prependTo($text); + + $text.css('font-size', '16px'); + + if (styles[ui.item.value] && styles[ui.item.value].parentClass) { + $text.parent().addClass(styles[ui.item.value].parentClass); + } + } + }).iconselectmenu('menuWidget').data('styles', styles).addClass('selectmenu-overflow'); + + $('#' + options.name + '_styles-menu').addClass('custom-vis-menu'); + + var $curStyle = $('#' + options.name + '_styles-button .vis-current-style'); + if ($curStyle.length) { + $curStyle.remove(); + + $styles.val(options.style) + .iconselectmenu('refresh'); + } + + var $text = $('#' + options.name + '_styles-button').find('.ui-selectmenu-text'); + $('', { + style: 'padding: 0px; margin; 0px; z-index: auto; display: inline-block; margin-right: 10px; position: relative; width: 50px; height: 20px;', + 'class': 'ui-corner-all vis-current-style ' + options.style + }).prependTo($text); + + $text.css('font-size', '16px'); + + if (styles[options.style] && styles[options.style].parentClass) { + $text.parent().addClass(styles[options.style].parentClass); + } + } +}; + +// Color selection Dialog +var colorSelect = { + // possible settings + settings: { + onselect: null, + onselectArg: null, + result: '', + current: null, // current value + parent: $('body'), + elemName: 'idialog_', + zindex: 5050 + }, + _selectText: '', + _cancelText: '', + _titleText: '', + + show: function (options) { + if (!this._selectText) { + this._selectText = _('Select'); + this._cancelText = _('Cancel'); + this._titleText = _('Select color'); + } + + if (!options.elemName) { + options.elemName = 'idialog_'; + } + if (!options.parent) { + options.parent = $('body'); + } + + if (document.getElementById(options.elemName) !== undefined) { + $('#' + options.elemName).remove(); + } + options.parent.append('
    '); + var htmlElem = document.getElementById("colorSelect"); + htmlElem.settings = {}; + htmlElem.settings = $.extend(htmlElem.settings, this.settings); + htmlElem.settings = $.extend(htmlElem.settings, options); + $(htmlElem).css({'z-index': htmlElem.settings.zindex}); + + // Define dialog buttons + var dialog_buttons = {}; + dialog_buttons[this._selectText] = function () { + $(this).dialog('close'); + if (this.settings.onselect) + this.settings.onselect ($('#colortext').val(), this.settings.onselectArg); + $(this).remove(); + }; + dialog_buttons[this._cancelText] = function () { + $(this).dialog('close'); + $(this).remove(); + }; + $('#colorSelect').dialog({ + resizable: false, + height: 385, + width: 340, + modal: true, + buttons: dialog_buttons + }); + $('div[aria-describedby="colorSelect"]').css({'z-index': htmlElem.settings.zindex}); + if (htmlElem.settings.current || htmlElem.settings.current === 0) { + $('#colortext').val(htmlElem.settings.current); + } else { + $('#colortext').val('#FFFFFF'); + } + if ($().farbtastic) { + $('#colorpicker').farbtastic('#colortext'); + } + }, + GetColor: function () { + return $('#colortext').val(); + } +}; + +// Create multiselect if no default widget loaded +if (!$().multiselect) { + (function ($, undefined) { + $.widget('dash.multiselect', { + // default options + options: { + multiple: true + }, + // the constructor + _create: function () { + if (!this.options.multiple) { + return; + } + var elem = this.element.hide(); + var div = ''; + div += '
    '; + this.table = $(div); + this.table.insertAfter(elem); + this._build(); + }, + + _build: function () { + this.table.empty(); + var div = ""; + this.element.find("option").each(function () { + div += '' + $(this).html() + ''; + console.log($(this).attr('value')); + }); + this.table.html(div); + var that = this; + this.table.find('input').each(function () { + this._parent = that; + $(this).on('click', function () { + var val = $(this).attr('data-value'); + var checked = $(this).is(':checked'); + // change state on the original option tags + this._parent.element.find('option').each(function () { + if(this.value === val) { + $(this).prop('selected', checked); + } + }); + + this._parent.element.trigger('change'); + }); + }); + }, + _init: function () { + if (!this.options.multiple) { + return; + } + this._build(); + }, + refresh: function () { + if (!this.options.multiple) { + return; + } + this._build(); + }, + + // events bound via _on are removed automatically + // revert other modifications here + _destroy: function () { + if (!this.options.multiple) { + return; + } + this.table.remove(); + this.element.show(); + + $.Widget.prototype.destroy.call(this); + }, + + _update: function () { + if (!this.options.multiple) { + return; + } + this.refresh(false); + } + }); + })(jQuery); +} \ No newline at end of file diff --git a/www/js/visEditInspect.js b/www/js/visEditInspect.js new file mode 100644 index 0000000..4d0ed9d --- /dev/null +++ b/www/js/visEditInspect.js @@ -0,0 +1,2601 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ + +// visEdit - the ioBroker.vis Editor +/* jshint browser:true */ +/* global document */ +/* global console */ +/* global session */ +/* global window */ +/* global location */ +/* global setTimeout */ +/* global clearTimeout */ +/* global io */ +/* global $ */ +/* global vis:true */ +/* global local */ +/* global can */ +/* global colorSelect */ +/* global storage */ +/* global html2canvas */ +/* global translateAll */ +/* global ace */ +/* global _ */ +/* jshint -W097 */// jshint strict:false + + +// Format: attr_name(start-end)[default_value]/type/onChangeFunc +// attr_name can be extended with numbers (1-2) means it will be attr_name1 and attr_name2 created +// end number can be other attribute, e.g (1-count) +// defaultValue: If defaultValue has ';' it must be replaced by § +// defaultValue: If defaultValue has '/' it must be replaced by ~ +// defaultValue: If defaultValue has '"' it must be replaced by ^ +// defaultValue: If defaultValue has '^' it must be replaced by ^^ +// onChangeFunc has following attributes (widgetID, view, newId, attr, isCss) and must return back the array with changed attributes or null +// Type format: id - Object ID Dialog +// hid +// checkbox +// image - image +// number,min,max,step - non-float number. min,max,step are optional +// color - color picker +// views - Name of the view +// effect - jquery UI show/hide effects +// eff_opt - additional option to effect slide (up, down, left, right) +// fontname - Font name +// slider,min,max,step - Default step is ((max - min) / 100) +// select,value1,value2,... - dropdown select +// nselect,value1,value2,... - same as select, but without translation of items +// auto,value1,value2,... - autocomplete +// style,fileFilter,nameFilter,attrFilter +// custom,functionName,options,... - custom editor - functionName is starting from vis.binds.[widgetset.funct]. E.g. custom/timeAndWeather.editWeather,short +// group.name - define new or old group. All following attributes belongs to new group till new group.xyz +// group.name/byindex/icon - like group, but all following attributes will be grouped by ID. Icon is optional. Like group.windows/byindex;slide(1-4)/id;slide_type(1-4)/select,open,closed Following groups will be created Windows1(slide1,slide_type1), Windows2(slide2,slide_type2), Windows3(slide3,slide_type3), Windows4(slide4,slide_type4) +// text - dialog box with html editor +// html - dialog box with html editor +// widget - existing widget selector +// history - select history instances + +'use strict'; + +vis = $.extend(true, vis, { + fontNames: [ + 'Verdana, Geneva, sans-serif', + 'Georgia, "Times New Roman", Times, serif', + '"Courier New", Courier, monospace', + 'Arial, Helvetica, sans-serif', + 'Tahoma, Geneva, sans-serif', + '"Trebuchet MS", Arial, Helvetica, sans-serif', + '"Arial Black", Gadget, sans-serif', + '"Times New Roman", Times, serif', + '"Palatino Linotype", "Book Antiqua", Palatino, serif', + '"Lucida Sans Unicode", "Lucida Grande", sans-serif', + '"MS Serif", "New York", serif', + '"Comic Sans MS", cursive' + ], + editObjectID: function (widAttr, widgetFilter, isHistory, onChange) { + var that = this; + if (typeof isHistory === 'function') { + onChange = isHistory; + isHistory = false; + } + + // Edit for Object ID + var line = [ + { + input: '' + } + ]; + + if (this.objectSelector) { + line[0].button = { + icon: 'ui-icon-note', + text: false, + title: _('Select object ID'), + click: function () { + var wdata = $(this).data('wdata'); + + $('#dialog-select-member-' + wdata.attr).selectId('show', that.views[wdata.view].widgets[wdata.widgets[0]].data[wdata.attr], function (newId, oldId) { + if (oldId !== newId) { + $('#inspect_' + wdata.attr).val(newId).trigger('change'); + + if ($('#inspect_min').length) { + if (that.objects[newId] && that.objects[newId].common && that.objects[newId].common.min !== undefined) { + $('#inspect_min').val(that.objects[newId].common.min).trigger('change'); + } + } + + if ($('#inspect_max').length) { + if (that.objects[newId] && that.objects[newId].common && that.objects[newId].common.max !== undefined) { + $('#inspect_max').val(that.objects[newId].common.max).trigger('change'); + } + } + + if ($('#inspect_oid-working').length) { + if (that.objects[newId] && that.objects[newId].common && that.objects[newId].common.workingID) { + if (that.objects[newId].common.workingID.indexOf('.') !== -1) { + $('#inspect_oid-working').val(that.objects[newId].common.workingID).trigger('change'); + } else { + var parts = newId.split('.'); + parts.pop(); + parts.push(that.objects[newId].common.workingID); + $('#inspect_oid-working').val(parts.join('.')).trigger('change'); + } + } + } + + /* + if (document.getElementById('inspect_hm_wid')) { + if (that.objects[newId]['Type'] !== undefined && that.objects[value]['Parent'] !== undefined && + (that.objects[newId]['Type'] === 'STATE' || + that.objects[newId]['Type'] === 'LEVEL')) { + + var parent = that.objects[newId]['Parent']; + if (that.objects[parent]['DPs'] !== undefined && + that.objects[parent]['DPs']['WORKING'] !== undefined) { + $('#inspect_hm_wid').val(that.objects[parent]['DPs']['WORKING']); + $('#inspect_hm_wid').trigger('change'); + } + } + } + + // Try to find Function of the device and fill the Filter field + var $filterkey = $('#inspect_filterkey'); + if ($filterkey.length) { + if ($filterkey.val() === '') { + var oid = newId; + var func = null; + if (that.metaIndex && that.metaIndex['ENUM_FUNCTIONS']) { + while (oid && that.objects[oid]) { + for (var t = 0; t < that.metaIndex['ENUM_FUNCTIONS'].length; t++) { + var list = that.objects[that.metaIndex['ENUM_FUNCTIONS'][t]]; + for (var z = 0; z < list['Channels'].length; z++) { + if (list['Channels'][z] === oid) { + func = list.Name; + break; + } + } + if (func) break; + } + if (func) break; + + oid = that.objects[oid]['Parent']; + } + } + if (func) $filterkey.val(func).trigger('change'); + } + }*/ + } + }); + } + }; + + line[0].onchange = function (val, oldValue) { + var wdata = $(this).data('wdata'); + $('#inspect_' + wdata.attr + '_desc').html(that.getObjDesc(val)); + var userOnchange = $(this).data('onchange'); + if (userOnchange) { + for (var w = 0; w < wdata.widgets.length; w++) { + var widgetSet = $('#' + that.views[wdata.view].widgets[wdata.widgets[w]].tpl).attr('data-vis-set'); + if (that.binds[widgetSet] && that.binds[widgetSet][userOnchange]) { + return that.binds[widgetSet][userOnchange](wdata.widgets[w], wdata.view, that.widgets[wdata.widgets[w]].data[wdata.attr], wdata.attr, false, oldValue); + } + } + } + }; + + line.push({input: '
    '}); + + var $dialog = $('#dialog-select-member-' + widAttr); + // Init select dialog + if (!$dialog.length) { + $('body').append(''); + $('#dialog-select-member-' + widAttr).selectId('init', { + filter: { + common: { + history: isHistory ? { + enabled: true + } : undefined + } + }, + texts: { + select: _('Select'), + cancel: _('Cancel'), + all: _('All'), + id: _('ID'), + name: _('Name'), + role: _('Role'), + room: _('Room'), + value: _('Value'), + selectid: _('Select ID'), + enum: _('Members'), + from: _('from'), + lc: _('lc'), + ts: _('ts'), + ack: _('ack'), + expand: _('expand'), + collapse: _('collapse'), + refresh: _('refresh'), + edit: _('edit'), + ok: _('ok'), + wait: _('wait'), + list: _('list'), + tree: _('tree'), + copyToClipboard: _('Copy to clipboard') + }, + filterPresets: {role: widgetFilter}, + noMultiselect: true, + columns: ['image', 'name', 'type', 'role', 'enum', 'room', 'value'], + imgPath: '/lib/css/fancytree/', + objects: this.objects, + states: this.states, + zindex: 1001 + }); + } else { + $dialog.selectId('option', 'filterPresets', {role: widgetFilter}); + $dialog.selectId('option', 'filter', { + common: { + history: isHistory ? { + enabled: true + } : undefined + } + }); + } + } + + return line; + }, + editWidgetNames: function (widAttr, options) { + // options[0] all views + var widgets = ['']; + if (options && options[0] === 'all') { + for (var w in this.widgets) { + widgets.push(w); + } + } else { + for (var w in this.views[this.activeView].widgets) { + widgets.push(w); + } + } + + return this.editSelect(widAttr, widgets, true); + }, + editSelect: function (widAttr, values, notTranslate, init, onchange) { + if (typeof notTranslate === 'function') { + onchange = init; + init = notTranslate; + notTranslate = false; + } + + // Select + var line = { + input: ''; + return line; + }, + editStyle: function (widAttr, options) { + var that = this; + // options[0] fileFilter + // options[1] nameFilter + // options[2] attrFilter + // Effect selector + return { + input: '', + init: function (_wid_attr, data) { + if (that.styleSelect) { + that.styleSelect.show({ + width: '100%', + name: 'inspect_' + _wid_attr, + filterFile: options[0], + filterName: options[1], + filterAttrs: options[2], + removeName: options[3], + style: data, + parent: $(this).parent(), + onchange: function (newStyle) { + $('#inspect_' + widAttr).val(newStyle).trigger('change'); + } + }); + $('#inspect_' + widAttr).hide(); + } + } + }; + }, + editFontName: function (widAttr) { + var that = this; + // Auto-complete + return { + input: '', + init: function (_wid_attr, data) { + $(this).autocomplete({ + minLength: 0, + source: function (request, response) { + var _data = $.grep(that.fontNames, function (value) { + return value.substring(0, request.term.length).toLowerCase() === request.term.toLowerCase(); + }); + + response(_data); + }, + select: function (event, ui) { + $(this).val(ui.item.value); + $(this).trigger('change', ui.item.value); + } + }).focus(function () { + // Show dropdown menu + $(this).autocomplete('search', ''); + }).autocomplete('instance')._renderItem = function (ul, item) { + return $('
  • ') + .append('' + item.label + '(En, Рус, Äü)') + .appendTo(ul); + }; + } + }; + }, + editHistoryInstance: function (widAttr) { + if (!this.historyInstances) { + for (var id in this.objects) { + if (this.objects[id].type === 'instance' && this.objects[id].common && this.objects[id].common.type === 'storage') { + this.historyInstances = this.historyInstances || []; + id = id.substring('system.adapter.'.length); + if (this.historyInstances.indexOf(id) === -1) this.historyInstances.push(id); + } + } + } + + return this.editAutoComplete(widAttr, this.historyInstances); + }, + editClass: function (widAttr) { + var that = this; + if (!this.styleClasses) { + this.styleClasses = []; + var classes = vis.styleSelect.collectClasses(); + var reg = /^vis-style-/; + for (var c in classes) { + if (reg.test(c) && this.styleClasses.indexOf(c) === -1) this.styleClasses.push(c); + } + classes = null; + } + + return this.editAutoComplete(widAttr, this.styleClasses); + }, + editAutoComplete: function (widAttr, values) { + // Auto-complete + return { + input: '', + init: function (_wid_attr, data) { + $(this).autocomplete({ + minLength: 0, + source: function (request, response) { + var _data = $.grep(values, function (value) { + return value.substring(0, request.term.length).toLowerCase() === request.term.toLowerCase(); + }); + + response(_data); + }, + select: function (event, ui) { + $(this).val(ui.item.value); + $(this).trigger('change', ui.item.value); + } + }).focus(function () { + // Show dropdown menu + $(this).autocomplete('search', ''); + }); + } + }; + }, + _editSetFontColor: function (element) { + try { + var r; + var b; + var g; + var hsp; + var $element = $('#' + element); + var a = $element.css('background-color'); + if (a.match(/^rgb/)) { + a = a.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/); + r = a[1]; + g = a[2]; + b = a[3]; + } else { + a = '0x' + a.slice(1).replace(a.length < 5 && /./g, '$&$&'); + r = a >> 16; + g = a >> 8 & 255; + b = a & 255; + } + hsp = Math.sqrt( + 0.299 * (r * r) + + 0.587 * (g * g) + + 0.114 * (b * b) + ); + if (hsp > 127.5) { + $element.css('color', '#000000'); + } else { + $element.css('color', '#FFFFFF'); + } + } catch (err) { + + } + }, + editColor: function (widAttr) { + var that = this; + var line = { + input: '', + onchange: function (value) { + $(this).css('background-color', value || ''); + that._editSetFontColor('inspect_' + widAttr); + } + }; + if ((typeof colorSelect !== 'undefined' && $().farbtastic)) { + line.button = { + icon: 'ui-icon-note', + text: false, + title: _('Select color'), + click: function (/*event*/) { + var wdata = $(this).data('wdata'); + var _settings = { + current: $('#inspect_' + wdata.attr).val(), + onselectArg: wdata, + onselect: function (img, _data) { + $('#inspect_' + wdata.attr).val(colorSelect.GetColor()).trigger('change'); + } + }; + + colorSelect.show(_settings); + } + }; + } + + return line; + }, + editViewName: function (widAttr) { + var views = ['']; + for (var v in this.views) { + if (!this.views.hasOwnProperty(v) || v === '___settings') continue; + views.push(v); + } + + return this.editAutoComplete(widAttr, views); + }, + editFilterName: function (widAttr) { + var filters = this.updateFilter(); + filters.unshift(''); + + //return this.editSelect(widAttr, filters, true); + return this.editAutoComplete(widAttr, filters); + }, + editEffect: function (widAttr) { + var that = this; + return this.editSelect(widAttr, [ + '', + 'show', + 'blind', + 'bounce', + 'clip', + 'drop', + 'explode', + 'fade', + 'fold', + 'highlight', + 'puff', + 'pulsate', + 'scale', + 'shake', + 'size', + 'slide' + ], null, function (_widAttr, data) { + if (_widAttr.indexOf('_effect') !== -1) { + var eff = _widAttr.replace('_effect', '_options'); + var $elem = $('#inspect_' + eff); + if ($elem.length) { + if (data === 'slide') { + that.hideShowAttr(eff, true); + } else { + that.hideShowAttr(eff, false); + $elem.val('').trigger('change'); + } + } + } + }); + }, + editNumber: function (widAttr, options, onchange) { + // options = {min: ?,max: ?,step: ?} + // Select + var line = { + input: '', + init: function (w, data) { + var platform = window.navigator.oscpu || window.navigator.platform; + // Do not show spin on MAc OS + if (platform.indexOf('Mac') === -1) { + options = options || {}; + options.spin = function () { + var $this = $(this); + var timer = $this.data('timer'); + if (timer) clearTimeout(timer); + $this.data('timer', setTimeout(function () { + $this.trigger('change'); + },200)); + }; + $(this).spinner(options); + $(this).parent().css({width: 'calc(100% - 2px)'}); + } else { + $(this).parent().css({width: 'calc(100% - 8px)'}); + } + // Allow only numbers + $(this).on('keypress', function(e) { + var code = e.keyCode || e.charCode; + return (code >= 48 && code <= 57) || (code === 110); + }); + } + }; + if (onchange) line.onchange = onchange; + return line; + }, + editButton: function (widAttr, options, onchange) { + // options = {min: ?,max: ?,step: ?} + // Select + var line = { + input: '', + init: function (w, data) { + $(this).button().click(function () { + $(this).val(true).trigger('change'); + }); + } + }; + if (onchange) line.onchange = onchange; + return line; + }, + editUrl: function (widAttr, filter) { + var line = { + input: '' + }; + var that = this; + + if ($.fm) { + line.button = { + icon: 'ui-icon-note', + text: false, + title: _('Select image'), + click: function (/*event*/) { + var wdata = $(this).data('wdata'); + var defPath = ('/' + (that.conn.namespace ? that.conn.namespace + '/' : '') + that.projectPrefix + 'img/'); + + var current = that.widgets[wdata.widgets[0]].data[wdata.attr]; + //workaround, that some widgets calling direct the img/picure.png without /vis/ + if (current && current.substring(0, 4) === 'img/') { + current = '/vis/' + current; + } + + $.fm({ + lang: that.language, + defaultPath: defPath, + path: current || defPath, + uploadDir: '/' + (that.conn.namespace ? that.conn.namespace + '/' : ''), + fileFilter: filter || ['gif', 'png', 'bmp', 'jpg', 'jpeg', 'tif', 'svg'], + folderFilter: false, + mode: 'open', + view: 'prev', + userArg: wdata, + conn: that.conn, + zindex: 1001 + }, function (_data, userData) { + var src = _data.path + _data.file; + $('#inspect_' + wdata.attr).val(src).trigger('change'); + }); + } + }; + } + return line; + }, + editCustom: function (widAttr, options) { + if (!options) { + console.log('No path to custom function'); + } else { + var funcs = options[0].split('.'); + options.unshift(); + if (funcs[0] === 'vis') funcs.unshift(); + if (funcs[0] === 'binds') funcs.unshift(); + if (funcs.length === 1) { + if (typeof this.binds[funcs[0]] === 'function') { + return this.binds[funcs[0]](widAttr, options); + } else { + console.log('No function: vis.binds.' + funcs.join('.')); + } + } else if (funcs.length === 2) { + if (this.binds[funcs[0]] && typeof this.binds[funcs[0]][funcs[1]] === 'function') { + return this.binds[funcs[0]][funcs[1]](widAttr, options); + } else { + console.log('No function: vis.binds.' + funcs.join('.')); + } + } else if (funcs.length === 3) { + if (this.binds[funcs[0]] && this.binds[funcs[0]][funcs[1]] && typeof this.binds[funcs[0]][funcs[1]][funcs[2]] === 'function') { + return this.binds[funcs[0]][funcs[1]][funcs[2]](widAttr, options); + } else { + console.log('No function: vis.binds.' + funcs.join('.')); + } + } else { + if (!funcs.length) { + console.log('Function name is too short: vis.binds'); + } else { + console.log('Function name is too long: vis.binds.' + funcs.join('.')); + } + } + return {}; + } + }, + editSlider: function (widAttr, options) { + options.min = (!options.min) ? 0 : options.min; + options.max = (!options.max) ? 0 : options.max; + options.step = (!options.step) ? (options.max - options.min) / 100 : options.step; + return { + input: '', + init: function (w, data) { + options.value = (data === undefined) ? options.min : data; + var input = this; + options.slide = function (event, ui) { + $(input).val(ui.value).trigger('change'); + }; + $('#inspect_' + widAttr + '_slider').slider(options); + }, + onchange: function (value) { + $('#inspect_' + widAttr + '_slider').slider('value', (value === undefined) ? options.min : value); + } + }; + }, + editEnableAbsolute: function () { + var val = $('#inspect_css_position').val(); + if (val === 'relative' || val === 'static' || val === 'sticky') { + // disable + $('#inspect_css_left').val('').prop('disabled', true); + $('#inspect_css_top').val('').prop('disabled', true); + $('#inspect_css_display').prop('disabled', false); + } else { + // enable + $('#inspect_css_left').prop('disabled', false); + $('#inspect_css_top').prop('disabled', false); + $('#inspect_css_display').val('').prop('disabled', true); + } + }, + editCssCommon: function (viewDiv, view) { + var that = this; + var group = 'css_common'; + this.groups[group] = this.groups[group] || {}; + + this.groups[group].css_position = this.editSelect('css_position', ['', /*'absolute', 'fixed',*/ 'relative', /*'static', */'sticky'], true, function () { + $(this).data('old-value', $(this).val()); + }, function () { + var val = $('#inspect_css_position').val(); + var oldVal = $(this).data('old-value'); + + if (val === 'relative' || val === 'static' || val === 'sticky') { + if (oldVal !== 'relative' && oldVal !== 'static' && oldVal !== 'sticky') { + $(this).data('old-value', val); + // disable + $('#inspect_css_display').prop('disabled', false); + $('#inspect_css_left').val('').prop('disabled', true).trigger('change'); + $('#inspect_css_top').val('').prop('disabled', true).trigger('change'); + setTimeout(function () { + for (var r = 0; r < that.activeWidgets.length; r++) { + that.reRenderWidgetEdit(viewDiv, view, that.activeWidgets[r]); + } + } , 100); + } + } else { + if (oldVal === 'relative' || oldVal === 'static' || oldVal === 'sticky') { + $(this).data('old-value', val); + // enable + $('#inspect_css_left').prop('disabled', false).val('0px').trigger('change'); + $('#inspect_css_top').prop('disabled', false).val('0px').trigger('change'); + $('#inspect_css_display').prop('disabled', true); + + setTimeout(function () { + for (var r = 0; r < that.activeWidgets.length; r++) { + that.reRenderWidgetEdit(viewDiv, view, that.activeWidgets[r]); + } + } , 100); + } + } + }); + this.groups[group].css_display = this.editSelect('css_display', ['', /*'inline', 'block', */'inline-block'/*, 'flex', 'list-item', 'run-in'*/], true, this.editEnableAbsolute); + + this.groups[group].css_left = {input: '', init: this.editEnableAbsolute}; + this.groups[group].css_top = {input: '', init: this.editEnableAbsolute}; + this.groups[group].css_width = {input: ''}; + this.groups[group].css_height = {input: ''}; + + this.groups[group]['css_z-index'] = this.editNumber('css_z-index'); + this.groups[group]['css_overflow-x'] = this.editSelect('css_overflow-x', ['', 'visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit'], true); + this.groups[group]['css_overflow-y'] = this.editSelect('css_overflow-y', ['', 'visible', 'hidden', 'scroll', 'auto', 'initial', 'inherit'], true); + this.groups[group].css_opacity = {input: ''}; + this.groups[group].css_cursor = this.editAutoComplete('css_cursor', ['', 'pointer', 'auto', 'alias', 'all-scroll', 'cell', 'context-menu', 'col-resize', 'copy', 'crosshair', 'default', 'e-resize', 'ew-resize', 'grab', 'grabbing', 'help', 'move', 'n-resize', 'ne-resize', 'nesw-resize', 'ns-resize', 'nw-resize', 'nwse-resize', 'no-drop', 'none', 'not-allowed', 'progress', 'row-resize', 's-resize', 'se-resize', 'sw-resize', 'text', 'vertical-text', 'w-resize', 'wait', 'zoom-in', 'zoom-out', 'initial', 'inherit']); + this.groups[group].css_transform = {input: ''}; + + for (var attr in this.groups[group]) { + if (!this.groups[group].hasOwnProperty(attr)) continue; + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editCssFontText: function () { + var group = 'css_font_text'; + this.groups[group] = this.groups[group] || {}; + + this.groups[group].css_color = this.editColor('css_color'); + this.groups[group]['css_text-align'] = this.editSelect('css_text-align', ['', 'left', 'right', 'center' ,'justify', 'initial', 'inherit'], true); + this.groups[group]['css_text-shadow'] = {input: ''}; + this.groups[group]['css_font-family'] = this.editFontName('css_font-family'); + this.groups[group]['css_font-style'] = this.editSelect('css_font-style', ['', 'normal', 'italic', 'oblique', 'initial', 'inherit'], true); + this.groups[group]['css_font-variant'] = this.editSelect('css_font-variant', ['', 'normal', 'small-caps', 'initial', 'inherit'], true); + this.groups[group]['css_font-weight'] = this.editAutoComplete('css_font-weight', ['', 'normal', 'bold', 'bolder', 'lighter', 'initial', 'inherit']); + this.groups[group]['css_font-size'] = this.editAutoComplete('css_font-size', ['', 'medium', 'xx-small', 'x-small', 'small', 'large', 'x-large', 'xx-large', 'smaller', 'larger', 'initial', 'inherit']); + this.groups[group]['css_line-height'] = {input: ''}; + this.groups[group]['css_letter-spacing'] = {input: ''}; + this.groups[group]['css_word-spacing'] = {input: ''}; + + for(var attr in this.groups[group]) { + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editCssBackground: function () { + var group = 'css_background'; + this.groups[group] = this.groups[group] || {}; + + this.groups[group].css_background = {input: ''}; + this.groups[group]['css_background-color'] = this.editColor('css_background-color'); + this.groups[group]['css_background-image'] = {input: ''}; + this.groups[group]['css_background-repeat'] = this.editSelect('css_background-repeat', ['', 'repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'], true); + this.groups[group]['css_background-attachment'] = this.editSelect('css_background-attachment', ['', 'scroll', 'fixed', 'local', 'initial', 'inherit'], true); + this.groups[group]['css_background-position'] = {input: ''}; + this.groups[group]['css_background-size'] = {input: ''}; + this.groups[group]['css_background-clip'] = this.editSelect('css_background-clip', ['', 'border-box', 'padding-box', 'content-box', 'initial', 'inherit'], true); + this.groups[group]['css_background-origin'] = this.editSelect('css_background-origin', ['', 'padding-box', 'border-box', 'content-box', 'initial', 'inherit'], true); + + for(var attr in this.groups[group]) { + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editDimensionOnChangeHelper: function (elem, value) { + if (value && typeof value !== 'object') { + var e = value.substring(value.length - 2); + if (e !== 'px' && e !== 'em' && value[value.length - 1] !== '%') { + var wdata = $(elem).data('wdata'); + for (var t = 0; t < wdata.widgets.length; t++) { + this.views[wdata.view].widgets[wdata.widgets[t]].style[wdata.attr.substring(4)] = value + 'px'; + $('#' + wdata.widgets[t]).css(wdata.attr.substring(4), value + 'px'); + } + } + } + }, + editCssBorder: function () { + var group = 'css_border'; + var that = this; + this.groups[group] = this.groups[group] || {}; + + this.groups[group]['css_border-width'] = { + input: '', + onchange: function (value) { + that.editDimensionOnChangeHelper(this, value); + } + }; + this.groups[group]['css_border-style'] = this.editAutoComplete('css_border-style', ['', 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial', 'inherit']); + this.groups[group]['css_border-color'] = this.editColor('css_border-color'); + this.groups[group]['css_border-radius'] = { + input: '', + onchange: function (value) { + that.editDimensionOnChangeHelper(this, value); + } + }; + + for(var attr in this.groups[group]) { + if (!this.groups[group].hasOwnProperty(attr)) continue; + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editCssShadowPadding: function () { + var group = 'css_shadow_padding'; + this.groups[group] = this.groups[group] || {}; + + this.groups[group].css_padding = {input: ''}; + this.groups[group]['css_padding-left'] = {input: ''}; + this.groups[group]['css_padding-top'] = {input: ''}; + this.groups[group]['css_padding-right'] = {input: ''}; + this.groups[group]['css_padding-bottom'] = {input: ''}; + this.groups[group]['css_box-shadow'] = {input: ''}; + this.groups[group]['css_margin-left'] = {input: ''}; + this.groups[group]['css_margin-top'] = {input: ''}; + this.groups[group]['css_margin-right'] = {input: ''}; + this.groups[group]['css_margin-bottom'] = {input: ''}; + + for(var attr in this.groups[group]) { + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editCssAnimation: function () { + var group = 'css_animation'; + this.groups[group] = this.groups[group] || {}; + + this.groups[group]['css_animation-name'] = {input: ''}; + this.groups[group]['css_animation-duration'] = {input: ''}; + + for(var attr in this.groups[group]) { + this.groups[group][attr].css = true; + this.groups[group][attr].attrName = attr; + this.groups[group][attr].attrIndex = ''; + } + }, + editSignalIcons: function () { + var group = 'signals'; + this.groups[group] = this.groups[group] || {}; + var i = 0; + for (var i = 0; i < 3; i++) { + // oid + this.addToInspect(this.activeWidgets, {name: 'signals-oid-' + i, type: 'id'}, group); + // condition + this.addToInspect(this.activeWidgets, {name: 'signals-cond-' + i, type: 'select', options: ['==', '!=', '<=', '>=', '<', '>', 'consist', 'not consist', 'exist', 'not exist'], default: '=='}, group); + // value + this.addToInspect(this.activeWidgets, {name: 'signals-val-' + i, default: true}, group); + + // icon path + this.addToInspect(this.activeWidgets, {name: 'signals-icon-' + i, type: 'image', default: '/vis/signals/lowbattery.png'}, group); + // icon size in px + this.addToInspect(this.activeWidgets, {name: 'signals-icon-size-' + i, type: 'slider', options: {min: 1, max: 120, step: 1}, default: 0}, group); + // icon style + this.addToInspect(this.activeWidgets, {name: 'signals-icon-style-' + i}, group); + + // icon text + this.addToInspect(this.activeWidgets, {name: 'signals-text-' + i}, group); + // text style + this.addToInspect(this.activeWidgets, {name: 'signals-text-style-' + i}, group); + // text class + this.addToInspect(this.activeWidgets, {name: 'signals-text-class-' + i}, group); + // blink + this.addToInspect(this.activeWidgets, {name: 'signals-blink-' + i, type: 'checkbox', default: false}, group); + + + // icon position vertical + this.addToInspect(this.activeWidgets, {name: 'signals-horz-' + i, type: 'slider', options: {min: -20, max: 120, step: 1}, default: 0}, group); + // icon position horizontal + this.addToInspect(this.activeWidgets, {name: 'signals-vert-' + i, type: 'slider', options: {min: -20, max: 120, step: 1}, default: 0}, group); + + // icon hide by edit + this.addToInspect(this.activeWidgets, {name: 'signals-hide-edit-' + i, type: 'checkbox', default: false}, group); + + if (i < 2) this.addToInspect('delimiterInGroup', group); + } + + }, + editLastChange: function () { + var group = 'last_change'; + this.groups[group] = this.groups[group] || {}; + // oid + this.addToInspect(this.activeWidgets, {name: 'lc-oid', type: 'id'}, group); + // type (or timestamp) + this.addToInspect(this.activeWidgets, {name: 'lc-type', type: 'select', options: ['last-change', 'timestamp'], default: 'last-change'}, group); + // is interval + this.addToInspect(this.activeWidgets, {name: 'lc-is-interval', type: 'checkbox', default: true}, group); + // is moment.js + this.addToInspect(this.activeWidgets, {name: 'lc-is-moment', type: 'checkbox', default: false}, group); + // format + this.addToInspect(this.activeWidgets, {name: 'lc-format', type: 'auto', options: ['YYYY.MM.DD hh:mm:ss','DD.MM.YYYY hh:mm:ss','YYYY.MM.DD','DD.MM.YYYY','YYYY/MM/DD hh:mm:ss','YYYY/MM/DD','hh:mm:ss'], default: ''}, group); + // position vertical + this.addToInspect(this.activeWidgets, {name: 'lc-position-vert', type: 'select', options: ['top', 'middle', 'bottom'], default: 'top'}, group); + // position horizontal + this.addToInspect(this.activeWidgets, {name: 'lc-position-horz', type: 'select', options: ['left', /*'middle', */'right'], default: 'right'}, group); + // offset vertical + this.addToInspect(this.activeWidgets, {name: 'lc-offset-vert', type: 'slider', options: {min: -120, max: 120, step: 1}, default: 0}, group); + // offset horizontal + this.addToInspect(this.activeWidgets, {name: 'lc-offset-horz', type: 'slider', options: {min: -120, max: 120, step: 1}, default: 0}, group); + + this.addToInspect('delimiterInGroup', group); + + // font-size + this.addToInspect(this.activeWidgets, {name: 'lc-font-size', type: 'auto', options: ['', 'medium', 'xx-small', 'x-small', 'small', 'large', 'x-large', 'xx-large', 'smaller', 'larger', 'initial', 'inherit'], default: '12px'}, group); + // font-family + this.addToInspect(this.activeWidgets, {name: 'lc-font-family', type: 'fontname', default: ''}, group); + // font-style + this.addToInspect(this.activeWidgets, {name: 'lc-font-style', type: 'auto', options: ['', 'normal', 'italic', 'oblique', 'initial', 'inherit'], default: ''}, group); + // background-color + this.addToInspect(this.activeWidgets, {name: 'lc-bkg-color', type: 'color', default: ''}, group); + // color + this.addToInspect(this.activeWidgets, {name: 'lc-color', type: 'color', default: ''}, group); + + // border-width + this.addToInspect(this.activeWidgets, {name: 'lc-border-width', default: '0'}, group); + // border-style + this.addToInspect(this.activeWidgets, {name: 'lc-border-style', type: 'auto', options: ['', 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial', 'inherit'], default: ''}, group); + // border-color + this.addToInspect(this.activeWidgets, {name: 'lc-border-color', type: 'color', default: ''}, group); + // border-radius + this.addToInspect(this.activeWidgets, {name: 'lc-border-radius', type: 'slider', options: {min: 0, max: 20, step: 1}, default: 10}, group); + // padding + this.addToInspect(this.activeWidgets, {name: 'lc-padding'}, group); + // z-index + this.addToInspect(this.activeWidgets, {name: 'lc-zindex', type: 'slider', options: {min: -10, max: 20, step: 1}, default: 0}, group); + }, + editGestures: function (view) { + var group = 'gestures'; + this.groups[group] = this.groups[group] || {}; + var gesturesAnalog = ['swiping', 'rotating', 'pinching']; + var gestures = ['swipeRight', 'swipeLeft', 'swipeUp', 'swipeDown', 'rotateLeft', 'rotateRight', 'pinchIn', 'pinchOut']; + + this.addToInspect(this.activeWidgets, {name: 'gestures-indicator', type: 'auto', options: this.getWidgetIds(view, 'tplValueGesture')}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-offsetX', default: 0, type: 'number'}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-offsetY', default: 0, type: 'number'}, group); + this.addToInspect('delimiterInGroup', group); + var j; + var gesture; + for (j = 0; j < gesturesAnalog.length; j++) { + gesture = gesturesAnalog[j]; + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-oid', type: 'id'}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-value', default: ''}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-minimum', type: 'number'}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-maximum', type: 'number'}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-delta', type: 'number'}, group); + this.addToInspect('delimiterInGroup', group); + } + + for (j = 0; j < gestures.length; j++) { + gesture = gestures[j]; + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-oid', type: 'id'}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-value', default: ''}, group); + this.addToInspect(this.activeWidgets, {name: 'gestures-' + gesture + '-limit', type: 'number'}, group); + if (j < gestures.length - 1) this.addToInspect('delimiterInGroup', group); + } + var that = this; + // install handlers + setTimeout(function () { + for (var j = 0; j < gesturesAnalog.length; j++) { + gesture = gesturesAnalog[j]; + $('#inspect_gestures-' + gesture + '-oid').change(function () { + var id = $(this).attr('id'); + var val = $(this).val(); + var g = id.split('-'); + + if (that.objects[val] && that.objects[val].common) { + if (that.objects[val].common.min !== undefined) { + var $min = $('#inspect_gestures-' + g[1] + '-minimum'); + if ($min.val() === '') { + $min.val(that.objects[val].common.min); + } + } + if (that.objects[val].common.max !== undefined) { + var $max = $('#inspect_gestures-' + g[1] + '-maximum'); + if ($max.val() === '') { + $max.val(that.objects[val].common.max); + } + } + } + }).keyup(function () { + $(this).trigger('change'); + }); + } + }, 300); + }, + editText: function (widAttr) { + var that = this; + var line = { + input: '' + }; + + line.button = { + icon: 'ui-icon-note', + text: false, + title: _('Select color'), + click: function (/*event*/) { + var wdata = $(this).data('wdata'); + var data = {}; + if (that.config['dialog-edit-text']) { + data = JSON.parse(that.config['dialog-edit-text']); + } + var editor = ace.edit('dialog-edit-text-textarea'); + var changed = false; + $('#dialog-edit-text').dialog({ + autoOpen: true, + width: data.width || 800, + height: data.height || 600, + modal: true, + resize: function () { + editor.resize(); + }, + open: function (event) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $(this).parent().css({'z-index': 1000}); + if (data.top !== undefined) { + if (data.top >= 0) { + $(this).parent().css({top: data.top}); + } else { + $(this).parent().css({top: 0}); + } + } + if (data.left !== undefined) { + if (data.left >= 0) { + $(this).parent().css({left: data.left}); + } else { + $(this).parent().css({left: 0}); + } + } + editor.getSession().setMode('ace/mode/html'); + editor.setOptions({ + enableBasicAutocompletion: true, + enableLiveAutocompletion: true + }); + editor.$blockScrolling = Infinity; + editor.getSession().setUseWrapMode(true); + editor.setValue($('#inspect_' + wdata.attr).val()); + editor.navigateFileEnd(); + editor.focus(); + editor.getSession().on('change', function() { + changed = true; + }); + }, + beforeClose: function () { + var $parent = $('#dialog-edit-text').parent(); + var pos = $parent.position(); + that.editSaveConfig('dialog-edit-text', JSON.stringify({ + top: pos.top > 0 ? pos.top : 0, + left: pos.left > 0 ? pos.left : 0, + width: $parent.width(), + height: $parent.height() + 9 + })); + + if (changed) { + if (!window.confirm(_('Changes are not saved!. Continue?'))) { + return false; + } + } + }, + buttons: [ + { + text: _('Ok'), + click: function () { + $('#inspect_' + wdata.attr).val(editor.getValue()).trigger('change'); + changed = false; + $(this).dialog('close'); + } + }, + { + text: _('Cancel'), + click: function () { + $(this).dialog('close'); + } + } + ] + }).show(); + } + }; + return line; + }, + // add font name to font selector (used in adapters, eg. vis-google-fonts + addFont: function (fontName) { + if (this.fontNames.indexOf(fontName) === -1) this.fontNames.push(fontName); + }, + // find states with requested roles of device + findByRoles: function (stateId, roles) { + if (typeof roles !== 'object') { + roles = [roles]; + } else { + roles = JSON.parse(JSON.stringify(roles)); + } + var result = {}; + // try to detect other values + + // Go trough all channels of this device + var parts = stateId.split('.'); + parts.pop(); // remove state + var channel = parts.join('.'); + var reg = new RegExp('^' + channel.replace(/\./g, '\\.') + '\\.'); + + // channels + for (var id in this.objects) { + if (reg.test(id) && + this.objects[id].common && + this.objects[id].type === 'state') { + for (var r = 0; r < roles.length; r++) { + if (this.objects[id].common.role === roles[r]) { + result[roles[r]] = id; + roles.splice(r, 1); + break; + } + if (!roles.length) break; + } + } + } + // try to search in channels + if (roles.length) { + parts.pop(); // remove channel + var device = parts.join('.'); + var reg = new RegExp("^" + device.replace(/\./g, '\\.') + '\\.'); + for (var id in this.objects) { + if (reg.test(id) && + this.objects[id].common && + this.objects[id].type === 'state') { + + for (var r = 0; r < roles.length; r++) { + if (this.objects[id].common.role === roles[r]) { + result[roles[r]] = id; + roles.splice(r, 1); + break; + } + } + if (!roles.length) break; + } + } + } + return result; + }, + findByName: function (stateId, objName) { + // try to detect other values + + // Go trough all channels of this device + var parts = stateId.split('.'); + parts.pop(); // remove state + var channel = parts.join('.'); + + // check same channel + var id = channel + '.' + objName; + if ((id in this.objects) && + this.objects[id].common && + this.objects[id].type === 'state') { + + return id; + } + + // try to search in channels + parts.pop(); // remove channel + var device = parts.join('.'); + var reg = new RegExp('^' + device.replace(/\./g, '\\.') + '\\.' + '.*\\.' + objName); + for (var id in this.objects) { + if (reg.test(id) && + this.objects[id].common && + this.objects[id].type === 'state') { + + return id; + } + } + return false; + }, + hideShowAttr: function (widAttr, isShow) { + if (isShow) { + $('#td_' + widAttr).show(); + } else { + $('#td_' + widAttr).hide(); + } + }, + addToInspect: function (widgets, widAttr, group, options, onchange) { + if (widgets === 'delimiter') { + this.groups[widAttr || group] = this.groups[widAttr || group] || {}; + var d = 0; + while (this.groups[widAttr || group]['delimiter' + d]) d++; + this.groups[widAttr || group]['delimiter' + d] = 'delimiter'; + return; + } + if (widgets === 'delimiterInGroup') { + this.groups[widAttr || group] = this.groups[widAttr || group] || {}; + var d = 0; + while (this.groups[widAttr || group]['delimiterInGroup' + d]) d++; + this.groups[widAttr || group]['delimiterInGroup' + d] = 'delimiterInGroup'; + return; + } + if (typeof widAttr !== 'object') { + widAttr = {name: widAttr}; + } + if (widAttr.clearName === undefined) widAttr.clearName = widAttr.name; + if (widAttr.index === undefined) widAttr.index = ''; + + if (typeof group === 'function') { + onchange = group; + group = null; + } + if (typeof options === 'function') { + onchange = options; + options = null; + } + + options = options || {}; + + var input; + var line; + // set default value if attr is empty + if (widAttr.default !== undefined) { + for (var i = 0; i < widgets.length; i++) { + var view = this.getViewOfWidget(widgets[i]); + var widgetData = this.views[view].widgets[widgets[i]].data; + + if (widgetData && (widgetData[widAttr.name] === null || widgetData[widAttr.name] === undefined) && !widAttr.name.match(/^gestures-/)) { + widgetData[widAttr.name] = widAttr.default; + this.reRenderList = this.reRenderList || []; + if (this.reRenderList.indexOf(widgets[i]) === -1) { + this.reRenderList.push(widgets[i]); + } + } + } + } else if (widAttr.name === 'lc-oid' && widgets.length === 1) { + var _view = this.getViewOfWidget(widgets[0]); + var _widgetData = this.views[_view].widgets[widgets[0]].data; + if (!_widgetData['lc-oid'] && _widgetData['g_last_change']) { + // find any oid value + for (var a in _widgetData) { + if (_widgetData.hasOwnProperty(a) && a.match(/^oid|oid$/)) { + if (_widgetData[a] && _widgetData[a] !== 'nothing_selected') { + _widgetData['lc-oid'] = _widgetData[a]; + } + break; + } + } + + } + } + + // Depends on attribute type + switch (widAttr.type) { + case 'id': + line = this.editObjectID(widAttr.name, widAttr.options, false, widAttr.onChangeWidget); + break; + case 'hid': + case 'history-id': + line = this.editObjectID(widAttr.name, widAttr.options, true, widAttr.onChangeWidget); + break; + case 'checkbox': + // All other attributes + line = ''; + break; + case 'select-views': + line = ''; + break; + case 'groups': + line = ''; + break; + case 'color': + line = this.editColor(widAttr.name); + break; + case 'class': + line = this.editClass(widAttr.name); + break; + case 'text': + line = this.editText(widAttr.name); + break; + case 'html': + line = this.editText(widAttr.name); + break; + case 'number': + line = this.editNumber(widAttr.name, widAttr.options); + break; + case 'button': + line = this.editButton(widAttr.name, widAttr.options); + break; + case 'auto': + line = this.editAutoComplete(widAttr.name, widAttr.options); + break; + case 'slider': + line = this.editSlider(widAttr.name, widAttr.options); + break; + case 'views': + line = this.editViewName(widAttr.name); + break; + case 'filters': + line = this.editFilterName(widAttr.name); + break; + case 'custom': + line = this.editCustom(widAttr.name, widAttr.options); + break; + case 'image': + line = this.editUrl(widAttr.name); + break; + case 'sound': + line = this.editUrl(widAttr.name, ['mp3', 'wav', 'ogg']); + break; + case 'select': + line = this.editSelect(widAttr.name, widAttr.options, widAttr.notTranslate); + break; + case 'style': + line = this.editStyle(widAttr.name, widAttr.options); + break; + case 'effect': + line = this.editEffect(widAttr.name); + break; + case 'widget': + line = this.editWidgetNames(widAttr.name, widAttr.options); + break; + case 'effect-options': + var _opts = {}; + _opts[_('left')] = 'left'; + _opts[_('right')] = 'right'; + _opts[_('top')] = 'top'; + _opts[_('bottom')] = 'bottom'; + line = this.editSelect(widAttr.name, _opts); + break; + case 'hidden': + return; + case 'fontname': + line = this.editFontName(widAttr.name); + break; + case 'history': + line = this.editHistoryInstance(widAttr.name); + break; + default: + line = ''; + } + + if (typeof line === 'string') line = {input: line}; + + if (line[0]) { + line[0].attrName = widAttr.clearName; + line[0].attrIndex = widAttr.index; + line[0].type = widAttr.type; + line[0].onChangeWidget = widAttr.onChangeWidget; + if (widAttr.title) line[0].attrTitle = widAttr.title; + if (widAttr.depends && widAttr.depends.length) line[0].depends = widAttr.depends; + } else { + line.attrName = widAttr.clearName; + line.attrIndex = widAttr.index; + line.type = widAttr.type; + line.onChangeWidget = widAttr.onChangeWidget; + if (widAttr.title) line.attrTitle = widAttr.title; + if (widAttr.depends && widAttr.depends.length) line.depends = widAttr.depends; + } + + // + this.groups[group] = this.groups[group] || {}; + this.groups[group][widAttr.name] = line; + }, + // Render edit panel + showInspect: function (viewDiv, view, widgets) { + var $widgetAttrs = $('#widget_attrs'); + var that = this; + var depends = []; + var values = {}; + var widAttr; + for (var group in this.groups) { + if (!this.groups.hasOwnProperty(group)) continue; + if (this.groupsState[group] === undefined) this.groupsState[group] = false; + + var groupName = group; + if (groupName.indexOf('_§') !== -1) { + var m = groupName.match(/^([\w_]+)_§([0-9]+)/); + groupName = _('group_' + m[1]) + '[' + m[2] + ']'; + } else { + groupName = _('group_' + group); + } +// $widgetAttrs.append(''); + var gText = ''; + } else { + gText += ''; + } + if (isGroupEnabled) { + gText += ''; + } else { + gText += ''; + } + $widgetAttrs.append(gText); + + if (isGroupEnabled) { + for (widAttr in this.groups[group]) { + if (!this.groups[group].hasOwnProperty(widAttr) || widAttr === '___enabled') continue; + + var line = this.groups[group][widAttr]; + if (line === 'delimiter') { + $widgetAttrs.append(''); + continue; + } + if (line === 'delimiterInGroup') { + $widgetAttrs.append(''); + continue; + } + if (line[0]) line = line[0]; + if (typeof line === 'string') line = {input: line}; + + var title = line.attrTitle; + + title = title || _(widAttr + '_tooltip'); + var icon; + if (title === widAttr + '_tooltip') { + title = ''; + icon = ''; + } else { + icon = '
    '; + } + + var text = '
    '; + } else { + text += ''; + } + } + if (line.css) { + text += ''; + } + + text += ''; + + $widgetAttrs.append(text); + + // Init button + if (line.button) { + // If init function specified => call it + if (typeof line.button.code === 'function') { + line.button.code(line.button); + } else { + // init button + var $btn = $widgetAttrs.find('#inspect_' + widAttr + '_btn').button({ + text: line.button.text || false, + icons: { + primary: line.button.icon || '' + } + }).css({width: line.button.width || 22, height: line.button.height || 22}); + if (line.button.click) $btn.click(line.button.click); + if (line.button.data) $btn.data('data-custom', line.button.data); + + $btn.data('wdata', { + attr: widAttr, + widgets: widgets, + view: view + }); + } + } + + // Init value + var $input = $widgetAttrs.find('#inspect_' + widAttr); + + if ($input.attr('type') === 'text' || $input.prop('tagName') === 'TEXTAREA') { + if (!$input.hasClass('vis-edit-textbox-with-button')){ + $input.addClass('vis-edit-textbox'); + } + } + + // Set the value + this.setAttrValue(view, this.activeWidgets, widAttr, line.css, values); + + var wdata = { + attr: widAttr, + widgets: widgets, + view: view, + type: line.type, + css: line.css, + onChangeWidget: line.onChangeWidget + }; + if (line.onchange) wdata.onchange = line.onchange; + + $input.addClass('vis-inspect-widget'); + $input.data('wdata', wdata); + + if (this.groups[group][widAttr][0]) { + for (var i = 1; i < this.groups[group][widAttr].length; i++) { + text = ''; + $widgetAttrs.append(text); + } + } + // Collect list of attribute names on which depends other attributes + if (line.depends) { + for (var u = 0; u < line.depends.length; u++) { + if (depends.indexOf(line.depends[u]) === -1) depends.push(line.depends[u]); + } + } + } + // Hide elements + if (!this.groupsState[group]) $widgetAttrs.find('.group-' + group).hide(); + } + } + + $('.vis-edit-percent-calc').each(function () { + var attr = $(this).data('attr'); + var val = $('#inspect_css_' + attr).val(); + + if (val.toString().indexOf('%') === -1) { + $(this).html('px'); + } else { + $(this).html('%'); + } + + $(this).button().css({width: 18, height: 18}).click(function () { + var attr = $(this).data('attr'); + var $input = $('#inspect_css_' + attr); + var val = $input.val(); + if (val.toString().indexOf('%') === -1) { + // convert to % + for (var i = 0; i < that.activeWidgets.length; i++) { + var rect = that.editConvertToPercent(viewDiv, view, that.activeWidgets[i], viewDiv !== view ? viewDiv : null); + that.views[view].widgets[that.activeWidgets[i]].style[attr] = rect[attr]; + $('#' + that.activeWidgets[i]).css(attr, rect[attr]); + } + that.setAttrValue(view, that.activeWidgets, 'css_' + attr, true, {}); + $(this).html('%'); + } else { + // convert to px + for (var j = 0; j < that.activeWidgets.length; j++) { + var pRect = that.editConvertToPx(viewDiv, view, that.activeWidgets[j], viewDiv !== view ? viewDiv : null); + that.views[view].widgets[that.activeWidgets[j]].style[attr] = pRect[attr]; + $('#' + that.activeWidgets[j]).css(attr, pRect[attr]); + } + that.setAttrValue(view, that.activeWidgets, 'css_' + attr, true, {}); + $(this).html('px'); + } + }); + }); + + // Init all elements together + for (group in this.groups) { + if (!this.groups.hasOwnProperty(group) || !this.groups[group].___enabled) continue; + for (widAttr in this.groups[group]) { + var line_ = this.groups[group][widAttr]; + var $input_ = $widgetAttrs.find('#inspect_' + widAttr); + var wdata_ = $input_.data('wdata'); + if (depends.length) $input_.data('depends', depends); + + if (line_[0]) line_ = line_[0]; + if (typeof line_ === 'string') line_ = {input: line_}; + if (typeof line_.init === 'function') { + if (wdata_.css) { + var cwidAttr_ = widAttr.substring(4); + if (values[cwidAttr_] === undefined) values[cwidAttr_] = this.findCommonValue(view, widgets, cwidAttr_); + line_.init.call($input_[0], cwidAttr_, values[cwidAttr_]); + } else { + if (values[widAttr] === undefined) values[widAttr] = this.findCommonValue(view, widgets, widAttr); + line_.init.call($input_[0], widAttr, values[widAttr]); + } + } + // Call on change + if (typeof line_.onchange === 'function') { + if (wdata_.css) { + var cwidAttr = widAttr.substring(4); + if (values[cwidAttr] === undefined) values[cwidAttr] = this.findCommonValue(view, widgets, cwidAttr); + line_.onchange.call($input_[0], values[cwidAttr]); + } else { + if (values[widAttr] === undefined) values[widAttr] = this.findCommonValue(view, widgets, widAttr); + line_.onchange.call($input_[0], values[widAttr]); + } + } + } + } + this.initStealHandlers(); + + $widgetAttrs.find('.vis-inspect-widget').change(function () { + var $this = $(this); + var wdata = $this.data('wdata'); + var depends = $this.data('depends'); + var diff = $this.data('different'); + var oldValue = null; + + // Set flag, that value was modified + if (diff) $this.data('different', false).removeClass('vis-edit-different'); + var css = wdata.attr.substring(4); + var val = ($this.attr('type') === 'checkbox') ? $this.prop('checked') : $this.val(); + + for (var i = 0; i < wdata.widgets.length; i++) { + if (wdata.css) { + if (!that.views[wdata.view].widgets[wdata.widgets[i]].style) { + that.views[wdata.view].widgets[wdata.widgets[i]].style = {}; + } + oldValue = that.views[wdata.view].widgets[wdata.widgets[i]].style[css]; + that.views[wdata.view].widgets[wdata.widgets[i]].style[css] = val; + if (css !== 'transform') { + var $widget = $('#' + wdata.widgets[i]); + if (val !== '' && (css === 'left' || css === 'top') && + (val.indexOf('%') === -1 && val.indexOf('px') === -1 && val.indexOf('em') === -1)) { + $widget.css(css, val + 'px'); + } else { + $widget.css(css, val); + } + } + + if (that.activeWidgets.indexOf(wdata.widgets[i]) !== -1) { + that.showWidgetHelper(viewDiv, view, wdata.widgets[i], true); + } + + if ($('#' + that.views[wdata.view].widgets[wdata.widgets[i]].tpl).attr('data-vis-update-style')) { + that.reRenderWidgetEdit(viewDiv, view, wdata.widgets[i]); + } + } else { + oldValue = that.widgets[wdata.widgets[i]].data[wdata.attr]; + that.views[wdata.view].widgets[wdata.widgets[i]].data[wdata.attr] = that.widgets[wdata.widgets[i]].data[wdata.attr] = val; + } + + // Some user adds ui-draggable and ui-resizable as class to widget. + // The result is DashUI tries to remove draggable and resizable properties and fails + if (wdata.attr === 'class') { + var _val_ = that.views[wdata.view].widgets[wdata.widgets[i]].data[wdata.attr]; + if (_val_.indexOf('ui-draggable') !== -1 || _val_.indexOf('ui-resizable') !== -1) { + var vals = _val_.split(' '); + _val_ = ''; + for (var j = 0; j < vals.length; j++) { + if (vals[j] && vals[j] !== 'ui-draggable' && vals[j] !== 'ui-resizable') { + _val_ += ((_val_) ? ' ' : '') + vals[j]; + } + } + that.views[wdata.view].widgets[wdata.widgets[i]].data[wdata.attr] = _val_; + $this.val(_val_); + } + } + + // Update select widget dropdown + if (wdata.attr === 'name') { + that.$selectActiveWidgets.find('option[value="' + wdata.widgets[i] + '"]').text(that.getWidgetName(wdata.view, wdata.widgets[i])); + that.sortSelectWidget(); + that.$selectActiveWidgets.multiselect('refresh'); + } + + var changed = false; + if (typeof wdata.onchange === 'function') { + if (wdata.css) { + var _css = wdata.attr.substring(4); + changed = wdata.onchange.call(this, that.views[wdata.view].widgets[wdata.widgets[i]].style[_css], oldValue) || false; + } else { + changed = wdata.onchange.call(this, that.widgets[wdata.widgets[i]].data[wdata.attr], oldValue) || false; + } + } + + if (wdata.onChangeWidget) { + var widgetSet = $('#' + that.views[wdata.view].widgets[wdata.widgets[i]].tpl).attr('data-vis-set'); + if (that.binds[widgetSet] && that.binds[widgetSet][wdata.onChangeWidget]) { + var _changed; + if (wdata.css) { + var __css = wdata.attr.substring(4); + _changed = that.binds[widgetSet][wdata.onChangeWidget](wdata.widgets[i], wdata.view, that.views[wdata.view].widgets[wdata.widgets[i]].style[__css], __css, true, oldValue); + } else { + _changed = that.binds[widgetSet][wdata.onChangeWidget](wdata.widgets[i], wdata.view, that.widgets[wdata.widgets[i]].data[wdata.attr], wdata.attr, false, oldValue); + } + if (!changed) changed = _changed; + } + } + + that.save(viewDiv, view); + if (!wdata.css) that.reRenderWidgetEdit(viewDiv, view, wdata.widgets[i]); + + // Rebuild attr list + if (changed || (depends && depends.indexOf(wdata.attr) !== -1)) that.inspectWidgets(viewDiv, view); + } + + //Update containers + if (wdata.type === 'views') { + // Set ths views for containers + that.updateContainers(wdata.view, wdata.view); + } + }); + + $widgetAttrs.find('.group-control').each(function () { + var group = $(this).attr('data-group'); + $(this).button({ + text: false, + icons: { + primary: that.groupsState[group] ? "ui-icon-triangle-1-n" : "ui-icon-triangle-1-s" + } + }).css({width: 22, height: 22}).click(function () { + var group = $(this).attr('data-group'); + that.groupsState[group] = !that.groupsState[group]; + $(this).button('option', { + icons: {primary: that.groupsState[group] ? "ui-icon-triangle-1-n" : "ui-icon-triangle-1-s"} + }); + if (that.groupsState[group]) { + $('.group-' + group).show(); + + if (that.widgetAccordeon) { + //close others + $('.group-control').each(function () { + var _group = $(this).attr('data-group'); + if (_group !== group && that.groupsState[_group]) { + that.groupsState[_group] = false; + $('.group-control[data-group="' + _group + '"]').button('option', {icons: {primary: "ui-icon-triangle-1-s"}}); + $('.group-' + _group).hide(); + } + }); + } + + } else { + $('.group-' + group).hide(); + } + that.editSaveConfig('groupsState', that.groupsState); + }); + }); + + function deleteAttrs(group, widgets, viewDiv, view, value) { + var isCss = group.substring(0, 4) === 'css_'; + + for (var i = 0; i < widgets.length; i++) { + if (!value) { + var cssChanged = false; + var $style; + if (isCss) $style = $('#' + wdata.widgets[i]).prop('style'); + + for (var attr in that.groups[group]) { + if (!that.groups[group].hasOwnProperty(attr)) continue; + if (isCss) { + if (that.views[view].widgets[widgets[i]].style) { + attr = attr.substring(4); + delete that.views[view].widgets[widgets[i]].style[attr]; + cssChanged = true; + $style.removeProperty(attr); + } + } else { + delete that.views[view].widgets[widgets[i]].data[attr]; + } + } + + if (cssChanged && $('#' + that.views[view].widgets[widgets[i]].tpl).attr('data-vis-update-style')) { + that.reRenderWidgetEdit(viewDiv, view, widgets[i]); + } + } + that.widgets[widgets[i]].data['g_' + group] = value; + that.views[view].widgets[widgets[i]].data['g_' + group] = value; + } + that.save(viewDiv, view); + // Rebuild attr list + that.inspectWidgets(viewDiv, view); + } + + $widgetAttrs.find('.group-enable').change(function () { + var $this = $(this); + var group = $this.attr('data-group'); + var wdata = $this.data('wdata'); + var checked = $this.prop('checked'); + // Set flag, that value was modified + var isCss = group.substring(0, 4) === 'css_'; + var isEmpty = true; + if (!checked) { + // check all attributes in this group and if some are not empty, ask + for (var i = 0; i < wdata.widgets.length; i++) { + for (var attr in that.groups[group]) { + var val; + if (isCss) { + val = that.views[wdata.view].widgets[wdata.widgets[i]].style[attr.substring(4)]; + } else { + val = that.views[wdata.view].widgets[wdata.widgets[i]].data[attr]; + } + if (val !== undefined && val !== null && val !== '') { + isEmpty = false; + break; + } + } + if (!isEmpty) break; + } + + if (!isEmpty) { + vis.showMessage(_('Some field are not empty. Sure?'), _('Are you sure?'), 450, function (result) { + if (result) { + deleteAttrs(group, wdata.widgets, wdata.viewDiv, wdata.view, false); + } else { + $this.prop('checked', true); + } + }); + } else { + deleteAttrs(group, wdata.widgets, wdata.viewDiv, wdata.view, false); + } + } else { + deleteAttrs(group, wdata.widgets, wdata.viewDiv, wdata.view, true); + } + }).each(function() { + $(this).data('wdata', { + widgets: widgets, + view: view, + viewDiv: viewDiv + }); + if ($(this).data('indeterminate')) { + $(this).prop('indeterminate', true) + } + }); + }, + extractAttributes: function (_wid_attr, widget) { + + //returns array of all attributes with groups + /*var oneAttr = { + name: '', + type: '', + default: '', + options: '', + notTranslate: false, + depends: [] + } + Result: array of oneAttr + */ + + if (!this.regexAttr) this.regexAttr = /([a-zA-Z0-9._-]+)(\([a-zA-Z.0-9-_]*\))?(\[.*])?(\/[-_,^§~\s:\/\.a-zA-Z0-9]+)?/; + var match = this.regexAttr.exec(_wid_attr); + + var widAttr = match[1]; + var wid_repeats = match[2]; + var wid_default = match[3]; + var wid_type = match[4]; + var wid_on_change = null; + var wid_type_opt = null; + var notTranslate = false; + var index = ''; + var attrDepends = []; + + // remove / + if (wid_type) { + wid_type = wid_type.substring(1); + // extract on change function + var _parts = wid_type.split('/'); + wid_type = _parts[0]; + wid_on_change = _parts[1]; + + wid_type = wid_type.replace(/§/g, ';'); + wid_type = wid_type.replace(/~/g, '/'); + wid_type = wid_type.replace(/\^/g, '"'); + wid_type = wid_type.replace(/\^\^/g, '^'); + + parts = wid_type.split(','); + // extract min,max,step or select values + if (parts.length > 1) { + wid_type = parts.shift(); + wid_type_opt = parts; + } + } + // remove () + if (wid_repeats) { + wid_repeats = wid_repeats.substring(1, wid_repeats.length - 1); + var parts = wid_repeats.split('-', 2); + if (parts.length === 2) { + wid_repeats = { + start: parseInt(parts[0], 10), + end: parseInt(parts[1], 10) + }; + // If end is not number, it can be attribute + if (parts[1][0] < '0' || parts[1][0] > '9') { + var view = this.getViewOfWidget(widget); + var widgetData = this.views[view].widgets[widget].data; + wid_repeats.end = (widgetData[parts[1]] !== undefined) ? parseInt(widgetData[parts[1]], 10) : 1; + attrDepends.push(parts[1]); + } + + index = wid_repeats.start; + } else { + throw 'Invalid repeat argument: ' + wid_repeats; + } + } + // remove [] + if (wid_default) { + wid_default = wid_default.substring(1, wid_default.length - 1); + wid_default = wid_default.replace(/§/g, ';'); + wid_default = wid_default.replace(/~/g, '/'); + wid_default = wid_default.replace(/\^/g, '"'); + wid_default = wid_default.replace(/\^\^/g, '^'); + } else { + wid_default = undefined; + } + + if (widAttr === 'color') { + wid_type = 'color'; + } else if (widAttr === 'oid' || widAttr.match(/^oid-/)) { + wid_type = wid_type || 'id'; + } else if (widAttr.match(/nav_view$/)) { + wid_type = 'views'; + } else + /*if (widAttr.match(/src$/)) { + wid_type = 'image'; + } else*/ + if (widAttr === 'sound') { + wid_type = 'sound'; + } else if (widAttr.indexOf('_effect') !== -1) { + wid_type = 'effect'; + } else if (widAttr.indexOf('_eff_opt') !== -1) { + wid_type = 'effect-options'; + } + if (wid_type === 'nselect') { + wid_type = 'select'; + notTranslate = true; + } + + // Extract min, max, step for number and slider + if ((wid_type === 'number' || wid_type === 'slider') && wid_type_opt) { + var old = wid_type_opt; + wid_type_opt = {}; + if (old[0] !== undefined) { + wid_type_opt.min = parseFloat(old[0]); + if (old[1] !== undefined) { + wid_type_opt.max = parseFloat(old[1]); + if (old[2] !== undefined) { + wid_type_opt.step = parseFloat(old[2]); + } + } + } + } + var result = []; + do { + result.push({ + name: (widAttr + index), + type: wid_type, + default: wid_default, + options: wid_type_opt, + onChangeWidget: wid_on_change, + notTranslate: notTranslate, + depends: attrDepends, + clearName: widAttr, + index: index + }); + } while (wid_repeats && ((++index) <= wid_repeats.end)); + return result; + }, + findCommonAttributes: function (view, widgets) { + view = view || this.activeView; + var allWidgetsAttr = null; + for (var i = 0; i < widgets.length; i++) { + var widget = this.views[view].widgets[widgets[i]]; + + if (!widget) { + console.log('inspectWidget ' + widgets[i] + ' undefined'); + return []; + } + + if (!widget.tpl) return false; + + var $widgetTpl = $('#' + widget.tpl); + if (!$widgetTpl) { + console.log(widget.tpl + ' is not included'); + return []; + } + var widgetAttrs = $widgetTpl.attr('data-vis-attrs'); + // Combine attributes from data-vis-attrs, data-vis-attrs0, data-vis-attrs1, ... + var t = 0; + var attr; + while ((attr = $widgetTpl.attr('data-vis-attrs' + t))) { + widgetAttrs += attr; + t++; + } + if (widgetAttrs) { + widgetAttrs = widgetAttrs.split(';'); + } else { + widgetAttrs = []; + } + var group = 'common'; + var groupMode = 'normal'; + var attrs = {}; + for (var j = 0; j < widgetAttrs.length; j++) { + if (widgetAttrs[j].match(/^group\./)) { + group = widgetAttrs[j].substring('group.'.length); + // extract group mode + if (group.indexOf('/') !== -1) { + var parts = group.split('/'); + group = parts[0]; + groupMode = parts[1] || 'normal'; + // if icon + if (parts[2]) this.groupsIcons[group] = groupMode; + } else { + groupMode = 'normal'; + } + continue; + } + if (!widgetAttrs[j]) continue; + + var a = this.extractAttributes(widgetAttrs[j], widgets[i]); + if (groupMode === 'byindex') { + for (var k = 0; k < a.length; k++) { + attrs[group + '_§' + k] = attrs[group + '_§' + k] || {}; + attrs[group + '_§' + k][a[k].name] = a[k]; + } + } else { + attrs[group] = attrs[group] || {}; + for (var k = 0; k < a.length; k++) { + attrs[group][a[k].name] = a[k]; + } + } + } + + if (!allWidgetsAttr) { + allWidgetsAttr = attrs; + } else { + // Combine these too groups + for (group in allWidgetsAttr) { + if (!attrs[group]) delete allWidgetsAttr[group]; + } + for (group in attrs) { + if (!allWidgetsAttr[group]) delete attrs[group]; + } + for (group in allWidgetsAttr) { + for (var name in allWidgetsAttr[group]) { + if (!attrs[group][name]) delete allWidgetsAttr[group][name]; + } + for (name in attrs[group]) { + if (!allWidgetsAttr[group][name]) delete attrs[group][name]; + } + for (name in allWidgetsAttr[group]) { + var d1 = allWidgetsAttr[group][name].default; + delete allWidgetsAttr[group][name].default; + delete attrs[group][name].default; + if (JSON.stringify(allWidgetsAttr[group][name]) !== JSON.stringify(attrs[group][name])){ + delete allWidgetsAttr[group][name]; + } else { + allWidgetsAttr[group][name].default = d1; + } + } + } + } + } + + return allWidgetsAttr; + }, + // If only one widget, it returns the value + // If array of widgets, ot returns object {values, widgetValues}, where values are all found different values and widgetValues is array with values for every widget + findCommonValue: function (view, widgets, attr, isStyle) { + view = view || this.activeView; + var widgetValues = []; + var values = []; + for (var i = 0; i < widgets.length; i++) { + var widget = this.views[view].widgets[widgets[i]]; + var obj = isStyle ? widget.style : widget.data; + var val = (isStyle && (!obj || obj[attr] === undefined)) ? '' : (obj ? obj[attr] : ''); + + widgetValues[i] = val; + if (values.indexOf(val) === -1) values.push(val); + } + if (values.length === 1) { + return values[0]; + } else { + return { + values: values, + widgetValues: widgetValues + }; + } + }, + setAttrValue: function (view, widgets, attr, isStyle, values) { + var $input = $('#inspect_' + attr); + if (isStyle && attr.substring(0, 4) === 'css_') attr = attr.substring(4); + + if (values[attr] === undefined) values[attr] = this.findCommonValue(view, widgets, attr, isStyle); + if ($input.attr('type') === 'checkbox') { + if (typeof values[attr] === 'object') { + $input.prop('indeterminate', true); + } else { + $input.prop('checked', values[attr]); + } + } else { + if (typeof values[attr] === 'object') { + $input.addClass('vis-edit-different').val(_('--different--')).data('value', values[attr]).data('different', true); + $input.autocomplete({ + minLength: 0, + source: function (request, response) { + var data = $.grep(this.element.data('value').values, function (value) { + if (value === undefined || value === null) return false; + value = value.toString(); + return value.substring(0, request.term.length).toLowerCase() === request.term.toLowerCase(); + }); + response(data); + }, + select: function (event, ui) { + $(this).val(ui.item.value).trigger('change'); + }, + change: function (event, ui) { + //$(this).trigger('change'); + } + }).focus(function (event, ui) { + if ($(this).data('different')) { + $(this).val(''); + } + $(this).autocomplete('search', ''); + }).blur(function (event, ui) { + if ($(this).data('different')) { + $(this).val(_('--different--')).addClass('vis-edit-different'); + } + }); + } else { + $input.val(values[attr]); + } + } + $input.unbind('keyup').keyup(function () { + var $this = $(this); + var timer = $this.data('timer'); + if (timer) clearTimeout(timer); + + $this.data('timer', setTimeout(function () { + $this.data('timer', null); + $this.trigger('change'); + }, 500)); + }); + }, + inspectWidgets: function (viewDiv, view, addWidget, delWidget, onlyUpdate) { + if (this.isStealCss) return false; + var that = this; + + if (typeof viewDiv === 'object') { + addWidget = viewDiv; + viewDiv = this.activeViewDiv; + view = this.activeView; + } + + var oldView; + $('.vis-widget[data-zmodified="true"]').each(function () { + var wid = $(this).attr('id'); + + $(this).removeAttr('data-zmodified'); + + oldView = oldView || that.getViewOfWidget(wid); + + var zIndex = that.views[oldView].widgets[wid] && that.views[oldView].widgets[wid].style && that.views[oldView].widgets[wid].style['z-index']; + + if (!zIndex && zIndex !== '0' && zIndex !== 0) { + $(this).prop('style').removeProperty('z-index'); + } else { + $(this).css('z-index', zIndex); + } + }); + $('.vis-widget[data-tmodified="true"]').each(function () { + var wid = $(this).attr('id'); + + $(this).removeAttr('data-tmodified'); + + oldView = oldView || that.getViewOfWidget(wid); + + var transform = that.views[oldView].widgets[wid] && that.views[oldView].widgets[wid].style && that.views[oldView].widgets[wid].style.transform; + + if (!transform) { + $(this).prop('style').removeProperty('transform'); + } else { + $(this).css('transform', transform); + } + }); + + // Deselect all elements + $(':focus').blur(); + + // Hide context menu + $('#context_menu').hide(); + + if (typeof addWidget === 'boolean') { + onlyUpdate = addWidget; + addWidget = undefined; + delWidget = undefined; + } + if (addWidget) { + if (typeof addWidget === 'object') { + this.activeWidgets = addWidget; + } else { + if (this.activeWidgets.indexOf(addWidget) === -1) this.activeWidgets.push(addWidget); + } + } + if (typeof delWidget === 'string') { + var pos = this.activeWidgets.indexOf(delWidget); + if (pos !== -1) this.activeWidgets.splice(pos, 1); + } + var wid = this.activeWidgets[0] || 'none'; + + this.groups = {}; + this.groupsIcons = { + fixed: 'icon/groupFixed.png' + }; + + if (view !== viewDiv) { + // disable group resize + var $group = $('#' + viewDiv); + if ($group.hasClass('vis-resize-group')) { + $group.resizable('destroy').removeClass('vis-resize-group'); + } + } + if (!onlyUpdate) { + this.alignIndex = 0; + + var s = JSON.stringify(this.activeWidgets); + if (this.views[view] && JSON.stringify(this.views[view].activeWidgets) !== s) { + this.views[view].activeWidgets = JSON.parse(s); + // Store selected widgets + this.save(viewDiv, view); + } + + //this.$selectActiveWidgets.find('option[value="' + wid + '"]').prop('selected', true); + //this.$selectActiveWidgets.multiselect('refresh'); + var $widget; + var select = []; + var deselect = []; + + for (var i = 0; i < this.activeWidgets.length; i++) { + if (this.oldActiveWidgets.indexOf(this.activeWidgets[i]) === -1) select.push(this.activeWidgets[i]); + } + for (i = 0; i < this.oldActiveWidgets.length; i++) { + if (this.activeWidgets.indexOf(this.oldActiveWidgets[i]) === -1) deselect.push(this.oldActiveWidgets[i]); + } + + // Deselect unselected widgets + for (i = 0; i < deselect.length; i++) { + this.showWidgetHelper(viewDiv, view, deselect[i], false); + $widget = $('#' + deselect[i]); + $widget.removeClass('ui-selected'); + + if ($widget.hasClass('ui-draggable')) { + try { + $widget.draggable('destroy'); + } catch (e) { + this.conn.logError('inspectWidgets - Cannot destroy draggable ' + deselect[i] + ' ' + e); + } + } + + if ($widget.hasClass('ui-resizable')) { + try { + $widget.resizable('destroy'); + } catch (e) { + this.conn.logError('inspectWidgets - Cannot destroy resizable ' + deselect[i] + ' ' + e); + } + } + } + // disable resize if widget not more selected alone + if (this.oldActiveWidgets.length === 1 && this.activeWidgets.length !== 1) { + $widget = $('#' + this.oldActiveWidgets[0]); + if ($widget.hasClass('ui-resizable')) { + try { + $widget.resizable('destroy'); + } catch (e) { + this.conn.logError('inspectWidgets - Cannot destroy resizable ' + deselect[i] + ' ' + e); + } + } + } + + // Select selected widgets + for (var p = 0; p < select.length; p++) { + try { + $widget = this.showWidgetHelper(viewDiv, view, select[p], true); + + if ($widget && !$('#wid_all_lock_d').hasClass('ui-state-active')) { + this.draggable(viewDiv, view, $widget); + } + } catch (e) { + console.log(e); + } + } + this.$selectActiveWidgets.val(this.activeWidgets); + + // Enable disable buttons + if (this.activeWidgets.length) { + $('#rib_wid_del').button('enable'); + $('#rib_wid_copy').button('enable'); + $('#rib_wid_doc').button('enable'); + $('#export_widgets').button('enable'); + } else { + $('#rib_wid_del').button('disable'); + $('#rib_wid_copy').button('disable'); + $('#rib_wid_doc').button('disable'); + $('#export_widgets').button('disable'); + } + + if (this.activeWidgets.length === 1) { + try { + $widget = $('#' + this.activeWidgets[0]); + if (!$widget.hasClass('ui-resizable') && this.widgets[wid] && this.widgets[wid].data && !this.widgets[wid].data._no_resize) { + this.resizable(viewDiv, view, $widget); + } + } catch (e) { + console.log(e); + } + } + this.oldActiveWidgets = []; + for (var k = 0; k < this.activeWidgets.length; k++) { + this.oldActiveWidgets.push(this.activeWidgets[k]); + } + // update selected widgets dropdown + this.$selectActiveWidgets.multiselect('refresh'); + + // Disable copy widget if was active + $('#rib_wid_copy_cancel').trigger('click'); + + this.actualAttrs = this.findCommonAttributes(view, this.activeWidgets); + } + + var $widgetAttrs = $('#widget_attrs').hide(); + // Clear Inspector + $widgetAttrs[0].innerHTML = ''; + //$widgetAttrs.empty(); + + if (!wid || wid === 'none') { + // Switch tabs to View settings + $('#pan_attr').tabs('option', 'disabled', [1]).tabs({active: 0}); + $('#widget_tab').text(_('Widget')); + + if (view !== viewDiv) { + // enable group resize of nothing selected + this.editResizeGroup(viewDiv, view); + } + return false; + } + + $('#pan_attr').tabs('option', 'disabled', []).tabs({active: 1}); + $('#widget_tab').text((this.activeWidgets.length === 1) ? wid : _('Widget') + ': ' + this.activeWidgets.length); + + if (!this.views[view]) { + console.warn('No view "' + view + ' for ' + wid + ' found'); + return; + } + var widget = this.views[view].widgets[wid]; + + if (!widget) { + console.log('inspectWidget ' + wid + ' undefined'); + return false; + } + + if (!widget.tpl) return false; + + var $widgetTpl = $('#' + widget.tpl); + if (!$widgetTpl) { + console.log(widget.tpl + ' is not included'); + return false; + } + /*var widgetAttrs = $widgetTpl.attr('data-vis-attrs'); + // Combine attributes from data-vis-attrs, data-vis-attrs0, data-vis-attrs1, ... + var t = 0; + var attr; + while ((attr = $widgetTpl.attr('data-vis-attrs' + t))) { + widgetAttrs += attr; + t++; + } + if (widgetAttrs) { + widgetAttrs = widgetAttrs.split(';'); + } else { + widgetAttrs = []; + } + var widgetFilter = $widgetTpl.attr('data-vis-filter');*/ + + $('#inspect_comment_tr').show(); + $('#inspect_class_tr').show(); + + $widgetAttrs.css({width: '100%'}); + + // Add fixed attributes + var group = 'fixed'; + this.addToInspect(this.activeWidgets, 'name', group); + this.addToInspect(this.activeWidgets, 'comment', group); + this.addToInspect(this.activeWidgets, {name: 'class', type: 'class'}, group); + this.addToInspect(this.activeWidgets, {name: 'filterkey', type: 'auto', options: this.updateFilter(view)}, group); + this.addToInspect(this.activeWidgets, {name: 'views', type: 'select-views'}, group); + this.addToInspect(this.activeWidgets, {name: 'locked', type: 'checkbox'}, group); + + group = 'visibility'; + this.addToInspect(this.activeWidgets, {name: 'visibility-oid', type: 'id'}, group); + this.addToInspect(this.activeWidgets, {name: 'visibility-cond', type: 'select', options: ['==', '!=', '<=', '>=', '<', '>', 'consist', 'not consist', 'exist', 'not exist'], default: '=='}, group); + this.addToInspect(this.activeWidgets, {name: 'visibility-val', default: 1}, group); + this.addToInspect(this.activeWidgets, {name: 'visibility-groups', type: 'groups'}, group); + this.addToInspect(this.activeWidgets, {name: 'visibility-groups-action', type: 'select', options: ['hide', 'disabled'], default: 'hide'}, group); + + this.addToInspect('delimiter', group); + + // special case for group widget + group = 'common'; + if ($widgetTpl.attr('id') === '_tplGroup' && this.activeWidgets.length === 1) { + var _wid = this.activeWidgets[0]; + var id = 1; + var _data = this.views[view].widgets[_wid].data; + var maxCount = parseInt(_data.attrCount, 10); + if (maxCount) { + for (var a = 1; a <= maxCount; a++) { + this.addToInspect(this.activeWidgets, { + name: 'groupAttr' + a, + type: _data['attrType' + a], + clearName: _data['attrName' + a] || ('attrName' + a), + title: _('Use inside of group groupAttr%s', a) + }, group); + } + } + } + + // Edit all attributes + for (group in this.actualAttrs) { + if (!this.actualAttrs.hasOwnProperty(group)) continue; + for (var attr in this.actualAttrs[group]) { + if (!this.actualAttrs[group].hasOwnProperty(attr)) continue; + this.addToInspect(this.activeWidgets, this.actualAttrs[group][attr], group); + } + } + + this.addToInspect('delimiter', group); + // Add common css + this.editCssCommon(); + this.editCssFontText(); + this.editCssBackground(); + this.editCssBorder(); + this.editCssShadowPadding(); + //this.editCssAnimation(); + + this.addToInspect('delimiter', 'css_shadow_padding'); + if ($widgetTpl.attr('data-vis-no-gestures') !== 'true') { + this.editGestures(view); + } + if ($widgetTpl.attr('data-vis-no-signals') !== 'true') { + this.editSignalIcons(view); + } + if ($widgetTpl.attr('data-vis-no-ls') !== 'true') { + this.editLastChange(view); + } + // Re-render all widgets, where default values applied + if (this.reRenderList && this.reRenderList.length) { + for (var r = 0; r < this.reRenderList.length; r++) { + this.reRenderWidgetEdit(viewDiv, view, this.reRenderList[r]); + } + this.reRenderList = []; + } + + this.showInspect(viewDiv, view, this.activeWidgets); + + // snap objects to the grid, elsewise cannot move + /*if (this.views[view].settings.snapType == 2) { + this.gridWidth = parseInt(this.views[view].settings.gridSize, 10); + + if (this.gridWidth < 1 || isNaN(this.gridWidth)) this.gridWidth = 10; + + for (var i = 0; i < this.activeWidgets.length; i++) { + var $this = $('#' + this.activeWidgets[i]); + var x = parseInt($this.css('left')); + var y = parseInt($this.css('top')); + + x = Math.round(x / this.gridWidth) * this.gridWidth; + y = Math.round(y / this.gridWidth) * this.gridWidth; + + $this.css({'left': x, 'top': y}); + this.showWidgetHelper(this.activeWidgets[i], true); + } + // show grid + + }*/ + + // Put all view names in the select element + var $inspectViews = $('#inspect_views'); + if ($inspectViews.length) { + $inspectViews.html(''); + + var views = this.getViewsOfWidget(this.activeWidgets[0]); + for (var v in this.views) { + if (v === '___settings') continue; + if (v !== this.activeView) { + var selected = ''; + for (var m = 0; m < views.length; m++) { + if (views[m] === v) { + selected = 'selected'; + break; + } + } + $inspectViews.append(''); + } + } + + $inspectViews.multiselect({ + maxWidth: 180, + height: 260, + noneSelectedText: _('Single view'), + selectedText: function (numChecked, numTotal, checkedItems) { + var text = ''; + for (var i = 0; i < checkedItems.length; i++) { + text += (!text ? '' : ',') + checkedItems[i].title; + } + return text; + }, + multiple: true, + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + close: function () { + if ($inspectViews.data('changed')) { + $inspectViews.data('changed', false); + that.syncWidgets(that.activeWidgets, $(this).val()); + that.save(viewDiv, view); + } + } + //noneSelectedText: _("Select options") + }).change(function () { + $inspectViews.data('changed', true); + }).data('changed', false); + + $inspectViews.next().css('width', '100%'); + } + + // Put all view names in the select element + var $inspectGroups = $('#inspect_visibility-groups'); + if ($inspectGroups.length) { + $inspectGroups.html(''); + + var groups = this.getUserGroups(); + var widGroups = this.findCommonValue(view, this.activeWidgets, 'visibility-groups'); + if (widGroups && !(widGroups instanceof Array)) widGroups = widGroups.values; + widGroups = widGroups || []; + for (var g in groups) { + var val = g.substring('system.group.'.length); + $inspectGroups.append(''); + } + + $inspectGroups.multiselect({ + maxWidth: 180, + height: 260, + noneSelectedText: _('All groups'), + selectedText: function (numChecked, numTotal, checkedItems) { + var text = ''; + for (var i = 0; i < checkedItems.length; i++) { + text += (!text ? '' : ',') + checkedItems[i].title; + } + return text; + }, + multiple: true, + checkAllText: _('Check all'), + uncheckAllText: _('Uncheck all'), + close: function () { + if ($inspectGroups.data('changed')) { + $inspectGroups.data('changed', false); + that.save(viewDiv, view); + } + } + //noneSelectedText: _("Select options") + }).change(function () { + $inspectGroups.data('changed', true); + }).data('changed', false); + + $inspectGroups.next().css('width', '100%'); + } + + // If tab Widget is not selected => select it + var $menu = $('#menu_body'); + if ($menu.tabs('option', 'active') === 1) $menu.tabs({'active': 2}); + $widgetAttrs.show(); + + // modify by all selected widgets the z-index + if (this.views[view]) { + for (var w in this.views[view].widgets) { + if (!this.views[view].widgets.hasOwnProperty(w)) continue; + if (this.activeWidgets.indexOf(w) !== -1) { + $('#' + w) + .attr('data-zmodified', 'true') + .css('z-index', 700); + } else { + var wwidget = this.views[view].widgets[w]; + $('#' + w) + .attr('data-zmodified', 'true') + .css('z-index', (wwidget && wwidget.style) ? (wwidget.style['z-index'] || 0) : 0); + } + } + } + } +}); \ No newline at end of file diff --git a/www/js/visEditTemplates.js b/www/js/visEditTemplates.js new file mode 100644 index 0000000..19fc4b2 --- /dev/null +++ b/www/js/visEditTemplates.js @@ -0,0 +1,300 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + */ + +vis.editTemplatesInit = function () { + var that = this; + $('#toolbox').on('contextmenu click', function (e) { + // Workaround for OSX. Ignore clicks without ctrl + if (!e.button && !e.ctrlKey && !e.metaKey) return; + + if (!e.shiftKey && !e.altKey) { + e.preventDefault(); + } + }); + $(document).on('contextmenu click', '.templates_prev', function (e) { + // Workaround for OSX. Ignore clicks without ctrl + if (!e.button && !e.ctrlKey && !e.metaKey) return; + + if (!e.shiftKey && !e.altKey) { + var parentOffset = $(this).parent().offset(); + //or $(this).offset(); if you really just want the current element's offset + var options = { + left: e.pageX - parentOffset.left, + top: e.pageY - parentOffset.top + }; + + options.scrollLeft = $(this).scrollLeft(); + options.scrollTop = $(this).scrollTop(); + + options.left += options.scrollLeft; + options.top += options.scrollTop; + + that.editTemplatesShowMenu(options); + + $('.context-template-submenu').data('template', $(this).data('template')); + e.preventDefault(); + } + }); + $('.context-template-submenu').click(function () { + var action = $(this).data('action'); + that.editTemplateHideMenu(); + // get template name + var template = $('.context-template-submenu').data('template'); + + switch (action) { + case 'edit': + that.editTemplatesSettings(template, function (data) { + var template = $('.context-template-submenu').data('template'); + var changed = false; + + if (template !== data.name) { + that.views.___settings.templates[data.name] = that.views.___settings.templates[template]; + delete that.views.___settings.templates[template]; + changed = true; + } + + if (that.views.___settings.templates[data.name].desc !== data.desc) { + that.views.___settings.templates[data.name].desc = data.desc; + changed = true; + } + + if (changed) { + that.save(); + that.editTemplatesInitPreview(); + } + }); + break; + + case 'delete': + that.confirmMessage(_('Are you sure?'), _('Confirm'), 'alert', function (result) { + if (result) { + delete that.views.___settings.templates[template]; + that.save(); + that.editTemplatesInitPreview(); + } + }); + break; + } + }); + + vis.editTemplatesInitPreview(); +}; + +vis.editTemplatesInitPreview = function () { + $('.templates_prev').remove(); + var $selectSet = $('#select_set'); + + if (this.views.___settings && this.views.___settings.templates) { + var $panel = $('#panel_body'); + var $toolbox = $('#toolbox'); + var templates = this.views.___settings.templates; + for (var t in templates) { + if (!templates.hasOwnProperty(t)) { + continue; + } + var text = '
    ' + t + '
    '; + var $preview = $(text); + $toolbox.append($preview); + + if (templates[t].icon) { + $preview.append(''); + } + + $preview.draggable({ + helper: 'clone', + appendTo: $panel, + containment: $panel, + zIndex: 10000, + cursorAt: {top: 0, left: 0}, + start: function (event, ui) { + if (ui.helper.children().length < 3) { + $(ui.helper).addClass('ui-state-highlight ui-corner-all').css({padding: '2px', 'font-size': '12px'}); + } else { + $(ui.helper).find('.wid-prev-type').remove(); + $(ui.helper).find('.wid-prev-name').remove(); + $(ui.helper).css('border', 'none'); + $(ui.helper).css('width', 'auto'); + } + } + }); + } + if (!$selectSet.find('option[value="templates"]').length) { + $selectSet.append(''); + $selectSet.selectmenu('refresh'); + } + } +}; + +vis.editTemplatesCreate = function (viewDiv, view, groupId) { + this.views.___settings = this.views.___settings || {}; + this.views.___settings.templates = this.views.___settings.templates || {}; + var members = []; + var that = this; + this.editTemplatesSettings(function (data) { + that.copyWidgets(viewDiv, view, false, groupId, members, 0); + that.views.___settings.templates[data.name] = { + widgets: members, + icon: null, + desc: data.desc + }; + if (typeof html2canvas !== 'undefined') { + that.getWidgetThumbnail(groupId, 0, 0, function (canvas) { + if (canvas) { + that.views.___settings.templates[data.name].icon = canvas.toDataURL(); + } + that.save(viewDiv, view); + that.editTemplatesInitPreview(); + }); + } else { + that.save(viewDiv, view); + that.editTemplatesInitPreview(); + } + + }); +}; + +vis.editTemplatesSettings = function (template, callback) { + var that = this; + var $dialog = $('#dialog-template'); + if (typeof template === 'function') { + callback = template; + template = ''; + } + + if (template) { + $('#dialog_template_name').val(template); + $('#dialog_template_desc').val(that.views.___settings.templates[template].desc || ''); + } else { + var found; + var i = 0; + do { + i++; + found = false; + for (var t in that.views.___settings.templates) { + if (t === 'template' + i) { + found = true; + break; + } + } + } while(found); + + template = 'template' + i; + $('#dialog_template_name').val(template); + $('#dialog_template_desc').val(''); + } + + $dialog + .data('template', template) + .dialog({ + autoPen: true, + width: 800, + height: 250, + modal: true, + draggable: false, + resizable: false, + open: function () { + $('[aria-describedby="dialog-template"]').css('z-index', 1002); + }, + buttons: [ + { + id: 'ok', + text: _('Ok'), + click: function () { + var name = $('#dialog_template_name').val(); + var desc = $('#dialog_template_desc').val(); + var oldName = $dialog.data('template'); + + if (oldName !== name) { + if (that.views.___settings.templates[name]) { + that.showError(_('Duplicate name')); + return; + } + } + + callback({desc: desc, name: name}); + + $dialog.dialog('close'); + } + }, + { + text: _('Cancel'), + click: function () { + $dialog.dialog('close'); + } + } + ] + }); +}; + +vis.editTemplateHideMenu = function (e) { + if (e) { + e.stopImmediatePropagation(); + e.preventDefault(); + } + + $('#context_menu_template').hide(); +}; + +vis.editTemplatesShowMenu = function (options) { + var $contextMenu = $('#context_menu_template'); + this.hideContextMenu(); + + $contextMenu.unbind('blur').blur(this.editTemplateHideMenu); + + $contextMenu.css(options) + .show() + .menu(); + + // var pos = $contextMenu.position(); + var h = $contextMenu.height(); + var ww = $contextMenu.width(); + + if (options.top - h > options.scrollTop) { + $contextMenu.css({top: options.top - h}); + } + if (options.left - ww > options.scrollLeft) { + $contextMenu.css({left: options.left - ww}); + } + + $contextMenu.focus(); +}; + +vis.editTemplatesShowWarning = function () { + var isHideDialog = this.config['dialog/templates_is_show'] || false; + if (!isHideDialog) { + var that = this; + + $('#dialog_template_warning').dialog({ + autoOpen: true, + width: 600, + height: 400, + modal: true, + title: _('Hint'), + open: function (event, ui) { + $(event.target).parent().find('.ui-dialog-titlebar-close .ui-button-text').html(''); + $('[aria-describedby="dialog_template_warning"]').css('z-index', 11002); + $('.ui-widget-overlay').css('z-index', 1001); + }, + buttons: [ + { + id: 'ok', + text: _('Ok'), + click: function () { + if ($('#dialog_template_warning_is_show').prop('checked')) { + that.editSaveConfig('dialog/templates_is_show', true); + } + $('#dialog_template_warning').dialog('close'); + } + } + ] + }); + } +}; \ No newline at end of file diff --git a/www/js/visEditWelcome.js b/www/js/visEditWelcome.js new file mode 100644 index 0000000..1172d59 --- /dev/null +++ b/www/js/visEditWelcome.js @@ -0,0 +1,608 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ +/* jshint browser:true */ +/* global _ */ +/* global $ */ +/* global systemDictionary */ +/* global vis:true */ +/* jshint -W097 */// jshint strict:false + +'use strict'; + +$.extend(systemDictionary, { + 'Bath' : {"en": 'Bath', "de": 'Badezimmer', "ru": 'Ванная'}, + 'Kitchen' : {"en": 'Kitchen', "de": 'Küche', "ru": 'Кухня'}, + 'Living room' : {"en": 'Living room', "de": 'Wohnzimmer', "ru": 'Студия'}, + 'Apartment' : {"en": 'Apartment', "de": 'Wohnung', "ru": 'Квартира'}, + 'WebCam' : {"en": 'WebCam', "de": 'IP Kamera', "ru": 'Камера'}, + 'Edit' : {"en": 'Edit', "de": 'Editieren', "ru": 'Редактировать'}, + 'Click here, Press Ctrl+A and then "Del" to
    delete all widgets' : { + "en": 'Click here, Press Ctrl+A and then "Del" to
    delete all widgets', + "de": 'Um alle Widgets zu löschen:
    klicke hier,
    dann drücke Strg+A and dann Löschtaste', + "ru": 'Что бы удалить все элементы:
    Кликни сюда,
    нажми Ctrl+A и нажми Del' + }, + "OFF": {"en": "OFF", "de": "AUS", "ru": "ВЫКЛ"}, + "ON": {"en": "ON", "de": "AN", "ru": "ВКЛ"}, + "Click me!": {"en": "Click me!", "de": "Klick mich!", "ru": "Нажми!"}, + "off": {"en": "off", "de": "aus", "ru": "выкл"}, + "on": {"en": "on", "de": "an", "ru": "вкл"}, + "light": {"en": "light", "de": "Licht", "ru": "Свет"}, + "Outside": {"en": "Outside", "de": "Außen", "ru": "Снаружи"}, + "You can install more widget-sets and icon-sets (over 20)": { + "en": "You can install more widget-sets and icon-sets (over 20)", + "de": "Es können auch weiter schöne Widgets und Icons installiert werden (über 20)", + "ru": "Можно установить другие наборы элементов и картинки (свыше 20ти)" + }, + "Filter:": {"en": "Filter:", "de": "Filter:", "ru": "Фильтр:"} +}); +vis.createDemoView = function () { + + var obj = + { + "settings": { + "style": { + "background_class": "hq-background-blue-marine-lines" + }, + "theme": "redmond", + "sizex": "1024", + "sizey": "748", + "hideDescription": false, + "gridSize": "" + }, + "widgets": { + "w00001": { + "tpl": "tplImage", + "data": { + "src": "img/eg_trans.png", + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "refreshOnWakeUp": "false", + "refreshOnViewChange": "false", + "locked": true + }, + "style": { + "left": "5px", + "top": "3px", + "width": 761, + "height": 727, + "z-index": "0" + }, + "widgetSet": "basic" + }, + "w00002": { + "tpl": "tplBulbOnOffCtrl", + "data": { + "oid": "dev1", + "visibility-cond": "==", + "visibility-val": 1, + "icon_off": "img/bulb_off.png", + "icon_on": "img/bulb_on.png", + "readOnly": true, + "filterkey": _("light"), + "name": "Sleeping Room Status" + }, + "style": { + "left": "335.5px", + "top": "457px", + "z-index": "1", + "box-shadow": "0 0 30px 10px #4575b5", + "border-radius": "40px", + "background-color": "#4575b5", + "width": "55px", + "height": "57px" + }, + "widgetSet": "basic" + }, + "w00004": { + "tpl": "tplBulbOnOffCtrl", + "data": { + "oid": "dev2", + "visibility-cond": "==", + "visibility-val": 1, + "icon_off": "img/bulb_off.png", + "icon_on": "img/bulb_on.png", + "filterkey": _("light"), + "name": "Bath Control" + }, + "style": { + "left": "185px", + "top": "317px", + "z-index": "1", + "box-shadow": "0 0 30px 10px #4575b5", + "border-radius": "40px", + "background-color": "#4575b5", + "width": "55px", + "height": "57px" + }, + "widgetSet": "basic" + }, + "w00005": { + "tpl": "tplBulbOnOffCtrl", + "data": { + "oid": "dev3", + "visibility-cond": "==", + "visibility-val": 1, + "icon_off": "img/bulb_off.png", + "icon_on": "img/bulb_on.png", + "filterkey": _("light"), + "name": "Living Room Status" + }, + "style": { + "left": "417px", + "top": "261px", + "z-index": "1", + "background-color": "#4575b5", + "border-radius": "40px", + "width": "55px", + "height": "57px", + "box-shadow": "0 0 30px 10px #4575b5" + }, + "widgetSet": "basic" + }, + "w00009": { + "tpl": "tplJquiRadio", + "data": { + "oid": "dev1", + "visibility-cond": "==", + "visibility-val": 1, + "off_text": _("OFF"), + "on_text": _("ON"), + "padding": "5", + "filterkey": _("light"), + "name": "Sleeping Room Control" + }, + "style": { + "left": "287px", + "top": "523px", + "z-index": "1", + "border-radius": "5px" + }, + "widgetSet": "jqui" + }, + "w00008": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": "\n\n
    " + _("Click me!") + "
    ", + "filterkey": _("light"), + "name": "Click me" + }, + "style": { + "left": 177, + "top": 367, + "width": "74px", + "height": "17px", + "font-family": "Arial, sans-serif", + "color": "#001bf5", + "font-weight": "bold", + "z-index": "1" + }, + "widgetSet": "basic" + }, + "w00010": { + "tpl": "tplJquiButtonState", + "data": { + "oid": "dev3", + "visibility-cond": "==", + "visibility-val": 1, + "buttontext": _("off"), + "value": "0", + "filterkey": _("light"), + "name": "Living Room Off" + }, + "style": { + "left": "327px", + "top": "271px", + "z-index": "1", + "border-radius": "5px" + }, + "widgetSet": "jqui" + }, + "w00011": { + "tpl": "tplJquiButtonState", + "data": { + "oid": "dev3", + "visibility-cond": "==", + "visibility-val": 1, + "buttontext": _("on"), + "value": "1", + "filterkey": _("light"), + "name": "Living Room On" + }, + "style": { + "left": "475px", + "top": "271px", + "z-index": "1", + "border-radius": "5px" + }, + "widgetSet": "jqui" + }, + "w00012": { + "tpl": "tplJquiSlider", + "data": { + "oid": "dev4", + "visibility-cond": "==", + "visibility-val": 1, + "min": "0", + "max": "100", + "filterkey":_( "data"), + "name": "Demo Slider" + }, + "style": { + "left": "563px", + "top": "701px", + "z-index": "1" + }, + "widgetSet": "jqui" + }, + "w00013": { + "tpl": "tplValueFloat", + "data": { + "oid": "demoTemperature", + "visibility-cond": "==", + "visibility-val": 1, + "is_comma": "true", + "factor": "1", + "html_append_singular": " C°", + "html_append_plural": " C°", + "filterkey":_( "data"), + "name": "Outside Temperature" + }, + "style": { + "left": "695px", + "top": "47px", + "width": "66px", + "height": "17px", + "z-index": "2", + "font-family": "Arial, Helvetica, sans-serif", + "text-shadow": "", + "color": "#ffffff" + }, + "widgetSet": "basic" + }, + "w00015": { + "tpl": "tplValueFloat", + "data": { + "oid": "demoHumidity", + "visibility-cond": "==", + "visibility-val": 1, + "is_comma": "true", + "factor": "1", + "html_append_singular": " %", + "html_append_plural": " %", + "filterkey":_( "data"), + "name": "Outside Humidity" + }, + "style": { + "left": "695px", + "top": "66px", + "width": "66px", + "height": "17px", + "z-index": "2", + "font-family": "Arial, Helvetica, sans-serif", + "color": "#ffffff" + }, + "widgetSet": "basic" + }, + "w00016": { + "tpl": "tplValueFloatBar", + "data": { + "oid": "dev4", + "visibility-cond": "==", + "visibility-val": 1, + "min": "0", + "max": "100", + "orientation": "horizontal", + "color": "blue", + "filterkey":_( "data"), + "name": "Demo Bar" + }, + "style": { + "left": "560px", + "top": "672px", + "width": "164px", + "height": "18px", + "z-index": "1" + }, + "widgetSet": "basic" + }, + "w00014": { + "tpl": "tplValueString", + "data": { + "oid": "dev4", + "visibility-cond": "==", + "visibility-val": 1, + "filterkey":_( "data"), + "name": "Demo Text" + }, + "style": { + "left": "616px", + "top": "674px", + "z-index": "2", + "text-align": "center", + "color": "#ffffff", + "font-family": "Arial, sans-serif" + }, + "widgetSet": "basic" + }, + "w00017": { + "tpl": "tplFilterDropdown", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "filters": _("light") + ";data", + "filterkey": _("light") + ";" + ("data"), + "name": "Filter selector" + }, + "style": { + "left": "76px", + "top": "47px", + "width": "103px", + "height": "22px" + }, + "widgetSet": "basic" + }, + "w00019": { + "tpl": "tplImage", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "30000", + "refreshOnWakeUp": "false", + "refreshOnViewChange": "false", + "src": "http://www.kernspin-lindau.de/images/Bodensee2.jpg", + "name": "Webcam Image" + }, + "style": { + "left": "5px", + "top": "599px", + "border-width": "3px", + "border-style": "ridge", + "border-color": "#ccfaff", + "border-radius": "5px" + }, + "widgetSet": "basic" + }, + "w00018": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("WebCam"), + "name": "WebCam Label" + }, + "style": { + "left": "7px", + "top": "576px", + "width": "152px", + "height": "19px", + "color": "#ffffff", + "font-family": "Arial, sans-serif", + "font-size": "large", + "font-weight": "bold" + }, + "widgetSet": "basic" + }, + "w00020": { + "tpl": "tplFrame", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "title": _("Outside"), + "title_color": "#ffffff", + "title_top": "0", + "title_left": "15", + "header_height": "17", + "header_color": "#5297ff", + "name": "Frame Temperature" + }, + "style": { + "left": "677px", + "top": "26px", + "width": "85px", + "height": "58px", + "background-color": "#0067d6", + "font-family": "Arial, sans-serif", + "z-index": "1", + "border-radius": "5px" + }, + "widgetSet": "basic" + }, + "w00021": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("You can install more widget-sets and icon-sets (over 20)"), + "name": "Comment" + }, + "style": { + "left": "50%", + "top": "calc(100% - 50px)", + "width": "50%", + "height": "42px", + "color": "#ffffff", + "font-family": "Arial, sans-serif" + }, + "widgetSet": "basic" + }, + "w00022": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Filter:"), + "name": "Label Filter" + }, + "style": { + "left": "14px", + "top": "48px", + "width": "60px", + "height": "17px", + "color": "#ffffff", + "font-family": "Arial, sans-serif" + }, + "widgetSet": "basic" + }, + "w00023": { + "tpl": "tplRedNumber", + "data": { + "oid": "dev4", + "visibility-cond": "==", + "visibility-val": 1, + "type": "circle", + "name": "Demo RedNumber" + }, + "style": { + "left": "732px", + "top": "668px" + }, + "widgetSet": "basic" + }, + "w00028": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Living room"), + "name": "Living room Label" + }, + "style": { + "left": "310px", + "top": "422px", + "width": "152px", + "height": "19px", + "color": "#000000", + "font-size": "large", + "font-weight": "bold", + "font-family": "Arial, Helvetica, sans-serif" + }, + "widgetSet": "basic" + }, + "w00029": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Kitchen"), + "name": "Kitchen Label" + }, + "style": { + "left": "352px", + "top": "222px", + "width": "152px", + "height": "19px", + "color": "#000000", + "font-size": "large", + "font-weight": "bold", + "font-family": "Arial, Helvetica, sans-serif" + }, + "widgetSet": "basic" + }, + "w00030": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Bath"), + "name": "Bath Label" + }, + "style": { + "left": "91px", + "top": "324px", + "width": "108px", + "height": "19px", + "color": "#000000", + "font-size": "large", + "font-weight": "bold", + "font-family": "Arial, Helvetica, sans-serif" + }, + "widgetSet": "basic" + }, + "w00031": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Apartment"), + "name": "Apartment Label" + }, + "style": { + "left": "11px", + "top": "5px", + "width": "162px", + "height": "32px", + "color": "#c7c7c7", + "font-size": "2em", + "font-weight": "bold", + "font-family": "Arial, Helvetica, sans-serif" + }, + "widgetSet": "basic" + }, + "w00032": { + "tpl": "tplJquiButtonLink", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "buttontext": _("Edit"), + "padding": "0", + "href": "/vis/edit.html#DemoView" + }, + "style": { + "left": "calc(100% - 200px)", + "top": "5px" + }, + "widgetSet": "jqui" + }, + "w00033": { + "tpl": "tplHtml", + "data": { + "visibility-cond": "==", + "visibility-val": 1, + "refreshInterval": "0", + "html": _("Click here, Press Ctrl+A and then \"Del\" to
    delete all widgets"), + "name": "Comment" + }, + "style": { + "left": "9px", + "top": "159px", + "width": "173px", + "height": "90px", + "color": "#ffffff", + "font-family": "Arial, sans-serif" + }, + "widgetSet": "basic" + } + + }, + "rerender": false, + "filterList": [ + _("light"), + _( "data") + ], + "activeWidgets": [] + }; + return obj; +}; \ No newline at end of file diff --git a/www/js/visUtils.js b/www/js/visUtils.js new file mode 100644 index 0000000..5d26ade --- /dev/null +++ b/www/js/visUtils.js @@ -0,0 +1,537 @@ +function getWidgetGroup(views, view, widget) { + var widgets = views[view].widgets; + var members; + for (var w in widgets) { + if (!widgets.hasOwnProperty(w)) continue; + members = views[view].widgets[w].data.members; + if (members && members.indexOf(widget) !== -1) { + return w; + } + } + return null; +} + +function extractBinding(format) { + var oid = format.match(/{(.+?)}/g); + var result = null; + if (oid) { + if (oid.length > 50) { + console.warn('Too many bindings in one widget: ' + oid.length + '[max = 50]'); + } + for (var p = 0; p < oid.length && p < 50; p++) { + var _oid = oid[p].substring(1, oid[p].length - 1); + if (_oid[0] === '{') continue; + // If first symbol '"' => it is JSON + if (_oid && _oid[0] === '"') continue; + var parts = _oid.split(';'); + result = result || []; + var systemOid = parts[0].trim(); + var visOid = systemOid; + + var test1 = visOid.substring(visOid.length - 4); + var test2 = visOid.substring(visOid.length - 3); + + if (visOid && test1 !== '.val' && test2 !== '.ts' && test2 !== '.lc' && test1 !== '.ack') { + visOid = visOid + '.val'; + } + + var isSeconds = (test2 === '.ts' || test2 === '.lc'); + + test1 = systemOid.substring(systemOid.length - 4); + test2 = systemOid.substring(systemOid.length - 3); + + if (test1 === '.val' || test1 === '.ack') { + systemOid = systemOid.substring(0, systemOid.length - 4); + } else if (test2 === '.lc' || test2 === '.ts') { + systemOid = systemOid.substring(0, systemOid.length - 3); + } + var operations = null; + var isEval = visOid.match(/[\d\w_.]+:\s?[-\d\w_.]+/) || (!visOid.length && parts.length > 0);//(visOid.indexOf(':') !== -1) && (visOid.indexOf('::') === -1); + + if (isEval) { + var xx = visOid.split(':', 2); + var yy = systemOid.split(':', 2); + visOid = xx[1]; + systemOid = yy[1]; + operations = operations || []; + operations.push({ + op: 'eval', + arg: [{ + name: xx[0], + visOid: visOid, + systemOid: systemOid + }] + }); + } + + for (var u = 1; u < parts.length; u++) { + // eval construction + if (isEval) { + if (parts[u].trim().match(/^[\d\w_.]+:\s?[-.\d\w_]+$/)) {//parts[u].indexOf(':') !== -1 && parts[u].indexOf('::') === -1) { + var _systemOid = parts[u].trim(); + var _visOid = _systemOid; + + test1 = _visOid.substring(_visOid.length - 4); + test2 = _visOid.substring(_visOid.length - 3); + + if (test1 !== '.val' && test2 !== '.ts' && test2 !== '.lc' && test1 !== '.ack') { + _visOid = _visOid + '.val'; + } + + test1 = systemOid.substring(_systemOid.length - 4); + test2 = systemOid.substring(_systemOid.length - 3); + + if (test1 === '.val' || test1 === '.ack') { + _systemOid = _systemOid.substring(0, _systemOid.length - 4); + } else if (test2 === '.lc' || test2 === '.ts') { + _systemOid = _systemOid.substring(0, _systemOid.length - 3); + } + var x1 = _visOid.split(':', 2); + var y1 = _systemOid.split(':', 2); + + operations[0].arg.push({ + name: x1[0], + visOid: x1[1], + systemOid: y1[1] + }); + } else { + parts[u] = parts[u].replace(/::/g, ':'); + if (operations[0].formula) { + var n = JSON.parse(JSON.stringify(operations[0])); + n.formula = parts[u]; + operations.push(n); + } else { + operations[0].formula = parts[u]; + } + } + } else { + var parse = parts[u].match(/([\w\s\/+*-]+)(\(.+\))?/); + if (parse && parse[1]) { + parse[1] = parse[1].trim(); + // operators requires parameter + if (parse[1] === '*' || + parse[1] === '+' || + parse[1] === '-' || + parse[1] === '/' || + parse[1] === '%' || + parse[1] === 'min' || + parse[1] === 'max') { + if (parse[2] === undefined) { + console.log('Invalid format of format string: ' + format); + parse[2] = null; + } else { + parse[2] = (parse[2] || '').trim().replace(',', '.'); + parse[2] = parse[2].substring(1, parse[2].length - 1); + parse[2] = parseFloat(parse[2].trim()); + + if (parse[2].toString() === 'NaN') { + console.log('Invalid format of format string: ' + format); + parse[2] = null; + } else { + operations = operations || []; + operations.push({op: parse[1], arg: parse[2]}); + } + } + } else + // date formatting + if (parse[1] === 'date') { + operations = operations || []; + parse[2] = (parse[2] || '').trim(); + parse[2] = parse[2].substring(1, parse[2].length - 1); + operations.push({op: parse[1], arg: parse[2]}); + } else + // returns array[value]. e.g.: {id.ack;array(ack is false,ack is true)} + if (parse[1] === 'array') { + operations = operations || []; + param = (parse[2] || '').trim(); + param = param.substring(1, param.length - 1); + param = param.split(','); + if (Array.isArray(param)) { + operations.push ({op: parse[1], arg: param}); //xxx + } + } else + // value formatting + if (parse[1] === 'value') { + operations = operations || []; + var param = (parse[2] === undefined) ? '(2)' : (parse[2] || ''); + param = param.trim(); + param = param.substring(1, param.length - 1); + operations.push({op: parse[1], arg: param}); + } else + // operators have optional parameter + if (parse[1] === 'pow' || parse[1] === 'round' || parse[1] === 'random') { + if (parse[2] === undefined) { + operations = operations || []; + operations.push({op: parse[1]}); + } else { + parse[2] = (parse[2] || '').trim().replace(',', '.'); + parse[2] = parse[2].substring(1, parse[2].length - 1); + parse[2] = parseFloat(parse[2].trim()); + + if (parse[2].toString() === 'NaN') { + console.log('Invalid format of format string: ' + format); + parse[2] = null; + } else { + operations = operations || []; + operations.push({op: parse[1], arg: parse[2]}); + } + } + } else + // operators without parameter + { + operations = operations || []; + operations.push({op: parse[1]}); + } + } else { + console.log('Invalid format ' + format); + } + } + } + + result.push({ + visOid: visOid, + systemOid: systemOid, + token: oid[p], + operations: operations ? operations : undefined, + format: format, + isSeconds: isSeconds + }); + } + } + return result; +} + +function getUsedObjectIDs(views, isByViews) { + if (!views) { + console.log('Check why views are not yet loaded!'); + return null; + } + + var _views = isByViews ? {} : null; + var IDs = []; + var visibility = {}; + var bindings = {}; + var lastChanges = {}; + var signals = {}; + + var view; + var id; + var sidd; + for (view in views) { + if (!views.hasOwnProperty(view)) continue; + + if (view === '___settings') continue; + + if (_views) _views[view] = []; + + for (id in views[view].widgets) { + if (!views[view].widgets.hasOwnProperty(id)) continue; + // Check all attributes + var data = views[view].widgets[id].data; + var style = views[view].widgets[id].style; + + // fix error in naming + if (views[view].widgets[id].groupped) { + views[view].widgets[id].grouped = true; + delete views[view].widgets[id].groupped; + } + + // rename hqWidgets => hqwidgets + if (views[view].widgets[id].widgetSet === 'hqWidgets') { + views[view].widgets[id].widgetSet = 'hqwidgets'; + } + + // rename RGraph => rgraph + if (views[view].widgets[id].widgetSet === 'RGraph') { + views[view].widgets[id].widgetSet = 'rgraph'; + } + + // rename timeAndWeather => timeandweather + if (views[view].widgets[id].widgetSet === 'timeAndWeather') { + views[view].widgets[id].widgetSet = 'timeandweather'; + } + + // convert "Show on Value" to HTML + if (views[view].widgets[id].tpl === 'tplShowValue') { + views[view].widgets[id].tpl = 'tplHtml'; + views[view].widgets[id].data['visibility-oid'] = views[view].widgets[id].data.oid; + views[view].widgets[id].data['visibility-val'] = views[view].widgets[id].data.value; + delete views[view].widgets[id].data.oid; + delete views[view].widgets[id].data.value; + } + + // convert "Hide on >0/True" to HTML + if (views[view].widgets[id].tpl === 'tplHideTrue') { + views[view].widgets[id].tpl = 'tplHtml'; + views[view].widgets[id].data['visibility-cond'] = '!='; + views[view].widgets[id].data['visibility-oid'] = views[view].widgets[id].data.oid; + views[view].widgets[id].data['visibility-val'] = true; + delete views[view].widgets[id].data.oid; + } + + // convert "Hide on 0/False" to HTML + if (views[view].widgets[id].tpl === 'tplHide') { + views[view].widgets[id].tpl = 'tplHtml'; + views[view].widgets[id].data['visibility-cond'] = '!='; + views[view].widgets[id].data['visibility-oid'] = views[view].widgets[id].data.oid; + views[view].widgets[id].data['visibility-val'] = false; + delete views[view].widgets[id].data.oid; + } + + // convert "Door/Window sensor" to HTML + if (views[view].widgets[id].tpl === 'tplHmWindow') { + views[view].widgets[id].tpl = 'tplValueBool'; + views[view].widgets[id].data.html_false = views[view].widgets[id].data.html_closed; + views[view].widgets[id].data.html_true = views[view].widgets[id].data.html_open; + delete views[view].widgets[id].data.html_closed; + delete views[view].widgets[id].data.html_open; + } + + // convert "Door/Window sensor" to HTML + if (views[view].widgets[id].tpl === 'tplHmWindowRotary') { + views[view].widgets[id].tpl = 'tplValueListHtml8'; + views[view].widgets[id].data.count = 2; + views[view].widgets[id].data.value0 = views[view].widgets[id].data.html_closed; + views[view].widgets[id].data.value1 = views[view].widgets[id].data.html_open; + views[view].widgets[id].data.value2 = views[view].widgets[id].data.html_tilt; + delete views[view].widgets[id].data.html_closed; + delete views[view].widgets[id].data.html_open; + delete views[view].widgets[id].data.html_tilt; + } + + // convert "tplBulbOnOff" to tplBulbOnOffCtrl + if (views[view].widgets[id].tpl === 'tplBulbOnOff') { + views[view].widgets[id].tpl = 'tplBulbOnOffCtrl'; + views[view].widgets[id].data.readOnly = true; + } + + // convert "tplValueFloatBarVertical" to tplValueFloatBar + if (views[view].widgets[id].tpl === 'tplValueFloatBarVertical') { + views[view].widgets[id].tpl = 'tplValueFloatBar'; + views[view].widgets[id].data.orientation = 'vertical'; + } + + for (var attr in data) { + if (!data.hasOwnProperty(attr) || !attr) continue; + /* TODO DO do not forget remove it after a while. Required for import from DashUI */ + if (attr === 'state_id') { + data.state_oid = data[attr]; + delete data[attr]; + attr = 'state_oid'; + } else + if (attr === 'number_id') { + data.number_oid = data[attr]; + delete data[attr]; + attr = 'number_oid'; + } else + if (attr === 'toggle_id') { + data.toggle_oid = data[attr]; + delete data[attr]; + attr = 'toggle_oid'; + } else + if (attr === 'set_id') { + data.set_oid = data[attr]; + delete data[attr]; + attr = 'set_oid'; + } else + if (attr === 'temp_id') { + data.temp_oid = data[attr]; + delete data[attr]; + attr = 'temp_oid'; + } else + if (attr === 'drive_id') { + data.drive_oid = data[attr]; + delete data[attr]; + attr = 'drive_oid'; + } else + if (attr === 'content_id') { + data.content_oid = data[attr]; + delete data[attr]; + attr = 'content_oid'; + } else + if (attr === 'dialog_id') { + data.dialog_oid = data[attr]; + delete data[attr]; + attr = 'dialog_oid'; + } else + if (attr === 'max_value_id') { + data.max_value_oid = data[attr]; + delete data[attr]; + attr = 'max_value_oid'; + } else + if (attr === 'dialog_id') { + data.dialog_oid = data[attr]; + delete data[attr]; + attr = 'dialog_oid'; + } else + if (attr === 'weoid') { + data.woeid = data[attr]; + delete data[attr]; + attr = 'woeid'; + } + + if (typeof data[attr] === 'string') { + var m; + var oids = extractBinding(data[attr]); + if (oids) { + for (var t = 0; t < oids.length; t++) { + var ssid = oids[t].systemOid; + if (ssid) { + if (IDs.indexOf(ssid) === -1) IDs.push(ssid); + if (_views && _views[view].indexOf(ssid) === -1) _views[view].push(ssid); + if (!bindings[ssid]) bindings[ssid] = []; + oids[t].type = 'data'; + oids[t].attr = attr; + oids[t].view = view; + oids[t].widget = id; + + bindings[ssid].push(oids[t]); + } + + if (oids[t].operations && oids[t].operations[0].arg instanceof Array) { + for (var ww = 0; ww < oids[t].operations[0].arg.length; ww++) { + ssid = oids[t].operations[0].arg[ww].systemOid; + if (!ssid) continue; + if (IDs.indexOf(ssid) === -1) IDs.push(ssid); + if (_views && _views[view].indexOf(ssid) === -1) _views[view].push(ssid); + if (!bindings[ssid]) bindings[ssid] = []; + bindings[ssid].push(oids[t]); + } + } + } + } else + if (attr !== 'oidTrueValue' && attr !== 'oidFalseValue' && ((attr.match(/oid\d{0,2}$/) || attr.match(/^oid/) || attr.match(/^signals-oid-/) || attr === 'lc-oid') && data[attr])) { + if (data[attr] && data[attr] !== 'nothing_selected') { + if (IDs.indexOf(data[attr]) === -1) IDs.push(data[attr]); + if (_views && _views[view].indexOf(data[attr]) === -1) _views[view].push(data[attr]); + } + + // Visibility binding + if (attr === 'visibility-oid' && data['visibility-oid']) { + var vid = data['visibility-oid']; + if (vid.match(/^groupAttr(\d+)$/)) { + var vgroup = getWidgetGroup(views, view, id); + if (vgroup) vid = views[view].widgets[vgroup].data[vid]; + } + + if (!visibility[vid]) visibility[vid] = []; + visibility[vid].push({view: view, widget: id}); + } + + // Signal binding + if (attr.match(/^signals-oid-/) && data[attr]) { + var sid = data[attr]; + if (sid.match(/^groupAttr(\d+)$/)) { + var group = getWidgetGroup(views, view, id); + if (group) sid = views[view].widgets[group].data[sid]; + } + + if (!signals[sid]) signals[sid] = []; + signals[sid].push({ + view: view, + widget: id, + index: parseInt(attr.substring('signals-oid-'.length), 10) + }); + } + if (attr === 'lc-oid') { + var lcsid = data[attr]; + if (lcsid.match(/^groupAttr(\d+)$/)) { + var ggroup = getWidgetGroup(views, view, id); + if (ggroup) lcsid = views[view].widgets[ggroup].data[lcsid]; + } + + if (!lastChanges[lcsid]) lastChanges[lcsid] = []; + lastChanges[lcsid].push({ + view: view, + widget: id + }); + } + } else + if ((m = attr.match(/^attrType(\d+)$/)) && data[attr] === 'id') { + var _id = 'groupAttr' + m[1]; + if (data[_id]) { + if (IDs.indexOf(data[_id]) === -1) IDs.push(data[_id]); + if (_views && _views[view].indexOf(data[_id]) === -1) _views[view].push(data[_id]); + } + } + } + } + + // build bindings for styles + if (style) { + for (var cssAttr in style) { + if (!style.hasOwnProperty(cssAttr) || !cssAttr) continue; + if (typeof style[cssAttr] === 'string') { + var objIDs = extractBinding(style[cssAttr]); + if (objIDs) { + for (var tt = 0; tt < objIDs.length; tt++) { + sidd = objIDs[tt].systemOid; + if (sidd) { + if (IDs.indexOf(sidd) === -1) IDs.push(sidd); + if (_views && _views[view].indexOf(sidd) === -1) _views[view].push(sidd); + if (!bindings[sidd]) bindings[sidd] = []; + + objIDs[tt].type = 'style'; + objIDs[tt].attr = cssAttr; + objIDs[tt].view = view; + objIDs[tt].widget = id; + + bindings[sidd].push(objIDs[tt]); + } + + if (objIDs[tt].operations && objIDs[tt].operations[0].arg instanceof Array) { + for (var w = 0; w < objIDs[tt].operations[0].arg.length; w++) { + sidd = objIDs[tt].operations[0].arg[w].systemOid; + if (!sidd) continue; + if (IDs.indexOf(sidd) === -1) IDs.push(sidd); + if (_views && _views[view].indexOf(sidd) === -1) _views[view].push(sidd); + if (!bindings[sidd]) bindings[sidd] = []; + bindings[sidd].push(objIDs[tt]); + } + } + } + } + } + } + } + } + } + + if (_views) { + var changed; + do { + changed = false; + // Check containers + for (view in views) { + if (!views.hasOwnProperty(view)) continue; + + if (view === '___settings') continue; + + for (id in views[view].widgets) { + if (!views[view].widgets.hasOwnProperty(id)) continue; + + // Add all OIDs from this view to parent + if (views[view].widgets[id].tpl === 'tplContainerView' && views[view].widgets[id].data.contains_view) { + var ids = _views[views[view].widgets[id].data.contains_view]; + if (ids) { + for (var a = 0; a < ids.length; a++) { + if (ids[a] && _views[view].indexOf(ids[a]) === -1) { + _views[view].push(ids[a]); + changed = true; + } + } + } else { + console.warn('View does not exist: "' + views[view].widgets[id].data.contains_view + '"'); + } + } + } + } + } while (changed); + } + + return {IDs: IDs, byViews: _views, visibility: visibility, bindings: bindings, lastChanges: lastChanges, signals: signals}; +} + +if (typeof module !== 'undefined' && module.parent) { + module.exports.getUsedObjectIDs = getUsedObjectIDs; +} \ No newline at end of file diff --git a/www/js/visWizard.js b/www/js/visWizard.js new file mode 100644 index 0000000..9702beb --- /dev/null +++ b/www/js/visWizard.js @@ -0,0 +1,369 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker, + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ + // visEdit - the ioBroker.vis Editor Wizard + +'use strict'; + +// Add words for bars +jQuery.extend(systemDictionary, { + "All except Low battery": {"en" : "All except 'Battery Indicator'", "de": "Alle außer 'Battery Indicator'", "ru": "Все, кроме 'Battery Indicator'"}, + "Place following widget to the room and start wizard again": { + "en" : "Place following widget to the room and start wizard again", + "de" : "Platziere diesen Widget auf dem View im zugehörigen Raum und starte Wizard neu", + "ru" : "Поместите элемент в комнате, где он должен быть и запустите Помошника снова" + } +}); + +vis = $.extend(true, vis, { + hm2Widget: { + 'tplHqButton' : {findImage: false, hssType: ['HM-LC-Sw1-Pl', 'HM-LC-Sw1-FM', 'HM-LC-Sw1-PB-FM', 'HM-LC-Sw2-PB-FM', 'HM-LC-Sw2-FM','HM-ES-PMSw1-Pl','HM-LC-Sw1PBU-FM','HM-LC-Sw1-SM','HM-LC-Sw4-SM']}, + 'tplHqLowbat' : {findImage: true, hssType: ['HM-PB-4-WM', 'HM-PB-2-WM', 'HM-PB-4Dis-WM', + 'HM-PB-2-WM55','HM-CC-VD',//'HM-SCI-3-FM', + 'HM-Sec-WDS','HM-Sec-SD','HM-Sec-TiS', + 'HM-RC-4-2', 'HM-RC-Key4-2', 'HM-RC-Sec4-2', + 'HM-RC-4', 'HM-RC-4-B', 'HM-RC-Sec3', + 'HM-RC-Key3', 'HM-RC-Key3-B', 'HM-RC-12', + 'HM-RC-12-B', 'HM-RC-19', 'HM-RC-19-B', + 'HM-RC-P1', 'HM-PB-6-WM55', 'HM-Sen-EP', + 'HM-SCI-3-FM', 'HM-SwI-3-FM', 'HM-PBI-4-FM', + 'HM-LC-Sw4-Ba-PCB', 'HM-WDS30-OT2-SM','HM-Sen-Wa-Od', + 'HM-Dis-TD-T'], point: "LOWBAT"}, + 'tplHqMotion' : {findImage: false, hssType: ['HM-Sen-MDIR-O', 'HM-Sec-MDIR'], point: 'MOTION'}, + 'tplHqIp' : {findImage: false, hssType: ['PING']}, + 'tplHqGong' : {findImage: false, hssType: ['HM-OU-CF-PL', 'HM-OU-CFM-Pl']}, + 'tplHqOutTemp': {findImage: false, hssType: ['HM-WDC7000','HM-WDS10-TH-O','HM-WDS40-TH-I','HM-WDS100-C6-O','HM-WDS30-T-O']}, + 'tplHqInTemp' : {findImage: false, hssType: ['HM-CC-TC','HM-CC-RT-DN'], aux: [{hssType: ['HM-CC-VD'], attr:'hm_idV'}], useDevice: true}, + 'tplHqShutter': {findImage: false, hssType: ['HM-LC-Bl1-SM','HMW-LC-Bl1-DR','HM-LC-Bl1-FM','HM-LC-Bl1-PB-FM','HM-LC-Bl1PBU-FM'], + aux : [{hssType: ['HM-Sec-RHS'], attr:'hm_id_hnd0'}, + {hssType: ['HM-Sec-SC','CC-SC-Rd-WM-W-R5','FHT80TF-2'], attr:'hm_id0'}]}, + 'tplHqDimmer' : {findImage: false, hssType: ['HM-LC-Dim1TPBU-FM','HM-LC-Dim1PWM-CV','HM-LC-Dim1T-FM','HM-LC-Dim1T-CV','HM-LC-Dim1T-PI','HM-LC-Dim1L-CV','HM-LC-Dim1L-Pl','HM-LC-Dim2L-SM','HMW-LC-Dim1L-DR']}, + 'tplHqLock' : {findImage: false, hssType: ['HM-Sec-Key-S']} + }, + hmDeviceToWidget: function (device) { + for (var w in vis.hm2Widget) { + for (var j = 0; j < vis.hm2Widget[w].hssType.length; j++) { + if (vis.hm2Widget[w].hssType[j] == device) { + return w; + } + } + } + return null; + }, + wizardGetFunction : function (channel) { + var hm_id = channel; + var func = null; + while (hm_id && localData.metaObjects[hm_id]) { + for (var t = 0; t < localData.metaIndex["ENUM_FUNCTIONS"].length; t++) { + var list = localData.metaObjects[localData.metaIndex["ENUM_FUNCTIONS"][t]]; + for (var z = 0; z < list['Channels'].length; z++) { + if (list['Channels'][z] == hm_id) { + func = localData.metaIndex["ENUM_FUNCTIONS"][t];//list.Name; + break; + } + } + if (func) + break; + } + if (func) + break; + + hm_id = localData.metaObjects[hm_id]['Parent']; + } + return func; + }, + // Try to find point for wirget + wizardGetPoint: function (widgetName, channel) { + if (vis.hm2Widget[widgetName].point) { + for (var p in localData.metaObjects[channel]["DPs"]) { + if (p == vis.hm2Widget[widgetName].point) { + return localData.metaObjects[channel]["DPs"][p]; + } + } + var parent = localData.metaObjects[channel]["Parent"]; + if (localData.metaObjects[parent]["Channels"]) { + for (var i = 0; i < localData.metaObjects[parent]["Channels"].length; i++) { + var chn = localData.metaObjects[localData.metaObjects[parent]["Channels"][i]]; + if (channel == localData.metaObjects[parent]["Channels"][i]) { + continue; + } + for (var p in chn["DPs"]) { + if (p == vis.hm2Widget[widgetName].point) { + return chn["DPs"][p]; + } + } + } + } + } else + if (vis.hm2Widget[widgetName].useDevice) { + while (localData.metaObjects[channel]["Parent"]) { + channel = localData.metaObjects[channel]["Parent"]; + } + } + return channel; + }, + findUniqueDeviceInRoom: function (devNames, roomID) { + var idFound = null; + // Find all HM Devices belongs to this room + var elems = localData.metaObjects[roomID]["Channels"]; + for (var i = 0; i < elems.length; i++) { + var devID = localData.metaObjects[elems[i]]["Parent"]; + for(var j = 0;j < devNames.length; j++) { + if (localData.metaObjects[devID]["HssType"] == devNames[j]) { + if (idFound) { + return null; + } + idFound = elems[i]; + break; + } + } + } + return idFound; + }, + wizardCreateWidget: function (view, roomID, func, widgetName, devID, channel, point, pos) { + var field = null; + if (pos) { + field = {x: pos.left, y: pos.top, width: 500}; + } + + // Find empty position for new widget + var style = vis.findFreePosition (view, null, field, hqWidgets.gOptions.gBtWidth, hqWidgets.gOptions.gBtHeight); + + // Find function of the widget for filter key + func = func || vis.wizardGetFunction (channel); + + // get device description + var title = hmSelect._convertName(localData.metaObjects[channel].Name); + // Remove ROOM from device name + if (title.length > localData.metaObjects[roomID]["Name"].length && title.substring(0, localData.metaObjects[roomID]["Name"].length) == localData.metaObjects[roomID]["Name"]) + title = title.substring(localData.metaObjects[roomID]["Name"].length); + // Remove the leading dot + if (title.length > 0 && title[0] == '.') + title = title.substring(1); + + // Get default settings + var hqoptions = vis.binds.hqWidgetsExt.hqEditDefault(widgetName); + hqoptions = $.extend(hqoptions, {"x": style.left,"y": style.top, "title": title, "hm_id": point, "room": localData.metaObjects[roomID]["Name"]}); + + // Set image of widget + if (vis.hm2Widget[widgetName].findImage) { + hqoptions['iconName'] = hmSelect._getImage(localData.metaObjects[devID].HssType); + } + if (vis.hm2Widget[widgetName].aux) { + for (var t = 0; t < vis.hm2Widget[widgetName].aux.length; t++) { + // Try to find if only one device are in the room + var hmId = vis.findUniqueDeviceInRoom (vis.hm2Widget[widgetName].aux[t].hssType, roomID); + if (hmId) { + hqoptions[vis.hm2Widget[widgetName].aux[t].attr] = hmId; + } + } + } + + //var data = {"filterkey":func, "hqoptions": hqoptions}; TODO hqoptions stringify + var data = {"filterkey":func, "hqoptions": JSON.stringify (hqoptions)}; + var wid = vis.addWidget (widgetName, data, style, null, view); + $("#select_active_widget").append(""); + $("#select_active_widget").multiselect("refresh"); + return wid; + }, + wizardIsWidgetExists: function (view, widgetName) { + for (var w in vis.views[view].widgets) { + if (vis.views[view].widgets[w].tpl == widgetName) { + return true; + } + } + return false; + }, + // Create Date, time, history and may be weather + wizardRunGeneral: function (view) { + var data = { + hm_id: 'nothing_selected', + digits: "", + factor: 1, + min: 0.00, + max: 1.00, + step: 0.01 + }; + + if (!vis.wizardIsWidgetExists (view, "tplTwSimpleClock")) { + var wid = vis.addWidget ("tplTwSimpleClock", {"hideSeconds": "true"}); + $("#select_active_widget").append(""); + $("#select_active_widget").multiselect("refresh"); + } + if (!vis.wizardIsWidgetExists (view, "tplTwSimpleDate")) { + var wid = vis.addWidget ("tplTwSimpleDate", {"showWeekDay": "true"}); + $("#select_active_widget").append(""); + $("#select_active_widget").multiselect("refresh"); + } + if (!vis.wizardIsWidgetExists (view, "tplTwYahooWeather")) { + var wid = vis.addWidget ("tplTwYahooWeather", data, {"width": 205, "height": 229}); + $("#select_active_widget").append(""); + $("#select_active_widget").multiselect("refresh"); + } + if (!vis.wizardIsWidgetExists (view, "tplHqEventlist")) { + var wid = vis.addWidget ("tplHqEventlist", data); + $("#select_active_widget").append(""); + $("#select_active_widget").multiselect("refresh"); + } + }, + wizardRunOneRoom: function (view, roomID, funcs, widgets) { + // Find first created element belongs to this room + var pos = null; + var idCreated = null; + for (var w in vis.views[view].widgets) { + var wObj = vis.views[view].widgets[w]; + if (wObj.data.hqoptions && + wObj.data.hqoptions.indexOf ('"room":"' + localData.metaObjects[roomID]["Name"] + '"') != -1) { +// wObj.data.hqoptions.room == localData.metaObjects[roomID]["Name"]) { TODO hqoptions stringify + if (pos == null) { + pos = {left: wObj.style.left, top: wObj.style.top}; + } else { + if (pos.left > wObj.style.left) { + pos.left = wObj.style.left; + } + if (pos.top > wObj.style.top) { + pos.top = wObj.style.top; + } + } + break; + } + } + + // Find all HM Devices belongs to this room + var elems = localData.metaObjects[roomID]["Channels"]; + for (var i = 0; i < elems.length; i++) { + var devID = localData.metaObjects[elems[i]]["Parent"]; + var widgetName = vis.hmDeviceToWidget (localData.metaObjects[devID]["HssType"]); + if (widgetName) { + // filter out not selected widgets + if (widgets) { + if (widgets == "_nobat") { + if (widgetName == "tplHqLowbat") { + continue; + } + } else + if (widgetName != widgets) { + continue; + } + } + + var isFound = false; + var func = null; + var hm_id = vis.wizardGetPoint(widgetName, elems[i]); + + // Check if this widget exists + for (var w in vis.views[view].widgets) { + if (vis.views[view].widgets[w].data.hqoptions) { + var btn = hqWidgets.Get (w); + if (btn) { + var opt = btn.GetSettings(); + if (elems[i] == opt["hm_id"] || opt["hm_id"] == hm_id) { + isFound = true; + break; + } + } + } + } + // Check function + if (funcs) { + func = vis.wizardGetFunction (elems[i]); + if (funcs != func) { + continue; + } + } + + if (!isFound) { + if (pos == null && idCreated) { + return idCreated; + } + // Create this widget + var widgetId = vis.wizardCreateWidget (view, roomID, localData.metaObjects[func]["Name"], widgetName, devID, elems[i], hm_id, pos); + + if (pos == null) { + idCreated = widgetId; + } + } + } + } + return null; + }, + wizardRun: function (view) { + var room = $('#wizard_rooms').val(); + var widgetIds = []; + if (!room) { + var elems = localData.metaIndex['ENUM_ROOMS'];// IDs of all ROOMS + for (var r in elems) { + if (room != '_general') { + var wid = vis.wizardRunOneRoom (view, elems[r], $('#wizard_funcs').val(), $('#wizard_widgets').val()); + if (wid) { + widgetIds[widgetIds.length] = wid; + } + } else { + vis.wizardRunGeneral (view); + } + } + } else { + if (room != '_general') { + var wid = vis.wizardRunOneRoom (view, room, $('#wizard_funcs').val(), $('#wizard_widgets').val()); + if (wid) { + widgetIds[widgetIds.length] = wid; + } + } else { + vis.wizardRunGeneral (view); + } + } + if (widgetIds.length) { + window.alert(_("Place following widget to the room and start wizard again")); + for (var i = 0; i < widgetIds.length; i++) { + vis.actionNewWidget (widgetIds[i]); + } + vis.inspectWidget(widgetIds[widgetIds.length - 1]); + } + + // Save the changes + vis.binds.hqWidgetsExt.hqEditSave (); + }, + fillWizard: function () { + var elems = localData.metaIndex['ENUM_ROOMS'];// IDs of all ROOMS + var jSelect = $('#wizard_rooms').html("").addClass('dashui-wizard-select'); + for (var r in elems) { + jSelect.append("\n"); + } + jSelect.append(''); + jSelect.append(''); + + elems = localData.metaIndex['ENUM_FUNCTIONS'];// IDs of all ROOMS + jSelect = $('#wizard_funcs').html("").addClass('dashui-wizard-select'); + jSelect.append(''); + for (var r in elems) { + jSelect.append("\n"); + } + jSelect = $('#wizard_widgets').html("").addClass('dashui-wizard-select'); + jSelect.append(''); + jSelect.append(''); + for (var r in vis.hm2Widget) { + for (var i = 0; i < vis.widgetSets.length; i++) { + var name = vis.widgetSets[i].name || vis.widgetSets[i]; + $(".dashui-tpl[data-dashui-set='" + name + "']").each(function () { + if (r == $(this).attr("id")) { + $('#wizard_widgets').append("\n"); + } + }); + } + } + $( "#wizard_run" ).button ({icons: {primary: "ui-icon-wrench"}}).bind( "click", function() { + vis.wizardRun(vis.activeView); + }); + } +}); diff --git a/www/js/words.js b/www/js/words.js new file mode 100644 index 0000000..fa44c5f --- /dev/null +++ b/www/js/words.js @@ -0,0 +1,893 @@ +/** + * ioBroker.vis + * https://github.com/ioBroker/ioBroker.vis + * + * Copyright (c) 2013-2018 bluefox https://github.com/GermanBluefox, hobbyquaker https://github.com/hobbyquaker + * Creative Common Attribution-NonCommercial (CC BY-NC) + * + * http://creativecommons.org/licenses/by-nc/4.0/ + * + * Short content: + * Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. + * Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. + * (Free for non-commercial use). + */ +/* jshint browser:true */ +/* jshint -W097 */// jshint strict:false +/* global $ */ +/* global systemDictionary */ + +'use strict'; + +// Languages +$.extend(systemDictionary, { + 'Views': {'en': 'Views', 'de': 'Views', 'ru': 'Страницы'}, + 'Widgets': {'en': 'Widgets', 'de': 'Widgets', 'ru': 'Элементы'}, + 'CSS Inspector': {'en': 'CSS Inspector', 'de': 'CSS Inspektor', 'ru': 'CSS'}, + 'Misc': {'en': 'Misc', 'de': 'Versch.', 'ru': 'Разное'}, + 'Info': {'en': 'Info', 'de': 'Info', 'ru': 'Инфо'}, + 'default_filter_key': {'en': 'Default filter:', 'de': 'Voreinge. Filter:', 'ru': 'Фильтр по умолчанию:'}, + 'class': {'en': 'CSS Class', 'de': 'CSS Klasse', 'ru': 'CSS Класс'}, + 'Snapping': {'en': 'Snapping', 'de': 'Ausrichten', 'ru': 'Опорные точки'}, + 'disabled': {'en': 'Disabled', 'de': 'Inaktiv', 'ru': 'не активно'}, + 'elements': {'en': 'Elements', 'de': 'Elemente', 'ru': 'элементы'}, + 'grid': {'en': 'Grid', 'de': 'Raster', 'ru': 'таблица'}, + 'grid size': {'en': 'Grid size:', 'de': 'Rastermaß:', 'ru': 'Шаг:'}, + 'theme': {'en': 'Theme', 'de': 'Thema', 'ru': 'Тема'}, + '--different--': {'en': 'different:', 'de': 'verschiedene', 'ru': 'разное'}, + 'Screensize': {'en': 'Screensize:', 'de': 'Bildschirmgröße', 'ru': 'Размер экрана'}, + 'Width': {'en': 'Width (px)', 'de': 'Breite (px)', 'ru': 'Ширина'}, + 'Height': {'en': 'Height (px)', 'de': 'Höhe (px)', 'ru': 'Высота'}, + 'comment': {'en': 'Comment', 'de': 'Kommentar', 'ru': 'Комментарий'}, + 'Room:': {'en': 'Room:', 'de': 'Raum:', 'ru': 'Комната:'}, + 'Function:': {'en': 'Function:', 'de': 'Gewerk:', 'ru': 'Функциональность:'}, + 'Widget:': {'en': 'Widget:', 'de': 'Widget:', 'ru': 'Элемент:'}, + 'New View': {'en': 'New View:', 'de': 'Neue View', 'ru': 'Новая страница'}, + 'Current View': {'en': 'Current View', 'de': 'Aktuelle View', 'ru': 'Текущая страница'}, + 'New Name:': {'en': 'New Name:', 'de': 'Neuer Name:', 'ru': 'Новое имя:'}, + 'Name:': {'en': 'Name:', 'de': 'Name:', 'ru': 'Имя:'}, + 'Mode:': {'en': 'Mode:', 'de': 'Mode:', 'ru': 'Режим:'}, + 'Widget Set:': {'en': 'Widget Set:', 'de': 'Widget Set:', 'ru': 'Пакет элементов:'}, + 'View Attributes': {'en': 'View Attributes', 'de': 'View-Eigenschaften', 'ru': 'Свойства страницы'}, + 'External Commands': {'en': 'External Commands', 'de': 'Externe Befehle', 'ru': 'Внешние комманды'}, + 'View:': {'en': 'View:', 'de': 'View:', 'ru': 'Страница:'}, + 'Wizard': {'en': 'Wizard', 'de': 'Wizard', 'ru': 'Помошник'}, + 'wizard_run': {'en': 'Run', 'de': 'Ausführen', 'ru': 'Выполнить'}, + 'add_view': {'en': 'Add', 'de': 'Hinzufügen', 'ru': 'Добавить'}, + 'dup_view': {'en': 'Duplicate', 'de': 'Duplizieren', 'ru': 'Копировать'}, + 'del_view': {'en': 'Delete', 'de': 'Löschen', 'ru': 'Удалить'}, + 'rename_view': {'en': 'Rename', 'de': 'Umbenennen', 'ru': 'Перемменовать'}, + 'create_instance': {'en': 'Create instance', 'de': 'Browser ID erzeugen', 'ru': 'Создать ID броузера'}, + "Object browser...": {"en": "Object browser...", "de": "Objekt-Browser...", "ru": "Просмотреть объекты..."}, + 'add_widget': {'en': 'Add widget', 'de': 'Widget einfügen', 'ru': 'Добавить'}, + 'del_widget': {'en': 'Delete widget', 'de': 'Löschen', 'ru': 'Удалить'}, + 'dup_widget': {'en': 'Copy to:', 'de': 'Kopieren nach:', 'ru': 'Копия в:'}, + 'Clipboard: ': {'en': 'Clipboard:', 'de': 'Zwischenablage:', 'ru': 'Буфер:'}, + 'New:': {'en': 'New:', 'de': 'Neues:', 'ru': 'Новое:'}, + "name": {"en": "Name", "de": "Name", "ru": "Имя"}, + "Select color": {"en": "Select color", "de": "Farbe auswählen", "ru": "Выбрать цвет"}, + "File manager...": {"en": "File manager...", "de": "Dateimanager...", "ru": 'Проводник...'}, + "Copy to clipboard": {"en": "Copy to clipboard", "de": "In die Zwischenablage kopieren", "ru": "Копировать в буфер обмена"}, + "Wizard to create widgets...": {"en": "Wizard to create widgets...", "de": "Wizard um Widgets zu erzeugen...", "ru": "Создать несколько виджетов..."}, + "Generate": {"en": "Generate", "de": "Generieren", "ru": "Создать"}, + "Attribute for OID:": {"en": "Attribute for OID:", "de": "Attribute für OID:", "ru": "Атрибут для OID:"}, + "Export as zip:": {"en": "Export as zip:", "de": "Exportieren als ZIP:", "ru": "Экспорт ZIP:"}, + "Make template": {"en": "Make template", "de": "Vorlage erzeigen", "ru": "Создать шаблон"}, + "Group from widget": {"en": "Group from widget", "de": "Group from widget", "ru": "Group from widget"}, + "Description:": {"en": "Description:", "de": "Beschreibung:", "ru": "Описание:"}, + "Template Settings": {"en": "Template Settings", "de": "Vorlage-Einstellungen", "ru": "Свойства шаблона"}, + "Do not show again": {"en": "Do not show again", "de": "Nicht mehr zeigen", "ru": "Больше не показывать"}, + 'Confirm widget deletion': { + 'en': 'Confirm widget deletion', + 'de': 'Bestätigung', + 'ru': 'Подтвердите' + }, + 'Widget copied to view %s': { + 'en': 'Widget copied to view %s', + 'de': 'Widget wurde in die View "%s" kopiert', + 'ru': 'Элемент скопирован на страницу %s' + }, + 'Really delete view %s?': { + 'en': 'Really delete view %s?', + 'de': 'Wirklich View "%s" löschen?', + 'ru': 'Вы действительно хотите удалить страницу %s?' + }, + 'Do you want delete %s widgets?': { + 'en': 'Do you want delete %s widgets?', + 'de': 'Wirklich %s Widgets löschen?', + 'ru': 'Вы действительно хотите удалить %s элемента(ов)?' + }, + 'Do you want delete widget %s?': { + 'en': 'Do you want delete widget %s?', + 'de': 'Wirklich %s Widget löschen?', + 'ru': 'Вы действительно хотите удалить элемент %s?' + }, + 'Hide widget description': { + 'en': 'Hide widget description', + 'de': 'Zeige Widget-Beschreibung nicht', + 'ru': 'Скрыть описание элементов' + }, + "Changes are not saved!. Continue?": { + "en": "Changes are not saved!. Continue?", + "de": "Änderungen sind nicht gespeichert!. Weitermachen?", + "ru": "Изменения не сохранены!. Продолжить?" + }, + 'Is hide': {'en': 'Is hide', 'de': 'Verbergen', 'ru': 'Скрыть'}, + 'User defined': {'en': 'User defined', 'de': 'Vom Anwender definiert', 'ru': 'Пользовательское'}, + 'Resolution': {'en': 'Resolution:', 'de': 'Auflösung:', 'ru': 'Разрешение:'}, + 'widget_doc': {'en': 'Widget help', 'de': 'Widgethilfe', 'ru': 'Помощь'}, + 'Add Widget:': {'en': 'Add Widget:', 'de': 'Widget einfügen:', 'ru': 'Добавить элемент:'}, + 'Inspecting Widget:': {'en': 'Inspecting Widget:', 'de': 'Widget inspizieren:', 'ru': 'Редактировать элемент:'}, + 'Widget Attributes:': {'en': 'Widget Attributes:', 'de': 'Widget-Eigenschaften:', 'ru': 'Свойства элемента:'}, + 'filterkey': {'en': 'Filter key', 'de': 'Filterwort', 'ru': 'Фильтр'}, + 'views': {'en': 'Show in views', 'de': 'Zeige in Views', 'ru': 'Показать на страницах'}, + 'Background class': {'en': 'Background class:', 'de': 'Hintergrundklasse:', 'ru': 'CSS класс фона:'}, + 'Background': {'en': 'Background:', 'de': 'Hintergrund:', 'ru': 'CSS класс фона:'}, + 'Webseite': {'en': 'Web link', 'de': 'Webseite', 'ru': 'Веб сайт'}, + 'none selected': {'en': 'none selected', 'de': 'nichts selektiert', 'ru': 'ничего не выбрано'}, + 'Unterstützung': {'en': 'Hilfe', 'de': 'Unterstützung', 'ru': 'Помощь'}, + 'User name': {'en': 'User name', 'de': 'Anwendername', 'ru': 'Логин'}, + 'Password': {'en': 'Password', 'de': 'Kennwort', 'ru': 'Пароль'}, + 'Sign in': {'en': 'Sign in', 'de': 'Anmelden', 'ru': 'Войти'}, + 'Check all': {'en': 'Check all', 'de': 'Alle selektieren', 'ru': 'Выбрать все'}, + 'Uncheck all': {'en': 'Uncheck all', 'de': 'Alle deselektieren', 'ru': 'Убрать все'}, + 'Select options': {'en': 'Select options', 'de': 'Selekt-Eingensch.', 'ru': 'Свойства выбора'}, + 'Änderungs-Historie': {'en': 'Change log', 'de': 'Änderungs-Historie:', 'ru': 'Список изменений'}, + + 'invalid JSON': {'en': 'Invalid JSON', 'de': 'Invalid JSON', 'ru': 'Неправильный формат'}, + 'Do not ask again': {'en': 'Don\'t ask again', 'de': 'Nicht mehr fragen', 'ru': 'Больше не спрашивать'}, + 'import': {'en': 'Import view', 'de': 'View importieren', 'ru': 'Импорт страницы'}, + 'export view': {'en': 'Export view', 'de': 'View exportieren', 'ru': 'Экспорт страницы'}, + 'export': {'en': 'Export view (Ctrl+A, Ctrl+C)', 'de': 'View exportieren (Strg+A, Strg+C)', 'ru': 'Экспорт страницы (Ctrl+A, Ctrl+C)'}, + 'export widgets title': {'en': 'Export widgets (Ctrl+A, Ctrl+C)', 'de': 'Widgets exportieren (Strg+A, Strg+C)', 'ru': 'Экспорт элементов (Ctrl+A, Ctrl+C)'}, + 'import view': {'en': 'Import view', 'de': 'View importieren', 'ru': 'Импорт страницы'}, + 'export views': {'en': 'Export views', 'de': 'View exportieren', 'ru': 'Экспорт страницы'}, + 'import views': {'en': 'Import views', 'de': 'View importieren', 'ru': 'Импорт страницы'}, + "export widgets": {"en": "Export widgets", "de": "Widgets Exportieren", "ru": "Экспорт элементов"}, + "import widgets": {"en": "Import widgets", "de": "Widgets Importieren", "ru": "Импорт элементов"}, + "View name: ": {"en": "View name: ", "de": "Viewname: ", "ru": "Имя страницы: "}, + "More": {"en": "More...", "de": "Mehr...", "ru": "Дальше..."}, + "locked": { + "en": '
    Locked', + "de": '
    Inaktiv(locked)', + "ru": '
    Не выбирать' + }, + 'clear cached views': {'en': 'Clear views from cache', 'de': 'Views aus Browser-Cache löschen', 'ru': 'Очистить страницы из броузера'}, + 'Select object ID': {"en": "Select object ID", "de": "Id vom Objekt auswählen", "ru": "Выбрать ID объекта"}, + 'Select image': {"en": "Select image", "de": "Bild auswählen", "ru": "Выбрать изображение"}, + "all": {"en": "All", "de": "Alle", "ru": "Все"}, + "Copy": {"en": "Copy", "de": "Kopieren", "ru": "Скопировать"}, + "Paste": {"en": "Paste", "de": "Einfügen", "ru": "Вставить"}, + "Delete": {"en": "Delete", "de": "Löschen", "ru": "Удалить"}, + 'from': {"en": "From", "de": "von", "ru": "Выбрать изображение"}, + 'lc': {"en": "Last change", "de": "Letzte Änderung", "ru": "Последнее изменение"}, + 'ts': {"en": "Time stamp", "de": "Zeitstempel", "ru": "Время"}, + 'ack': {"en": "Acknowledged", "de": "Bestätigt", "ru": "Подтверждено"}, + 'expand': {"en": "Expand all nodes", "de": "Alle ausklappen", "ru": "Развернуть все узлы"}, + 'collapse': {"en": "Collapse all nodes", "de": "Alle zusammenklappen", "ru": "Свернуть все узлы"}, + 'refresh': {"en": "Refresh tree/list", "de": "Baum neu aufbauen", "ru": "Построить дерево заново"}, + 'edit': {"en": "Edit", "de": "Ändern", "ru": "Изменить"}, + 'ok': {"en": "Ok", "de": "Ok", "ru": "Ok"}, + 'wait': {"en": "Processing...", "de": "In Bearbeitung...", "ru": "Обработка..."}, + 'list': {"en": "Show list view", "de": "Liste zeigen", "ru": "Показать список"}, + 'tree': {"en": "Show tree view", "de": "Baum zeigen", "ru": "Показать дерево"}, + 'All': {"en": "All", "de": "alle", "ru": "все"}, + 'ID': {"en": "ID", "de": "ID", "ru": "ID"}, + 'Role': {"en": "Role", "de": "Rolle", "ru": "Роль"}, + 'Room': {"en": "Room", "de": "Zimmer", "ru": "Комната"}, + 'Value': {"en": "Value", "de": "Wert", "ru": "Значение"}, + 'Members': {"en": "Members", "de": "Mitglieder", "ru": "Объекты"}, + "nothing": {"en": "none", "de": "keins", "ru": "ничего"}, + "Cut": {"en": "Cut", "de": "Ausschneiden", "ru": "Вырезать"}, + "Bring to front": {"en": "Bring to front", "de": "In den Vordergrund", "ru": "Вынести наверх"}, + "Move to back": {"en": "Move to back", "de": "In den Hintergrund", "ru": "Убрать вниз"}, + 'Import / Export View': { + 'en': 'Import / Export View', + 'de': 'Importieren / Exportieren View', + 'ru': 'Импортировать / Экспортировать страницу' + }, + 'Local Views': { + 'en': 'Local Views (cached)', + 'de': 'Lokal gespeicherte Views', + 'ru': 'Страницы в кеше броузера' + }, + 'View yet exists or name of view is empty': { + 'en': 'View yet exists or name of view is empty.', + 'de': 'View existiert schon oder Name ist nicht eingegeben.', + 'ru': 'Страница уже существует или имя страницы на задано.' + }, + 'please use /dashui/edit.html instead of /dashui/?edit': { + 'en': 'Please use /dashui/edit.html instead of /dashui/?edit', + 'de': 'Bitte /dashui/edit.html statt /dashui/?edit nutzen', + 'ru': 'Используйте /dashui/edit.html вместо /dashui/?edit' + }, + 'The view with the same name yet exists!': { + 'en': 'The view with the same name yet exists!', + 'de': 'Ein View mit diesem Namen existiert bereits!', + 'ru': 'The view with the same name yet exists!' + }, + 'Please enter the name for the new view!': { + 'en': 'Please enter the name for the new view!', + 'de': 'Bitte einen Namen für die neue View eingeben!', + 'ru': 'Пожалуста введите имя для новой страницы!' + }, + 'Instance ID': {'en': 'Instance ID', 'de': 'Instanz ID', 'ru': 'ID броузера'}, + 'Single view': {'en': 'Single view', 'de': 'Nur in aktueller View', 'ru': 'Только на текущей странице'}, +// 'Single mode' : {'en' : 'Only in actual view', 'de': 'Nur in aktueller View', 'ru': 'Только на текущей странице'}, + 'CC BY-NC License': {'en': 'CC BY-NC License', 'de': 'CC BY-NC Lizenz', 'ru': 'Лицензия CC BY-NC'}, + /*'license1' : { + 'en': 'Short content:', + 'de': 'Die Nutzung dieser Software erfolgt auf eigenes Risiko. Der Author dieser Software kann für eventuell auftretende Folgeschäden nicht haftbar gemacht werden!', + 'ru': 'Пользователь использует это программное обеспечение на свой страх и риск. Обязательным условием использования Вами этого программного обеспечения является согласие Вами с отказом авторов программного обеспечения от какой-либо ответственности за любые потери, упущенную выгоду, затраты или убытки в какой-либо форме в связи с использованием Вами или третьими лицами этого программного обеспечения. Используя это программное обеспечене, Вы соглашаетесь с такой дискламацией (отказом от ответственности). В любом другом случае Вы должны немедленно удалить это программное обеспечение.'}, + 'license2' : { + 'en': 'Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these.', + 'de': 'Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt, sie uneingeschränkt zu benutzen, inklusive und ohne Ausnahme dem Recht, sie zu verwenden, kopieren, ändern, fusionieren, verlegen, verbreiten, unterlizenzieren und/oder zu verkaufen, und Personen, die diese Software erhalten, diese Rechte zu geben, unter den folgenden Bedingungen:', + 'ru': 'Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (в дальнейшем именуемыми «Программное Обеспечение»), безвозмездно использовать Программное Обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, добавление, публикацию, распространение, сублицензирование и/или продажу копий Программного Обеспечения, также как и лицам, которым предоставляется данное Программное Обеспечение, при соблюдении следующих условий:'}, + 'license3' : { + 'en': 'Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes.', + 'de': 'Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in allen Kopien oder Teilkopien der Software beizulegen.', + 'ru': 'Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного Обеспечения.'}, + 'license4' : { + 'en': '(Free for non-commercial use)', + 'de': 'DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT, EINSCHLIESSLICH DER GARANTIE ZUR BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF BESCHRÄNKT. IN KEINEM FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE ANSPRÜCHE HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES ODER ANDERS IM ZUSAMMENHANG MIT DER SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE ENTSTANDEN.', + 'ru': 'ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ, НО НЕ ОГРАНИЧИВАЯСЬ ГАРАНТИЯМИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ ПРАВ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО ИСКАМ О ВОЗМЕЩЕНИИ УЩЕРБА, УБЫТКОВ ИЛИ ДРУГИХ ТРЕБОВАНИЙ ПО ДЕЙСТВУЮЩИМ КОНТРАКТАМ, ДЕЛИКТАМ ИЛИ ИНОМУ, ВОЗНИКШИМ ИЗ, ИМЕЮЩИМ ПРИЧИНОЙ ИЛИ СВЯЗАННЫМ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ ИЛИ ИСПОЛЬЗОВАНИЕМ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫМИ ДЕЙСТВИЯМИ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ.'}, + */ + 'license5': { + 'en': ' ', + 'de': ' ', + 'ru': ' ' + }, + 'icons8': { + 'en': 'In this project are used the icons from Icons8 resource.', + 'de': 'In diesem Projekt werden Bilder von Icons8 resource benutzt.', + 'ru': 'В этом проекте используются иконки с ресурса Icons8.' + }, + 'group_fixed': {'en': 'General', 'de': 'Generell', 'ru': 'Фиксированные'}, + 'group_common': {'en': 'Common', 'de': 'Allgemein', 'ru': 'Общие'}, + 'group_css_common': {'en': 'CSS Common', 'de': 'CSS Allgemein', 'ru': 'CSS Основные'}, + 'group_css_font_text': {'en': 'CSS Font & Text', 'de': 'CSS Font & Text', 'ru': 'CSS шрифт и текст'}, + 'group_css_background': {'en': 'CSS background (background-...)', 'de': 'CSS Hintergrund (background-...)', 'ru': 'CSS фон (background-...)'}, + "group_gestures": {"en": "Gestures", "de": "Gesten", "ru": "Жесты"}, + "File": {"en": "File", "de": "Datei", "ru": "Файл"}, + "Dev": {"en": "Dev", "de": "Dev", "ru": "Dev"}, + "Tools": {"en": "Tools", "de": "Tools", "ru": "Инструменты"}, + "Setup": {"en": "Setup", "de": "Setup", "ru": "Настройки"}, + "Theme": {"en": "Theme", "de": "Thema", "ru": "Темы"}, + "Language": {"en": "Language", "de": "Sprache", "ru": "Язык"}, + "Help": {"en": "Help", "de": "Hilfe", "ru": "Помощь"}, + "Shortcuts": {"en": "Shortcuts", "de": "Shortcuts", "ru": "Быстрые клавиши"}, + "About": {"en": "About", "de": "Über das Projekt", "ru": "О проекте"}, + "Active View:": {"en": "Active View:", "de": "Aktiver View:", "ru": "Выбранная страница:"}, + "To View:": {"en": "To View:", "de": "In View:", "ru": "На страницу:"}, + "Active Widget:": {"en": "Active widget:", "de": "Aktives Widget:", "ru": "Выбранный элемент:"}, + "Resolution:": {"en": "Resolution: ", "de": "Auflöung: ", "ru": "Разрешение экрана: "}, + "Widget": {"en": "Widget", "de": "Widget", "ru": "Элемент"}, + "View": {"en": "View", "de": "View", "ru": "Страница"}, + "Default:": {"en": "Default:", "de": "Default:", "ru": "По умолчанию:"}, + "Render always:": {"en": "Render always:", "de": "Immer rendern:", "ru": "Всегда создавать:"}, + "filter_key": {"en": "Initial filter", "de": "Anfangsfilter", "ru": "Фильтр при показе"}, + "templates": {"en": "Templates", "de": "Vorlagen", "ru": "Шаблоны"}, + "Hint": {"en": "Hint", "de": "Hinweis", "ru": "Сообщение"}, + "filter_key_tooltip": { + "en": "If set only widgets with this filter key will be shown.\x0A" + + "Many filter words can be set deivided by comma.", + "de": "Falls gesetzt, werden nur die Widgets mit diesem Filterwort angezeigt.\x0A" + + "Es können mehrere Filterworte mit einem Komma geteilt gesetzt werden.", + "ru": "Если задано, то элементы только с таким ключём фильтра будут показаны.\x0A" + + "Можно задать несколько ключей через запятую" + }, + "templates_help": { + "en": "We have been working hard on it and just want to say, that possible this feature will not be for free, but available for small fee. All created widgets will work, just for the creation and usage of the new templates could be not free.", + "de": "Wir haben hart daran gearbeitet und wollen mitteilen, dass diese Funktion in der Zukunft möglichicherweise für eine kleine Gebühr zur Verfügung stehen wird. Alle erstellten Widgets werden funktionieren, nur die Erstellung und Nutzung der neuen Vorlagen könnte nicht frei sein.", + "ru": "Мы упорно работали над этим и просто хотим сказать, что возможно эта функция в будущем не будет бесплатной и будет доступна за небольшую плату. Все созданные виджеты будут работать, только создание и использование новых шаблонов может быть не бесплатными." + }, + "Switch to runtime in this window": { + "en": "Close editor", + "de": "Editor schließen", + "ru": "Закрыть редактор" + }, + "Switch to runtime in new window": { + "en": "Open runtime in new window", + "de": "Runtime in einem Fenster aufmachen", + "ru": "Открыть Runtime в новом окне" + }, + "Reload all runtimes": {"en": "Reload all runtimes", "de": "Alle Runtimes neu laden", "ru": "Обновить все Runtime"}, + "Projects": {"en": "Projects", "de": "Projekte", "ru": "Проекты"}, + "Lock": {"en": "Lock", "de": "Sperren", "ru": "Lock"}, + "Unlock": {"en": "Unlock", "de": "Entsperren", "ru": "Unlock"}, + "max_rows": {"en": "Maximum rows", "de": "Maximale Zeilenanzahl", "ru": "Максимальное кол-во строк"}, + "CSS:": {"en": "CSS:", "de": "CSS:", "ru": "CSS:"}, + "Web": {"en": "Web", "de": "Web", "ru": "Веб"}, + "Confirm": {"en": "Confirm", "de": "Bestätigen", "ru": "Подтвердить"}, + "Community": {"en": "Community", "de": "Community", "ru": "Разработка"}, + "Change log": {"en": "Change log", "de": "Änderungen", "ru": "Изменения"}, + "CC BY-NC License 4.0": {"en": "CC BY-NC License 4.0", "de": "CC BY-NC Lizenz 4.0", "ru": "CC BY-NC лицензия 4.0"}, + "not defined": {"en": "not defined", "de": "nicht definiert", "ru": "не задано"}, + "PgUp": {"en": "PgUp", "de": "BildOben", "ru": "PgUp"}, + "Prev. View": {"en": "Previous view", "de": "Prev. View", "ru": "Предыдущая страница"}, + "PgDown": {"en": "PgDown", "de": "BildUnten", "ru": "PgDown"}, + "Move Widget 1px": {"en": "Move Widget 1px", "de": "Schiebe Widget auf 1px", "ru": "Сдвинуть элемент на 1 пиксель"}, + "Arrow Keys": {"en": "Arrow Keys", "de": "Pfeiltasten", "ru": "Стрелки"}, + "Move Widget 10px": {"en": "Move Widget 10px", "de": "Schiebe Widget auf 10px", "ru": "Сдвинуть элемент на 10 пикселей"}, + "Ctrl / CMD": {"en": "Ctrl / CMD", "de": "Strg / CMD", " ru": "Ctrl / CMD"}, + "Show develop ribbon": {"en": "Show develop ribbon", "de": "Zeige Entwicklerpanel", "ru": "Показать панель разработчика"}, + "Full screen": {"en": "Full screen", "de": "Vollbild", "ru": "Полный экран"}, + "Next View": {"en": "Next View", "de": "Nächste View", "ru": "Следующая страница"}, + "Add Widget": {"en": "Add Widget", "de": "Widget einfügen", "ru": "Добавить"}, + "Attributes": {"en": "Attributes", "de": "Eigenschaften", "ru": "Свойства"}, + "Align widgets:": {"en": "Align widgets:", "de": "Widgets ausrichten:", "ru": "Выровнять элементы:"}, + "Undo": {"en": "Undo", "de": "Undo", "ru": "Отменить последние действия"}, + "Add new view": {"en": "Add new view", "de": "Neue View einfügen", "ru": "Добавить новую страницу"}, + "Delete actual view": {"en": "Delete actual view", "de": "Löschen aktuelle View", "ru": "Удалить текущую страницу"}, + "Rename view": {"en": "Rename view", "de": "View umbennenen", "ru": "Переименовать страницу"}, + "Copy view": {"en": "Copy view", "de": "View kopieren", "ru": "Скопировать страницу"}, + "Delete widget": {"en": "Delete widget", "de": "Widget löschen", "ru": "Удалить элемент"}, + "Copy widget": {"en": "Copy widget", "de": "Widget kopieren", "ru": "Скопировать элемент"}, + "Help about widget": {"en": "Help about widget", "de": "Hilfe über Widget", "ru": "Помощь к элементу"}, + "Align horizontal/left": {"en": "Align horizontal/left", "de": "Ausrichten waagerecht links", "ru": "Выровнять по горизонтали налево"}, + "Align horizontal/right": {"en": "Align horizontal/right", "de": "Ausrichten waagerecht rechts", "ru": "Выровнять по горизонтали направо"}, + "Align vertical/top": {"en": "Align vertical/top", "de": "Ausrichten senkrecht oben", "ru": "Выровнять по вертикали наверх"}, + "Align vertical/bottom": {"en": "Align vertical/bottom", "de": "Ausrichten senkrecht unten", "ru": "Выровнять по вертикали к низу"}, + "Align horizontal/center": {"en": "Align horizontal/center", "de": "Ausrichten waagerecht zentriert", "ru": "Выровнять по горизонтали по центру"}, + "Align vertical/center": {"en": "Align vertical/center", "de": "Ausrichten senkrecht zentriert", "ru": "Выровнять по вертикали по центру"}, + "Align horizontal/equal": {"en": "Align horizontal/equal", "de": "Ausrichten waagerecht/gleicher Abstand", "ru": "Выровнять по горизонтали на равном расстоянии"}, + "Align vertical/equal": {"en": "Align vertical/equal", "de": "Ausrichten senkrecht/gleicher Abstand", "ru": "Выровнять по вертикали на равном расстоянии"}, + "All widgets:": {"en": "All widgets:", "de": "Alle Widgets:", "ru": "Все элементы:"}, + "Grid": {"en": "Grid", "de": "Gitter", "ru": "Сетка"}, + "Lock all Widgets": {"en": "Lock all Widgets", "de": "Alle Widgets fixieren", "ru": "Блокировать все элементы"}, + "Available for all:": {"en": "Available for all:", "de": "Für alle Anwender:", "ru": "Доступно для всех:"}, + "readOnly": {"en": "read only", "de": "nur lesend", "ru": "только для чтения"}, + "New project...": {"en": "New project...", "de": "Neues Projekt...", "ru": "Новый проект..."}, + "Create new project": {"en": "Create new project", "de": "Neues Projekt", "ru": "Создать новый проект"}, + "No connection": {"en": "No connection", "de": "Verbindungsfehler", "ru": "Связь прервана"}, + "Settings...": {"en": "Settings...", "de": "Einstellungen...", "ru": "Настройки..."}, + "Project name:": {"en": "Project name:", "de": "Projektname:", "ru": "Имя нового проекта:"}, + "Project export/import": {"en": "Project export/import", "de": "Projekt-Export/import", "ru": "Им/экспорт проекта"}, + "import project": {"en": "Import project", "de": "Import projekt", "ru": "Импорт проекта"}, + "import project": {"en": "Import project", "de": "Projektimport", "ru": "Импорт проекта"}, + "Drop the files here": {"en": "Drop the files here", "de": "Hier hinzufügen", "ru": "Добавить..."}, + "bytes": {"en": "bytes", "de": "Bytes", "ru": "байт"}, + "Kb": {"en": "Kb", "de": "Kb", "ru": "Кб"}, + "Mb": {"en": "Mb", "de": "Mb", "ru": "Мб"}, + "Export normal": {"en": "Export (normal)", "de": "Exportieren (normal)", "ru": "Экспорт (обычный)"}, + "Export anonymized": {"en": "Export (anonymized)", "de": "Exportieren (anonymized)", "ru": "Экспорт (анонимный)"}, + "Import": {"en": "Import", "de": "Import", "ru": "Импорт"}, + "Scripts": {"en": "Scripts", "de": "Skripte", "ru": "Скрипты"}, + "Find:": {"en": "Find:", "de": "Suchen:", "ru": "Найти:"}, + "Save scripts": {"en": "Save scripts", "de": "Speichern", "ru": "Сохранить"}, + "group_objects": {"en": "Attributes", "de": "Attribute", "ru": "Атрибуты"}, + "attrCount": {"en": "Count", "de": "Anzahl", "ru": "Количество"}, + "attrName": {"en": "Attribute name", "de": "Attributname", "ru": "Имя атрибута"}, + "attrType": {"en": "Attribute type", "de": "Attributetyp", "ru": "Тип атрибута"}, + "ctr": {"en": "control", "de": "Steuern", "ru": "Управлять"}, + "gauge": {"en": "gauge", "de": "gauge", "ru": "Круглая шкала"}, + "chart": {"en": "chart", "de": "chart", "ru": "График"}, + "barchart": {"en": "barchart", "de": "barchart", "ru": "barchart"}, + "id": {"en": "Object ID", "de": "Objekt ID", "ru": "ID объекта"}, + "image": {"en": "Image", "de": "Bild", "ru": "картинка"}, + "widget": {"en": "Widget", "de": "Widget", "ru": "элемент"}, + "history": {"en": "History", "de": "History", "ru": "история"}, + "attrName1": {"en": "Attribute 1", "de": "Attribut 1", "ru": "Параметр 1"}, + "attrName2": {"en": "Attribute 2", "de": "Attribut 2", "ru": "Параметр 2"}, + "attrName3": {"en": "Attribute 3", "de": "Attribut 3", "ru": "Параметр 3"}, + "attrName4": {"en": "Attribute 4", "de": "Attribut 4", "ru": "Параметр 4"}, + "attrName5": {"en": "Attribute 5", "de": "Attribut 5", "ru": "Параметр 5"}, + "attrName6": {"en": "Attribute 6", "de": "Attribut 6", "ru": "Параметр 6"}, + "attrName7": {"en": "Attribute 7", "de": "Attribut 7", "ru": "Параметр 7"}, + "Only background": {"en": "Only background", "de": "Nur Hintergrund", "ru": "Только background"}, + "Use inside of group groupAttr%s": { + "en": "Use inside of group groupAttr%s", + "de": "Benutze innerhalb der Gruppe groupAttr%s", + "ru": "Используй в группе groupAttr%s" + }, + 'Project "%s" was succseffully imported. Open it?': { + "en": 'Project "%s" was succseffully imported. Open it?', + "de": 'Projekt "%s" wurde erfolgreich importiert. Öffnen?', + "ru": 'Проект "%s" был успешно импортирован. Открыть?' + }, + "Drop files here or click to select one": { + "en": "Drop files here or click to select one...", + "de": "Dateien hereinziehen oder Mausklick, um ein Auswahlfenster zu öffnen...", + "ru": "Перетащите файл сюда или нажмите, что бы выбрать..." + }, + "Invalid file extenstion!": { + "en": "Invalid file extenstion!", + "de": "Ungültige Dateierweiterung!", + "ru": "Неправильный тип файла!" + }, + "Reload if sleep longer than:": { + "en": "Reload if sleep longer than:", + "de": "Neuladen, falls keine Verbindung länger als:", + "ru": "Перезагружать если нет соединения дольше:" + }, + "Destroy inactive view after:": { + "en": "Destroy inactive view:", + "de": "Lösche nicht aktive Views:", + "ru": "Стирать из памяти неактивные страницы:" + }, + "Changes are not saved. Are you sure?": { + "en": "Changes are not saved. Are you sure?", + "de": "Änderungen sind nicht gespeichert. Sicher?", + "ru": "Изменения не сохранены. Вы уверены?" + }, + "never": {"en": "never", "de": "nie", "ru": "никогда"}, + "1 second": {"en": "1 second", "de": "1 Sekunde", "ru": "1 секунда"}, + "2 seconds": {"en": "2 seconds", "de": "2 Sekunden", "ru": "2 секунды"}, + "5 seconds": {"en": "5 seconds", "de": "5 Sekunden", "ru": "5 секунд"}, + "10 seconds": {"en": "10 seconds", "de": "10 Sekunden", "ru": "10 секунд"}, + "20 seconds": {"en": "20 seconds", "de": "20 Sekunden", "ru": "20 секунд"}, + "30 seconds": {"en": "30 seconds", "de": "30 Sekunden", "ru": "30 секунд"}, + "1 minute": {"en": "1 minute", "de": "1 Minute", "ru": "1 минута"}, + "5 minutes": {"en": "5 minutes", "de": "5 Minuten", "ru": "5 минут"}, + "10 minutes": {"en": "10 minutes", "de": "10 Minutenutes", "ru": "10 минут"}, + "30 minutes": {"en": "30 minutes", "de": "30 Minuten", "ru": "30 минут"}, + "1 hour": {"en": "1 hour", "de": "1 Stunde", "ru": "1 час"}, + "2 hours": {"en": "2 hours", "de": "2 Stunden", "ru": "2 часа"}, + "3 hours": {"en": "3 hours", "de": "3 Stunden", "ru": "3 часа"}, + "6 hours": {"en": "6 hours", "de": "6 Stunden", "ru": "6 часов"}, + "12 hours": {"en": "12 hours", "de": "12 Stunden", "ru": "12 часов"}, + "1 day": {"en": "1 day", "de": "1 Tag", "ru": "1 день"}, + "VIS Settings": {"en": "Project settings", "de": "Projekteinstellungen", "ru": "Настройки проекта"}, + //"Änderungen": {"en": "Changes", "de": "Änderungen", "ru": "Изменения"}, + "Reconnect interval:": {"en": "Reconnect interval:", "de": "Wiederverbindungsintervall:", "ru": "Интервал при установке соединения:"}, + "Dark reconnect screen:": {"en": "Dark reconnect screen:", "de": "Dunkler Reconnect-Screen:", "ru": "Тёмный экран при соединении:"}, + "filter": {"en": "Filter", "de": "Filter", "ru": "Фильтр"}, + "navigation": {"en": "Navigation", "de": "Navigation", "ru": "Навигация"}, + "static": {"en": "Static", "de": "Statisch", "ru": "Статичное"}, + "ctrl": {"en": "control", "de": "Steuern", "ru": "Управлять"}, + "stateful": {"en": "stateful", "de": "stateful", "ru": "stateful"}, + "container": {"en": "Container", "de": "Container", "ru": "Контейнер"}, + "val": {"en": "Value", "de": "Wert", "ru": "Значение"}, + "timestamp": {"en": "Timestamp", "de": "Zeitstempel", "ru": "Время"}, + "state": {"en": "State", "de": "Zustand", "ru": "Состояние"}, + "bar": {"en": "Bar", "de": "Bar", "ru": "Bar"}, + "json": {"en": "JSON", "de": "JSON", "ru": "JSON"}, + "table": {"en": "Table", "de": "Tabelle", "ru": "Таблица"}, + "tools": {"en": "Tools", "de": "Hilfsmittel", "ru": "Инструменты"}, + "bool": {"en": "bool", "de": "bool", "ru": "bool"}, + "button": {"en": "button", "de": "button", "ru": "button"}, + "dimmer": {"en": "dimmer", "de": "dimmer", "ru": "dimmer"}, + "temperature": {"en": "temperature", "de": "temperature", "ru": "temperature"}, + "window": {"en": "window", "de": "window", "ru": "window"}, + "shutter": {"en": "shutter", "de": "shutter", "ru": "shutter"}, + "door": {"en": "door", "de": "door", "ru": "door"}, + "lock": {"en": "lock", "de": "lock", "ru": "lock"}, + "checkbox": {"en": "checkbox", "de": "checkbox", "ru": "checkbox"}, + "number": {"en": "number", "de": "number", "ru": "number"}, + "knob": {"en": "knob", "de": "knob", "ru": "knob"}, + "dialog": {"en": "dialog", "de": "dialog", "ru": "dialog"}, + "valve": {"en": "valve", "de": "valve", "ru": "valve"}, + "camera": {"en": "camera", "de": "camera", "ru": "camera"}, + "keyboard": {"en": "keyboard", "de": "keyboard", "ru": "keyboard"}, + "slider": {"en": "slider", "de": "slider", "ru": "slider"}, + "heating": {"en": "heating", "de": "heating", "ru": "heating"}, + "iframe": {"en": "iframe", "de": "iframe", "ru": "iframe"}, + "project": {"en": "project", "de": "project", "ru": "project"}, + "value": {"en": "value", "de": "Wert", "ru": "Значение"}, + "control": {"en": "control", "de": "Steuerung", "ru": "Управление"}, + "Loading stopped": { + "en": "Loading stopped, because no permissins for selected project. Please select other, e.g \"%s/vis/edit.html?main and try one more time.", + "de": "Ladevorgang wurde angehalten, da nicht genügend Rechte vorhanden sind. Bitte wählen Sie ein anderes Projekt, z.B. \"%s/vis/edit.html?main und versuchen Sie es erneut.", + "ru": "Загрузка остановлена, потому что не хватает прав для просмотра проекта. Выберите другой проект, например \"%s/vis/edit.html?main и попробуйте ещё раз." + }, + "Widgets filter. Double click to clear.": { + "en": "Widgets filter. Double click to clear.", + "de": "Widgets-Filter. Doppelklick, um das Feld zu löschen.", + "ru": "Фильтр элементов. Что бы очистить поле ввода - двойной щелчок." + }, + "Cannot save file \"%s\": ": { + "en": "Cannot save file \"%s\": ", + "de": "Kann die Datei \"%s\" nicht speichern: ", + "ru": "Не могу сохранить файл \"%s\": " + }, + "permissionError": { + "en": "permission denied", + "de": "kein Zugriff", + "ru": "отказано в доступе" + }, + "Logout": {"en": "Logout", "de": "Logout", "ru": "Выйти"}, + "Error": {"en": "Error", "de": "Fehler", "ru": "Ошибка"}, + "dev1": {"en": "dev 1", "de": "dev 1", "ru": "dev 1"}, + "dev2": {"en": "dev 2", "de": "dev 2", "ru": "dev 2"}, + "dev3": {"en": "dev 3", "de": "dev 3", "ru": "dev 3"}, + "dev4": {"en": "dev 4", "de": "dev 4", "ru": "dev 4"}, + "dev5": {"en": "dev 5", "de": "dev 5", "ru": "dev 5"}, + "dev6": {"en": "dev6", "de": "dev6", "ru": "dev6"}, + + "Configuration not saved.": { + "en": "Project was not saved yet.", + "de": "Projekt ist noch nicht gespeichert.", + "ru": "Проект не сохранён." + }, + "Clipboard:": {"en": "Clipboard:", "de": "Zwischenablage:", "ru": "Буфер обмена:"}, + "Click to hide": {"en": "Click to hide", "de": "Anklicken, um zu verbergen", "ru": "Нажать, что бы скрыть"}, + "Lock Widget function": {"en": "Disable interaction with widget", "de": "Deaktiviere Widget-Interaktion", "ru": "Деактивировать взаимодействие с элементом"}, + "Lock Widget dragging": {"en": "Lock widget dragging", "de": "Deaktiviere Widget-Verschieben", "ru": "Дективировать перенос виджетов мышкой"}, + "Show type of widgets": {"en": "Show type of widgets", "de": "Zeige Widgettyp", "ru": "Показать тип элемента"}, + "Small widgets": {"en": "Small widgets", "de": "Kleine Widgets", "ru": "Показать маленькие элементы"}, + "to group": {"en": "Group", "de": "Gruppieren", "ru": "Объеденить"}, + "Ungroup": {"en": "Ungroup", "de": "Gruppe aufheben", "ru": "Разъеденить"}, + "Group": {"en": "Group", "de": "Gruppe", "ru": "Группа"}, + "Edit group:": {"en": "Edit group:", "de": "Gruppe editieren:", "ru": "Редактировать:"}, + "%s widgets": {"en": "%s widgets", "de": "%s Widgets", "ru": "%s элемента(ов)"}, + "Widget(s) copied to view %s": { + "en": "Widget(s) copied to view %s", + "de": "Widget(s) wurden zur Seite %s kopiert", + "ru": "Элемент(а) скопированы на страницу %s" + }, + "Select more than one widget and try again.": { + "en": "Select more than one widget and try again.", + "de": "Es muss mehr als ein Widget seleketiert werden.", + "ru": "Выберите больше одного элемента и попробуйте ещё раз." + }, + "Too less widgets": { + "en": "Too less widgets selected", + "de": "Zu wenig selektierte Widgets", + "ru": "Слишком мало выбрано элементов" + }, + "==": {"en": "==", "de": "==", "ru": "=="}, + "!=": {"en": "!=", "de": "!=", "ru": "!="}, + "<=": {"en": "<=", "de": "<=", "ru": "<="}, + ">=": {"en": ">=", "de": ">=", "ru": ">="}, + "<": {"en": "<", "de": "<", "ru": "<"}, + ">": {"en": ">", "de": ">", "ru": ">"}, + "consist": {"en": "consist", "de": "bestehend aus", "ru": "содержит"}, + "not consist": {"en": "not consist", "de": "bestehend nicht aus", "ru": "не содержит"}, + "exist": {"en": "exist", "de": "existiert", "ru": "существует"}, + "not exist": {"en": "not exist", "de": "nicht existiert", "ru": "не существует"}, + "group_visibility": {"en": "Visibility", "de": "Sichtbarkeit", "ru": "Видимость"}, + "visibility-oid": {"en": "Object ID", "de": "Object ID", "ru": "ID Объекта"}, + "visibility-oid_tooltip": { + "en": "Depends on state of object with this ID,\x0Athe widget can be shown or hidden", + "de": "Abhängig von dem Zustand des Objektes mit\x0Adieser ID, kann das Widget verborgen oder angezeigt werden.", + "ru": "Элемент можно показать или скрыть\x0Aв зависимости от состояние объекта с таким ID" + }, + "visibility-cond": {"en": "Сondition", "de": "Bedingung", "ru": "Условие"}, + "visibility-cond_tooltip": { + "en": "E.g. 'Value of Object ID' >= 'Value of condition'", + "de": "Z.B. 'Wert von dem Objekt' >= 'Wert für die Bedingung'", + "ru": "Например 'Значение объекта' >= 'Значения для условия" + }, + "visibility-val": {"en": "Value for condition", "de": "Wert für die Bedingung", "ru": "Значение для условия"}, + "visibility-groups": {"en": "Only for groups", "de": "Nur für Gruppen", "ru": "Для групп"}, + "visibility-groups_tooltip": { + "en": "Select groups, that can view or control this widget", + "de": "Selektiere die Gruppen, die dieses Widget sehen oder steuern dürfen", + "ru": "Выберите группы, которые могут видеть или управлять этим виджетом" + }, + "visibility-groups-action": {"en": "If user not in group", "de": "Falls Anwender nicht in der Gruppe", "ru": "Если пользователь не в группе"}, + "visibility-groups-action_tooltip": { + "en": "If current user not in the given groups, what should happen?", + "de": "Falls aktueller Anwender nicht in den gesetzten Gruppen ist, was soll passieren?", + "ru": "Если пользователь не в указанных группах, что должно произойти?" + }, + "All groups": {"en": "all groups", "de": "Alle Gruppen", "ru": "всех групп"}, + "hide": {"en": "hide", "de": "verbergen", "ru": "скрыть"}, + "oid-working": {"en": "Working Object ID", "de": "Object ID in Arbeit", "ru": "ID в процессе"}, + "min": {"en": "min", "de": "min", "ru": "min"}, + "max": {"en": "max", "de": "max", "ru": "max"}, + + "group_signals": {"en": "Notification icons", "de": "Signalbilder", "ru": "Иконки сигналов"}, + "signals-oid-0": {"en": "Object ID [0]", "de": "Objekt ID [0]", "ru": "ID объекта [0]"}, + "signals-cond-0": {"en": "Condition [0]", "de": "Bedingung [0]", "ru": "Условие [0]"}, + "signals-val-0": {"en": "Value for condition [0]", "de": "Wert für die Bedingung [0]", "ru": "Значение для условия [0]"}, + "signals-icon-0": {"en": "Icon path [0]", "de": "Bild [0]", "ru": "Картинка [0]"}, + "signals-text-0": {"en": "Description [0]", "de": "Beschreibung [0]", "ru": "Описание [0]"}, + "signals-horz-0": {"en": "Horizontal[0]", "de": "Horizontale [0]", "ru": "по горизонтали [0]"}, + "signals-vert-0": {"en": "Vertical [0]", "de": "Vertikale [0]", "ru": "по вертикали [0]"}, + "signals-hide-edit-0": {"en": "Hide by edit [0]", "de": "Nicht zeigen beim Editieren [0]", "ru": "Не показывать в редакторе [0]"}, + "signals-icon-size-0": {"en": "Icon size in px[0]", "de": "Bildgröße in px [0]", "ru": "Размер картинки в px [0]"}, + "signals-icon-style-0": {"en": "CSS icon style [0]", "de": "CSS Bildstil [0]", "ru": "CSS для картинки [0]"}, + "signals-text-style-0": {"en": "CSS text style [0]", "de": "CSS Textstil [0]", "ru": "CSS для текста[0]"}, + "signals-blink-0": {"en": "Blinking [0]", "de": "Blinken [0]", "ru": "Мигание [0]"}, + "signals-text-class-0": {"en": "Classes [0]", "de": "Klassen [0]", "ru": "Классы [0]"}, + + "signals-oid-1": {"en": "Object ID [1]", "de": "Objekt ID [1]", "ru": "ID объекта [1]"}, + "signals-cond-1": {"en": "Condition [1]", "de": "Bedingung [1]", "ru": "Условие [1]"}, + "signals-val-1": {"en": "Value for condition [1]", "de": "Wert für die Bedingung [1]", "ru": "Значение для условия [1]"}, + "signals-icon-1": {"en": "Icon path [1]", "de": "Bild [1]", "ru": "Картинка [1]"}, + "signals-text-1": {"en": "Description [1]", "de": "Beschreibung [1]", "ru": "Описание [1]"}, + "signals-horz-1": {"en": "Horizontal[1]", "de": "Horizontale [1]", "ru": "по горизонтали [1]"}, + "signals-vert-1": {"en": "Vertical [1]", "de": "Vertikale [1]", "ru": "по вертикали [1]"}, + "signals-hide-edit-1": {"en": "Hide by edit [1]", "de": "Nicht zeigen bei Editieren [1]", "ru": "Не показывать в редакторе [1]"}, + "signals-icon-size-1": {"en": "Icon size in px[1]", "de": "Bildgröße in px [1]", "ru": "Размер картинки в px [1]"}, + "signals-icon-style-1": {"en": "CSS icon style [1]", "de": "CSS Bildstil [1]", "ru": "CSS для картинки [1]"}, + "signals-text-style-1": {"en": "CSS text style [1]", "de": "CSS Textstil [1]", "ru": "CSS для текста[1]"}, + "signals-blink-1": {"en": "Blinking [1]", "de": "Blinken [1]", "ru": "Мигание [1]"}, + "signals-text-class-1": {"en": "Classes [1]", "de": "Klassen [1]", "ru": "Классы [1]"}, + + "signals-oid-2": {"en": "Object ID [2]", "de": "Objekt ID [2]", "ru": "ID объекта [2]"}, + "signals-cond-2": {"en": "Condition [2]", "de": "Bedingung [2]", "ru": "Условие [2]"}, + "signals-val-2": {"en": "Value for condition [2]", "de": "Wert für die Bedingung [2]", "ru": "Значение для условия [2]"}, + "signals-icon-2": {"en": "Icon path [2]", "de": "Bild [2]", "ru": "Картинка [2]"}, + "signals-text-2": {"en": "Description [2]", "de": "Beschreibung [2]", "ru": "Описание [2]"}, + "signals-horz-2": {"en": "Horizontal[2]", "de": "Horizontale [2]", "ru": "по горизонтали [2]"}, + "signals-vert-2": {"en": "Vertical [2]", "de": "Vertikale [2]", "ru": "по вертикали [2]"}, + "signals-hide-edit-2": {"en": "Hide by edit [2]", "de": "Nicht zeigen beim Editieren [2]", "ru": "Не показывать в редакторе [2]"}, + "signals-icon-size-2": {"en": "Icon size in px[2]", "de": "Bildgröße in px [2]", "ru": "Размер картинки в px [2]"}, + "signals-icon-style-2": {"en": "CSS icon style [2]", "de": "CSS Bildstil [2]", "ru": "CSS для картинки [2]"}, + "signals-text-style-2": {"en": "CSS text style [2]", "de": "CSS Textstil [2]", "ru": "CSS для текста[2]"}, + "signals-blink-2": {"en": "Blinking [2]", "de": "Blinken [2]", "ru": "Мигание [2]"}, + "signals-text-class-2": {"en": "Classes [2]", "de": "Klassen [2]", "ru": "Классы [2]"}, + + + "group_last_change": {"en": "Show last change", "de": "Zeige letzte Änderung", "ru": "Показать последнее изменение"}, + "lc-oid": {"en": "Object ID", "de": "Objekt ID", "ru": "ID объекта"}, + "lc-type": {"en": "Type", "de": "Typ", "ru": "Тип"}, + "lc-is-interval": {"en": "Interval", "de": "Intervall", "ru": "Интервал"}, + "lc-is-moment": {"en": "Use Moment.js", "de": "Benutze Moment.js", "ru": "Исп. Moment.js"}, + "lc-format": {"en": "Time format", "de": "Zeitformat", "ru": "Формат времени"}, + "lc-position-vert": {"en": "Position vert", "de": "Position vert", "ru": "Положение Y"}, + "lc-position-horz": {"en": "Position horz", "de": "Position horz", "ru": "Положение X"}, + "lc-offset-vert": {"en": "Offset Y", "de": "Offset y", "ru": "Cдвиг по Y"}, + "lc-offset-horz": {"en": "Offset X", "de": "Offset x", "ru": "Cдвиг по X"}, + "lc-font-size": {"en": "font-size", "de": "font-size", "ru": "font-size"}, + "lc-font-family": {"en": "font-family", "de": "font-family", "ru": "font-family"}, + "lc-font-style": {"en": "font-style", "de": "font-style", "ru": "font-style"}, + "lc-bkg-color": {"en": "background", "de": "background", "ru": "background"}, + "lc-color": {"en": "color", "de": "color", "ru": "color"}, + "lc-border-width": {"en": "border-width", "de": "border-width", "ru": "border-width"}, + "lc-border-style": {"en": "border-style", "de": "border-style", "ru": "border-style"}, + "lc-border-color": {"en": "border-color", "de": "border-color", "ru": "border-color"}, + "lc-border-radius": {"en": "border-radius", "de": "border-radius", "ru": "border-radius"}, + "lc-padding": {"en": "padding", "de": "padding", "ru": "padding"}, + "lc-zindex": {"en": "zindex", "de": "zindex", "ru": "zindex"}, + "last-change": {"en": "last change", "de": "Letzte Änderung", "ru": "посл. изменение"}, + "middle": {"en": "middle", "de": "Mitte", "ru": "в середине"}, + + "Global": {"en": "Global", "de": "Global", "ru": "Общая"}, + "Project": {"en": "Project", "de": "Projekt", "ru": "Проект"}, + "Align width": { + "en": "Align width. Press more time to get the desired width.", + "de": "Gleiche Breite. Mehrmals drücken, um gewünschte Breite einzustellen.", + "ru": "Одинаковая ширина. Нажать несколько раз для получения желаемой ширина" + }, + "Align height": { + "en": "Align height. Press more time to get the desired height.", + "de": "Gleiche Höhe. Mehrmals drücken, um gewünschte Höhe einzustellen.", + "ru": "Одинаковая высота. Нажать несколько раз для получения желаемой высоты" + }, + "Find previous": {"en": "Find previous", "de": "Finde vorherige", "ru": "Искать назад"}, + "Find next": {"en": "Find next", "de": "Finde nächste", "ru": "Искать вперёд"}, + "Save CSS": {"en": "Save CSS", "de": "Speichern CSS", "ru": "Сохранить CSS"}, + "CSS": {"en": "CSS", "de": "CSS", "ru": "CSS"}, + 'To get back to edit mode just call "%s" in browser': { + "en": 'To get back to edit mode just call "%s" in browser', + "de": 'Um wieder in den Bearbeitungsmodus zurück zu kehren, einfach "%s" im Browser aufrufen', + "ru": 'Что бы снова вернуться в режим редактирования надо просто вызвать в браузере "%s"' + }, + "Popup window blocked!": { + "en": "Popup window blocked!", + "de": "Popup-Fenster blockiert!", + "ru": "Всплывающее окно заблокировано!" + }, + "Cannot open new window": { + "en": "Cannot open new window", + "de": "Kann kein neues Fenster aufmachen", + "ru": "Не могу открыть новое всплывающее окно" + }, + "License error! Please check logs for details.": { + "en": "License error! Please check logs for details.", + "de": "Lizenzfehler! Bitte überprüfen Sie die Log-Protokolle für Details.", + "ru": "Ошибка лицензии! Пожалуйста, проверьте логи." + }, + + "css_position": {"en": "position", "de": "position", "ru": "position"}, + "css_display": {"en": "display", "de": "display", "ru": "display"}, + "css_left": {"en": "left", "de": "left", "ru": "left"}, + "css_top": {"en": "top", "de": "top", "ru": "top"}, + "css_width": {"en": "width", "de": "width", "ru": "width"}, + "css_height": {"en": "height", "de": "height", "ru": "height"}, + "css_z-index": {"en": "z-index", "de": "z-index", "ru": "z-index"}, + "css_overflow-x": {"en": "overflow-x", "de": "overflow-x", "ru": "overflow-x"}, + "css_overflow-y": {"en": "overflow-y", "de": "overflow-y", "ru": "overflow-y"}, + "css_color": {"en": "color", "de": "color", "ru": "color"}, + "css_opacity": {"en": "opacity", "de": "opacity", "ru": "opacity"}, + "css_cursor": {"en": "cursor", "de": "cursor", "ru": "cursor"}, + "css_text-align": {"en": "text-align", "de": "text-align", "ru": "text-align"}, + "css_text-shadow": {"en": "text-shadow", "de": "text-shadow", "ru": "text-shadow"}, + "css_font-family": {"en": "font-family", "de": "font-family", "ru": "font-family"}, + "css_font-style": {"en": "font-style", "de": "font-style", "ru": "font-style"}, + "css_font-variant": {"en": "font-variant", "de": "font-variant", "ru": "font-variant"}, + "css_font-weight": {"en": "font-weight", "de": "font-weight", "ru": "font-weight"}, + "css_font-size": {"en": "font-size", "de": "font-size", "ru": "font-size"}, + "css_line-height": {"en": "line-height", "de": "line-height", "ru": "line-height"}, + "css_letter-spacing": {"en": "letter-spacing", "de": "letter-spacing", "ru": "letter-spacing"}, + "css_word-spacing": {"en": "word-spacing", "de": "word-spacing", "ru": "word-spacing"}, + "css_background": {"en": "background", "de": "background", "ru": "background"}, + "css_background-color": {"en": "-color", "de": "-color", "ru": "-color"}, + "css_background-image": {"en": "-image", "de": "-image", "ru": "-image"}, + "css_background-repeat": {"en": "-repeat", "de": "-repeat", "ru": "-repeat"}, + "css_background-attachment": {"en": "-attachment", "de": "-attachment", "ru": "-attachment"}, + "css_background-position": {"en": "-position", "de": "-position", "ru": "-position"}, + "css_background-size": {"en": "-size", "de": "-size", "ru": "-size"}, + "css_background-clip": {"en": "-clip", "de": "-clip", "ru": "-clip"}, + "css_background-origin": {"en": "-origin", "de": "-origin", "ru": "-origin"}, + "group_css_border": {"en": "CSS Border (border-...)", "de": "CSS Ränder (border-...)", "ru": "CSS рамка (border-...)"}, + "css_border-width": {"en": "-width", "de": "-width", "ru": "-width"}, + "css_border-style": {"en": "-style", "de": "-style", "ru": "-style"}, + "css_border-color": {"en": "-color", "de": "-color", "ru": "-color"}, + "css_border-radius": {"en": "-radius", "de": "-radius", "ru": "-radius"}, + "group_css_shadow_padding": {"en": "CSS padding & shadow", "de": "CSS Schatten und Abstand", "ru": "CSS Тень и отступы"}, + "css_padding": {"en": "padding", "de": "padding", "ru": "padding"}, + "css_padding-left": {"en": "padding-left", "de": "padding-left", "ru": "padding-left"}, + "css_padding-top": {"en": "padding-top", "de": "padding-top", "ru": "padding-top"}, + "css_padding-right": {"en": "padding-right", "de": "padding-right", "ru": "padding-right"}, + "css_padding-bottom": {"en": "padding-bottom", "de": "padding-bottom", "ru": "padding-bottom"}, + "css_transform": {"en": "transform", "de": "transform", "ru": "transform"}, + "css_transform_tooltip": { + "en": "Transformation that affects an element's appearance\x0A" + + "Only visible, if widget is NOT selected.\x0A" + + "Examples: rotate(45deg) scale(0.5) skew(10deg)", + "de": "Transformation, die das Aussehen eines Elements beeinflusst\x0A" + + "Nur sichtbar, wenn das Widget NICHT ausgewählt ist.\x0A" + + "Beispiele: rotate(45deg) scale(0.5) skew(10deg)", + "ru": "Трансформация, которая влияет на внешний вид элемента\x0A" + + "Видно только, если виджет НЕ выбран.\x0A" + + "Примеры: rotate(45deg) scale(0.5) skew(10deg)" + }, + "css_margin-left": {"en": "margin-left", "de": "margin-left", "ru": "margin-left"}, + "css_margin-top": {"en": "margin-top", "de": "margin-top", "ru": "margin-top"}, + "css_margin-right": {"en": "margin-right", "de": "margin-right", "ru": "margin-right"}, + "css_margin-bottom": {"en": "margin-bottom", "de": "margin-bottom", "ru": "margin-bottom"}, + "css_box-shadow": {"en": "box-shadow", "de": "box-shadow", "ru": "box-shadow"}, + "css_box-shadow_tooltip": { + "en": "h-shadow v-shadow blur spread color\x0A" + + "h-shadow: Required. The position of the horizontal shadow. Negative values are allowed\x0A" + + "v-shadow: Required. The position of the vertical shadow. Negative values are allowed\x0A" + + "blur: Optional. The blur distance\x0A" + + "spread: Optional. The size of shadow\x0A" + + "color: Optional. The color of the shadow. The default value is black. Look at CSS Color Values for a complete list of possible color values.\x0A" + + "inset: Optional. Changes the shadow from an outer shadow (outset) to an inner shadow.", + "de": "inset [ ]\x0A" + + "inset: Die Angabe ist optional. Wenn nicht festgelegt, wird angenommen, dass es sich um einen Schlagschatten handelt.\x0A" + + "X-Verschiebung Y-Verschiebung: Eine Angabe ist erforderlich. Es gibt zwei Längenwerte, die die Verschiebung des Schattens angeben. Negative Werte sind auch möglich.\x0A" + + "Unschärfe-Radius: Die Angabe ist optional und Null, wenn kein gesetzt wurde. Je großer der Wert, desto größer die Unschärfe.\x0A" + + "Ausbreitungsradius: Eine weitere Längenangabe, deren Angabe optional ist. Wenn nicht festgelegt ist der Ausbreitungsradius 0 und der Schatten hat die gleiche Größe wie das Element.\x0A" + + "Farbe: Die Angabe ist optional. Wenn nicht festgelegt, hängt die Farbe vom Browser ab. In Gecko (Firefox) wird der Wert der color Eigenschaft verwendet.\x0A", + "ru": "inset <сдвиг по x> <сдвиг по y> <радиус размытия> <растяжение> <цвет>\x0A" + + "inset: Тень выводится внутри элемента. Необязательный параметр.\x0A" + + "сдвиг по x: Смещение тени по горизонтали относительно элемента. Положительное значение этого параметра задает сдвиг тени вправо, отрицательное — влево. Обязательный параметр.\x0A" + + "сдвиг по y: Смещение тени по вертикали относительно элемента. Положительное значение задает сдвиг тени вниз, отрицательное — вверх. Обязательный параметр.\x0A" + + "радиус размытия: Задает радиус размытия тени. Чем больше это значение, тем сильнее тень сглаживается, становится шире и светлее. Если этот параметр не задан, по умолчанию устанавливается равным 0, тень при этом будет четкой, а не размытой.\x0A" + + "растяжение: Положительное значение растягивает тень, отрицательное, наоборот, ее сжимает. Если этот параметр не задан, по умолчанию устанавливается 0, при этом тень будет того же размера, что и элемент.\x0A" + + "цвет: Цвет тени в любом доступном CSS формате, по умолчанию тень черная. Необязательный параметр." + }, + "group_css_animation": {"en": "CSS Animation", "de": "CSS Animation", "ru": "CSS Анимация"}, + "css_animation-name": {"en": "animation-name", "de": "animation-name", "ru": "animation-name"}, + "css_animation-duration": {"en": "animation-duration", "de": "animation-duration", "ru": "animation-duration"}, + + "gestures-indicator": {"en": "Gesture Indicator", "de": "Gestenindikator", "ru": "Индикатор изменения"}, + "gestures-indicator_tooltip": { + "en": "Create and style \"basic - Gesture Indicator\".\x0AOne indicator can be used in many widgets.", + "de": "Erzeuge einen \"basic - Gesture Indicator\" und setze Stil dafür.\x0AEin Gestenindikator kann für mehrere Widgets benutzt werden.", + "ru": "Создайте \"basic - Gesture Indicator\"и задайте стиль. Один индикатор может использоваться во многих элементах." + }, + "gestures-offsetX": {"en": "-offset X", "de": "Versatz X", "ru": "Сдвиг по X"}, + "gestures-offsetY": {"en": "-offset Y", "de": "Versatz Y", "ru": "Сдвиг по Y"}, + + "gestures-swiping-oid": {"en": "swiping Object ID", "de": "swiping Object ID", "ru": "ID объекта при скольжении"}, + "gestures-swiping-oid_tooltip": { + "en": "Object ID of the state to be changed", + "de": "Objekt ID des zu ändernden Zustandes", + "ru": "ID объекта, который будет изменятся" + }, + "gestures-swiping-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-swiping-value_tooltip": { + "en": "value or step (e.g. 0.5 or -0.5)", + "de": "Wert oder Veränderung (z. B. 0.5 or -0.5)", + "ru": "значение или шаг (например 0.5 или -0.5)" + }, + "gestures-swiping-maximum": {"en": "-max value", "de": "-max Wert", "ru": "-макс. значение"}, + "gestures-swiping-maximum_tooltip": { + "en": "maximum value", + "de": "maximaler Wert", + "ru": "минимальное значение" + }, + "gestures-swiping-minimum": {"en": "-min value", "de": "-min Wert", "ru": "-мин. значение"}, + "gestures-swiping-minimum_tooltip": { + "en": "minimum value", + "de": "minimaler Wert", + "ru": "максимальное значение" + }, + "gestures-swiping-delta": {"en": "-delta", "de": "-delta", "ru": "-дельта"}, + "gestures-swiping-delta_tooltip": { + "en": "value gets changed after that many pixels movement", + "de": "Wert wird nach so viele Pixeln Bewegung verändert", + "ru": "value gets changed after that many pixels movement" + }, + "gestures-rotating-oid": {"en": "rotating Object ID", "de": "rotating Object ID", "ru": "ID объекта при кручении"}, + "gestures-rotating-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-rotating-maximum":{"en": "-max value", "de": "-max Wert", "ru": "-макс. значение"}, + "gestures-rotating-minimum":{"en": "-min value", "de": "-min Wert", "ru": "-мин. значение"}, + "gestures-rotating-delta": {"en": "-delta", "de": "-delta", "ru": "-дельта"}, + "gestures-pinching-oid": {"en": "pinching Object ID", "de": "pinching Object ID", "ru": "ID объекта при увеличении/уменьшении"}, + "gestures-pinching-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-pinching-maximum":{"en": "-max value", "de": "-max Wert", "ru": "-макс. значение"}, + "gestures-pinching-minimum":{"en": "-min value", "de": "-min Wert", "ru": "-мин. значение"}, + "gestures-pinching-delta": {"en": "-delta", "de": "-delta", "ru": "-дельта"}, + "gestures-swipeRight-oid": {"en": "swipe right Object ID", "de": "swipe right Object ID", "ru": "ID объекта при скольжении вправо"}, + "gestures-swipeRight-oid_tooltip": { + "en": "Object ID of the state to be changed", + "de": "Objekt ID des zu ändernden Zustandes", + "ru": "ID объекта, который будет изменятся" + }, + "gestures-swipeRight-value":{"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-swipeRight-value_tooltip": { + "en": "value or step (e.g. 0.5 or -0.5)", + "de": "Wert oder Veränderung (z. B. 0.5 or -0.5)", + "ru": "значение или шаг (например 0.5 или -0.5)" + }, + "gestures-swipeRight-limit":{"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-swipeRight-limit_tooltip": { + "en": "minimum or maximum value", + "de": "minimaler oder maximaler Wert", + "ru": "минимальное или максимальное значение" + }, + "gestures-swipeLeft-oid": {"en": "swipe left Object ID", "de": "swipe left Object ID", "ru": "ID объекта при скольжении влево"}, + "gestures-swipeLeft-oid_tooltip": { + "en": "Object ID of the state to be changed", + "de": "Objekt ID des zu ändernden Zustandes", + "ru": "ID объекта, который будет изменятся" + }, + "gestures-swipeLeft-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-swipeLeft-value_tooltip": { + "en": "value or step (e.g. 0.5 or -0.5)", + "de": "Wert oder Veränderung (z. B. 0.5 or -0.5)", + "ru": "значение или шаг (например 0.5 или -0.5)" + }, + "gestures-swipeLeft-limit": {"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-swipeLeft-limit_tooltip": { + "en": "minimum or maximum value", + "de": "minimaler oder maximaler Wert", + "ru": "минимальное или максимальное значение" + }, + "gestures-swipeUp-oid": {"en": "swipe up Object ID", "de": "swipe up Object ID", "ru": "ID объекта при скольжении вверх"}, + "gestures-swipeUp-oid_tooltip": { + "en": "Object ID of the state to be changed", + "de": "Objekt ID des zu ändernden Zustandes", + "ru": "ID объекта, который будет изменятся" + }, + "gestures-swipeUp-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-swipeUp-value_tooltip": { + "en": "value or step (e.g. 0.5 or -0.5)", + "de": "Wert oder Veränderung (z. B. 0.5 or -0.5)", + "ru": "значение или шаг (например 0.5 или -0.5)" + }, + "gestures-swipeUp-limit": {"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-swipeUp-limit_tooltip": { + "en": "minimum or maximum value", + "de": "minimaler oder maximaler Wert", + "ru": "минимальное или максимальное значение" + }, + "gestures-swipeDown-oid": {"en": "swipe down Object ID", "de": "swipe down Object ID", "ru": "ID объекта при скольжении вниз"}, + "gestures-swipeDown-oid_tooltip": { + "en": "Object ID of the state to be changed", + "de": "Objekt ID des zu ändernden Zustandes", + "ru": "ID объекта, который будет изменятся" + }, + "gestures-swipeDown-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-swipeDown-value_tooltip": { + "en": "value or step (e.g. 0.5 or -0.5)", + "de": "Wert oder Veränderung (z. B. 0.5 or -0.5)", + "ru": "значение или шаг (например 0.5 или -0.5)" + }, + "gestures-swipeDown-limit": {"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-swipeDown-limit_tooltip": { + "en": "minimum or maximum value", + "de": "minimaler oder maximaler Wert", + "ru": "минимальное или максимальное значение" + }, + "gestures-rotateLeft-oid": {"en": "rotate left Object ID", "de": "rotate left Object ID", "ru": "ID объекта при кручении на лево"}, + "gestures-rotateLeft-value":{"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-rotateLeft-limit":{"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-rotateRight-oid": {"en": "rotate right Object ID", "de": "rotate right Object ID", "ru": "ID объекта при кручении на право"}, + "gestures-rotateRight-value":{"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-rotateRight-limit":{"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-pinchIn-oid": {"en": "pinch in Object ID", "de": "pinch in Object ID", "ru": "ID объекта при увеличении"}, + "gestures-pinchIn-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-pinchIn-limit": {"en": "-limit", "de": "-limit", "ru": "-ограничение"}, + "gestures-pinchOut-oid": {"en": "pinch out Object ID", "de": "pinch out Object ID", "ru": "ID объекта при уменьшении"}, + "gestures-pinchOut-value": {"en": "-value", "de": "-Wert", "ru": "-значение"}, + "gestures-pinchOut-limit": {"en": "-limit", "de": "-limit", "ru": "-ограничение"} +}); \ No newline at end of file diff --git a/www/lib/ace/ace.js b/www/lib/ace/ace.js new file mode 100644 index 0000000..4d27ea6 --- /dev/null +++ b/www/lib/ace/ace.js @@ -0,0 +1,11 @@ +(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE="",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;et.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+ta)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n=0?parseFloat((i.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=(window.Controllers||window.controllers)&&window.navigator.product==="Gecko",t.isOldGecko=t.isGecko&&parseInt((i.match(/rv\:(\d+)/)||[])[1],10)<4,t.isOpera=window.opera&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(i.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(i.split(" Chrome/")[1])||undefined,t.isAIR=i.indexOf("AdobeAIR")>=0,t.isIPad=i.indexOf("iPad")>=0,t.isTouchPad=i.indexOf("TouchPad")>=0,t.isChromeOS=i.indexOf(" CrOS ")>=0}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t,n){var o=s(t);if(!i.isMac&&u){if(u[91]||u[92])o|=8;if(u.altGr){if((3&o)==3)return;u.altGr=0}if(n===18||n===17){var f="location"in t?t.location:t.keyLocation;if(n===17&&f===1)u[n]==1&&(a=t.timeStamp);else if(n===18&&o===3&&f===2){var l=t.timeStamp-a;l<50&&(u.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1),o&8&&(n===91||n===93)&&(n=-1);if(!o&&n===13){var f="location"in t?t.location:t.keyLocation;if(f===3){e(t,o,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&o&8){e(t,o,n);if(t.defaultPrevented)return;o&=-9}return!!o||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,o,n):!1}function f(e){u=Object.create(null)}var r=e("./keys"),i=e("./useragent");t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent("on"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent("on"+t,n._wrapper||n)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,"mousemove",n,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}return t.addListener(document,"mousemove",n,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0),i},t.addTouchMoveListener=function(e,n){if("ontouchmove"in e){var r,i;t.addListener(e,"touchstart",function(e){var t=e.changedTouches[0];r=t.clientX,i=t.clientY}),t.addListener(e,"touchmove",function(e){var t=1,s=e.changedTouches[0];e.wheelX=-(s.clientX-r)/t,e.wheelY=-(s.clientY-i)/t,r=s.clientX,i=s.clientY,n(e)})}},t.addMouseWheelListener=function(e,n){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){var o=0,u,a,f,l={2:"dblclick",3:"tripleclick",4:"quadclick"};t.addListener(e,"mousedown",function(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}e._clicks=o,r[s]("mousedown",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}),i.isOldIE&&t.addListener(e,"dblclick",function(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s]("mousedown",e),r[s](l[o],e)})};var s=!i.isMac||!i.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[s(e)]};var u=null,a=0;t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var s=null;r(e,"keydown",function(e){s=e.keyCode}),r(e,"keypress",function(e){return o(n,e,s)})}else{var a=null;r(e,"keydown",function(e){u[e.keyCode]=(u[e.keyCode]||0)+1;var t=o(n,e,e.keyCode);return a=e.defaultPrevented,t}),r(e,"keypress",function(e){a&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),a=null)}),r(e,"keyup",function(e){u[e.keyCode]=null}),u||(f(),r(window,"focus",f))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+l;t.addListener(n,"message",function i(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,"message",i),e())}),n.postMessage(r,"*")}}t.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;n.$blockScrolling++,this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select"),n.$blockScrolling--},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);t.$blockScrolling++;if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=f(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.$blockScrolling--,t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);n.$blockScrolling++;if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=f(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.$blockScrolling--,n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>o||t-this.mousedownEvent.time>this.$focusTimout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=e.domEvent.timeStamp,n=t-(this.$lastScrollTime||0),r=this.editor,i=r.renderer.isScrollableBy(e.wheelX*e.speed,e.wheelY*e.speed);if(i||n<200)return this.$lastScrollTime=t,r.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()},this.onTouchMove=function(e){var t=e.domEvent.timeStamp,n=t-(this.$lastScrollTime||0),r=this.editor,i=r.renderer.isScrollableBy(e.wheelX*e.speed,e.wheelY*e.speed);if(i||n<200)return this.$lastScrollTime=t,r.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}}).call(u.prototype),t.DefaultHandlers=u}),define("ace/tooltip",["require","exports","module","ace/lib/oop","ace/lib/dom"],function(e,t,n){"use strict";function s(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}var r=e("./lib/oop"),i=e("./lib/dom");(function(){this.$init=function(){return this.$element=i.createElement("div"),this.$element.className="ace_tooltip",this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){i.setInnerText(this.getElement(),e)},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+"px",this.getElement().style.top=t+"px"},this.setClassName=function(e){i.addCssClass(this.getElement(),e)},this.show=function(e,t,n){e!=null&&this.setText(e),t!=null&&n!=null&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display="none",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth}}).call(s.prototype),t.Tooltip=s}),define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event","ace/tooltip"],function(e,t,n){"use strict";function u(e){function l(){var r=u.getDocumentPosition().row,s=n.$annotations[r];if(!s)return c();var o=t.session.getLength();if(r==o){var a=t.renderer.pixelToScreenCoordinates(0,u.y).row,l=u.$pos;if(a>t.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("
    "),i.setHtml(f),i.show(),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=n.$cells[t.session.documentToScreenRow(r,0)].element,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t.removeEventListener("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.$blockScrolling+=1,t.moveCursorToPosition(e),t.$blockScrolling-=1,S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.$blockScrolling+=1,t.selection.fromOrientedRange(m),t.$blockScrolling-=1,t.isFocused()&&!w&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&t.session.remove(t.getSelectionRange()),t.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e)),i.addListener(c,"dragend",this.onDragEnd.bind(e)),i.addListener(c,"dragenter",this.onDragEnter.bind(e)),i.addListener(c,"dragover",this.onDragOver.bind(e)),i.addListener(c,"dragleave",this.onDragLeave.bind(e)),i.addListener(c,"drop",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("./dom");t.get=function(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.onreadystatechange=function(){n.readyState===4&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=r.getDocumentHead(),i=document.createElement("script");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,n){if(n||!i.readyState||i.readyState=="loaded"||i.readyState=="complete")i=i.onload=i.onreadystatechange=null,n||t()}},t.qualifyURL=function(e){var t=document.createElement("a");return t.href=e,t.href}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a)},t.init=f}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("../config"),l=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){(!document.hasFocus||!document.hasFocus())&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click")),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove")),r.addMultiMouseDownListener(u,[400,300,250],this,"onMouseEvent"),e.renderer.scrollBarV&&(r.addMultiMouseDownListener(e.renderer.scrollBarV.inner,[400,300,250],this,"onMouseEvent"),r.addMultiMouseDownListener(e.renderer.scrollBarH.inner,[400,300,250],this,"onMouseEvent"),i.isIE&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n),r.addListener(e.renderer.scrollBarH.element,"mousedown",n))),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),r.addTouchMoveListener(e.container,this.onTouchMove.bind(this,"touchmove"));var f=e.renderer.$gutter;r.addListener(f,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),r.addListener(f,"click",this.onMouseEvent.bind(this,"gutterclick")),r.addListener(f,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),r.addListener(f,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),r.addListener(u,"mousedown",n),r.addListener(f,"mousedown",function(t){return e.focus(),r.preventDefault(t)}),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.onTouchMove=function(e,t){var n=new u(t,this.editor);n.speed=1,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor.renderer;n.$keepTextAreaAtCursor&&(n.$keepTextAreaAtCursor=null);var s=this,o=function(e){if(!e)return;if(i.isWebKit&&!e.which&&s.releaseMouse)return s.releaseMouse();s.x=e.clientX,s.y=e.clientY,t&&t(e),s.mouseEvent=new u(e,s.editor),s.$mouseMoved=!0},a=function(e){clearInterval(l),f(),s[s.state+"End"]&&s[s.state+"End"](e),s.state="",n.$keepTextAreaAtCursor==null&&(n.$keepTextAreaAtCursor=!0,n.$moveTextAreaToCursor()),s.isMousePressed=!1,s.$onCaptureMouseMove=s.releaseMouse=null,e&&s.onMouseEvent("mouseup",e)},f=function(){s[s.state]&&s[s.state](),s.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){a(e)});s.$onCaptureMouseMove=o,s.releaseMouse=r.capture(this.editor.container,o,a);var l=setInterval(f,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(l.prototype),f.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=l}),define("ace/mouse/fold_handler",["require","exports","module"],function(e,t,n){"use strict";function r(e){e.on("click",function(t){var n=t.getDocumentPosition(),r=e.session,i=r.getFoldAt(n.row,n.column,1);i&&(t.getAccelKey()?r.removeFold(i):r.expandFold(i),t.stop())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}t.FoldHandler=r}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){var t=this.$callKeyboardHandlers(-1,e);t||this.$editor.commands.exec("insertstring",this.$editor,e)}}).call(s.prototype),t.KeyBinding=s}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.rowt.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.isEmpty()?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){var e=this.doc.getLength()-1;this.setSelectionAnchor(0,0),this.moveCursorTo(e,this.doc.getLine(e).length)},this.setRange=this.setSelectionRange=function(e,t){t?(this.setSelectionAnchor(e.end.row,e.end.column),this.selectTo(e.start.row,e.start.column)):(this.setSelectionAnchor(e.start.row,e.start.column),this.selectTo(e.end.row,e.end.column)),this.getRange().isEmpty()&&(this.$isEmpty=!0),this.$desiredColumn=null},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(e.column-n,e.column).split(" ").length-1==n?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i;this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var s=this.session.getFoldAt(e,t,1);if(s){this.moveCursorTo(s.end.row,s.end.column);return}if(i=this.session.nonTokenRe.exec(r))t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t);if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e0&&this.moveCursorWordLeft();return}if(o=this.session.tokenRe.exec(s))t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0;this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t,n=0,r,i=/\s/,s=this.session.tokenRe;s.lastIndex=0;if(t=this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{while((r=e[n])&&i.test(r))n++;if(n<1){s.lastIndex=0;while((r=e[n])&&!s.test(r)){s.lastIndex=0,n++;if(i.test(r)){if(n>2){n--;break}while((r=e[n])&&i.test(r))n++;if(n>2)break}}}}return s.lastIndex=0,n},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column);t===0&&(this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var r=this.session.screenToDocumentPosition(n.row+e,n.column);e!==0&&t===0&&r.row===this.lead.row&&r.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[r.row]&&r.row++,this.moveCursorTo(r.row,r.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0,this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e.call(null,this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;il){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;yi){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}}}).call(r.prototype),t.TokenIterator=r}),define("ace/mode/text",["require","exports","module","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(e,t,n){"use strict";var r=e("../tokenizer").Tokenizer,i=e("./text_highlight_rules").TextHighlightRules,s=e("./behaviour").Behaviour,o=e("../unicode"),u=e("../lib/lang"),a=e("../token_iterator").TokenIterator,f=e("../range").Range,l=function(){this.HighlightRules=i,this.$behaviour=new s};(function(){this.tokenRe=new RegExp("^["+o.packages.L+o.packages.Mn+o.packages.Mc+o.packages.Nd+o.packages.Pc+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+o.packages.L+o.packages.Mn+o.packages.Mc+o.packages.Nd+o.packages.Pc+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules,this.$tokenizer=new r(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(e,t,n,r){function w(e){for(var t=n;t<=r;t++)e(i.getLine(t),t)}var i=t.doc,s=!0,o=!0,a=Infinity,f=t.getTabSize(),l=!1;if(!this.lineCommentStart){if(!this.blockComment)return!1;var c=this.blockComment.start,h=this.blockComment.end,p=new RegExp("^(\\s*)(?:"+u.escapeRegExp(c)+")"),d=new RegExp("(?:"+u.escapeRegExp(h)+")\\s*$"),v=function(e,t){if(g(e,t))return;if(!s||/\S/.test(e))i.insertInLine({row:t,column:e.length},h),i.insertInLine({row:t,column:a},c)},m=function(e,t){var n;(n=e.match(d))&&i.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(p))&&i.removeInLine(t,n[1].length,n[0].length)},g=function(e,n){if(p.test(e))return!0;var r=t.getTokens(n);for(var i=0;i2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(ne.length&&(E=e.length)}),a==Infinity&&(a=E,s=!1,o=!1),l&&a%f!=0&&(a=Math.floor(a/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new a(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,l=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new f(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new a(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new f(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);l.start.row==c&&(l.start.column+=h),l.end.row==c&&(l.end.column+=h),t.selection.fromOrientedRange(l)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)e[t]&&(this.$embeds.push(t),this.$modes[t]=new e[t]);var n=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.columnthis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){!e instanceof o&&(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4&&this.$splitAndapplyLargeDelta(e,2e4),i(this.$lines,e,t),this._signal("change",e)},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length,i=e.start.row,s=e.start.column,o=0,u=0;do{o=u,u+=t-1;var a=n.slice(o,u);if(u>r){e.lines=a,e.start.row=i+o,e.start.column=s;break}a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}while(!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.rowthis.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.call(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.rowr)break;l.start.row==r&&l.start.column>=t.column&&(l.start.column!=t.column||!this.$insertRight)&&(l.start.column+=o,l.start.row+=s);if(l.end.row==r&&l.end.column>=t.column){if(l.end.column==t.column&&this.$insertRight)continue;l.end.column==t.column&&o>0&&al.start.column&&l.end.column==u[a+1].start.column&&(l.end.column-=o),l.end.column+=o,l.end.row+=s}}if(s!=0&&a=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i=t){u=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column;if(u0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(t=e){i=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=n)}catch(u){}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle==e)return;this.$foldStyle=e,e=="manual"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._emit("changeAnnotation");if(!e||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s){t.children||t.all?this.removeFold(s):this.expandFold(s);return}var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range)){this.removeFold(s);return}}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,o),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.$deltasFold.length&&(t.$deltas.push({group:"fold",deltas:t.$deltasFold}),t.$deltasFold=[]),t.$deltasDoc.length&&(t.$deltas.push({group:"doc",deltas:t.$deltasDoc}),t.$deltasDoc=[]),t.$deltas.length>0&&e.execute({action:"aceupdate",args:[t.$deltas,t],merge:t.mergeUndoDeltas}),t.mergeUndoDeltas=!1,t.$deltas=[]},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(oe&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;ao){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;var n=null;for(var r=e.length-1;r!=-1;r--){var i=e[r];i.group=="doc"?(this.doc.revertDeltas(i.deltas),n=this.$getUndoSelection(i.deltas,!0,n)):i.deltas.forEach(function(e){this.addFolds(e.folds)},this)}return this.$fromUndo=!1,n&&this.$undoSelect&&!t&&this.selection.setSelectionRange(n),n},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;var n=null;for(var r=0;re.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,l=s.start,o=l.row-a.row,u=l.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new f(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new f(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$useWrapMode&&this._signal("changeWrapMode")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),s=this.$wrapData,o=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,s){var o;if(e!=null){o=this.$getDisplayTokens(e,a.length),o[0]=n;for(var f=1;fr-b){var w=a+r-b;if(e[w-1]>=p&&e[w]>=p){y(w);continue}if(e[w]==n||e[w]==u){for(w;w!=a-1;w--)if(e[w]==n)break;if(w>a){y(w);continue}w=a+r;for(w;w>2)),a-1);while(w>E&&e[w]E&&e[w]E&&e[w]==l)w--}else while(w>E&&e[w]E){y(++w);continue}w=a+r,e[w]==t&&w--,y(w-b)}return s},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o39&&u<48||u>57&&u<64?i.push(l):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]=0)var o=a[f],r=this.$docRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getLength()-1,p=this.getNextFoldLine(r),d=p?p.start.row:Infinity;while(o<=e){u=this.getRowLength(r);if(o+u>e||r>=h)break;o+=u,r++,r>d&&(r=p.end.row+1,p=this.getNextFoldLine(r,p),d=p?p.start.row:Infinity),c&&(this.$docRowCache.push(r),this.$screenRowCache.push(o))}if(p&&p.start.row<=r)n=this.getFoldDisplayLine(p),r=p.start.row;else{if(o+u<=e||r>h)return{row:h,column:this.getLine(h).length};n=this.getLine(r),p=null}var v=0;if(this.$useWrapMode){var m=this.$wrapData[r];if(m){var g=Math.floor(e-o);s=m[g],g>0&&m.length&&(v=m.indent,i=m[g-1]||m[m.length-1],n=n.substring(i))}}return i+=this.$getStringScreenWidth(n,t-v)[1],this.$useWrapMode&&i>=s&&(i=s-1),p?p.idxToPosition(i):{row:r,column:i}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return{row:r,column:v+this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;ro&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()}}).call(p.prototype),e("./edit_session/folding").Folding.call(p.prototype),e("./edit_session/bracket_match").BracketMatch.call(p.prototype),s.defineOptions(p.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$modified=!0,this.$resetRowCache(0),this.$updateWrapData(0,this.getLength()-1)))},initialValue:"auto"},indentedSoftWrap:{initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){if(isNaN(e)||this.$tabSize===e)return;this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize")},initialValue:4,handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId}}}),t.EditSession=p}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i){if(!e.start){var o=e.offset+(i||0);r=new s(n,o,n,o+e.length);if(!e.length&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start))return r=null,!1}else r=e;return!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;hv)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;gE&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g=0;u--)if(i(o[u],t,s))return!0};else var u=function(e,t,s){var o=r.getMatchOffsets(e,n);for(var u=0;u=o;r--)if(n(e.getLine(r),r))return;if(t.wrap==0)return;for(r=u,o=s.row;r>=o;r--)if(n(e.getLine(r),r))return}:function(n){var r=s.row,i=e.getLine(r).substr(s.column);if(n(i,r,s.column))return;for(r+=1;r<=u;r++)if(n(e.getLine(r),r))return;if(t.wrap==0)return;for(r=o,u=s.row;r<=u;r++)if(n(e.getLine(r),r))return};return{forEach:a}}}).call(o.prototype),t.Search=o}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&e.bindKey&&e.bindKey.position||0}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r||n.isDefault?r=-100:r=e(n));var o=i[t];for(s=0;sr)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","Ctrl-E"),exec:function(e){i.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Ctrl-Shift-E"),exec:function(e){i.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",bindKey:o("Ctrl-L","Command-L"),exec:function(e){var t=parseInt(prompt("Enter line number:"),10);isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",bindKey:o("Ctrl-Shift-Home","Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",bindKey:o("Shift-Up","Shift-Up"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",bindKey:o("Ctrl-Shift-End","Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",bindKey:o("Shift-Down","Shift-Down"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",bindKey:o("Alt-Shift-Left","Command-Shift-Left"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",bindKey:o("Shift-Left","Shift-Left"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",bindKey:o("Alt-Shift-Right","Command-Shift-Right"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",bindKey:o("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",bindKey:o("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",exec:function(e){},readOnly:!0},{name:"cut",exec:function(e){var t=e.getSelectionRange();e._emit("cut",t),e.selection.isEmpty()||(e.session.remove(t),e.clearSelection())},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",bindKey:o("Alt-Delete","Ctrl-K"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",exec:function(e,t){e.insert(r.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",bindKey:o("Ctrl-T","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+10?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o0&&this.$blockScrolling--;var n=t&&t.scrollIntoView;if(n){switch(n){case"center-animate":n="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var r=this.selection.getRange(),i=this.renderer.layerConfig;(r.start.row>=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.removeEventListener("change",this.$onDocumentChange),this.session.removeEventListener("changeMode",this.$onChangeMode),this.session.removeEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.session.removeEventListener("changeTabSize",this.$onChangeTabSize),this.session.removeEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.session.removeEventListener("changeWrapMode",this.$onChangeWrapMode),this.session.removeEventListener("onChangeFold",this.$onChangeFold),this.session.removeEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.session.removeEventListener("changeBackMarker",this.$onChangeBackMarker),this.session.removeEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.session.removeEventListener("changeAnnotation",this.$onChangeAnnotation),this.session.removeEventListener("changeOverwrite",this.$onCursorChange),this.session.removeEventListener("changeScrollTop",this.$onScrollTopChange),this.session.removeEventListener("changeScrollLeft",this.$onScrollLeftChange);var n=this.session.getSelection();n.removeEventListener("changeCursor",this.$onCursorChange),n.removeEventListener("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.addEventListener("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.addEventListener("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.addEventListener("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.addEventListener("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.addEventListener("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.addEventListener("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.addEventListener("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.addEventListener("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.addEventListener("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.addEventListener("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.addEventListener("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.addEventListener("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.addEventListener("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.addEventListener("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.addEventListener("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this})},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?t==1?this.navigateFileEnd():t==-1&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container,"fontSize")},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=t.findMatchingBracket(e.getCursorPosition());if(n)var r=new p(n.row,n.column,n.row,n.column+1);else if(t.$mode.getMatching)var r=t.$mode.getMatching(e.session);r&&(t.$bracketHighlight=t.addMarker(r,"ace_bracket","text"))},50)},this.$highlightTags=function(){if(this.$highlightTagPending)return;var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=e.getCursorPosition(),r=new y(e.session,n.row,n.column),i=r.getCurrentToken();if(!i||!/\b(?:tag-open|tag-name)/.test(i.type)){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}if(i.type.indexOf("tag-open")!=-1){i=r.stepForward();if(!i)return}var s=i.value,o=0,u=r.stepBackward();if(u.value=="<"){do u=i,i=r.stepForward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="=0)}else{do i=u,u=r.stepBackward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,"ace_active-line","screenLine"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column-1,r=t.end.column+1,i=e.getLine(t.start.row),s=i.length,o=i.substring(Math.max(n,0),Math.min(r,s));if(n>=0&&/^[\w\d]/.test(o)||r<=s&&/[\w\d]$/.test(o))return;o=i.substring(t.start.column,t.end.column);if(!/^[\w\d]+$/.test(o))return;var u=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:o});return u},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText();return this._signal("copy",e),e},this.onCopy=function(){this.commands.exec("copy",this)},this.onCut=function(){this.commands.exec("cut",this)},this.onPaste=function(e,t){var n={text:e,event:t};this.commands.exec("paste",this,n)},this.$handlePaste=function(e){typeof e=="string"&&(e={text:e}),this._signal("paste",e);var t=e.text;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)this.insert(t);else{var n=t.split(/\r\n|\r|\n/),r=this.selection.rangeList.ranges;if(n.length>r.length||n.length<2||!n[1])return this.commands.exec("insertstring",this,t);for(var i=r.length;i--;){var s=r[i];s.isEmpty()||this.session.remove(s),this.session.insert(s.start,n[i])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var n=this.session,r=n.getMode(),i=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=r.transformAction(n.getState(i.row),"insertion",this,n,e);s&&(e!==s.text&&(this.session.mergeUndoDeltas=!1,this.$mergeNextCommand=!1),e=s.text)}e==" "&&(e=this.session.getTabString());if(!this.selection.isEmpty()){var o=this.getSelectionRange();i=this.session.remove(o),this.clearSelection()}else if(this.session.getOverwrite()){var o=new p.fromPoints(i,i);o.end.column+=e.length,this.session.remove(o)}if(e=="\n"||e=="\r\n"){var u=n.getLine(i.row);if(i.column>u.search(/\S|$/)){var a=u.substr(i.column).search(/\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e),h=n.insert(i,e);s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(n.getDocument().isNewLine(e)){var d=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},d)}c&&r.autoOutdent(l,n,i.row)},this.onTextInput=function(e){this.keyBinding.onTextInput(e)},this.onCommandKey=function(e,t,n){this.keyBinding.onCommandKey(e,t,n)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&(e=="left"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,"deletion",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]=="\n"){var o=n.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;tt.toLowerCase()?1:0});var r=new p(0,0,0,0);for(var i=e.first;i<=e.last;i++){var s=t.getLine(i);r.start.row=i,r.end.row=i,r.end.column=s.length,t.replace(r,n[i-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&np+1)break;p=d.last}l--,u=this.session.$moveLines(h,p,t?0:e),t&&e==-1&&(c=l+1);while(c<=l)o[c].moveBy(u,0),c++;t||(u=0),a+=u}i.fromOrientedRange(i.ranges[0]),i.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);this.$blockScrolling++,t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection()),this.$blockScrolling--;var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,n,r){this.renderer.scrollToLine(e,t,n,r)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.$blockScrolling+=1,this.selection.selectAll(),this.$blockScrolling-=1},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var n=this.getCursorPosition(),r=new y(this.session,n.row,n.column),i=r.getCurrentToken(),s=i||r.stepForward();if(!s)return;var o,u=!1,a={},f=n.column-s.start,l,c={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g))for(;f=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),this.$blockScrolling-=1,r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e=="string"||e instanceof RegExp?t.needle=e:typeof e=="object"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.$blockScrolling+=1,this.session.unfold(e),this.selection.setSelectionRange(e),this.$blockScrolling-=1;var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy()},this.setAutoScrollEditorIntoView=function(e){if(!e)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var s=this.on("changeSelection",function(){r=!0}),o=this.renderer.on("beforeRender",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on("afterRender",function(){if(r&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.topwindow.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+"px",i.style.left=s.left+"px",i.style.height=o.lineHeight+"px",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.removeEventListener("changeSelection",s),this.renderer.removeEventListener("afterRender",u),this.renderer.removeEventListener("beforeRender",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!="wide",i.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e))}}).call(b.prototype),g.defineOptions(b.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.$resetCursorStyle()},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",showLineNumbers:"renderer",showGutter:"renderer",displayIndentGuides:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"}),t.Editor=b}),define("ace/undomanager",["require","exports","module"],function(e,t,n){"use strict";var r=function(){this.reset()};(function(){function e(e){return{action:e.action,start:e.start,end:e.end,lines:e.lines.length==1?null:e.lines,text:e.lines.length==1?e.lines[0]:null}}function t(e){return{action:e.action,start:e.start,end:e.end,lines:e.lines||[e.text]}}function n(e,t){var n=new Array(e.length);for(var r=0;r0},this.hasRedo=function(){return this.$redoStack.length>0},this.markClean=function(){this.dirtyCounter=0},this.isClean=function(){return this.dirtyCounter===0},this.$serializeDeltas=function(t){return n(t,e)},this.$deserializeDeltas=function(e){return n(e,t)}}).call(r.prototype),t.UndoManager=r}),define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/lang"),o=e("../lib/event_emitter").EventEmitter,u=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_gutter-layer",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$cells=[]};(function(){i.implement(this,o),this.setSession=function(e){this.session&&this.session.removeEventListener("change",this.$updateAnnotations),this.session=e,e&&e.on("change",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;to&&(v=s.end.row+1,s=t.getNextFoldLine(v,s),o=s?s.start.row:Infinity);if(v>i){while(this.$cells.length>d+1)p=this.$cells.pop(),this.element.removeChild(p.element);break}p=this.$cells[++d],p||(p={element:null,textNode:null,foldWidget:null},p.element=r.createElement("div"),p.textNode=document.createTextNode(""),p.element.appendChild(p.textNode),this.element.appendChild(p.element),this.$cells[d]=p);var m="ace_gutter-cell ";a[v]&&(m+=a[v]),f[v]&&(m+=f[v]),this.$annotations[v]&&(m+=this.$annotations[v].className),p.element.className!=m&&(p.element.className=m);var g=t.getRowLength(v)*e.lineHeight+"px";g!=p.element.style.height&&(p.element.style.height=g);if(u){var y=u[v];y==null&&(y=u[v]=t.getFoldWidget(v))}if(y){p.foldWidget||(p.foldWidget=r.createElement("span"),p.element.appendChild(p.foldWidget));var m="ace_fold-widget ace_"+y;y=="start"&&v==o&&vn.right-t.right)return"foldWidgets"}}).call(u.prototype),t.Gutter=u}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../lib/dom"),s=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,n,r){return(e?1:0)|(t?2:0)|(n?4:0)|(r?8:0)}this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.update=function(e){var e=e||this.config;if(!e)return;this.config=e;var t=[];for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var i=r.range.clipRows(e.firstRow,e.lastRow);if(i.isEmpty())continue;i=i.toScreenRange(this.session);if(r.renderer){var s=this.$getTop(i.start.row,e),o=this.$padding+i.start.column*e.characterWidth;r.renderer(t,i,o,s,e)}else r.type=="fullLine"?this.drawFullLineMarker(t,i,r.clazz,e):r.type=="screenLine"?this.drawScreenLineMarker(t,i,r.clazz,e):i.isMultiLine()?r.type=="text"?this.drawTextMarker(t,i,r.clazz,e):this.drawMultiLineMarker(t,i,r.clazz,e):this.drawSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e)}this.element.innerHTML=t.join("")},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(t,n,i,s,o){var u=this.session,a=n.start.row,f=n.end.row,l=a,c=0,h=0,p=u.getScreenLastRowColumn(l),d=new r(l,n.start.column,l,h);for(;l<=f;l++)d.start.row=d.end.row=l,d.start.column=l==a?n.start.column:u.getRowWrapIndent(l),d.end.column=p,c=h,h=p,p=l+1p,l==f),s,l==f?0:1,o)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth;i=i||"",e.push("
    "),u=this.$getTop(t.end.row,r);var f=t.end.column*r.characterWidth;e.push("
    "),o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<=0)return;u=this.$getTop(t.start.row+1,r);var l=(t.start.column?1:0)|(t.end.column?0:8);e.push("
    ")},this.drawSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;e.push("
    ")},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),e.push("
    ")},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;e.push("
    ")}}).call(s.prototype),t.Marker=s}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/useragent"),u=e("../lib/event_emitter").EventEmitter,a=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this)};(function(){r.implement(this,u),this.EOF_CHAR="\u00b6",this.EOL_CHAR_LF="\u00ac",this.EOL_CHAR_CRLF="\u00a4",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="\u2014",this.SPACE_CHAR="\u00b7",this.$padding=0,this.$updateEolChar=function(){var e=this.session.doc.getNewLineCharacter()=="\n"?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=e)return this.EOL_CHAR=e,!0},this.setPadding=function(e){this.$padding=e,this.element.style.padding="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;n"+s.stringRepeat(this.TAB_CHAR,n)+""):t.push(s.stringRepeat(" ",n));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var r="ace_indent-guide",i="",o="";if(this.showInvisibles){r+=" ace_invisible",i=" ace_invisible_space",o=" ace_invisible_tab";var u=s.stringRepeat(this.SPACE_CHAR,this.tabSize),a=s.stringRepeat(this.TAB_CHAR,this.tabSize)}else var u=s.stringRepeat(" ",this.tabSize),a=u;this.$tabStrings[" "]=""+u+"",this.$tabStrings[" "]=""+a+""}},this.updateLines=function(e,t,n){(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)&&this.scrollLines(e),this.config=e;var r=Math.max(t,e.firstRow),i=Math.min(n,e.lastRow),s=this.element.childNodes,o=0;for(var u=e.firstRow;uf&&(u=a.end.row+1,a=this.session.getNextFoldLine(u,a),f=a?a.start.row:Infinity);if(u>i)break;var l=s[o++];if(l){var c=[];this.$renderLine(c,u,!this.$useLineGroups(),u==f?a:!1),l.style.height=e.lineHeight*this.session.getRowLength(u)+"px",l.innerHTML=c.join("")}u++}},this.scrollLines=function(e){var t=this.config;this.config=e;if(!t||t.lastRow0;r--)n.removeChild(n.firstChild);if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)n.removeChild(n.lastChild);if(e.firstRowt.lastRow){var i=this.$renderLinesFragment(e,t.lastRow+1,e.lastRow);n.appendChild(i)}},this.$renderLinesFragment=function(e,t,n){var r=this.element.ownerDocument.createDocumentFragment(),s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=i.createElement("div"),f=[];this.$renderLine(f,s,!1,s==u?o:!1),a.innerHTML=f.join("");if(this.$useLineGroups())a.className="ace_line_group",r.appendChild(a),a.style.height=e.lineHeight*this.session.getRowLength(s)+"px";else while(a.firstChild)r.appendChild(a.firstChild);s++}return r},this.update=function(e){this.config=e;var t=[],n=e.firstRow,r=e.lastRow,i=n,s=this.session.getNextFoldLine(i),o=s?s.start.row:Infinity;for(;;){i>o&&(i=s.end.row+1,s=this.session.getNextFoldLine(i,s),o=s?s.start.row:Infinity);if(i>r)break;this.$useLineGroups()&&t.push("
    "),this.$renderLine(t,i,!1,i==o?s:!1),this.$useLineGroups()&&t.push("
    "),i++}this.element.innerHTML=t.join("")},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var i=this,o=/\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g,u=function(e,n,r,o,u){if(n)return i.showInvisibles?""+s.stringRepeat(i.SPACE_CHAR,e.length)+"":e;if(e=="&")return"&";if(e=="<")return"<";if(e==">")return">";if(e==" "){var a=i.session.getScreenTabSize(t+o);return t+=a-1,i.$tabStrings[a]}if(e=="\u3000"){var f=i.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",l=i.showInvisibles?i.SPACE_CHAR:"";return t+=1,""+l+""}return r?""+i.SPACE_CHAR+"":(t+=1,""+e+"")},a=r.replace(o,u);if(!this.$textToken[n.type]){var f="ace_"+n.type.replace(/\./g," ace_"),l="";n.type=="fold"&&(l=" style='width:"+n.value.length*this.config.characterWidth+"px;' "),e.push("",a,"")}else e.push(a);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);return r<=0||r>=n?t:t[0]==" "?(r-=r%this.tabSize,e.push(s.stringRepeat(this.$tabStrings[" "],r/this.tabSize)),t.substr(r)):t[0]==" "?(e.push(s.stringRepeat(this.$tabStrings[" "],r)),t.substr(r)):t},this.$renderWrappedLine=function(e,t,n,r){var i=0,o=0,u=n[0],a=0;for(var f=0;f=u)a=this.$renderToken(e,a,l,c.substring(0,u-i)),c=c.substring(u-i),i=u,r||e.push("","
    "),e.push(s.stringRepeat("\u00a0",n.indent)),o++,a=0,u=n[o]||Number.MAX_VALUE;c.length!=0&&(i+=c.length,a=this.$renderToken(e,a,l,c))}}},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;s");if(i.length){var s=this.session.getRowSplitData(t);s&&s.length?this.$renderWrappedLine(e,i,s,n):this.$renderSimpleLine(e,i)}this.showInvisibles&&(r&&(t=r.end.row),e.push("",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,"")),n||e.push("
    ")},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.lengthn-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(sn?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:"fold",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(a.prototype),t.Text=a}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i,s=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),i===undefined&&(i=!("opacity"in this.element.style)),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=(i?this.$updateVisibility:this.$updateOpacity).bind(this)};(function(){this.$updateVisibility=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.visibility=e?"":"hidden"},this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.opacity=e?"":"0"},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&!i&&(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.$updateCursors=this.$updateOpacity.bind(this),this.restartTimer())},this.addCursor=function(){var e=r.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible)return;this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+n.column*this.config.characterWidth,i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,r=0;if(t===undefined||t.length===0)t=[{cursor:null}];for(var n=0,i=t.length;ne.height+e.offset||s.top<0)&&n>1)continue;var o=(this.cursors[r++]||this.addCursor()).style;this.drawCursor?this.drawCursor(o,s,e,t[n],this.session):(o.left=s.left+"px",o.top=s.top+"px",o.width=e.characterWidth+"px",o.height=e.lineHeight+"px")}while(this.cursors.length>r)this.removeCursor();var u=this.session.getOverwrite();this.$setOverwrite(u),this.$pixelPos=s,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(s.prototype),t.Cursor=s}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,u=function(e){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e}}).call(u.prototype);var a=function(e,t){u.call(this,e),this.scrollTop=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px"};r.inherits(a,u),function(){this.classSuffix="-v",this.onScroll=function(){this.skipEvent||(this.scrollTop=this.element.scrollTop,this._emit("scroll",{data:this.scrollTop})),this.skipEvent=!1},this.getWidth=function(){return this.isVisible?this.width:0},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=function(e){this.inner.style.height=e+"px"},this.setScrollHeight=function(e){this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=this.element.scrollTop=e)}}.call(a.prototype);var f=function(e,t){u.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};r.inherits(f,u),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(f.prototype),t.ScrollBar=a,t.ScrollBarV=a,t.ScrollBarH=f,t.VScrollBar=a,t.HScrollBar=f}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var r=e("./lib/event"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){this.changes=this.changes|e;if(!this.pending&&this.changes){this.pending=!0;var t=this;r.nextFrame(function(){t.pending=!1;var e;while(e=t.changes)t.changes=0,t.onRender(e)},this.window)}}}).call(i.prototype),t.RenderLoop=i}),define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/useragent"),u=e("../lib/event_emitter").EventEmitter,a=0,f=t.FontMetrics=function(e,t){this.el=i.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),a||this.$testFractionalRect(),this.$measureNode.innerHTML=s.stringRepeat("X",a),this.$characterSize={width:0,height:0},this.checkForSizeChanges()};(function(){r.implement(this,u),this.$characterSize={width:0,height:0},this.$testFractionalRect=function(){var e=i.createElement("div");this.$setMeasureNodeStyles(e.style),e.style.width="0.2px",document.documentElement.appendChild(e);var t=e.getBoundingClientRect().width;t>0&&t<1?a=50:a=100,e.parentNode.removeChild(e)},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",o.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(){var e=this.$measureSizes();if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=setInterval(function(){e.checkForSizeChanges()},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(){if(a===50){var e=null;try{e=this.$measureNode.getBoundingClientRect()}catch(t){e={width:0,height:0}}var n={height:e.height,width:e.width/a}}else var n={height:this.$measureNode.clientHeight,width:this.$measureNode.clientWidth/a};return n.width===0||n.height===0?null:n},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,a);var t=this.$main.getBoundingClientRect();return t.width/a},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}).call(f.prototype)}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/lib/useragent","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./config"),o=e("./lib/useragent"),u=e("./layer/gutter").Gutter,a=e("./layer/marker").Marker,f=e("./layer/text").Text,l=e("./layer/cursor").Cursor,c=e("./scrollbar").HScrollBar,h=e("./scrollbar").VScrollBar,p=e("./renderloop").RenderLoop,d=e("./layer/font_metrics").FontMetrics,v=e("./lib/event_emitter").EventEmitter,m='.ace_editor {position: relative;overflow: hidden;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;min-width: 100%;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;text-indent: -1em;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: inherit;color: inherit;z-index: 1000;opacity: 1;text-indent: 0;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;}.ace_text-layer {font: inherit !important;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {-webkit-transition: opacity 0.18s;transition: opacity 0.18s;}.ace_editor.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}.ace_line .ace_fold {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {-webkit-transition: opacity 0.4s ease 0.05s;transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {-webkit-transition: opacity 0.05s ease 0.05s;transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}';i.importCssString(m,"ace_editor.css");var g=function(e,t){var n=this;this.container=e||i.createElement("div"),this.$keepTextAreaAtCursor=!o.isOldIE,i.addCssClass(this.container,"ace_editor"),this.setTheme(t),this.$gutter=i.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.scroller=i.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=i.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new u(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new a(this.content);var r=this.$textLayer=new f(this.content);this.canvas=r.element,this.$markerFront=new a(this.content),this.$cursorLayer=new l(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new h(this.container,this),this.scrollBarH=new c(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new d(this.container,500),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$loop=new p(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._emit("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,r.implement(this,v),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e);if(!e)return;this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode)},this.updateLines=function(e,t,n){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRowthis.layerConfig.lastRow)return;this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar()},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null},this.$updateCachedSize=function(e,t,n,r){r-=this.$extraHeight||0;var i=0,s=this.$size,o={width:s.width,height:s.height,scrollerHeight:s.scrollerHeight,scrollerWidth:s.scrollerWidth};r&&(e||s.height!=r)&&(s.height=r,i|=this.CHANGE_SIZE,s.scrollerHeight=s.height,this.$horizScroll&&(s.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",i|=this.CHANGE_SCROLL);if(n&&(e||s.width!=n)){i|=this.CHANGE_SIZE,s.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,this.scrollBarH.element.style.left=this.scroller.style.left=t+"px",s.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()),this.scrollBarH.element.style.right=this.scroller.style.right=this.scrollBarV.getWidth()+"px",this.scroller.style.bottom=this.scrollBarH.getHeight()+"px";if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)i|=this.CHANGE_FULL}return s.$dirty=!n||!r,i&&this._signal("resize",o),i},this.onGutterResize=function(){var e=this.$showGutter?this.$gutter.offsetWidth:0;e!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,e,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):(this.$computeLayerConfig(),this.$loop.schedule(this.CHANGE_MARKER))},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updateGutterLineHighlight=function(){var e=this.$cursorLayer.$pixelPos,t=this.layerConfig.lineHeight;if(this.session.getUseWrapMode()){var n=this.session.selection.getCursor();n.column=0,e=this.$cursorLayer.getPixelPosition(n,!0),t*=this.session.getRowLength(n.row)}this.$gutterLineHighlight.style.top=e.top-this.layerConfig.offset+"px",this.$gutterLineHighlight.style.height=t+"px"},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=i.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=this.characterWidth*this.$printMarginColumn+this.$padding+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(!this.$keepTextAreaAtCursor)return;var e=this.layerConfig,t=this.$cursorLayer.$pixelPos.top,n=this.$cursorLayer.$pixelPos.left;t-=e.offset;var r=this.textarea.style,i=this.lineHeight;if(t<0||t>e.height-i){r.top=r.left="0";return}var s=this.characterWidth;if(this.$composition){var o=this.textarea.value.replace(/^\x01+/,"");s*=this.session.$getStringScreenWidth(o)[0]+2,i+=2}n-=this.scrollLeft,n>this.$size.scrollerWidth-s&&(n=this.$size.scrollerWidth-s),n+=this.gutterWidth,r.height=i+"px",r.width=s+"px",r.left=Math.min(n,this.$size.scrollerWidth-s)+"px",r.top=Math.min(t,this.$size.height-i)+"px"},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=Math.floor((this.layerConfig.height+this.layerConfig.offset)/this.layerConfig.lineHeight);return this.layerConfig.firstRow-1+e},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender");var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){e|=this.$computeLayerConfig();if(n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var r=this.scrollTop+(n.firstRow-this.layerConfig.firstRow)*this.lineHeight;r>0&&(this.scrollTop=r,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),this.$gutterLayer.element.style.marginTop=-n.offset+"px",this.content.style.marginTop=-n.offset+"px",this.content.style.width=n.width+2*this.$padding+"px",this.content.style.height=n.minHeight+"px"}e&this.CHANGE_H_SCROLL&&(this.content.style.marginLeft=-this.scrollLeft+"px",this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left");if(e&this.CHANGE_FULL){this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this._signal("afterRender");return}if(e&this.CHANGE_SCROLL){e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this.$moveTextAreaToCursor(),this._signal("afterRender");return}e&this.CHANGE_TEXT?(this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):(e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER)&&this.$showGutter&&this.$gutterLayer.update(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender")},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.max((this.$minLines||1)*this.lineHeight,Math.min(t,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight());var r=e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||r!=this.$vScroll){r!=this.$vScroll&&(this.$vScroll=r,this.scrollBarV.setVisible(r));var i=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,i,n),this.desiredHeight=n,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.$getLongestLine(),o=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),u=this.$horizScroll!==o;u&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var f=this.scrollTop%this.lineHeight,l=t.scrollerHeight+this.lineHeight,c=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=c;var h=this.scrollMargin;this.session.setScrollTop(Math.max(-h.top,Math.min(this.scrollTop,i-t.scrollerHeight+h.bottom))),this.session.setScrollLeft(Math.max(-h.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+h.right)));var p=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+c<0||this.scrollTop>h.top),d=a!==p;d&&(this.$vScroll=p,this.scrollBarV.setVisible(p));var v=Math.ceil(l/this.lineHeight)-1,m=Math.max(0,Math.round((this.scrollTop-f)/this.lineHeight)),g=m+v,y,b,w=this.lineHeight;m=e.screenToDocumentRow(m,0);var E=e.getFoldLine(m);E&&(m=E.start.row),y=e.documentToScreenRow(m,0),b=e.getRowLength(m)*w,g=Math.min(e.screenToDocumentRow(g,0),e.getLength()-1),l=t.scrollerHeight+e.getRowLength(g)*w+b,f=this.scrollTop-y*w;var S=0;this.layerConfig.width!=s&&(S=this.CHANGE_H_SCROLL);if(u||d)S=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),d&&(s=this.$getLongestLine());return this.layerConfig={width:s,padding:this.$padding,firstRow:m,firstRowScreen:y,lastRow:g,lineHeight:w,characterWidth:this.characterWidth,minHeight:l,maxHeight:i,offset:f,gutterOffset:Math.max(0,Math.ceil((f+t.height-t.scrollerHeight)/w)),height:this.$size.scrollerHeight},S},this.$updateLines=function(){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(ts?(t&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-ui?(i=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=(e+this.scrollLeft-n.left-this.$padding)/this.characterWidth,i=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),s=Math.round(r);return{row:i,column:s,side:r-s>0?1:-1}},this.screenToTextCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=Math.round((e+this.scrollLeft-n.left-this.$padding)/this.characterWidth),i=(t+this.scrollTop-n.top)/this.lineHeight;return this.session.screenToDocumentPosition(i,Math.max(r,0))},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+Math.round(r.column*this.characterWidth),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){i.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,i.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor()},this.setCompositionText=function(e){this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;i.removeCssClass(this.textarea,"ace_composition"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null},this.setTheme=function(e,t){function o(r){if(n.$themeId!=e)return t&&t();if(!r.cssClass)return;i.importCssString(r.cssText,r.cssClass,n.container.ownerDocument),n.theme&&i.removeCssClass(n.container,n.theme.cssClass);var s="padding"in r?r.padding:"padding"in(n.theme||{})?4:n.$padding;n.$padding&&s!=n.$padding&&n.setPadding(s),n.$theme=r.cssClass,n.theme=r,i.addCssClass(n.container,r.cssClass),i.setCssClass(n.container,"ace_dark",r.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent("themeLoaded",{theme:r}),t&&t()}var n=this;this.$themeId=e,n._dispatchEvent("themeChange",{theme:e});if(!e||typeof e=="string"){var r=e||this.$options.theme.initialValue;s.loadModule(["theme",r],o)}else o(e)},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){i.setCssClass(this.container,e,t!==!1)},this.unsetStyle=function(e){i.removeCssClass(this.container,e)},this.setCursorStyle=function(e){this.scroller.style.cursor!=e&&(this.scroller.style.cursor=e)},this.setMouseCursor=function(e){this.scroller.style.cursor=e},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(g.prototype),s.defineOptions(g.prototype,"renderer",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){typeof e=="number"&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){i.setCssClass(this.$gutter,"ace_fade-fold-widgets",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e)},initialValue:!0},showLineNumbers:{set:function(e){this.$gutterLayer.setShowLineNumbers(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){if(!this.$gutterLineHighlight){this.$gutterLineHighlight=i.createElement("div"),this.$gutterLineHighlight.className="ace_gutter-active-line",this.$gutter.appendChild(this.$gutterLineHighlight);return}this.$gutterLineHighlight.style.display=e?"":"none",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight()},initialValue:!1,value:!0},hScrollBarAlwaysVisible:{set:function(e){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){typeof e=="number"&&(e+="px"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.updateFull()}},scrollPastEnd:{set:function(e){e=+e||0;if(this.$scrollPastEnd==e)return;this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0}}),t.VirtualRenderer=g}),define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/net"),s=e("../lib/event_emitter").EventEmitter,o=e("../config"),u=function(t,n,r,i){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl);if(o.get("packaged")||!e.toUrl)i=i||o.moduleUrl(n,"worker");else{var s=this.$normalizePath;i=i||s(e.toUrl("ace/worker/worker.js",null,"_"));var u={};t.forEach(function(t){u[t]=s(e.toUrl(t,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}try{this.$worker=new Worker(i)}catch(a){if(!(a instanceof window.DOMException))throw a;var f=this.$workerBlob(i),l=window.URL||window.webkitURL,c=l.createObjectURL(f);this.$worker=new Worker(c),l.revokeObjectURL(c)}this.$worker.postMessage({init:!0,tlns:u,module:n,classname:r}),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){r.implement(this,s),this.onMessage=function(e){var t=e.data;switch(t.type){case"event":this._signal(t.name,{data:t.data});break;case"call":var n=this.callbacks[t.id];n&&(n(t.data),delete this.callbacks[t.id]);break;case"error":this.reportError(t.data);break;case"log":window.console&&console.log&&console.log.apply(console,t.data)}},this.reportError=function(e){window.console&&console.error&&console.error(e)},this.$normalizePath=function(e){return i.qualifyURL(e)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,n){if(n){var r=this.callbackId++;this.callbacks[r]=n,t.push(r)}this.send(e,t)},this.emit=function(e,t){try{this.$worker.postMessage({event:e,data:{data:t.data}})}catch(n){console.error(n.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call("setValue",[e.getValue()]),e.on("change",this.changeListener)},this.changeListener=function(e){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),e.action=="insert"?this.deltaQueue.push(e.start,e.lines):this.deltaQueue.push(e.start,e.end)},this.$sendDeltaQueue=function(){var e=this.deltaQueue;if(!e)return;this.deltaQueue=null,e.length>50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e})},this.$workerBlob=function(e){var t="importScripts('"+i.qualifyURL(e)+"');";try{return new Blob([t],{type:"application/javascript"})}catch(n){var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,s=new r;return s.append(t),s.getBlob("application/javascript")}}}).call(u.prototype);var a=function(e,t,n){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var r=null,i=!1,u=Object.create(s),a=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){a.messageBuffer.push(e),r&&(i?setTimeout(f):f())},this.setEmitSync=function(e){i=e};var f=function(){var e=a.messageBuffer.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};u.postMessage=function(e){a.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){r=new e[n](u);while(a.messageBuffer.length)f()})};a.prototype=u.prototype,t.UIWorkerClient=a,t.WorkerClient=u}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./range").Range,i=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session,i=this.$pos;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(i.row,i.column),this.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.pos.on("change",function(t){n.removeMarker(e.markerId),e.markerId=n.addMarker(new r(t.value.row,t.value.column,t.value.row,t.value.column+e.length),e.mainClass,null,!1)}),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1),n.on("change",function(i){e.removeMarker(n.markerId),n.markerId=e.addMarker(new r(i.value.row,i.value.column,i.value.row,i.value.column+t.length),t.othersClass,null,!1)})})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e=this.pos.column&&t.start.column<=this.pos.column+this.length+1){var i=t.start.column-this.pos.column;this.length+=n;if(!this.session.$fromUndo){if(e.action==="insert")for(var s=this.others.length-1;s>=0;s--){var o=this.others[s],u={row:o.row,column:o.column+i};o.row===t.start.row&&t.start.column=0;s--){var o=this.others[s],u={row:o.row,column:o.column+i};o.row===t.start.row&&t.start.column=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))},this.detach=function(){this.session.removeMarker(this.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.pos.detach();for(var e=0;e1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length?this.$onRemoveRange(e):this.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal("removeRange",{ranges:e}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var n=this.getRange(),r=this.isBackwards(),s=n.start.row,o=n.end.row;if(s==o){if(r)var u=n.end,a=n.start;else var u=n.start,a=n.end;this.addRange(i.fromPoints(a,a)),this.addRange(i.fromPoints(u,u));return}var f=[],l=this.getLineRange(s,!0);l.start.column=n.start.column,f.push(l);for(var c=s+1;c1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.selectionLead),s=this.session.documentToScreenPosition(this.selectionAnchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column0)d--;if(d>0){var m=0;while(r[m].isEmpty())m++}for(var g=d;g>=m;g--)r[g].isEmpty()&&r.splice(g,1)}return r}}.call(s.prototype);var d=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(!e.marker)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,1)}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction=="forEach"?r=n.forEachSelection(t,e.args):t.multiSelectAction=="forEachLine"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction=="single"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges();var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r0);u<0&&(u=0),f>=c&&(f=c-1)}var p=this.session.removeFullLines(u,f);p=this.$reAlignText(p,l),this.session.insert({row:u,column:0},p.join("\n")+"\n"),l||(o.start.column=0,o.end.column=p[p.length-1].length),this.selection.setRange(o)}else{s.forEach(function(e){t.substractPoint(e.cursor)});var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),io?e.insert(r,a.stringRepeat(" ",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(" ",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o," ")+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),st[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=m,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){m(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../../range").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?"start":t=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++tf){var h=e.getLine(l).length;return new r(f,u,l,h)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a=="start"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}';var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}),define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeEditor",this.$onChangeEditor)}var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./range").Range;(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach();if(this.editor==e)return;this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets))},this.detach=function(e){var t=this.editor;if(!t)return;this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnChange=function(e){var t=this.session.lineWidgets;if(!t)return;var n=e.start.row,r=e.end.row-n;if(r!==0)if(e.action=="remove"){var i=t.splice(n+1,r);i.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var s=new Array(r);s.unshift(n,0),t.splice.apply(t,s),this.$updateRows()}},this.$updateRows=function(){var e=this.session.lineWidgets;if(!e)return;var t=!0;e.forEach(function(e,n){e&&(t=!1,e.row=n)}),t&&(this.session.lineWidgets=null)},this.addLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength())),this.session.lineWidgets[e.row]=e;var t=this.editor.renderer;return e.html&&!e.el&&(e.el=i.createElement("div"),e.el.innerHTML=e.html),e.el&&(i.addCssClass(e.el,"ace_lineWidgetContainer"),e.el.style.position="absolute",e.el.style.zIndex=5,t.container.appendChild(e.el),e._inDocument=!0),e.coverGutter||(e.el.style.zIndex=3),e.pixelHeight||(e.pixelHeight=e.el.offsetHeight),e.rowCount==null&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight),this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),e},this.removeLineWidget=function(e){e._inDocument=!1,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el);if(e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(t){}this.session.lineWidgets&&(this.session.lineWidgets[e.row]=undefined),this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var n=this.session._changedWidgets,r=t.layerConfig;if(!n||!n.length)return;var i=Infinity;for(var s=0;s0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+"px";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+"px",u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+"px":u.el.style.right=""}}}).call(o.prototype),t.LineWidgets=o}),define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?"unshift":"push"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e("../line_widgets").LineWidgets,i=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.lineWidgets&&n.lineWidgets[o];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!="number"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div")},p=h.el.appendChild(i.createElement("div")),d=h.el.appendChild(i.createElement("div"));d.className="error_widget_arrow "+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+"px",h.el.className="error_widget_wrapper",p.className="error_widget "+l.className,p.innerHTML=l.text.join("
    "),p.appendChild(i.createElement("div"));var m=function(e,t,n){if(t===0&&(n==="esc"||n==="return"))return h.destroy(),{command:"null"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off("changeSelection",h.destroy),e.off("changeSession",h.destroy),e.off("mouseup",h.destroy),e.off("change",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",h.destroy),e.on("changeSession",h.destroy),e.on("mouseup",h.destroy),e.on("change",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.el.offsetHeight})},i.importCssString(" .error_widget_wrapper { background: inherit; color: inherit; border:none } .error_widget { border-top: solid 2px; border-bottom: solid 2px; margin: 5px 0; padding: 10px 40px; white-space: pre-wrap; } .error_widget.ace_error, .error_widget_arrow.ace_error{ border-color: #ff5a5a } .error_widget.ace_warning, .error_widget_arrow.ace_warning{ border-color: #F1D817 } .error_widget.ace_info, .error_widget_arrow.ace_info{ border-color: #5a5a5a } .error_widget.ace_ok, .error_widget_arrow.ace_ok{ border-color: #5aaa5a } .error_widget_arrow { position: absolute; border: solid 5px; border-top-color: transparent!important; border-right-color: transparent!important; border-left-color: transparent!important; top: -5px; }","")}),define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),i=e("./lib/event"),s=e("./editor").Editor,o=e("./edit_session").EditSession,u=e("./undomanager").UndoManager,a=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,t.edit=function(e){if(typeof e=="string"){var n=e;e=document.getElementById(n);if(!e)throw new Error("ace.edit can't find div #"+n)}if(e&&e.env&&e.env.editor instanceof s)return e.env.editor;var o="";if(e&&/input|textarea/i.test(e.tagName)){var u=e;o=u.value,e=r.createElement("pre"),u.parentNode.replaceChild(e,u)}else e&&(o=r.getInnerText(e),e.innerHTML="");var f=t.createEditSession(o),l=new s(new a(e));l.setSession(f);var c={document:f,editor:l,onResize:l.resize.bind(l,null)};return u&&(c.textarea=u),i.addListener(window,"resize",c.onResize),l.on("destroy",function(){i.removeListener(window,"resize",c.onResize),c.editor.container.env=null}),l.container.env=l.env=c,l},t.createEditSession=function(e,t){var n=new o(e,t);return n.setUndoManager(new u),n},t.EditSession=o,t.UndoManager=u}); + (function() { + window.require(["ace/ace"], function(a) { + a && a.config.init(true); + if (!window.ace) + window.ace = a; + for (var key in a) if (a.hasOwnProperty(key)) + window.ace[key] = a[key]; + }); + })(); + \ No newline at end of file diff --git a/www/lib/ace/ext-language_tools.js b/www/lib/ace/ext-language_tools.js new file mode 100644 index 0000000..ada137e --- /dev/null +++ b/www/lib/ace/ext-language_tools.js @@ -0,0 +1,5 @@ +define("ace/snippets",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/anchor","ace/keyboard/hash_handler","ace/tokenizer","ace/lib/dom","ace/editor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=e("./lib/lang"),o=e("./range").Range,u=e("./anchor").Anchor,a=e("./keyboard/hash_handler").HashHandler,f=e("./tokenizer").Tokenizer,l=o.comparePoints,c=function(){this.snippetMap={},this.snippetNameMap={}};(function(){r.implement(this,i),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return"(?:[^\\\\"+e+"]|\\\\.)"}return c.$tokenizer=new f({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):":"}},{regex:/\\./,onMatch:function(e,t,n){var r=e[1];return r=="}"&&n.length?e=r:"`$\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r=="n"?e="\n":r=="t"?e="\n":"ulULE".indexOf(r)!=-1&&(e={changeCase:r,local:r>"a"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\$(?:\d+|\w+)/,onMatch:e},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+t("\\|")+"*\\|",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(",")},next:"start"},{regex:"/("+t("/")+"+)/(?:("+t("/")+"*)/)(\\w*):?",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],""},next:"start"},{regex:"`"+t("`")+"*`",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),""},next:"start"},{regex:"\\?",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:"start"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:"/("+t("/")+"+)/",token:"regex"},{regex:"",onMatch:function(e,t,n){n.inFormatString=!0},next:"start"}]}),c.prototype.getTokenizer=function(){return c.$tokenizer},c.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+"__"]||{})[n]}if(/^\d+$/.test(t))return(this.variables.__||{})[t];t=t.replace(/^TM_/,"");if(!e)return;var r=e.session;switch(t){case"CURRENT_WORD":var i=r.getWordRange();case"SELECTION":case"SELECTED_TEXT":return r.getTextRange(i);case"CURRENT_LINE":return r.getLine(e.getCursorPosition().row);case"PREV_LINE":return r.getLine(e.getCursorPosition().row-1);case"LINE_INDEX":return e.getCursorPosition().column;case"LINE_NUMBER":return e.getCursorPosition().row+1;case"SOFT_TABS":return r.getUseSoftTabs()?"YES":"NO";case"TAB_SIZE":return r.getTabSize();case"FILENAME":case"FILEPATH":return"";case"FULLNAME":return"Ace"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||"":this.$getDefaultValue(e,t)||""},this.tmStrFormat=function(e,t,n){var r=t.flag||"",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,""));var s=this.tokenizeTmSnippet(t.fmt,"formatString"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t="E";for(var r=0;r=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\r/g,"");var t=[],n={},r=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\t/gm,""),t.push(n),n={};else{var o=i[2],u=i[3];if(o=="regex"){var a=/\/((?:[^\/\\]|\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o=="snippet"?(n.tabTrigger=u.match(/^\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,r;return this.getActiveScopes(t).some(function(t){var i=n[t];return i&&(r=i[e]),!!r},this),r}}).call(c.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener("change",this.$onChange),this.editor.removeListener("changeSelection",this.$onChangeSelection),this.editor.removeListener("changeSession",this.$onChangeSession),this.editor.commands.removeListener("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e,n=e.action[0]=="r",r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=i.column-r.column;n&&(u=-u,a=-a);if(!this.$inChange&&n){var f=this.selectedTabstop,c=f&&!f.some(function(e){return l(e.start,r)<=0&&l(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=a),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=a),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),l(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e||!e.hasLinkedRanges)return;this.$inChange=!0;var n=this.editor.session,r=n.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=t.snippetManager.tmStrFormat(r,s.original);n.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),n===0&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}n.ranges[0]&&n.addRange(n.ranges[0].clone())}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){this.$openTabstops||(this.$openTabstops=[]);if(!e[0]){var r=o.fromPoints(n,n);v(r.start,t),v(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,s=[i+1,0],u=this.ranges;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;for(var i=e.length;i--;){var a=e[i],f=o.fromPoints(a.start,a.end||a.start);d(f.start,t),d(f.end,t),f.original=a,f.tabstop=r,u.push(f),r!=e?r.unshift(f):r[i]=f,a.fmtString?(f.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=f)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(s.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,"ace_snippet-marker","text"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),t!=-1&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new a,this.keyboardHandler.bindKeys({Tab:function(e){if(t.snippetManager&&t.snippetManager.expandWithTab(e))return;e.tabstopManager.tabNext(1)},"Shift-Tab":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var p={};p.onChange=u.prototype.onChange,p.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},p.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var d=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},v=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e("./lib/dom").importCssString(".ace_snippet-marker { -moz-box-sizing: border-box; box-sizing: border-box; background: rgba(194, 193, 208, 0.09); border: 1px dotted rgba(211, 208, 235, 0.62); position: absolute;}"),t.snippetManager=new c;var m=e("./editor").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../virtual_renderer").VirtualRenderer,i=e("../editor").Editor,s=e("../range").Range,o=e("../lib/event"),u=e("../lib/lang"),a=e("../lib/dom"),f=function(e){var t=new r(e);t.$maxLines=4;var n=new i(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusWaitTimout=0,n.$highlightTagPending=!0,n},l=function(e){var t=a.createElement("div"),n=new f(t);e&&e.appendChild(t),t.style.display="none",n.renderer.content.style.cursor="default",n.renderer.setStyle("ace_autocomplete"),n.setOption("displayIndentGuides",!1),n.setOption("dragDelay",150);var r=function(){};n.focus=r,n.$isFocused=!0,n.renderer.$cursorLayer.restartTimer=r,n.renderer.$cursorLayer.element.style.opacity=0,n.renderer.$maxLines=8,n.renderer.$keepTextAreaAtCursor=!1,n.setHighlightActiveLine(!1),n.session.highlight(""),n.session.$searchHighlight.clazz="ace_highlight-marker",n.on("mousedown",function(e){var t=e.getDocumentPosition();n.selection.moveToPosition(t),c.start.row=c.end.row=t.row,e.stop()});var i,l=new s(-1,0,-1,Infinity),c=new s(-1,0,-1,Infinity);c.id=n.session.addMarker(c,"ace_active-line","fullLine"),n.setSelectOnHover=function(e){e?l.id&&(n.session.removeMarker(l.id),l.id=null):l.id=n.session.addMarker(l,"ace_line-hover","fullLine")},n.setSelectOnHover(!1),n.on("mousemove",function(e){if(!i){i=e;return}if(i.x==e.x&&i.y==e.y)return;i=e,i.scrollTop=n.renderer.scrollTop;var t=i.getDocumentPosition().row;l.start.row!=t&&(l.id||n.setRow(t),p(t))}),n.renderer.on("beforeRender",function(){if(i&&l.start.row!=-1){i.$pos=null;var e=i.getDocumentPosition().row;l.id||n.setRow(e),p(e,!0)}}),n.renderer.on("afterRender",function(){var e=n.getRow(),t=n.renderer.$textLayer,r=t.element.childNodes[e-t.config.firstRow];if(r==t.selectedNode)return;t.selectedNode&&a.removeCssClass(t.selectedNode,"ace_selected"),t.selectedNode=r,r&&a.addCssClass(r,"ace_selected")});var h=function(){p(-1)},p=function(e,t){e!==l.start.row&&(l.start.row=l.end.row=e,t||n.session._emit("changeBackMarker"),n._emit("changeHoverMarker"))};n.getHoveredRow=function(){return l.start.row},o.addListener(n.container,"mouseout",h),n.on("hide",h),n.on("changeSelection",h),n.session.doc.getLength=function(){return n.data.length},n.session.doc.getLine=function(e){var t=n.data[e];return typeof t=="string"?t:t&&t.value||""};var d=n.session.bgTokenizer;return d.$tokenizeRow=function(e){var t=n.data[e],r=[];if(!t)return r;typeof t=="string"&&(t={value:t}),t.caption||(t.caption=t.value||t.name);var i=-1,s,o;for(var u=0;ua-2&&(f=f.substr(0,a-t.caption.length-3)+"\u2026"),r.push({type:"rightAlignedText",value:f})}return r},d.$updateOnChange=r,d.start=r,n.session.$computeWidth=function(){return this.screenWidth=0},n.$blockScrolling=Infinity,n.isOpen=!1,n.isTopdown=!1,n.data=[],n.setData=function(e){n.setValue(u.stringRepeat("\n",e.length),-1),n.data=e||[],n.setRow(0)},n.getData=function(e){return n.data[e]},n.getRow=function(){return c.start.row},n.setRow=function(e){e=Math.max(-1,Math.min(this.data.length,e)),c.start.row!=e&&(n.selection.clearSelection(),c.start.row=c.end.row=e||0,n.session._emit("changeBackMarker"),n.moveCursorTo(e||0,0),n.isOpen&&n._signal("select"))},n.on("changeSelection",function(){n.isOpen&&n.setRow(n.selection.lead.row),n.renderer.scrollCursorIntoView()}),n.hide=function(){this.container.style.display="none",this._signal("hide"),n.isOpen=!1},n.show=function(e,t,r){var s=this.container,o=window.innerHeight,u=window.innerWidth,a=this.renderer,f=a.$maxLines*t*1.4,l=e.top+this.$borderSize;l+f>o-t&&!r?(s.style.top="",s.style.bottom=o-l+"px",n.isTopdown=!1):(l+=t,s.style.top=l+"px",s.style.bottom="",n.isTopdown=!0),s.style.display="",this.renderer.$textLayer.checkForSizeChanges();var c=e.left;c+s.offsetWidth>u&&(c=u-s.offsetWidth),s.style.left=c+"px",this._signal("show"),i=null,n.isOpen=!0},n.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},n.$imageSize=0,n.$borderSize=1,n};a.importCssString(".ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line { background-color: #CAD6FA; z-index: 1;}.ace_editor.ace_autocomplete .ace_line-hover { border: 1px solid #abbffe; margin-top: -1px; background: rgba(233,233,253,0.4);}.ace_editor.ace_autocomplete .ace_line-hover { position: absolute; z-index: 2;}.ace_editor.ace_autocomplete .ace_scroller { background: none; border: none; box-shadow: none;}.ace_rightAlignedText { color: gray; display: inline-block; position: absolute; right: 4px; text-align: right; z-index: -1;}.ace_editor.ace_autocomplete .ace_completion-highlight{ color: #000; text-shadow: 0 0 0.01em;}.ace_editor.ace_autocomplete { width: 280px; z-index: 200000; background: #fbfbfb; color: #444; border: 1px lightgray solid; position: fixed; box-shadow: 2px 3px 5px rgba(0,0,0,.2); line-height: 1.4;}"),t.AcePopup=l}),define("ace/autocomplete/util",["require","exports","module"],function(e,t,n){"use strict";t.parForEach=function(e,t,n){var r=0,i=e.length;i===0&&n();for(var s=0;s=0;s--){if(!n.test(e[s]))break;i.push(e[s])}return i.reverse().join("")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t;s=n?-1:t+1;break;case"start":t=0;break;case"end":t=n}this.popup.setRow(t)},this.insertMatch=function(e,t){e||(e=this.popup.getData(this.popup.getRow()));if(!e)return!1;if(e.completer&&e.completer.insertMatch)e.completer.insertMatch(this.editor,e);else{if(this.completions.filterText){var n=this.editor.selection.getAllRanges();for(var r=0,i;i=n[r];r++)i.start.column-=this.completions.filterText.length,this.editor.session.remove(i)}e.snippet?f.insertSnippet(this.editor,e.snippet):this.editor.execCommand("insertstring",e.value||e)}this.detach()},this.commands={Up:function(e){e.completer.goTo("up")},Down:function(e){e.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(e){e.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(e){e.completer.goTo("end")},Esc:function(e){e.completer.detach()},Return:function(e){return e.completer.insertMatch()},"Shift-Return":function(e){e.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(e){var t=e.completer.insertMatch();if(!!t||!!e.tabstopManager)return t;e.completer.goTo("down")},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},this.gatherCompletions=function(e,t){var n=e.getSession(),r=e.getCursorPosition(),i=n.getLine(r.row),o=s.retrievePrecedingIdentifier(i,r.column);this.base=n.doc.createAnchor(r.row,r.column-o.length),this.base.$insertRight=!0;var u=[],a=e.completers.length;return e.completers.forEach(function(i,f){i.getCompletions(e,n,r,o,function(r,i){r||(u=u.concat(i));var o=e.getCursorPosition(),f=n.getLine(o.row);t(null,{prefix:s.retrievePrecedingIdentifier(f,o.column,i[0]&&i[0].identifierRegex),matches:u,finished:--a===0})})}),!0},this.showPopup=function(e){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.on("changeSelection",this.changeListener),e.on("blur",this.blurListener),e.on("mousedown",this.mousedownListener),e.on("mousewheel",this.mousewheelListener),this.updateCompletions()},this.updateCompletions=function(e){if(e&&this.base&&this.completions){var t=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:t});if(n==this.completions.filterText)return;this.completions.setFilter(n);if(!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==n&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,n,e);return}var r=this.gatherCompletionsId;this.gatherCompletions(this.editor,function(t,n){var i=function(){if(!n.finished)return;return this.detach()}.bind(this),s=n.prefix,o=n&&n.matches;if(!o||!o.length)return i();if(s.indexOf(n.prefix)!==0||r!=this.gatherCompletionsId)return;this.completions=new c(o),this.exactMatch&&(this.completions.exactMatch=!0),this.completions.setFilter(s);var u=this.completions.filtered;if(!u.length)return i();if(u.length==1&&u[0].value==s&&!u[0].snippet)return i();if(this.autoInsert&&u.length==1&&n.finished)return this.insertMatch(u[0]);this.openPopup(this.editor,s,e)}.bind(this))},this.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},this.updateDocTooltip=function(){var e=this.popup,t=e.data,n=t&&(t[e.getHoveredRow()]||t[e.getRow()]),r=null;if(!n||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();this.editor.completers.some(function(e){return e.getDocTooltip&&(r=e.getDocTooltip(n)),r}),r||(r=n),typeof r=="string"&&(r={docText:r});if(!r||!r.docHTML&&!r.docText)return this.hideDocTooltip();this.showDocTooltip(r)},this.showDocTooltip=function(e){this.tooltipNode||(this.tooltipNode=a.createElement("div"),this.tooltipNode.className="ace_tooltip ace_doc-tooltip",this.tooltipNode.style.margin=0,this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this));var t=this.tooltipNode;e.docHTML?t.innerHTML=e.docHTML:e.docText&&(t.textContent=e.docText),t.parentNode||document.body.appendChild(t);var n=this.popup,r=n.container.getBoundingClientRect();t.style.top=n.container.style.top,t.style.bottom=n.container.style.bottom,window.innerWidth-r.right<320?(t.style.right=window.innerWidth-r.left+"px",t.style.left=""):(t.style.left=r.right+1+"px",t.style.right=""),t.style.display="block"},this.hideDocTooltip=function(){this.tooltipTimer.cancel();if(!this.tooltipNode)return;var e=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==e&&this.editor.focus(),this.tooltipNode=null,e.parentNode&&e.parentNode.removeChild(e)}}).call(l.prototype),l.startCommand={name:"startAutocomplete",exec:function(e){e.completer||(e.completer=new l),e.completer.autoInsert=!1,e.completer.autoSelect=!0,e.completer.showPopup(e),e.completer.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var c=function(e,t){this.all=e,this.filtered=e,this.filterText=t||"",this.exactMatch=!1};(function(){this.setFilter=function(e){if(e.length>this.filterText&&e.lastIndexOf(this.filterText,0)===0)var t=this.filtered;else var t=this.all;this.filterText=e,t=this.filterCompletions(t,this.filterText),t=t.sort(function(e,t){return t.exactMatch-e.exactMatch||t.score-e.score});var n=null;t=t.filter(function(e){var t=e.snippet||e.caption||e.value;return t===n?!1:(n=t,!0)}),this.filtered=t},this.filterCompletions=function(e,t){var n=[],r=t.toUpperCase(),i=t.toLowerCase();e:for(var s=0,o;o=e[s];s++){var u=o.value||o.caption||o.snippet;if(!u)continue;var a=-1,f=0,l=0,c,h;if(this.exactMatch){if(t!==u.substr(0,t.length))continue e}else for(var p=0;p=0?v<0||d0&&(a===-1&&(l+=10),l+=h),f|=1<",o.escapeHTML(e.caption),"","
    ",o.escapeHTML(e.snippet)].join(""))}},c=[l,a,f];t.setCompleters=function(e){c=e||[]},t.addCompleter=function(e){c.push(e)},t.textCompleter=a,t.keyWordCompleter=f,t.snippetCompleter=l;var h={name:"expandSnippet",exec:function(e){return r.expandWithTab(e)},bindKey:"Tab"},p=function(e,t){d(t.session.$mode)},d=function(e){var t=e.$id;r.files||(r.files={}),v(t),e.modes&&e.modes.forEach(d)},v=function(e){if(!e||r.files[e])return;var t=e.replace("mode","snippets");r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){v("ace/mode/"+e)})))})},g=function(e){var t=e.editor,n=t.completer&&t.completer.activated;if(e.command.name==="backspace")n&&!m(t)&&t.completer.detach();else if(e.command.name==="insertstring"){var r=m(t);r&&!n&&(t.completer||(t.completer=new i),t.completer.autoInsert=!1,t.completer.showPopup(t))}},y=e("../editor").Editor;e("../config").defineOptions(y.prototype,"editor",{enableBasicAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers||(this.completers=Array.isArray(e)?e:c),this.commands.on("afterExec",g)):this.commands.removeListener("afterExec",g)},value:!1},enableSnippets:{set:function(e){e?(this.commands.addCommand(h),this.on("changeMode",p),p(null,this)):(this.commands.removeCommand(h),this.off("changeMode",p))},value:!1}})}); + (function() { + window.require(["ace/ext/language_tools"], function() {}); + })(); + \ No newline at end of file diff --git a/www/lib/ace/ext-searchbox.js b/www/lib/ace/ext-searchbox.js new file mode 100644 index 0000000..c1e1027 --- /dev/null +++ b/www/lib/ace/ext-searchbox.js @@ -0,0 +1,5 @@ +define("ace/ext/searchbox",["require","exports","module","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/keyboard/hash_handler","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=e("../lib/lang"),s=e("../lib/event"),o=".ace_search {background-color: #ddd;border: 1px solid #cbcbcb;border-top: 0 none;max-width: 325px;overflow: hidden;margin: 0;padding: 4px;padding-right: 6px;padding-bottom: 0;position: absolute;top: 0px;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {border-radius: 3px;border: 1px solid #cbcbcb;float: left;margin-bottom: 4px;overflow: hidden;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {background-color: white;border-right: 1px solid #cbcbcb;border: 0 none;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;float: left;height: 22px;outline: 0;padding: 0 7px;width: 214px;margin: 0;}.ace_searchbtn,.ace_replacebtn {background: #fff;border: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;float: left;height: 22px;margin: 0;padding: 0;position: relative;}.ace_searchbtn:last-child,.ace_replacebtn:last-child {border-top-right-radius: 3px;border-bottom-right-radius: 3px;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn {background-position: 50% 50%;background-repeat: no-repeat;width: 27px;}.ace_searchbtn.prev {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=); }.ace_searchbtn.next {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=); }.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;float: right;font: 16px/16px Arial;height: 14px;margin: 5px 1px 9px 5px;padding: 0;text-align: center;width: 14px;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_replacebtn.prev {width: 54px}.ace_replacebtn.next {width: 27px}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;-moz-box-sizing: border-box;box-sizing: border-box;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;}",u=e("../keyboard/hash_handler").HashHandler,a=e("../lib/keys");r.importCssString(o,"ace_searchbox");var f=''.replace(/>\s+/g,">"),l=function(e,t,n){var i=r.createElement("div");i.innerHTML=f,this.element=i.firstChild,this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.container.appendChild(this.element),this.editor=e},this.$initElements=function(e){this.searchBox=e.querySelector(".ace_search_form"),this.replaceBox=e.querySelector(".ace_replace_form"),this.searchOptions=e.querySelector(".ace_search_options"),this.regExpOption=e.querySelector("[action=toggleRegexpMode]"),this.caseSensitiveOption=e.querySelector("[action=toggleCaseSensitive]"),this.wholeWordOption=e.querySelector("[action=toggleWholeWords]"),this.searchInput=this.searchBox.querySelector(".ace_search_field"),this.replaceInput=this.replaceBox.querySelector(".ace_search_field")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;s.addListener(e,"mousedown",function(e){setTimeout(function(){t.activeInput.focus()},0),s.stopPropagation(e)}),s.addListener(e,"click",function(e){var n=e.target||e.srcElement,r=n.getAttribute("action");r&&t[r]?t[r]():t.$searchBarKb.commands[r]&&t.$searchBarKb.commands[r].exec(t),s.stopPropagation(e)}),s.addCommandKeyListener(e,function(e,n,r){var i=a.keyCodeToString(r),o=t.$searchBarKb.findKeyCommand(n,i);o&&o.exec&&(o.exec(t),s.stopEvent(e))}),this.$onChange=i.delayedCall(function(){t.find(!1,!1)}),s.addListener(this.searchInput,"input",function(){t.$onChange.schedule(20)}),s.addListener(this.searchInput,"focus",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),s.addListener(this.replaceInput,"focus",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new u([{bindKey:"Esc",name:"closeSearchBar",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new u,this.$searchBarKb.bindKeys({"Ctrl-f|Command-f|Ctrl-H|Command-Option-F":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?"":"none",e[t?"replaceInput":"searchInput"].focus()},"Ctrl-G|Command-G":function(e){e.findNext()},"Ctrl-Shift-G|Command-Shift-G":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},"Shift-Return":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},"Alt-Return":function(e){e.activeInput==e.replaceInput&&e.replaceAll(),e.findAll()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:"toggleRegexpMode",bindKey:{win:"Alt-R|Alt-/",mac:"Ctrl-Alt-R|Ctrl-Alt-/"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:"toggleCaseSensitive",bindKey:{win:"Alt-C|Alt-I",mac:"Ctrl-Alt-R|Ctrl-Alt-I"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:"toggleWholeWords",bindKey:{win:"Alt-B|Alt-W",mac:"Ctrl-Alt-B|Ctrl-Alt-W"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}}]),this.$syncOptions=function(){r.setCssClass(this.regExpOption,"checked",this.regExpOption.checked),r.setCssClass(this.wholeWordOption,"checked",this.wholeWordOption.checked),r.setCssClass(this.caseSensitiveOption,"checked",this.caseSensitiveOption.checked),this.find(!1,!1)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t){var n=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),i=!n&&this.searchInput.value;r.setCssClass(this.searchBox,"ace_nomatch",i),this.editor._emit("findSearchBox",{match:!i}),this.highlight()},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.findAll=function(){var e=this.editor.findAll(this.searchInput.value,{regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),t=!e&&this.searchInput.value;r.setCssClass(this.searchBox,"ace_nomatch",t),this.editor._emit("findSearchBox",{match:!t}),this.highlight(),this.hide()},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.element.style.display="none",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.element.style.display="",this.replaceBox.style.display=t?"":"none",this.isReplace=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb)},this.isFocused=function(){var e=document.activeElement;return e==this.searchInput||e==this.replaceInput}}).call(l.prototype),t.SearchBox=l,t.Search=function(e,t){var n=e.searchBox||new l(e);n.show(e.session.getTextRange(),t)}}); + (function() { + window.require(["ace/ext/searchbox"], function() {}); + })(); + \ No newline at end of file diff --git a/www/lib/ace/mode-css.js b/www/lib/ace/mode-css.js new file mode 100644 index 0000000..f1ba8de --- /dev/null +++ b/www/lib/ace/mode-css.js @@ -0,0 +1 @@ +define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=t.supportType="animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index",u=t.supportFunction="rgb|rgba|url|attr|counter|counters",a=t.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero",f=t.supportConstantColor="aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow",l=t.supportConstantFonts="arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace",c=t.numRe="\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))",h=t.pseudoElements="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",p=t.pseudoClasses="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",d=function(){var e=this.createKeywordMapper({"support.function":u,"support.constant":a,"support.type":o,"support.constant.color":f,"support.constant.fonts":l},"text",!0);this.$rules={start:[{token:"comment",regex:"\\/\\*",push:"comment"},{token:"paren.lparen",regex:"\\{",push:"ruleset"},{token:"string",regex:"@.*?{",push:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],media:[{token:"comment",regex:"\\/\\*",push:"comment"},{token:"paren.lparen",regex:"\\{",push:"ruleset"},{token:"string",regex:"\\}",next:"pop"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],comment:[{token:"comment",regex:"\\*\\/",next:"pop"},{defaultToken:"comment"}],ruleset:[{token:"paren.rparen",regex:"\\}",next:"pop"},{token:"comment",regex:"\\/\\*",push:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:["constant.numeric","keyword"],regex:"("+c+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"},{token:"constant.numeric",regex:c},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:h},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:p},{token:["support.function","string","support.function"],regex:"(url\\()(.*)(\\))"},{token:e,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},p=function(){this.add("braces","insertion",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i=="{"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==""&&l!=="{"&&n.getWrapBehavioursEnabled())return h(a,l,"{","}");if(p.isSaneInsertion(n,r))return/[\]\}\)]/.test(u[s.column])||n.inMultiSelectMode?(p.recordAutoInsert(n,r,"}"),{text:"{}",selection:[1,1]}):(p.recordMaybeInsert(n,r,"{"),{text:"{",selection:[1,1]})}else if(i=="}"){c(n);var d=u.substring(s.column,s.column+1);if(d=="}"){var v=r.$findOpeningBracket("}",{column:s.column+1,row:s.row});if(v!==null&&p.isAutoInsertedClosing(s,u,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(i=="\n"||i=="\r\n"){c(n);var m="";p.isMaybeInsertedClosing(s,u)&&(m=o.stringRepeat("}",f.maybeInsertedBrackets),p.clearMaybeInsertedClosing());var d=u.substring(s.column,s.column+1);if(d==="}"){var g=r.findMatchingBracket({row:s.row,column:s.column+1},"}");if(!g)return null;var y=this.$getIndent(r.getLine(g.row))}else{if(!m){p.clearMaybeInsertedClosing();return}var y=this.$getIndent(u)}var b=y+r.getTabString();return{text:"\n"+b+"\n"+y+m,selection:[1,b.length,1,b.length]}}p.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"(",")");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"[","]");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==""&&u!=="'"&&u!='"'&&n.getWrapBehavioursEnabled())return h(o,u,s,s);if(!u){var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column),p=f.substring(a.column,a.column+1),d=r.getTokenAt(a.row,a.column),v=r.getTokenAt(a.row,a.column+1);if(l=="\\"&&d&&/escape/.test(d.type))return null;var m=d&&/string|escape/.test(d.type),g=!v||/string|escape/.test(v.type),y;if(p==s)y=m!==g;else{if(m&&!g)return null;if(m&&g)return null;var b=r.$mode.tokenRe;b.lastIndex=0;var w=b.test(l);b.lastIndex=0;var E=b.test(l);if(w||E)return null;if(p&&!/[\s;,.})\]\\]/.test(p))return null;y=!0}return{text:y?s+s:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};p.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},p.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},p.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},p.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},p.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},p.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},p.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},p.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(p,i),t.CstyleBehaviour=p}),define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("./cstyle").CstyleBehaviour,o=e("../../token_iterator").TokenIterator,u=function(){this.inherit(s),this.add("colon","insertion",function(e,t,n,r,i){if(i===":"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\s+/)&&(a=u.stepBackward());if(a&&a.type==="support.type"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===":")return{text:"",selection:[1,1]};if(!f.substring(s.column).match(/^\s*;/))return{text:":;",selection:[1,1]}}}}),this.add("colon","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===":"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\s+/)&&(f=a.stepBackward());if(f&&f.type==="support.type"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===";")return i.end.column++,i}}}),this.add("semicolon","insertion",function(e,t,n,r,i){if(i===";"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===";")return{text:"",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./css_highlight_rules").CssHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../worker/worker_client").WorkerClient,a=e("./behaviour/css").CssBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules="cStyle",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type=="comment")return r;var s=t.match(/^.*\{\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u(["ace"],"ace/mode/css_worker","Worker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/css"}.call(l.prototype),t.Mode=l}) \ No newline at end of file diff --git a/www/lib/ace/mode-html.js b/www/lib/ace/mode-html.js new file mode 100644 index 0000000..558238e --- /dev/null +++ b/www/lib/ace/mode-html.js @@ -0,0 +1 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b",s="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[{token:"comment",regex:"\\/\\/",next:"line_comment"},i.getStartRule("doc-start"),{token:"comment",regex:/\/\*/,next:"comment"},{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0[xX][0-9a-fA-F]+\b/},{token:"constant.numeric",regex:/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+r+")(\\.)(prototype)(\\.)("+r+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\.)("+r+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+r+")(\\.)("+r+")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+r+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:"(?:"+n+")\\b",next:"start"},{token:["punctuation.operator","support.function"],regex:/(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:["punctuation.operator","support.function.dom"],regex:/(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:["punctuation.operator","support.constant"],regex:/(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:["support.constant"],regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/},{token:t,regex:r},{token:"keyword.operator",regex:/--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],start:[i.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment_regex_allowed"},{token:"comment",regex:"\\/\\/",next:"line_comment_regex_allowed"},{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],function_arguments:[{token:"variable.parameter",regex:r},{token:"punctuation.operator",regex:"[, ]+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],comment_regex_allowed:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:"start"},{defaultToken:"comment",caseInsensitive:!0}],comment:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:"no_regex"},{defaultToken:"comment",caseInsensitive:!0}],line_comment_regex_allowed:[i.getTagRule(),{token:"comment",regex:"$|^",next:"start"},{defaultToken:"comment",caseInsensitive:!0}],line_comment:[i.getTagRule(),{token:"comment",regex:"$|^",next:"no_regex"},{defaultToken:"comment",caseInsensitive:!0}],qqstring:[{token:"constant.language.escape",regex:s},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:s},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]},(!e||!e.noES6)&&this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(e,t,n){this.next=e=="{"?this.nextState:"";if(e=="{"&&n.length)return n.unshift("start",t),"paren";if(e=="}"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf("string")!=-1)return"paren.quasi.end"}return e=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:s},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]}),this.embedRules(i,"doc-",[i.getEndRule("no_regex")]),this.normalizeRules()};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},p=function(){this.add("braces","insertion",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i=="{"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==""&&l!=="{"&&n.getWrapBehavioursEnabled())return h(a,l,"{","}");if(p.isSaneInsertion(n,r))return/[\]\}\)]/.test(u[s.column])||n.inMultiSelectMode?(p.recordAutoInsert(n,r,"}"),{text:"{}",selection:[1,1]}):(p.recordMaybeInsert(n,r,"{"),{text:"{",selection:[1,1]})}else if(i=="}"){c(n);var d=u.substring(s.column,s.column+1);if(d=="}"){var v=r.$findOpeningBracket("}",{column:s.column+1,row:s.row});if(v!==null&&p.isAutoInsertedClosing(s,u,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(i=="\n"||i=="\r\n"){c(n);var m="";p.isMaybeInsertedClosing(s,u)&&(m=o.stringRepeat("}",f.maybeInsertedBrackets),p.clearMaybeInsertedClosing());var d=u.substring(s.column,s.column+1);if(d==="}"){var g=r.findMatchingBracket({row:s.row,column:s.column+1},"}");if(!g)return null;var y=this.$getIndent(r.getLine(g.row))}else{if(!m){p.clearMaybeInsertedClosing();return}var y=this.$getIndent(u)}var b=y+r.getTabString();return{text:"\n"+b+"\n"+y+m,selection:[1,b.length,1,b.length]}}p.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"(",")");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"[","]");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==""&&u!=="'"&&u!='"'&&n.getWrapBehavioursEnabled())return h(o,u,s,s);if(!u){var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column),p=f.substring(a.column,a.column+1),d=r.getTokenAt(a.row,a.column),v=r.getTokenAt(a.row,a.column+1);if(l=="\\"&&d&&/escape/.test(d.type))return null;var m=d&&/string|escape/.test(d.type),g=!v||/string|escape/.test(v.type),y;if(p==s)y=m!==g;else{if(m&&!g)return null;if(m&&g)return null;var b=r.$mode.tokenRe;b.lastIndex=0;var w=b.test(l);b.lastIndex=0;var E=b.test(l);if(w||E)return null;if(p&&!/[\s;,.})\]\\]/.test(p))return null;y=!0}return{text:y?s+s:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};p.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},p.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},p.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},p.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},p.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},p.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},p.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},p.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(p,i),t.CstyleBehaviour=p}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./javascript_highlight_rules").JavaScriptHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../range").Range,a=e("../worker/worker_client").WorkerClient,f=e("./behaviour/cstyle").CstyleBehaviour,l=e("./folding/cstyle").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"||e=="no_regex"){var u=t.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc-start"){if(o=="start"||o=="no_regex")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/javascript"}.call(c.prototype),t.Mode=c}),define("ace/mode/css_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text_highlight_rules").TextHighlightRules,o=t.supportType="animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index",u=t.supportFunction="rgb|rgba|url|attr|counter|counters",a=t.supportConstant="absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero",f=t.supportConstantColor="aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow",l=t.supportConstantFonts="arial|century|comic|courier|cursive|fantasy|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace",c=t.numRe="\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))",h=t.pseudoElements="(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b",p=t.pseudoClasses="(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b",d=function(){var e=this.createKeywordMapper({"support.function":u,"support.constant":a,"support.type":o,"support.constant.color":f,"support.constant.fonts":l},"text",!0);this.$rules={start:[{token:"comment",regex:"\\/\\*",push:"comment"},{token:"paren.lparen",regex:"\\{",push:"ruleset"},{token:"string",regex:"@.*?{",push:"media"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],media:[{token:"comment",regex:"\\/\\*",push:"comment"},{token:"paren.lparen",regex:"\\{",push:"ruleset"},{token:"string",regex:"\\}",next:"pop"},{token:"keyword",regex:"#[a-z0-9-_]+"},{token:"variable",regex:"\\.[a-z0-9-_]+"},{token:"string",regex:":[a-z0-9-_]+"},{token:"constant",regex:"[a-z0-9-_]+"},{caseInsensitive:!0}],comment:[{token:"comment",regex:"\\*\\/",next:"pop"},{defaultToken:"comment"}],ruleset:[{token:"paren.rparen",regex:"\\}",next:"pop"},{token:"comment",regex:"\\/\\*",push:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:["constant.numeric","keyword"],regex:"("+c+")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"},{token:"constant.numeric",regex:c},{token:"constant.numeric",regex:"#[a-f0-9]{6}"},{token:"constant.numeric",regex:"#[a-f0-9]{3}"},{token:["punctuation","entity.other.attribute-name.pseudo-element.css"],regex:h},{token:["punctuation","entity.other.attribute-name.pseudo-class.css"],regex:p},{token:["support.function","string","support.function"],regex:"(url\\()(.*)(\\))"},{token:e,regex:"\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define("ace/mode/behaviour/css",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/mode/behaviour/cstyle","ace/token_iterator"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("./cstyle").CstyleBehaviour,o=e("../../token_iterator").TokenIterator,u=function(){this.inherit(s),this.add("colon","insertion",function(e,t,n,r,i){if(i===":"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\s+/)&&(a=u.stepBackward());if(a&&a.type==="support.type"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===":")return{text:"",selection:[1,1]};if(!f.substring(s.column).match(/^\s*;/))return{text:":;",selection:[1,1]}}}}),this.add("colon","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===":"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\s+/)&&(f=a.stepBackward());if(f&&f.type==="support.type"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===";")return i.end.column++,i}}}),this.add("semicolon","insertion",function(e,t,n,r,i){if(i===";"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===";")return{text:"",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define("ace/mode/css",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/css_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/css","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./css_highlight_rules").CssHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../worker/worker_client").WorkerClient,a=e("./behaviour/css").CssBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules="cStyle",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type=="comment")return r;var s=t.match(/^.*\{\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u(["ace"],"ace/mode/css_worker","Worker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/css"}.call(l.prototype),t.Mode=l}),define("ace/mode/xml_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(e){var t="[_:a-zA-Z\u00c0-\uffff][-_:.a-zA-Z0-9\u00c0-\uffff]*";this.$rules={start:[{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:["punctuation.xml-decl.xml","keyword.xml-decl.xml"],regex:"(<\\?)(xml)(?=[\\s])",next:"xml_decl",caseInsensitive:!0},{token:["punctuation.instruction.xml","keyword.instruction.xml"],regex:"(<\\?)("+t+")",next:"processing_instruction"},{token:"comment.xml",regex:"<\\!--",next:"comment"},{token:["xml-pe.doctype.xml","xml-pe.doctype.xml"],regex:"(<\\!)(DOCTYPE)(?=[\\s])",next:"doctype",caseInsensitive:!0},{include:"tag"},{token:"text.end-tag-open.xml",regex:"",next:"start"}],processing_instruction:[{token:"punctuation.instruction.xml",regex:"\\?>",next:"start"},{defaultToken:"instruction.xml"}],doctype:[{include:"whitespace"},{include:"string"},{token:"xml-pe.doctype.xml",regex:">",next:"start"},{token:"xml-pe.xml",regex:"[-_a-zA-Z0-9:]+"},{token:"punctuation.int-subset",regex:"\\[",push:"int_subset"}],int_subset:[{token:"text.xml",regex:"\\s+"},{token:"punctuation.int-subset.xml",regex:"]",next:"pop"},{token:["punctuation.markup-decl.xml","keyword.markup-decl.xml"],regex:"(<\\!)("+t+")",push:[{token:"text",regex:"\\s+"},{token:"punctuation.markup-decl.xml",regex:">",next:"pop"},{include:"string"}]}],cdata:[{token:"string.cdata.xml",regex:"\\]\\]>",next:"start"},{token:"text.xml",regex:"\\s+"},{token:"text.xml",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment.xml",regex:"-->",next:"start"},{defaultToken:"comment.xml"}],reference:[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],attr_reference:[{token:"constant.language.escape.reference.attribute-value.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}],tag:[{token:["meta.tag.punctuation.tag-open.xml","meta.tag.punctuation.end-tag-open.xml","meta.tag.tag-name.xml"],regex:"(?:(<)|(",next:"start"}]}],tag_whitespace:[{token:"text.tag-whitespace.xml",regex:"\\s+"}],whitespace:[{token:"text.whitespace.xml",regex:"\\s+"}],string:[{token:"string.xml",regex:"'",push:[{token:"string.xml",regex:"'",next:"pop"},{defaultToken:"string.xml"}]},{token:"string.xml",regex:'"',push:[{token:"string.xml",regex:'"',next:"pop"},{defaultToken:"string.xml"}]}],attributes:[{token:"entity.other.attribute-name.xml",regex:"(?:"+t+":)?"+t+""},{token:"keyword.operator.attribute-equals.xml",regex:"="},{include:"tag_whitespace"},{include:"attribute_value"}],attribute_value:[{token:"string.attribute-value.xml",regex:"'",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"attr_reference"},{defaultToken:"string.attribute-value.xml"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:["meta.tag.punctuation.tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(<)("+n+"(?=\\s|>|$))",next:[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:t+"start"}]}),this.$rules[n+"-end"]=[{include:"attributes"},{token:"meta.tag.punctuation.tag-close.xml",regex:"/?>",next:"start",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:["meta.tag.punctuation.end-tag-open.xml","meta.tag."+n+".tag-name.xml"],regex:"(|$))",next:n+"-end"},{token:"string.cdata.xml",regex:"<\\!\\[CDATA\\["},{token:"string.cdata.xml",regex:"\\]\\]>"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define("ace/mode/html_highlight_rules",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/css_highlight_rules","ace/mode/javascript_highlight_rules","ace/mode/xml_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./css_highlight_rules").CssHighlightRules,o=e("./javascript_highlight_rules").JavaScriptHighlightRules,u=e("./xml_highlight_rules").XmlHighlightRules,a=i.createMap({a:"anchor",button:"form",form:"form",img:"image",input:"form",label:"form",option:"form",script:"script",select:"form",textarea:"form",style:"style",table:"table",tbody:"table",td:"table",tfoot:"table",th:"table",tr:"table"}),f=function(){u.call(this),this.addRules({attributes:[{include:"tag_whitespace"},{token:"entity.other.attribute-name.xml",regex:"[-_a-zA-Z0-9:.]+"},{token:"keyword.operator.attribute-equals.xml",regex:"=",push:[{include:"tag_whitespace"},{token:"string.unquoted.attribute-value.html",regex:"[^<>='\"`\\s]+",next:"pop"},{token:"empty",regex:"",next:"pop"}]},{include:"attribute_value"}],tag:[{token:function(e,t){var n=a[t];return["meta.tag.punctuation."+(e=="<"?"":"end-")+"tag-open.xml","meta.tag"+(n?"."+n:"")+".tag-name.xml"]},regex:"(",next:"start"}]}),this.embedTagRules(s,"css-","style"),this.embedTagRules(o,"js-","script"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define("ace/mode/behaviour/xml",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";function u(e,t){return e.type.lastIndexOf(t+".xml")>-1}var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),a=function(){this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){var o=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==""&&a!=="'"&&a!='"'&&n.getWrapBehavioursEnabled())return{text:o+a+o,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==o&&(u(p,"attribute-value")||u(p,"string")))return{text:"",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(u(p,"tag-whitespace")||u(p,"whitespace"))p=h.stepBackward();var d=!c||c.match(/\s/);if(u(p,"attribute-equals")&&(d||c==">")||u(p,"decl-attribute-equals")&&(d||c=="?"))return{text:o+o,selection:[1,1]}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add("autoclosing","insertion",function(e,t,n,r,i){if(i==">"){var o=n.getCursorPosition(),a=new s(r,o.row,o.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(u(f,"tag-name")||u(f,"tag-whitespace")||u(f,"attribute-name")||u(f,"attribute-equals")||u(f,"attribute-value")))return;if(u(f,"reference.attribute-value"))return;if(u(f,"attribute-value")){var l=f.value.charAt(0);if(l=='"'||l=="'"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>o.column||h==o.column&&l!=c)return}}while(!u(f,"tag-name"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(u(a.stepBackward(),"end-tag-open"))return;var v=f.value;p==o.row&&(v=v.substring(0,o.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:">",selection:[1,1]}}}),this.add("autoindent","insertion",function(e,t,n,r,i){if(i=="\n"){var o=n.getCursorPosition(),u=r.getLine(o.row),a=new s(r,o.row,o.column),f=a.getCurrentToken();if(f&&f.type.indexOf("tag-close")!==-1){if(f.value=="/>")return;while(f&&f.type.indexOf("tag-name")===-1)f=a.stepBackward();if(!f)return;var l=f.value,c=a.getCurrentTokenRow();f=a.stepBackward();if(!f||f.type.indexOf("end-tag")!==-1)return;if(this.voidElements&&!this.voidElements[l]){var h=r.getTokenAt(o.row,o.column+1),u=r.getLine(c),p=this.$getIndent(u),d=p+r.getTabString();return h&&h.value==="-1}var r=e("../../lib/oop"),i=e("../../lib/lang"),s=e("../../range").Range,o=e("./fold_mode").FoldMode,u=e("../../token_iterator").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=e||{},this.optionalEndTags=r.mixin({},this.voidElements),t&&r.mixin(this.optionalEndTags,t)};r.inherits(a,o);var f=function(){this.tagName="",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t=="markbeginend"?"end":"":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?"":this._findEndTagInLine(e,n,r.tagName,r.end.column)?"":"start":""},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i";break}}return r}if(l(s,"tag-close"))return r.selfClosing=s.value=="/>",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,"tag-open"))return n.closing=l(t,"end-tag-open"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,"tag-name")?n.tagName=t.value:l(t,"tag-close")&&(n.selfClosing=t.value=="/>",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.optionalEndTags.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};r.start.row==r.end.row&&(l.column=r.end.column);while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,a.start.row==a.end.row&&a.start.column-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,"tag-name"))i=n.stepBackward();if(i)return i.value}var r=e("../token_iterator").TokenIterator,i=["accesskey","class","contenteditable","contextmenu","dir","draggable","dropzone","hidden","id","inert","itemid","itemprop","itemref","itemscope","itemtype","lang","spellcheck","style","tabindex","title","translate"],s=["onabort","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextmenu","oncuechange","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onload","onloadeddata","onloadedmetadata","onloadstart","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onmousewheel","onpause","onplay","onplaying","onprogress","onratechange","onreset","onscroll","onseeked","onseeking","onselect","onshow","onstalled","onsubmit","onsuspend","ontimeupdate","onvolumechange","onwaiting"],o=i.concat(s),u={html:["manifest"],head:[],title:[],base:["href","target"],link:["href","hreflang","rel","media","type","sizes"],meta:["http-equiv","name","content","charset"],style:["type","media","scoped"],script:["charset","type","src","defer","async"],noscript:["href"],body:["onafterprint","onbeforeprint","onbeforeunload","onhashchange","onmessage","onoffline","onpopstate","onredo","onresize","onstorage","onundo","onunload"],section:[],nav:[],article:["pubdate"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:["cite"],ol:["start","reversed"],ul:[],li:["value"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:["href","target","ping","rel","media","hreflang","type"],em:[],strong:[],small:[],s:[],cite:[],q:["cite"],dfn:[],abbr:[],data:[],time:["datetime"],code:[],"var":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:["cite","datetime"],del:["cite","datetime"],img:["alt","src","height","width","usemap","ismap"],iframe:["name","src","height","width","sandbox","seamless"],embed:["src","height","width","type"],object:["param","data","type","height","width","usemap","name","form","classid"],param:["name","value"],video:["src","autobuffer","autoplay","loop","controls","width","height","poster"],audio:["src","autobuffer","autoplay","loop","controls"],source:["src","type","media"],track:["kind","src","srclang","label","default"],canvas:["width","height"],map:["name"],area:["shape","coords","href","hreflang","alt","target","media","rel","ping","type"],svg:[],math:[],table:["summary"],caption:[],colgroup:["span"],col:["span"],tbody:[],thead:[],tfoot:[],tr:[],td:["headers","rowspan","colspan"],th:["headers","rowspan","colspan","scope"],form:["accept-charset","action","autocomplete","enctype","method","name","novalidate","target"],fieldset:["disabled","form","name"],legend:[],label:["form","for"],input:["type","accept","alt","autocomplete","checked","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","height","list","max","maxlength","min","multiple","pattern","placeholder","readonly","required","size","src","step","width","files","value"],button:["autofocus","disabled","form","formaction","formenctype","formmethod","formnovalidate","formtarget","name","value","type"],select:["autofocus","disabled","form","multiple","name","size"],datalist:[],optgroup:["disabled","label"],option:["disabled","selected","label","value"],textarea:["autofocus","disabled","form","maxlength","name","placeholder","readonly","required","rows","cols","wrap"],keygen:["autofocus","challenge","disabled","form","keytype","name"],output:["for","form","name"],progress:["value","max"],meter:["value","min","max","low","high","optimum"],details:["open"],summary:[],command:["type","label","icon","disabled","checked","radiogroup","command"],menu:["type","label"],dialog:["open"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,"tag-name")||f(i,"tag-open")||f(i,"end-tag-open")?this.getTagCompletions(e,t,n,r):f(i,"tag-whitespace")||f(i,"attribute-name")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:"tag",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'="$0"',meta:"attribute",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define("ace/mode/html",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/mode/text","ace/mode/javascript","ace/mode/css","ace/mode/html_highlight_rules","ace/mode/behaviour/xml","ace/mode/folding/html","ace/mode/html_completions","ace/worker/worker_client"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/lang"),s=e("./text").Mode,o=e("./javascript").Mode,u=e("./css").Mode,a=e("./html_highlight_rules").HtmlHighlightRules,f=e("./behaviour/xml").XmlBehaviour,l=e("./folding/html").FoldMode,c=e("./html_completions").HtmlCompletions,h=e("../worker/worker_client").WorkerClient,p=["area","base","br","col","embed","hr","img","input","keygen","link","meta","menuitem","param","source","track","wbr"],d=["li","dt","dd","p","rt","rp","optgroup","option","colgroup","td","th"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({"js-":o,"css-":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:""},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h(["ace"],"ace/mode/html_worker","Worker");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call("setOptions",[{context:this.fragmentContext}]),t.on("error",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/html"}.call(v.prototype),t.Mode=v}) \ No newline at end of file diff --git a/www/lib/ace/mode-javascript.js b/www/lib/ace/mode-javascript.js new file mode 100644 index 0000000..4be6044 --- /dev/null +++ b/www/lib/ace/mode-javascript.js @@ -0,0 +1 @@ +define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b",s="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[{token:"comment",regex:"\\/\\/",next:"line_comment"},i.getStartRule("doc-start"),{token:"comment",regex:/\/\*/,next:"comment"},{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0[xX][0-9a-fA-F]+\b/},{token:"constant.numeric",regex:/[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+r+")(\\.)(prototype)(\\.)("+r+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\.)("+r+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+r+")(\\.)("+r+")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+r+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+r+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:"(?:"+n+")\\b",next:"start"},{token:["punctuation.operator","support.function"],regex:/(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:["punctuation.operator","support.function.dom"],regex:/(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:["punctuation.operator","support.constant"],regex:/(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:["support.constant"],regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/},{token:t,regex:r},{token:"keyword.operator",regex:/--|\+\+|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],start:[i.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment_regex_allowed"},{token:"comment",regex:"\\/\\/",next:"line_comment_regex_allowed"},{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],function_arguments:[{token:"variable.parameter",regex:r},{token:"punctuation.operator",regex:"[, ]+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],comment_regex_allowed:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:"start"},{defaultToken:"comment",caseInsensitive:!0}],comment:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:"no_regex"},{defaultToken:"comment",caseInsensitive:!0}],line_comment_regex_allowed:[i.getTagRule(),{token:"comment",regex:"$|^",next:"start"},{defaultToken:"comment",caseInsensitive:!0}],line_comment:[i.getTagRule(),{token:"comment",regex:"$|^",next:"no_regex"},{defaultToken:"comment",caseInsensitive:!0}],qqstring:[{token:"constant.language.escape",regex:s},{token:"string",regex:"\\\\$",next:"qqstring"},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:s},{token:"string",regex:"\\\\$",next:"qstring"},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]},(!e||!e.noES6)&&this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(e,t,n){this.next=e=="{"?this.nextState:"";if(e=="{"&&n.length)return n.unshift("start",t),"paren";if(e=="}"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf("string")!=-1)return"paren.quasi.end"}return e=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:s},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]}),this.embedRules(i,"doc-",[i.getEndRule("no_regex")]),this.normalizeRules()};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},h=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},p=function(){this.add("braces","insertion",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i=="{"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==""&&l!=="{"&&n.getWrapBehavioursEnabled())return h(a,l,"{","}");if(p.isSaneInsertion(n,r))return/[\]\}\)]/.test(u[s.column])||n.inMultiSelectMode?(p.recordAutoInsert(n,r,"}"),{text:"{}",selection:[1,1]}):(p.recordMaybeInsert(n,r,"{"),{text:"{",selection:[1,1]})}else if(i=="}"){c(n);var d=u.substring(s.column,s.column+1);if(d=="}"){var v=r.$findOpeningBracket("}",{column:s.column+1,row:s.row});if(v!==null&&p.isAutoInsertedClosing(s,u,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(i=="\n"||i=="\r\n"){c(n);var m="";p.isMaybeInsertedClosing(s,u)&&(m=o.stringRepeat("}",f.maybeInsertedBrackets),p.clearMaybeInsertedClosing());var d=u.substring(s.column,s.column+1);if(d==="}"){var g=r.findMatchingBracket({row:s.row,column:s.column+1},"}");if(!g)return null;var y=this.$getIndent(r.getLine(g.row))}else{if(!m){p.clearMaybeInsertedClosing();return}var y=this.$getIndent(u)}var b=y+r.getTabString();return{text:"\n"+b+"\n"+y+m,selection:[1,b.length,1,b.length]}}p.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"(",")");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return h(s,o,"[","]");if(p.isSaneInsertion(n,r))return p.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&p.isAutoInsertedClosing(u,a,i))return p.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){if(i=='"'||i=="'"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==""&&u!=="'"&&u!='"'&&n.getWrapBehavioursEnabled())return h(o,u,s,s);if(!u){var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column),p=f.substring(a.column,a.column+1),d=r.getTokenAt(a.row,a.column),v=r.getTokenAt(a.row,a.column+1);if(l=="\\"&&d&&/escape/.test(d.type))return null;var m=d&&/string|escape/.test(d.type),g=!v||/string|escape/.test(v.type),y;if(p==s)y=m!==g;else{if(m&&!g)return null;if(m&&g)return null;var b=r.$mode.tokenRe;b.lastIndex=0;var w=b.test(l);b.lastIndex=0;var E=b.test(l);if(w||E)return null;if(p&&!/[\s;,.})\]\\]/.test(p))return null;y=!0}return{text:y?s+s:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='"'||s=="'")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};p.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},p.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},p.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},p.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},p.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},p.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},p.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},p.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(p,i),t.CstyleBehaviour=p}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\{|\[)[^\}\]]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/range","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./javascript_highlight_rules").JavaScriptHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../range").Range,a=e("../worker/worker_client").WorkerClient,f=e("./behaviour/cstyle").CstyleBehaviour,l=e("./folding/cstyle").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"||e=="no_regex"){var u=t.match(/^.*(?:\bcase\b.*\:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc-start"){if(o=="start"||o=="no_regex")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/javascript"}.call(c.prototype),t.Mode=c}) \ No newline at end of file diff --git a/www/lib/ace/worker-css.js b/www/lib/ace/worker-css.js new file mode 100644 index 0000000..c28c835 --- /dev/null +++ b/www/lib/ace/worker-css.js @@ -0,0 +1 @@ +"no use strict";(function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}})(this),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/lib/lang",["require","exports","module"],function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){var n="";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/lib/event_emitter",["require","exports","module"],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;othis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){!e instanceof o&&(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4&&this.$splitAndapplyLargeDelta(e,2e4),i(this.$lines,e,t),this._signal("change",e)},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length,i=e.start.row,s=e.start.column,o=0,u=0;do{o=u,u+=t-1;var a=n.slice(o,u);if(u>r){e.lines=a,e.start.row=i+o,e.start.column=s;break}a.push(""),this.applyDelta({start:this.pos(i+o,s),end:this.pos(i+u,s=0),action:e.action,lines:a},!0)}while(!0)},this.revertDelta=function(e){this.applyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i=0&&this._ltIndex-1&&!t[u.type].hide&&(u.channel=t[u.type].channel,this._token=u,this._lt.push(u),this._ltIndexCache.push(this._lt.length-this._ltIndex+i),this._lt.length>5&&this._lt.shift(),this._ltIndexCache.length>5&&this._ltIndexCache.shift(),this._ltIndex=this._lt.length),a=t[u.type],a&&(a.hide||a.channel!==undefined&&e!==a.channel)?this.get(e):u.type},LA:function(e){var t=e,n;if(e>0){if(e>5)throw new Error("Too much lookahead.");while(t)n=this.get(),t--;while(tthis._tokenData.length?"UNKNOWN_TOKEN":this._tokenData[e].name},tokenType:function(e){return this._tokenData[e]||-1},unget:function(){if(!this._ltIndexCache.length)throw new Error("Too much lookahead.");this._ltIndex-=this._ltIndexCache.pop(),this._token=this._lt[this._ltIndex-1]}},parserlib.util={StringReader:t,SyntaxError:n,SyntaxUnit:r,EventTarget:e,TokenStreamBase:i}})(),function(){function Combinator(e,t,n){SyntaxUnit.call(this,e,t,n,Parser.COMBINATOR_TYPE),this.type="unknown",/^\s+$/.test(e)?this.type="descendant":e==">"?this.type="child":e=="+"?this.type="adjacent-sibling":e=="~"&&(this.type="sibling")}function MediaFeature(e,t){SyntaxUnit.call(this,"("+e+(t!==null?":"+t:"")+")",e.startLine,e.startCol,Parser.MEDIA_FEATURE_TYPE),this.name=e,this.value=t}function MediaQuery(e,t,n,r,i){SyntaxUnit.call(this,(e?e+" ":"")+(t?t:"")+(t&&n.length>0?" and ":"")+n.join(" and "),r,i,Parser.MEDIA_QUERY_TYPE),this.modifier=e,this.mediaType=t,this.features=n}function Parser(e){EventTarget.call(this),this.options=e||{},this._tokenStream=null}function PropertyName(e,t,n,r){SyntaxUnit.call(this,e,n,r,Parser.PROPERTY_NAME_TYPE),this.hack=t}function PropertyValue(e,t,n){SyntaxUnit.call(this,e.join(" "),t,n,Parser.PROPERTY_VALUE_TYPE),this.parts=e}function PropertyValueIterator(e){this._i=0,this._parts=e.parts,this._marks=[],this.value=e}function PropertyValuePart(text,line,col){SyntaxUnit.call(this,text,line,col,Parser.PROPERTY_VALUE_PART_TYPE),this.type="unknown";var temp;if(/^([+\-]?[\d\.]+)([a-z]+)$/i.test(text)){this.type="dimension",this.value=+RegExp.$1,this.units=RegExp.$2;switch(this.units.toLowerCase()){case"em":case"rem":case"ex":case"px":case"cm":case"mm":case"in":case"pt":case"pc":case"ch":case"vh":case"vw":case"vmax":case"vmin":this.type="length";break;case"deg":case"rad":case"grad":this.type="angle";break;case"ms":case"s":this.type="time";break;case"hz":case"khz":this.type="frequency";break;case"dpi":case"dpcm":this.type="resolution"}}else/^([+\-]?[\d\.]+)%$/i.test(text)?(this.type="percentage",this.value=+RegExp.$1):/^([+\-]?\d+)$/i.test(text)?(this.type="integer",this.value=+RegExp.$1):/^([+\-]?[\d\.]+)$/i.test(text)?(this.type="number",this.value=+RegExp.$1):/^#([a-f0-9]{3,6})/i.test(text)?(this.type="color",temp=RegExp.$1,temp.length==3?(this.red=parseInt(temp.charAt(0)+temp.charAt(0),16),this.green=parseInt(temp.charAt(1)+temp.charAt(1),16),this.blue=parseInt(temp.charAt(2)+temp.charAt(2),16)):(this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16))):/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3):/^rgb\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/100):/^rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3,this.alpha=+RegExp.$4):/^rgba\(\s*(\d+)%\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.red=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/100,this.alpha=+RegExp.$4):/^hsl\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*\)/i.test(text)?(this.type="color",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100):/^hsla\(\s*(\d+)\s*,\s*(\d+)%\s*,\s*(\d+)%\s*,\s*([\d\.]+)\s*\)/i.test(text)?(this.type="color",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100,this.alpha=+RegExp.$4):/^url\(["']?([^\)"']+)["']?\)/i.test(text)?(this.type="uri",this.uri=RegExp.$1):/^([^\(]+)\(/i.test(text)?(this.type="function",this.name=RegExp.$1,this.value=text):/^["'][^"']*["']/.test(text)?(this.type="string",this.value=eval(text)):Colors[text.toLowerCase()]?(this.type="color",temp=Colors[text.toLowerCase()].substring(1),this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16)):/^[\,\/]$/.test(text)?(this.type="operator",this.value=text):/^[a-z\-_\u0080-\uFFFF][a-z0-9\-_\u0080-\uFFFF]*$/i.test(text)&&(this.type="identifier",this.value=text)}function Selector(e,t,n){SyntaxUnit.call(this,e.join(" "),t,n,Parser.SELECTOR_TYPE),this.parts=e,this.specificity=Specificity.calculate(this)}function SelectorPart(e,t,n,r,i){SyntaxUnit.call(this,n,r,i,Parser.SELECTOR_PART_TYPE),this.elementName=e,this.modifiers=t}function SelectorSubPart(e,t,n,r){SyntaxUnit.call(this,e,n,r,Parser.SELECTOR_SUB_PART_TYPE),this.type=t,this.args=[]}function Specificity(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function isHexDigit(e){return e!==null&&h.test(e)}function isDigit(e){return e!==null&&/\d/.test(e)}function isWhitespace(e){return e!==null&&/\s/.test(e)}function isNewLine(e){return e!==null&&nl.test(e)}function isNameStart(e){return e!==null&&/[a-z_\u0080-\uFFFF\\]/i.test(e)}function isNameChar(e){return e!==null&&(isNameStart(e)||/[0-9\-\\]/.test(e))}function isIdentStart(e){return e!==null&&(isNameStart(e)||/\-\\/.test(e))}function mix(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function TokenStream(e){TokenStreamBase.call(this,e,Tokens)}function ValidationError(e,t,n){this.col=n,this.line=t,this.message=e}var EventTarget=parserlib.util.EventTarget,TokenStreamBase=parserlib.util.TokenStreamBase,StringReader=parserlib.util.StringReader,SyntaxError=parserlib.util.SyntaxError,SyntaxUnit=parserlib.util.SyntaxUnit,Colors={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32",activeBorder:"Active window border.",activecaption:"Active window caption.",appworkspace:"Background color of multiple document interface.",background:"Desktop background.",buttonface:"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonhighlight:"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttonshadow:"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",buttontext:"Text on push buttons.",captiontext:"Text in caption, size box, and scrollbar arrow box.",graytext:"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",greytext:"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.",highlight:"Item(s) selected in a control.",highlighttext:"Text of item(s) selected in a control.",inactiveborder:"Inactive window border.",inactivecaption:"Inactive window caption.",inactivecaptiontext:"Color of text in an inactive caption.",infobackground:"Background color for tooltip controls.",infotext:"Text color for tooltip controls.",menu:"Menu background.",menutext:"Text in menus.",scrollbar:"Scroll bar gray area.",threeddarkshadow:"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedface:"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedhighlight:"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedlightshadow:"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",threedshadow:"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",window:"Window background.",windowframe:"Window frame.",windowtext:"Text in windows."};Combinator.prototype=new SyntaxUnit,Combinator.prototype.constructor=Combinator,MediaFeature.prototype=new SyntaxUnit,MediaFeature.prototype.constructor=MediaFeature,MediaQuery.prototype=new SyntaxUnit,MediaQuery.prototype.constructor=MediaQuery,Parser.DEFAULT_TYPE=0,Parser.COMBINATOR_TYPE=1,Parser.MEDIA_FEATURE_TYPE=2,Parser.MEDIA_QUERY_TYPE=3,Parser.PROPERTY_NAME_TYPE=4,Parser.PROPERTY_VALUE_TYPE=5,Parser.PROPERTY_VALUE_PART_TYPE=6,Parser.SELECTOR_TYPE=7,Parser.SELECTOR_PART_TYPE=8,Parser.SELECTOR_SUB_PART_TYPE=9,Parser.prototype=function(){var e=new EventTarget,t,n={constructor:Parser,DEFAULT_TYPE:0,COMBINATOR_TYPE:1,MEDIA_FEATURE_TYPE:2,MEDIA_QUERY_TYPE:3,PROPERTY_NAME_TYPE:4,PROPERTY_VALUE_TYPE:5,PROPERTY_VALUE_PART_TYPE:6,SELECTOR_TYPE:7,SELECTOR_PART_TYPE:8,SELECTOR_SUB_PART_TYPE:9,_stylesheet:function(){var e=this._tokenStream,t=null,n,r,i;this.fire("startstylesheet"),this._charset(),this._skipCruft();while(e.peek()==Tokens.IMPORT_SYM)this._import(),this._skipCruft();while(e.peek()==Tokens.NAMESPACE_SYM)this._namespace(),this._skipCruft();i=e.peek();while(i>Tokens.EOF){try{switch(i){case Tokens.MEDIA_SYM:this._media(),this._skipCruft();break;case Tokens.PAGE_SYM:this._page(),this._skipCruft();break;case Tokens.FONT_FACE_SYM:this._font_face(),this._skipCruft();break;case Tokens.KEYFRAMES_SYM:this._keyframes(),this._skipCruft();break;case Tokens.VIEWPORT_SYM:this._viewport(),this._skipCruft();break;case Tokens.UNKNOWN_SYM:e.get();if(!!this.options.strict)throw new SyntaxError("Unknown @ rule.",e.LT(0).startLine,e.LT(0).startCol);this.fire({type:"error",error:null,message:"Unknown @ rule: "+e.LT(0).value+".",line:e.LT(0).startLine,col:e.LT(0).startCol}),n=0;while(e.advance([Tokens.LBRACE,Tokens.RBRACE])==Tokens.LBRACE)n++;while(n)e.advance([Tokens.RBRACE]),n--;break;case Tokens.S:this._readWhitespace();break;default:if(!this._ruleset())switch(i){case Tokens.CHARSET_SYM:throw r=e.LT(1),this._charset(!1),new SyntaxError("@charset not allowed here.",r.startLine,r.startCol);case Tokens.IMPORT_SYM:throw r=e.LT(1),this._import(!1),new SyntaxError("@import not allowed here.",r.startLine,r.startCol);case Tokens.NAMESPACE_SYM:throw r=e.LT(1),this._namespace(!1),new SyntaxError("@namespace not allowed here.",r.startLine,r.startCol);default:e.get(),this._unexpectedToken(e.token())}}}catch(s){if(!(s instanceof SyntaxError&&!this.options.strict))throw s;this.fire({type:"error",error:s,message:s.message,line:s.line,col:s.col})}i=e.peek()}i!=Tokens.EOF&&this._unexpectedToken(e.token()),this.fire("endstylesheet")},_charset:function(e){var t=this._tokenStream,n,r,i,s;t.match(Tokens.CHARSET_SYM)&&(i=t.token().startLine,s=t.token().startCol,this._readWhitespace(),t.mustMatch(Tokens.STRING),r=t.token(),n=r.value,this._readWhitespace(),t.mustMatch(Tokens.SEMICOLON),e!==!1&&this.fire({type:"charset",charset:n,line:i,col:s}))},_import:function(e){var t=this._tokenStream,n,r,i,s=[];t.mustMatch(Tokens.IMPORT_SYM),i=t.token(),this._readWhitespace(),t.mustMatch([Tokens.STRING,Tokens.URI]),r=t.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/,"$1"),this._readWhitespace(),s=this._media_query_list(),t.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:"import",uri:r,media:s,line:i.startLine,col:i.startCol})},_namespace:function(e){var t=this._tokenStream,n,r,i,s;t.mustMatch(Tokens.NAMESPACE_SYM),n=t.token().startLine,r=t.token().startCol,this._readWhitespace(),t.match(Tokens.IDENT)&&(i=t.token().value,this._readWhitespace()),t.mustMatch([Tokens.STRING,Tokens.URI]),s=t.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/,"$1"),this._readWhitespace(),t.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:"namespace",prefix:i,uri:s,line:n,col:r})},_media:function(){var e=this._tokenStream,t,n,r;e.mustMatch(Tokens.MEDIA_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),r=this._media_query_list(),e.mustMatch(Tokens.LBRACE),this._readWhitespace(),this.fire({type:"startmedia",media:r,line:t,col:n});for(;;)if(e.peek()==Tokens.PAGE_SYM)this._page();else if(e.peek()==Tokens.FONT_FACE_SYM)this._font_face();else if(e.peek()==Tokens.VIEWPORT_SYM)this._viewport();else if(!this._ruleset())break;e.mustMatch(Tokens.RBRACE),this._readWhitespace(),this.fire({type:"endmedia",media:r,line:t,col:n})},_media_query_list:function(){var e=this._tokenStream,t=[];this._readWhitespace(),(e.peek()==Tokens.IDENT||e.peek()==Tokens.LPAREN)&&t.push(this._media_query());while(e.match(Tokens.COMMA))this._readWhitespace(),t.push(this._media_query());return t},_media_query:function(){var e=this._tokenStream,t=null,n=null,r=null,i=[];e.match(Tokens.IDENT)&&(n=e.token().value.toLowerCase(),n!="only"&&n!="not"?(e.unget(),n=null):r=e.token()),this._readWhitespace(),e.peek()==Tokens.IDENT?(t=this._media_type(),r===null&&(r=e.token())):e.peek()==Tokens.LPAREN&&(r===null&&(r=e.LT(1)),i.push(this._media_expression()));if(t===null&&i.length===0)return null;this._readWhitespace();while(e.match(Tokens.IDENT))e.token().value.toLowerCase()!="and"&&this._unexpectedToken(e.token()),this._readWhitespace(),i.push(this._media_expression());return new MediaQuery(n,t,i,r.startLine,r.startCol)},_media_type:function(){return this._media_feature()},_media_expression:function(){var e=this._tokenStream,t=null,n,r=null;return e.mustMatch(Tokens.LPAREN),t=this._media_feature(),this._readWhitespace(),e.match(Tokens.COLON)&&(this._readWhitespace(),n=e.LT(1),r=this._expression()),e.mustMatch(Tokens.RPAREN),this._readWhitespace(),new MediaFeature(t,r?new SyntaxUnit(r,n.startLine,n.startCol):null)},_media_feature:function(){var e=this._tokenStream;return e.mustMatch(Tokens.IDENT),SyntaxUnit.fromToken(e.token())},_page:function(){var e=this._tokenStream,t,n,r=null,i=null;e.mustMatch(Tokens.PAGE_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),e.match(Tokens.IDENT)&&(r=e.token().value,r.toLowerCase()==="auto"&&this._unexpectedToken(e.token())),e.peek()==Tokens.COLON&&(i=this._pseudo_page()),this._readWhitespace(),this.fire({type:"startpage",id:r,pseudo:i,line:t,col:n}),this._readDeclarations(!0,!0),this.fire({type:"endpage",id:r,pseudo:i,line:t,col:n})},_margin:function(){var e=this._tokenStream,t,n,r=this._margin_sym();return r?(t=e.token().startLine,n=e.token().startCol,this.fire({type:"startpagemargin",margin:r,line:t,col:n}),this._readDeclarations(!0),this.fire({type:"endpagemargin",margin:r,line:t,col:n}),!0):!1},_margin_sym:function(){var e=this._tokenStream;return e.match([Tokens.TOPLEFTCORNER_SYM,Tokens.TOPLEFT_SYM,Tokens.TOPCENTER_SYM,Tokens.TOPRIGHT_SYM,Tokens.TOPRIGHTCORNER_SYM,Tokens.BOTTOMLEFTCORNER_SYM,Tokens.BOTTOMLEFT_SYM,Tokens.BOTTOMCENTER_SYM,Tokens.BOTTOMRIGHT_SYM,Tokens.BOTTOMRIGHTCORNER_SYM,Tokens.LEFTTOP_SYM,Tokens.LEFTMIDDLE_SYM,Tokens.LEFTBOTTOM_SYM,Tokens.RIGHTTOP_SYM,Tokens.RIGHTMIDDLE_SYM,Tokens.RIGHTBOTTOM_SYM])?SyntaxUnit.fromToken(e.token()):null},_pseudo_page:function(){var e=this._tokenStream;return e.mustMatch(Tokens.COLON),e.mustMatch(Tokens.IDENT),e.token().value},_font_face:function(){var e=this._tokenStream,t,n;e.mustMatch(Tokens.FONT_FACE_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),this.fire({type:"startfontface",line:t,col:n}),this._readDeclarations(!0),this.fire({type:"endfontface",line:t,col:n})},_viewport:function(){var e=this._tokenStream,t,n;e.mustMatch(Tokens.VIEWPORT_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),this.fire({type:"startviewport",line:t,col:n}),this._readDeclarations(!0),this.fire({type:"endviewport",line:t,col:n})},_operator:function(e){var t=this._tokenStream,n=null;if(t.match([Tokens.SLASH,Tokens.COMMA])||e&&t.match([Tokens.PLUS,Tokens.STAR,Tokens.MINUS]))n=t.token(),this._readWhitespace();return n?PropertyValuePart.fromToken(n):null},_combinator:function(){var e=this._tokenStream,t=null,n;return e.match([Tokens.PLUS,Tokens.GREATER,Tokens.TILDE])&&(n=e.token(),t=new Combinator(n.value,n.startLine,n.startCol),this._readWhitespace()),t},_unary_operator:function(){var e=this._tokenStream;return e.match([Tokens.MINUS,Tokens.PLUS])?e.token().value:null},_property:function(){var e=this._tokenStream,t=null,n=null,r,i,s,o;return e.peek()==Tokens.STAR&&this.options.starHack&&(e.get(),i=e.token(),n=i.value,s=i.startLine,o=i.startCol),e.match(Tokens.IDENT)&&(i=e.token(),r=i.value,r.charAt(0)=="_"&&this.options.underscoreHack&&(n="_",r=r.substring(1)),t=new PropertyName(r,n,s||i.startLine,o||i.startCol),this._readWhitespace()),t},_ruleset:function(){var e=this._tokenStream,t,n;try{n=this._selectors_group()}catch(r){if(r instanceof SyntaxError&&!this.options.strict){this.fire({type:"error",error:r,message:r.message,line:r.line,col:r.col}),t=e.advance([Tokens.RBRACE]);if(t!=Tokens.RBRACE)throw r;return!0}throw r}return n&&(this.fire({type:"startrule",selectors:n,line:n[0].line,col:n[0].col}),this._readDeclarations(!0),this.fire({type:"endrule",selectors:n,line:n[0].line,col:n[0].col})),n},_selectors_group:function(){var e=this._tokenStream,t=[],n;n=this._selector();if(n!==null){t.push(n);while(e.match(Tokens.COMMA))this._readWhitespace(),n=this._selector(),n!==null?t.push(n):this._unexpectedToken(e.LT(1))}return t.length?t:null},_selector:function(){var e=this._tokenStream,t=[],n=null,r=null,i=null;n=this._simple_selector_sequence();if(n===null)return null;t.push(n);do{r=this._combinator();if(r!==null)t.push(r),n=this._simple_selector_sequence(),n===null?this._unexpectedToken(e.LT(1)):t.push(n);else{if(!this._readWhitespace())break;i=new Combinator(e.token().value,e.token().startLine,e.token().startCol),r=this._combinator(),n=this._simple_selector_sequence(),n===null?r!==null&&this._unexpectedToken(e.LT(1)):(r!==null?t.push(r):t.push(i),t.push(n))}}while(!0);return new Selector(t,t[0].line,t[0].col)},_simple_selector_sequence:function(){var e=this._tokenStream,t=null,n=[],r="",i=[function(){return e.match(Tokens.HASH)?new SelectorSubPart(e.token().value,"id",e.token().startLine,e.token().startCol):null},this._class,this._attrib,this._pseudo,this._negation],s=0,o=i.length,u=null,a=!1,f,l;f=e.LT(1).startLine,l=e.LT(1).startCol,t=this._type_selector(),t||(t=this._universal()),t!==null&&(r+=t);for(;;){if(e.peek()===Tokens.S)break;while(s1&&e.unget()),null)},_class:function(){var e=this._tokenStream,t;return e.match(Tokens.DOT)?(e.mustMatch(Tokens.IDENT),t=e.token(),new SelectorSubPart("."+t.value,"class",t.startLine,t.startCol-1)):null},_element_name:function(){var e=this._tokenStream,t;return e.match(Tokens.IDENT)?(t=e.token(),new SelectorSubPart(t.value,"elementName",t.startLine,t.startCol)):null},_namespace_prefix:function(){var e=this._tokenStream,t="";if(e.LA(1)===Tokens.PIPE||e.LA(2)===Tokens.PIPE)e.match([Tokens.IDENT,Tokens.STAR])&&(t+=e.token().value),e.mustMatch(Tokens.PIPE),t+="|";return t.length?t:null},_universal:function(){var e=this._tokenStream,t="",n;return n=this._namespace_prefix(),n&&(t+=n),e.match(Tokens.STAR)&&(t+="*"),t.length?t:null},_attrib:function(){var e=this._tokenStream,t=null,n,r;return e.match(Tokens.LBRACKET)?(r=e.token(),t=r.value,t+=this._readWhitespace(),n=this._namespace_prefix(),n&&(t+=n),e.mustMatch(Tokens.IDENT),t+=e.token().value,t+=this._readWhitespace(),e.match([Tokens.PREFIXMATCH,Tokens.SUFFIXMATCH,Tokens.SUBSTRINGMATCH,Tokens.EQUALS,Tokens.INCLUDES,Tokens.DASHMATCH])&&(t+=e.token().value,t+=this._readWhitespace(),e.mustMatch([Tokens.IDENT,Tokens.STRING]),t+=e.token().value,t+=this._readWhitespace()),e.mustMatch(Tokens.RBRACKET),new SelectorSubPart(t+"]","attribute",r.startLine,r.startCol)):null},_pseudo:function(){var e=this._tokenStream,t=null,n=":",r,i;return e.match(Tokens.COLON)&&(e.match(Tokens.COLON)&&(n+=":"),e.match(Tokens.IDENT)?(t=e.token().value,r=e.token().startLine,i=e.token().startCol-n.length):e.peek()==Tokens.FUNCTION&&(r=e.LT(1).startLine,i=e.LT(1).startCol-n.length,t=this._functional_pseudo()),t&&(t=new SelectorSubPart(n+t,"pseudo",r,i))),t},_functional_pseudo:function(){var e=this._tokenStream,t=null;return e.match(Tokens.FUNCTION)&&(t=e.token().value,t+=this._readWhitespace(),t+=this._expression(),e.mustMatch(Tokens.RPAREN),t+=")"),t},_expression:function(){var e=this._tokenStream,t="";while(e.match([Tokens.PLUS,Tokens.MINUS,Tokens.DIMENSION,Tokens.NUMBER,Tokens.STRING,Tokens.IDENT,Tokens.LENGTH,Tokens.FREQ,Tokens.ANGLE,Tokens.TIME,Tokens.RESOLUTION,Tokens.SLASH]))t+=e.token().value,t+=this._readWhitespace();return t.length?t:null},_negation:function(){var e=this._tokenStream,t,n,r="",i,s=null;return e.match(Tokens.NOT)&&(r=e.token().value,t=e.token().startLine,n=e.token().startCol,r+=this._readWhitespace(),i=this._negation_arg(),r+=i,r+=this._readWhitespace(),e.match(Tokens.RPAREN),r+=e.token().value,s=new SelectorSubPart(r,"not",t,n),s.args.push(i)),s},_negation_arg:function(){var e=this._tokenStream,t=[this._type_selector,this._universal,function(){return e.match(Tokens.HASH)?new SelectorSubPart(e.token().value,"id",e.token().startLine,e.token().startCol):null},this._class,this._attrib,this._pseudo],n=null,r=0,i=t.length,s,o,u,a;o=e.LT(1).startLine,u=e.LT(1).startCol;while(r0?new PropertyValue(n,n[0].line,n[0].col):null},_term:function(e){var t=this._tokenStream,n=null,r=null,i=null,s,o,u;return n=this._unary_operator(),n!==null&&(o=t.token().startLine,u=t.token().startCol),t.peek()==Tokens.IE_FUNCTION&&this.options.ieFilters?(r=this._ie_function(),n===null&&(o=t.token().startLine,u=t.token().startCol)):e&&t.match([Tokens.LPAREN,Tokens.LBRACE,Tokens.LBRACKET])?(s=t.token(),i=s.endChar,r=s.value+this._expr(e).text,n===null&&(o=t.token().startLine,u=t.token().startCol),t.mustMatch(Tokens.type(i)),r+=i,this._readWhitespace()):t.match([Tokens.NUMBER,Tokens.PERCENTAGE,Tokens.LENGTH,Tokens.ANGLE,Tokens.TIME,Tokens.FREQ,Tokens.STRING,Tokens.IDENT,Tokens.URI,Tokens.UNICODE_RANGE])?(r=t.token().value,n===null&&(o=t.token().startLine,u=t.token().startCol),this._readWhitespace()):(s=this._hexcolor(),s===null?(n===null&&(o=t.LT(1).startLine,u=t.LT(1).startCol),r===null&&(t.LA(3)==Tokens.EQUALS&&this.options.ieFilters?r=this._ie_function():r=this._function())):(r=s.value,n===null&&(o=s.startLine,u=s.startCol))),r!==null?new PropertyValuePart(n!==null?n+r:r,o,u):null},_function:function(){var e=this._tokenStream,t=null,n=null,r;if(e.match(Tokens.FUNCTION)){t=e.token().value,this._readWhitespace(),n=this._expr(!0),t+=n;if(this.options.ieFilters&&e.peek()==Tokens.EQUALS)do{this._readWhitespace()&&(t+=e.token().value),e.LA(0)==Tokens.COMMA&&(t+=e.token().value),e.match(Tokens.IDENT),t+=e.token().value,e.match(Tokens.EQUALS),t+=e.token().value,r=e.peek();while(r!=Tokens.COMMA&&r!=Tokens.S&&r!=Tokens.RPAREN)e.get(),t+=e.token().value,r=e.peek()}while(e.match([Tokens.COMMA,Tokens.S]));e.match(Tokens.RPAREN),t+=")",this._readWhitespace()}return t},_ie_function:function(){var e=this._tokenStream,t=null,n=null,r;if(e.match([Tokens.IE_FUNCTION,Tokens.FUNCTION])){t=e.token().value;do{this._readWhitespace()&&(t+=e.token().value),e.LA(0)==Tokens.COMMA&&(t+=e.token().value),e.match(Tokens.IDENT),t+=e.token().value,e.match(Tokens.EQUALS),t+=e.token().value,r=e.peek();while(r!=Tokens.COMMA&&r!=Tokens.S&&r!=Tokens.RPAREN)e.get(),t+=e.token().value,r=e.peek()}while(e.match([Tokens.COMMA,Tokens.S]));e.match(Tokens.RPAREN),t+=")",this._readWhitespace()}return t},_hexcolor:function(){var e=this._tokenStream,t=null,n;if(e.match(Tokens.HASH)){t=e.token(),n=t.value;if(!/#[a-f0-9]{3,6}/i.test(n))throw new SyntaxError("Expected a hex color but found '"+n+"' at line "+t.startLine+", col "+t.startCol+".",t.startLine,t.startCol);this._readWhitespace()}return t},_keyframes:function(){var e=this._tokenStream,t,n,r,i="";e.mustMatch(Tokens.KEYFRAMES_SYM),t=e.token(),/^@\-([^\-]+)\-/.test(t.value)&&(i=RegExp.$1),this._readWhitespace(),r=this._keyframe_name(),this._readWhitespace(),e.mustMatch(Tokens.LBRACE),this.fire({type:"startkeyframes",name:r,prefix:i,line:t.startLine,col:t.startCol}),this._readWhitespace(),n=e.peek();while(n==Tokens.IDENT||n==Tokens.PERCENTAGE)this._keyframe_rule(),this._readWhitespace(),n=e.peek();this.fire({type:"endkeyframes",name:r,prefix:i,line:t.startLine,col:t.startCol}),this._readWhitespace(),e.mustMatch(Tokens.RBRACE)},_keyframe_name:function(){var e=this._tokenStream,t;return e.mustMatch([Tokens.IDENT,Tokens.STRING]),SyntaxUnit.fromToken(e.token())},_keyframe_rule:function(){var e=this._tokenStream,t,n=this._key_list();this.fire({type:"startkeyframerule",keys:n,line:n[0].line,col:n[0].col}),this._readDeclarations(!0),this.fire({type:"endkeyframerule",keys:n,line:n[0].line,col:n[0].col})},_key_list:function(){var e=this._tokenStream,t,n,r=[];r.push(this._key()),this._readWhitespace();while(e.match(Tokens.COMMA))this._readWhitespace(),r.push(this._key()),this._readWhitespace();return r},_key:function(){var e=this._tokenStream,t;if(e.match(Tokens.PERCENTAGE))return SyntaxUnit.fromToken(e.token());if(e.match(Tokens.IDENT)){t=e.token();if(/from|to/i.test(t.value))return SyntaxUnit.fromToken(t);e.unget()}this._unexpectedToken(e.LT(1))},_skipCruft:function(){while(this._tokenStream.match([Tokens.S,Tokens.CDO,Tokens.CDC]));},_readDeclarations:function(e,t){var n=this._tokenStream,r;this._readWhitespace(),e&&n.mustMatch(Tokens.LBRACE),this._readWhitespace();try{for(;;){if(!(n.match(Tokens.SEMICOLON)||t&&this._margin())){if(!this._declaration())break;if(!n.match(Tokens.SEMICOLON))break}this._readWhitespace()}n.mustMatch(Tokens.RBRACE),this._readWhitespace()}catch(i){if(!(i instanceof SyntaxError&&!this.options.strict))throw i;this.fire({type:"error",error:i,message:i.message,line:i.line,col:i.col}),r=n.advance([Tokens.SEMICOLON,Tokens.RBRACE]);if(r==Tokens.SEMICOLON)this._readDeclarations(!1,t);else if(r!=Tokens.RBRACE)throw i}},_readWhitespace:function(){var e=this._tokenStream,t="";while(e.match(Tokens.S))t+=e.token().value;return t},_unexpectedToken:function(e){throw new SyntaxError("Unexpected token '"+e.value+"' at line "+e.startLine+", col "+e.startCol+".",e.startLine,e.startCol)},_verifyEnd:function(){this._tokenStream.LA(1)!=Tokens.EOF&&this._unexpectedToken(this._tokenStream.LT(1))},_validateProperty:function(e,t){Validation.validate(e,t)},parse:function(e){this._tokenStream=new TokenStream(e,Tokens),this._stylesheet()},parseStyleSheet:function(e){return this.parse(e)},parseMediaQuery:function(e){this._tokenStream=new TokenStream(e,Tokens);var t=this._media_query();return this._verifyEnd(),t},parsePropertyValue:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._expr();return this._readWhitespace(),this._verifyEnd(),t},parseRule:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._ruleset();return this._readWhitespace(),this._verifyEnd(),t},parseSelector:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._selector();return this._readWhitespace(),this._verifyEnd(),t},parseStyleAttribute:function(e){e+="}",this._tokenStream=new TokenStream(e,Tokens),this._readDeclarations()}};for(t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}();var Properties={"align-items":"flex-start | flex-end | center | baseline | stretch","align-content":"flex-start | flex-end | center | space-between | space-around | stretch","align-self":"auto | flex-start | flex-end | center | baseline | stretch","-webkit-align-items":"flex-start | flex-end | center | baseline | stretch","-webkit-align-content":"flex-start | flex-end | center | space-between | space-around | stretch","-webkit-align-self":"auto | flex-start | flex-end | center | baseline | stretch","alignment-adjust":"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ","alignment-baseline":"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical",animation:1,"animation-delay":{multi:"
    title:button
    ' + (this.groupsIcons[group] ? '
    ' + groupName + '
    ' : groupName) + '
    '; + var isGroupEnabledObj = group === 'common' || group === 'css_common' ? true : this.findCommonValue(view, widgets, 'g_' + group); + var isGroupEnabled = false; + var isGroupEnabledIndeterminate = false; + if (typeof isGroupEnabledObj === 'object' && isGroupEnabledObj.values) { + for (var g = 0; g < isGroupEnabledObj.values.length; g++) { + if (isGroupEnabledObj.values[g] !== false) { + isGroupEnabled = true; + isGroupEnabledIndeterminate = true; + break; + } + } + } else { + isGroupEnabled = isGroupEnabledObj; + } + isGroupEnabled = isGroupEnabled !== false; + this.groups[group].___enabled = isGroupEnabled; + if (group === 'common' || group === 'css_common') { + gText += '
    ' + (icon ? '' : '') + _(line.attrName) + (line.attrIndex !== '' ? ('[' + line.attrIndex + ']') : '') + ':' + (icon ? '' : '') + ''; + + if (line.button) { + if (!line.button.html) { + text += '' + line.button.html + '
    ' + this.groups[group][widAttr][i].input + '
    "+l+"
    ",d=3===a.firstChild.nodeType?a.lastChild:a.firstChild):"col"===n?(a.innerHTML=""+l+"
    ",d=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild):"tr"===n?(a.innerHTML=""+l+"
    ",d=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild):"td"===n||"th"===n?(a.innerHTML=""+l+"
    ",d=3===a.firstChild.nodeType?a.lastChild:a.firstChild.firstChild.firstChild):"option"===n?(a.innerHTML="",d=3===a.firstChild.nodeType?a.lastChild:a.firstChild):d.innerHTML=""+l;var o={},h=e.childNodes(d);o.length=h.length;for(var c=0;cr;r++)n.appendChild(i[r]);return n},function(){var t="<-\n>",i=e.buildFragment(t,document);if(t!==i.firstChild.nodeValue){var l=e.buildFragment;e.buildFragment=function(e,t){var i=l(e,t);return 1===i.childNodes.length&&3===i.childNodes[0].nodeType&&(i.childNodes[0].nodeValue=e),i}}}(),e}); +/*can/util/array/isArrayLike*/ +define("can/util/array/isArrayLike",["can/util/can"],function(n){n.isArrayLike=function(n){var e=n&&"boolean"!=typeof n&&"number"!=typeof n&&"length"in n&&n.length;return"function"!=typeof arr&&(0===e||"number"==typeof e&&e>0&&e-1 in n)}}); +/*can/util/array/each*/ +define("can/util/array/each",["can/util/can","can/util/array/isArrayLike"],function(a){return a.each=function(e,t,r){var i,n,l,c=0;if(e)if(a.isArrayLike(e))if(a.List&&e instanceof a.List)for(n=e.attr("length");n>c&&(l=e.attr(c),t.call(r||l,l,c,e)!==!1);c++);else for(n=e.length;n>c&&(l=e[c],t.call(r||l,l,c,e)!==!1);c++);else if("object"==typeof e)if(a.Map&&e instanceof a.Map||e===a.route){var f=a.Map.keys(e);for(c=0,n=f.length;n>c&&(i=f[c],l=e.attr(i),t.call(r||l,l,i,e)!==!1);c++);}else for(i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&t.call(r||e[i],e[i],i,e)===!1)break;return e},a}); +/*can/util/inserted/inserted*/ +define("can/util/inserted/inserted",["can/util/can"],function(e){e.inserted=function(n,r){if(n.length){n=e.makeArray(n);for(var i,t,a=r||n[0].ownerDocument||n[0],d=!1,o=e.$(a.contains?a:a.body),s=0;void 0!==(t=n[s]);s++){if(!d){if(!t.getElementsByTagName)continue;if(!e.has(o,t).length)return;d=!0}if(d&&t.getElementsByTagName){i=e.makeArray(t.getElementsByTagName("*")),e.trigger(t,"inserted",[],!1);for(var f,c=0;void 0!==(f=i[c]);c++)e.trigger(f,"inserted",[],!1)}}}},e.appendChild=function(n,r,i){var t;t=11===r.nodeType?e.makeArray(e.childNodes(r)):[r],n.appendChild(r),e.inserted(t,i)},e.insertBefore=function(n,r,i,t){var a;a=11===r.nodeType?e.makeArray(e.childNodes(r)):[r],n.insertBefore(r,i),e.inserted(a,t)}}); +/*can/util/jquery/jquery*/ +define("can/util/jquery/jquery",["jquery/dist/jquery","can/util/can","can/util/attr/attr","can/event/event","can/util/fragment","can/util/array/each","can/util/inserted/inserted"],function(t,e,n,r){var i=function(t){return t.nodeName&&(1===t.nodeType||9===t.nodeType)||t==window||t.addEventListener};t=t||window.jQuery,t.extend(e,t,{trigger:function(n,r,a,s){i(n)?t.event.trigger(r,a,n,!s):n.trigger?n.trigger(r,a):("string"==typeof r&&(r={type:r}),r.target=r.target||n,a&&(a.length&&"string"==typeof a?a=[a]:a.length||(a=[a])),a||(a=[]),e.dispatch.call(n,r,a))},event:e.event,addEvent:e.addEvent,removeEvent:e.removeEvent,buildFragment:e.buildFragment,$:t,each:e.each,bind:function(n,r){return this.bind&&this.bind!==e.bind?this.bind(n,r):i(this)?t.event.add(this,n,r):e.addEvent.call(this,n,r),this},unbind:function(n,r){return this.unbind&&this.unbind!==e.unbind?this.unbind(n,r):i(this)?t.event.remove(this,n,r):e.removeEvent.call(this,n,r),this},delegate:function(n,r,a){return this.delegate?this.delegate(n,r,a):i(this)?t(this).delegate(n,r,a):e.bind.call(this,r,a),this},undelegate:function(n,r,a){return this.undelegate?this.undelegate(n,r,a):i(this)?t(this).undelegate(n,r,a):e.unbind.call(this,r,a),this},proxy:e.proxy,attr:n}),e.on=e.bind,e.off=e.unbind,t.each(["append","filter","addClass","remove","data","get","has"],function(t,n){e[n]=function(t){return t[n].apply(t,e.makeArray(arguments).slice(1))}});var a=t.cleanData;t.cleanData=function(n){t.each(n,function(t,n){n&&e.trigger(n,"removed",[],!1)}),a(n)};var s,u=t.fn.domManip;t.fn.domManip=function(t,e,n){for(var r=1;r=3&&(r=l.call(this,t,n));var a=l.apply(this,arguments);return arguments.length>=3&&(i=l.call(this,t,n)),i!==r&&e.attr.trigger(t,n,r),a};var o=t.removeAttr;return t.removeAttr=function(t,n){if(e.isDOM(t)&&e.attr.MutationObserver)return o.apply(this,arguments);var r=l.call(this,t,n),i=o.apply(this,arguments);return null!=r&&e.attr.trigger(t,n,r),i},t.event.special.attributes={setup:function(){if(e.isDOM(this)&&e.attr.MutationObserver){var t=this,n=new e.attr.MutationObserver(function(n){n.forEach(function(n){var r=e.simpleExtend({},n);e.trigger(t,r,[])})});n.observe(this,{attributes:!0,attributeOldValue:!0}),e.data(e.$(this),"canAttributesObserver",n)}else e.data(e.$(this),"canHasAttributesBindings",!0)},teardown:function(){e.isDOM(this)&&e.attr.MutationObserver?(e.data(e.$(this),"canAttributesObserver").disconnect(),t.removeData(this,"canAttributesObserver")):t.removeData(this,"canHasAttributesBindings")}},t.event.special.inserted={},t.event.special.removed={},e}); +/*can/util/util*/ +define("can/util/util",["can/util/jquery/jquery"],function(u){return u}); +/*can/util/string/string*/ +define("can/util/string/string",["can/util/util"],function(e){var r=/_|-/,n=/\=\=/,t=/([A-Z]+)([A-Z][a-z])/g,a=/([a-z\d])([A-Z])/g,u=/([a-z\d])([A-Z])/g,i=/\{([^\}]+)\}/g,c=/"/g,o=/'/g,l=/-+(.)?/g,p=/[a-z][A-Z]/g,f=function(e,r,n){var t=e[r];return void 0===t&&n===!0&&(t=e[r]={}),t},g=function(e){return/^f|^o/.test(typeof e)},d=function(e){var r=null===e||void 0===e||isNaN(e)&&""+e=="NaN";return""+(r?"":e)};return e.extend(e,{esc:function(e){return d(e).replace(/&/g,"&").replace(//g,">").replace(c,""").replace(o,"'")},getObject:function(r,n,t){var a,u,i,c,o=r?r.split("."):[],l=o.length,p=0;if(n=e.isArray(n)?n:[n||window],c=n.length,!l)return n[0];for(p;c>p;p++){for(a=n[p],i=void 0,u=0;l>u&&g(a);u++)i=a,a=f(i,o[u]);if(void 0!==i&&void 0!==a)break}if(t===!1&&void 0!==a&&delete i[o[u-1]],t===!0&&void 0===a)for(a=n[0],u=0;l>u&&g(a);u++)a=f(a,o[u],!0);return a},capitalize:function(e,r){return e.charAt(0).toUpperCase()+e.slice(1)},camelize:function(e){return d(e).replace(l,function(e,r){return r?r.toUpperCase():""})},hyphenate:function(e){return d(e).replace(p,function(e,r){return e.charAt(0)+"-"+e.charAt(1).toLowerCase()})},underscore:function(e){return e.replace(n,"/").replace(t,"$1_$2").replace(a,"$1_$2").replace(u,"_").toLowerCase()},sub:function(r,n,t){var a=[];return r=r||"",a.push(r.replace(i,function(r,u){var i=e.getObject(u,n,t===!0?!1:void 0);return void 0===i||null===i?(a=null,""):g(i)&&a?(a.push(i),""):""+i})),null===a?a:a.length<=1?a[0]:a},replacer:i,undHash:r}),e}); +/*can/construct/construct*/ +define("can/construct/construct",["can/util/string/string"],function(t){var n,e=0;try{Object.getOwnPropertyDescriptor({}),n=!0}catch(r){n=!1}var o=function(t,n){var e=Object.getOwnPropertyDescriptor(t,n);return e&&(e.get||e.set)?e:null},s=function(n,e,r){r=r||n;var s;for(var i in n)(s=o(n,i))?this._defineProperty(r,e,i,s):t.Construct._overwrite(r,e,i,n[i])},i=function(n,e,r){r=r||n;for(var o in n)t.Construct._overwrite(r,e,o,n[o])};return t.Construct=function(){return arguments.length?t.Construct.extend.apply(t.Construct,arguments):void 0},t.extend(t.Construct,{constructorExtends:!0,newInstance:function(){var t,n=this.instance();return n.setup&&(n.__inSetup=!0,t=n.setup.apply(n,arguments),delete n.__inSetup),n.init&&n.init.apply(n,t||arguments),n},_inherit:n?s:i,_defineProperty:function(t,n,e,r){Object.defineProperty(t,e,r)},_overwrite:function(t,n,e,r){t[e]=r},setup:function(n,e){this.defaults=t.extend(!0,{},n.defaults,this.defaults)},instance:function(){e=1;var t=new this;return e=0,t},extend:function(n,r,o){function s(){return e?void 0:this.constructor!==a&&arguments.length&&a.constructorExtends?a.extend.apply(a,arguments):a.newInstance.apply(a,arguments)}var i=n,u=r,c=o;"string"!=typeof i&&(c=u,u=i,i=null),c||(c=u,u=null),c=c||{};var a,p,f,l,h,d,y,m,g,v=this,_=this.prototype;g=this.instance(),t.Construct._inherit(c,_,g),i?(p=i.split("."),y=p.pop()):u&&u.shortName?y=u.shortName:this.shortName&&(y=this.shortName),"undefined"==typeof constructorName&&(a=function(){return s.apply(this,arguments)});for(d in v)v.hasOwnProperty(d)&&(a[d]=v[d]);t.Construct._inherit(u,v,a),i&&(f=t.getObject(p.join("."),window,!0),m=f,l=t.underscore(i.replace(/\./g,"_")),h=t.underscore(y),f[y]=a),t.extend(a,{constructor:a,prototype:g,namespace:m,_shortName:h,fullName:i,_fullName:l}),void 0!==y&&(a.shortName=y),a.prototype.constructor=a;var w=[v].concat(t.makeArray(arguments)),C=a.setup.apply(a,w);return a.init&&a.init.apply(a,C||w),a}}),t.Construct.prototype.setup=function(){},t.Construct.prototype.init=function(){},t.Construct}); +/*can/util/bind/bind*/ +define("can/util/bind/bind",["can/util/util"],function(i){return i.bindAndSetup=function(){return i.addEvent.apply(this,arguments),this.__inSetup||(this._bindings?this._bindings++:(this._bindings=1,this._bindsetup&&this._bindsetup())),this},i.unbindAndTeardown=function(n,t){if(!this.__bindEvents)return this;var s=this.__bindEvents[n]||[],d=s.length;return i.removeEvent.apply(this,arguments),null===this._bindings?this._bindings=0:this._bindings=this._bindings-(d-s.length),!this._bindings&&this._bindteardown&&this._bindteardown(),this},i}); +/*can/map/bubble*/ +define("can/map/bubble",["can/util/util"],function(n){var i=n.bubble={bind:function(n,e){if(!n.__inSetup){var b,t=i.events(n,e),r=t.length;n._bubbleBindings||(n._bubbleBindings={});for(var u=0;r>u;u++)b=t[u],n._bubbleBindings[b]?n._bubbleBindings[b]++:(n._bubbleBindings[b]=1,i.childrenOf(n,b))}},unbind:function(e,b){for(var t,r=i.events(e,b),u=r.length,d=0;u>d;d++)t=r[d],e._bubbleBindings&&e._bubbleBindings[t]--,e._bubbleBindings&&!e._bubbleBindings[t]&&(delete e._bubbleBindings[t],i.teardownChildrenFrom(e,t),n.isEmptyObject(e._bubbleBindings)&&delete e._bubbleBindings)},add:function(e,b,t){if(b instanceof n.Map&&e._bubbleBindings)for(var r in e._bubbleBindings)e._bubbleBindings[r]&&(i.teardownFromParent(e,b,r),i.toParent(b,e,t,r))},addMany:function(n,e){for(var b=0,t=e.length;t>b;b++)i.add(n,e[b],b)},remove:function(e,b){if(b instanceof n.Map&&e._bubbleBindings)for(var t in e._bubbleBindings)e._bubbleBindings[t]&&i.teardownFromParent(e,b,t)},removeMany:function(n,e){for(var b=0,t=e.length;t>b;b++)i.remove(n,e[b])},set:function(e,b,t,r){return n.isMapLike(t)&&i.add(e,t,b),n.isMapLike(r)&&i.remove(e,r),t},events:function(n,i){return n.constructor._bubbleRule(i,n)},toParent:function(i,e,b,t){n.listenTo.call(e,i,t,function(){var r=n.makeArray(arguments),u=r.shift();r[0]=(n.List&&e instanceof n.List?e.indexOf(i):b)+(r[0]?"."+r[0]:""),u.triggeredNS=u.triggeredNS||{},u.triggeredNS[e._cid]||(u.triggeredNS[e._cid]=!0,n.trigger(e,u,r),"change"===t&&n.trigger(e,r[0],[r[2],r[3]]))})},childrenOf:function(n,e){n._each(function(b,t){b&&b.bind&&i.toParent(b,n,t,e)})},teardownFromParent:function(i,e,b){e&&e.unbind&&n.stopListening.call(i,e,b)},teardownChildrenFrom:function(n,e){n._each(function(b){i.teardownFromParent(n,b,e)})},isBubbling:function(n,i){return n._bubbleBindings&&n._bubbleBindings[i]}};return i}); +/*can/util/object/isplain/isplain*/ +define("can/util/object/isplain/isplain",["can/util/can"],function(t){var n=Object.prototype.hasOwnProperty,r=function(t){return null!==t&&t==t.window},o=function(t){if(!t||"object"!=typeof t||t.nodeType||r(t))return!1;try{if(t.constructor&&!n.call(t,"constructor")&&!n.call(t.constructor.prototype,"isPrototypeOf"))return!1}catch(o){return!1}var c;for(c in t);return void 0===c||n.call(t,c)};return t.isPlainObject=o,t}); +/*can/map/map_helpers*/ +define("can/map/map_helpers",["can/util/util","can/util/object/isplain/isplain"],function(n){var t={attrParts:function(n,t){return t?[n]:"object"==typeof n?n:(""+n).split(".")},canMakeObserve:function(t){return t&&!n.isPromise(t)&&(n.isArray(t)||n.isPlainObject(t))},serialize:function(){var e=null;return function(i,r,a){var u=n.cid(i),c=!1;return e||(c=!0,e={attr:{},serialize:{}}),e[r][u]=a,i.each(function(u,c){var o,d=n.isMapLike(u),l=d&&e[r][n.cid(u)];o=l?l:i["___"+r]?i["___"+r](c,u):t.getValue(i,c,u,r),void 0!==o&&(a[c]=o)}),c&&(e=null),a}}(),getValue:function(t,e,i,r){return n.isMapLike(i)?i[r]():i},define:null,addComputedAttr:function(n,t,e){n._computedAttrs[t]={compute:e,count:0,handler:function(e,i,r){n._triggerChange(t,"set",i,r,e.batchNum)}}},addToMap:function(t,r){var a;e||(a=i,e={});var u=t._cid,c=n.cid(t);return e[c]||(e[c]={obj:t,instance:r,added:!u}),a},getMapFromObject:function(n){return e&&e[n._cid]&&e[n._cid].instance}},e=null,i=function(){for(var n in e)e[n].added&&delete e[n].obj._cid;e=null};return t}); +/*can/util/batch/batch*/ +define("can/util/batch/batch",["can/util/can"],function(t){var a=1,n=0,c=null,e=null,s=[],u=!1;t.batch={start:function(t){if(n++,1===n){var c={events:[],callbacks:[],number:a++};s.push(c),t&&c.callbacks.push(t),e=c}},stop:function(a,l){if(a?n=0:n--,0===n){e=null;var h;if(u===!1){u=!0;for(var r,i=[];h=s.shift();){var b=h.events;i.push.apply(i,h.callbacks),c=h,t.batch.batchNum=h.number;var p;for(l&&t.batch.start(),r=0,p=b.length;p>r;r++)t.dispatch.apply(b[r][0],b[r][1]);t.batch._onDispatchedEvents(h.number),c=null,t.batch.batchNum=void 0}for(r=i.length-1;r>=0;r--)i[r]();u=!1}}},_onDispatchedEvents:function(){},trigger:function(a,n,c){a.__inSetup||(n="string"==typeof n?{type:n}:n,e?(n.batchNum=e.number,e.events.push([a,[n,c]])):n.batchNum?t.dispatch.call(a,n,c):s.length?(t.batch.start(),n.batchNum=e.number,e.events.push([a,[n,c]]),t.batch.stop()):t.dispatch.call(a,n,c))},afterPreviousEvents:function(a){var n=t.last(s);if(n){var c={};t.bind.call(c,"ready",a),n.events.push([c,[{type:"ready"},[]]])}else a({})},after:function(t){var a=e||c;a?a.callbacks.push(t):t({})}}}); +/*can/compute/get_value_and_bind*/ +define("can/compute/get_value_and_bind",["can/util/util"],function(e){function t(t,n,r){this.newObserved={},this.oldObserved=null,this.func=t,this.context=n,this.compute=r,this.onDependencyChange=e.proxy(this.onDependencyChange,this),this.depth=null,this.childDepths={},this.ignore=0,this.inBatch=!1,this.ready=!1,r.observedInfo=this,this.setReady=e.proxy(this._setReady,this)}e.simpleExtend(t.prototype,{getPrimaryDepth:function(){return this.compute._primaryDepth},_setReady:function(){this.ready=!0},getDepth:function(){return null!==this.depth?this.depth:this.depth=this._getDepth()},_getDepth:function(){var e=0,t=this.childDepths;for(var n in t)t[n]>e&&(e=t[n]);return e+1},addEdge:function(e){e.obj.bind(e.event,this.onDependencyChange),e.obj.observedInfo&&(this.childDepths[e.obj._cid]=e.obj.observedInfo.getDepth(),this.depth=null)},removeEdge:function(e){e.obj.unbind(e.event,this.onDependencyChange),e.obj.observedInfo&&(delete this.childDepths[e.obj._cid],this.depth=null)},dependencyChange:function(e){this.bound&&this.ready&&(void 0!==e.batchNum?e.batchNum!==this.batchNum&&(t.registerUpdate(this),this.batchNum=e.batchNum):this.updateCompute(e.batchNum))},onDependencyChange:function(e,t,n){this.dependencyChange(e,t,n)},updateCompute:function(e){if(this.bound){var t=this.value;this.getValueAndBind(),this.compute.updater(this.value,t,e)}},getValueAndBind:function(){this.bound=!0,this.oldObserved=this.newObserved||{},this.ignore=0,this.newObserved={},this.ready=!1,h.push(this),this.value=this.func.call(this.context),h.pop(),this.updateBindings(),e.batch.afterPreviousEvents(this.setReady)},updateBindings:function(){var e,t,n=this.newObserved,r=this.oldObserved;for(e in n)t=n[e],r[e]?r[e]=null:this.addEdge(t);for(e in r)t=r[e],t&&this.removeEdge(t)},teardown:function(){this.bound=!1;for(var e in this.newObserved){var t=this.newObserved[e];this.removeEdge(t)}this.newObserved={}}});var n,r=[],i=1/0,s=0;t.registerUpdate=function(e,t){var n=e.getDepth()-1,h=e.getPrimaryDepth();i=Math.min(h,i),s=Math.max(h,s);var o=r[h]||(r[h]={observeInfos:[],current:1/0,max:0}),a=o.observeInfos[n]||(o.observeInfos[n]=[]);a.push(e),o.current=Math.min(n,o.current),o.max=Math.max(n,o.max)},t.updateUntil=function(e){for(var t;;){if(!(s>=i))return;var h=r[i];if(h&&h.current<=h.max){var o=h.observeInfos[h.current];if(o&&(t=o.pop())){if(t.updateCompute(n),t===e)return}else h.current++}else i++}},t.batchEnd=function(e){var t;for(n=e;;){if(!(s>=i))return r=[],i=1/0,void(s=0);var h=r[i];if(h&&h.current<=h.max){var o=h.observeInfos[h.current];o&&(t=o.pop())?t.updateCompute(e):h.current++}else i++}};var h=[];return e.__observe=function(e,t){var n=h[h.length-1];if(n&&!n.ignore){var r=t+"",i=e._cid+"|"+r;n.traps?n.traps.push({obj:e,event:r,name:i}):n.newObserved[i]||(n.newObserved[i]={obj:e,event:r})}},e.__reading=e.__observe,e.__trapObserves=function(){if(h.length){var e=h[h.length-1],t=e.traps=[];return function(){return e.traps=null,t}}return function(){return[]}},e.__observes=function(e){var t=h[h.length-1];if(t)for(var n=0,r=e.length;r>n;n++){var i=e[n],s=i.name;t.newObserved[s]||(t.newObserved[s]=i)}},e.__isRecordingObserves=function(){var e=h.length,t=h[e-1];return e&&0===t.ignore&&t},e.__notObserve=function(e){return function(){if(h.length){var t=h[h.length-1];t.ignore++;var n=e.apply(this,arguments);return t.ignore--,n}return e.apply(this,arguments)}},e.batch._onDispatchedEvents=t.batchEnd,t}); +/*can/map/map*/ +define("can/map/map",["can/util/util","can/util/bind/bind","can/map/bubble","can/map/map_helpers","can/construct/construct","can/util/batch/batch","can/compute/get_value_and_bind"],function(t,e,i,n){var r={constructor:!0},s=t.Map=t.Construct.extend({setup:function(){if(t.Construct.setup.apply(this,arguments),this._computedPropertyNames=[],t.Map){this.defaults||(this.defaults={});for(var e in this.prototype)"define"!==e&&"constructor"!==e&&("function"!=typeof this.prototype[e]||this.prototype[e].prototype instanceof t.Construct)?this.defaults[e]=this.prototype[e]:this.prototype[e].isComputed&&this._computedPropertyNames.push(e);n.define&&n.define(this)}!t.List||this.prototype instanceof t.List||(this.List=s.List.extend({Map:this},{}))},shortName:"Map",_bubbleRule:function(t){return"change"===t||t.indexOf(".")>=0?["change"]:[]},bind:t.bindAndSetup,unbind:t.unbindAndTeardown,id:"id",keys:function(e){var i=[];t.__observe(e,"__keys");for(var n in e._data)i.push(n);return i}},{setup:function(e){e instanceof t.Map&&(e=e.serialize()),this._data={},t.cid(this,".map"),this._setupComputedProperties();var i=e&&n.addToMap(e,this),r=this._setupDefaults(e),s=t.extend(t.extend(!0,{},r),e);this.attr(s),i&&i()},_setupComputedProperties:function(){this._computedAttrs={};for(var t=this.constructor._computedPropertyNames,e=0,i=t.length;i>e;e++){var r=t[e];n.addComputedAttr(this,r,this[r].clone(this))}},_setupDefaults:function(){return this.constructor.defaults||{}},attr:function(t,e){var i=typeof t;return void 0===t?this._getAttrs():"string"!==i&&"number"!==i?this._setAttrs(t,e):1===arguments.length?this._get(t+""):(this._set(t+"",e),this)},_get:function(e){var i=e.indexOf(".");if(i>=0){var n=this.___get(e);if(void 0!==n)return t.__observe(this,e),n;var r=e.substr(0,i),s=e.substr(i+1),o=this.__get(r);return o&&o._get?o._get(s):void 0}return this.__get(e)},__get:function(e){return r[e]||this._computedAttrs[e]||t.__observe(this,e),this.___get(e)},___get:function(t){if(void 0!==t){var e=this._computedAttrs[t];return e&&e.compute?e.compute():this._data.hasOwnProperty(t)?this._data[t]:void 0}return this._data},_set:function(e,i,n){var r,s=e.indexOf(".");if(s>=0&&!n){var o=e.substr(0,s),a=e.substr(s+1);if(r=this.__inSetup?void 0:this.___get(o),!t.isMapLike(r))throw new Error("can.Map: Object does not exist");r._set(a,i)}else r=this.__inSetup?void 0:this.___get(e),this.__convert&&(i=this.__convert(e,i)),this.__set(e,this.__type(i,e),r)},__type:function(e,i){if("object"==typeof e&&!(e instanceof t.Map)&&n.canMakeObserve(e)){var r=n.getMapFromObject(e);if(r)return r;if(t.isArray(e)){var s=t.List;return new s(e)}var o=this.constructor.Map||t.Map;return new o(e)}return e},__set:function(t,e,n){if(e!==n){var r=this._computedAttrs[t],s=r||void 0!==n||this.___get().hasOwnProperty(t)?"set":"add";this.___set(t,"object"==typeof e?i.set(this,t,e,n):e),r&&r.count||this._triggerChange(t,s,e,n),"object"==typeof n&&i.teardownFromParent(this,n)}},___set:function(t,e){var i=this._computedAttrs[t];i&&i.compute?i.compute(e):this._data[t]=e,"function"==typeof this.constructor.prototype[t]||i||(this[t]=e)},removeAttr:function(t){return this._remove(t)},_remove:function(t){var e=n.attrParts(t),i=e.shift(),r=this.___get(i);return e.length&&r?r.removeAttr(e):("string"==typeof t&&~t.indexOf(".")&&(i=t),this.__remove(i,r),r)},__remove:function(t,e){t in this._data&&(this.___remove(t),this._triggerChange(t,"remove",void 0,e))},___remove:function(t){delete this._data[t],t in this.constructor.prototype||delete this[t]},___serialize:function(t,e){return n.getValue(this,t,e,"serialize")},_getAttrs:function(){return n.serialize(this,"attr",{})},_setAttrs:function(e,i){e=t.simpleExtend({},e);var r,s,o=this;t.batch.start(),this._each(function(r,a){if("_cid"!==a){if(s=e[a],void 0===s)return void(i&&o.removeAttr(a));o.__convert&&(s=o.__convert(a,s)),t.isMapLike(r)&&n.canMakeObserve(s)?r.attr(s,i):r!==s&&o.__set(a,o.__type(s,a),r),delete e[a]}});for(r in e)"_cid"!==r&&(s=e[r],this._set(r,s,!0));return t.batch.stop(),this},serialize:function(){return n.serialize(this,"serialize",{})},_triggerChange:function(e,n,r,s,o){i.isBubbling(this,"change")&&t.batch.trigger(this,{type:"change",target:this,batchNum:o},[e,n,r,s]),t.batch.trigger(this,{type:e,target:this,batchNum:o},[r,s]),("remove"===n||"add"===n)&&t.batch.trigger(this,{type:"__keys",target:this,batchNum:o})},_bindsetup:function(){},_bindteardown:function(){},one:t.one,bind:function(e,n){var r=this._computedAttrs&&this._computedAttrs[e];return r&&r.compute&&(r.count?r.count++:(r.count=1,r.compute.bind("change",r.handler))),i.bind(this,e),t.bindAndSetup.apply(this,arguments)},unbind:function(e,n){var r=this._computedAttrs&&this._computedAttrs[e];return r&&(1===r.count?(r.count=0,r.compute.unbind("change",r.handler)):r.count--),i.unbind(this,e),t.unbindAndTeardown.apply(this,arguments)},compute:function(e){if(t.isFunction(this.constructor.prototype[e]))return t.compute(this[e],this);var i=t.compute.read.reads(e),n=i.length-1;return t.compute(function(e){return arguments.length?void t.compute.read(this,i.slice(0,n)).value.attr(i[n].key,e):t.compute.read(this,i,{args:[]}).value},this)},each:function(){return t.each.apply(void 0,[this].concat(t.makeArray(arguments)))},_each:function(t){var e=this.___get();for(var i in e)e.hasOwnProperty(i)&&t(e[i],i)},dispatch:t.dispatch});return s.prototype.on=s.prototype.bind,s.prototype.off=s.prototype.unbind,s.on=s.bind,s.off=s.unbind,s}); +/*can/list/list*/ +define("can/list/list",["can/util/util","can/map/map","can/map/bubble","can/map/map_helpers"],function(t,e,i,r){var s=[].splice,n=function(){var t={0:"a",length:1};return s.call(t,0,1),!t[0]}(),h=e.extend({Map:e},{setup:function(e,i){this.length=0,t.cid(this,".map"),this._setupComputedProperties(),e=e||[];var s;t.isPromise(e)?this.replace(e):(s=e.length&&r.addToMap(e,this),this.push.apply(this,t.makeArray(e||[]))),s&&s(),t.simpleExtend(this,i)},_triggerChange:function(i,r,s,n){e.prototype._triggerChange.apply(this,arguments);var h=+i;~(""+i).indexOf(".")||isNaN(h)||("add"===r?(t.batch.trigger(this,r,[s,h]),t.batch.trigger(this,"length",[this.length])):"remove"===r?(t.batch.trigger(this,r,[n,h]),t.batch.trigger(this,"length",[this.length])):t.batch.trigger(this,r,[s,h]))},___get:function(t){if(t){var e=this._computedAttrs[t];return e&&e.compute?e.compute():this[t]}return this},__set:function(e,i,r){if(e=isNaN(+e)||e%1?e:+e,"number"==typeof e&&e>this.length-1){var s=new Array(e+1-this.length);return s[s.length-1]=i,this.push.apply(this,s),s}return t.Map.prototype.__set.call(this,""+e,i,r)},___set:function(t,e){this[t]=e,+t>=this.length&&(this.length=+t+1)},__remove:function(t,e){isNaN(+t)?(delete this[t],this._triggerChange(t,"remove",void 0,e)):this.splice(t,1)},_each:function(t){for(var e=this.___get(),i=0;i2;for(e=e||0,h=0,a=c.length-2;a>h;h++)o=h+2,c[o]=this.__type(c[o],o),l.push(c[o]),this[h+e]!==c[o]&&(u=!1);if(u&&this.length<=l.length)return l;void 0===r&&(r=c[1]=this.length-e);var p=s.apply(this,c);if(!n)for(h=this.length;h0&&(i.removeMany(this,p),this._triggerChange(""+e,"remove",void 0,p)),c.length>2&&(i.addMany(this,l),this._triggerChange(""+e,"add",l,p)),t.batch.stop(),p},_getAttrs:function(){return r.serialize(this,"attr",[])},_setAttrs:function(e,i){e=t.makeArray(e),t.batch.start(),this._updateAttrs(e,i),t.batch.stop()},_updateAttrs:function(e,i){for(var s=Math.min(e.length,this.length),n=0;s>n;n++){var h=this[n],a=e[n];t.isMapLike(h)&&r.canMakeObserve(a)?h.attr(a,i):h!==a&&this._set(n+"",a)}e.length>this.length?this.push.apply(this,e.slice(this.length)):e.lengthv;){s=u;for(var l=0,f=t.propertyReaders.length;f>l;l++){var c=t.propertyReaders[l];if(c.test(u)){u=c.read(u,r[v],v,a,i);break}}if(v+=1,u=n(u,v,r,a,i,s),o=typeof u,vu;u++)t.valueReaders[u].test(e,r,n,a)&&(e=t.valueReaders[u].read(e,r,n,a,o,s))}while(i);return e};t.valueReaders=[{name:"compute",test:function(e,t,n,a){return e&&e.isComputed&&!r(t,n)},read:function(t,r,n,a,o){return a.readCompute===!1&&r===n.length?t:(!o.foundObservable&&a.foundObservable&&(a.foundObservable(t,r),o.foundObservable=!0),t instanceof e.Compute?t.get():t())}},{name:"function",test:function(t,r,n,a){var o=typeof t;return!("function"!==o||t.isComputed||e.Construct&&t.prototype instanceof e.Construct||e.route&&t===e.route)},read:function(t,n,a,o,s,i){return r(n,a)?n===a.length?e.proxy(t,i):t:o.callMethodsOnObservables&&e.isMapLike(i)?t.apply(i,o.args||[]):o.isArgument&&n===a.length?o.proxyMethods!==!1?e.proxy(t,i):t:t.apply(i,o.args||[])}}],t.propertyReaders=[{name:"map",test:e.isMapLike,read:function(e,t,r,n,a){!a.foundObservable&&n.foundObservable&&(n.foundObservable(e,r),a.foundObservable=!0);var o=e.attr(t.key);return void 0!==o?o:e[t.key]}},{name:"promise",test:function(t){return e.isPromise(t)},read:function(t,r,n,a,o){!o.foundObservable&&a.foundObservable&&(a.foundObservable(t,n),o.foundObservable=!0);var s=t.__observeData;return t.__observeData||(s=t.__observeData={isPending:!0,state:"pending",isResolved:!1,isRejected:!1,value:void 0,reason:void 0},e.cid(s),e.simpleExtend(s,e.event),t.then(function(e){s.isPending=!1,s.isResolved=!0,s.value=e,s.state="resolved",s.dispatch("state",["resolved","pending"])},function(e){s.isPending=!1,s.isRejected=!0,s.reason=e,s.state="rejected",s.dispatch("state",["rejected","pending"])})),e.__observe(s,"state"),r.key in s?s[r.key]:t[r.key]}},{name:"object",test:function(){return!0},read:function(e,t){return null==e?void 0:t.key in e?e[t.key]:t.at&&a[t.key]&&"@"+t.key in e?(t.at=!1,e["@"+t.key]):void 0}}];var a={index:!0,key:!0,event:!0,element:!0,viewModel:!0};return t.write=function(t,r,n,a){return a=a||{},e.isMapLike(t)?!a.isArgument&&t._data&&t._data[r]&&t._data[r].isComputed?t._data[r](n):t.attr(r,n):t[r]&&t[r].isComputed?t[r](n):void("object"==typeof t&&(t[r]=n))},t.reads=function(e){var t=[],r=0,n=!1;"@"===e.charAt(0)&&(r=1,n=!0);for(var a="",o=r;oo;o++)u[o]=arguments[o];var h=typeof u[1];"function"==typeof u[0]?this._setupGetterSetterFn(u[0],u[1],u[2],u[3]):u[1]?"string"===h?this._setupProperty(u[0],u[1],u[2]):"function"===h?this._setupSetter(u[0],u[1],u[2]):u[1]&&u[1].fn?this._setupAsyncCompute(u[0],u[1]):this._setupSettings(u[0],u[1]):this._setupSimpleValue(u[0]),this._args=u,this._primaryDepth=0,this.isComputed=!0},t.simpleExtend(t.Compute.prototype,{setPrimaryDepth:function(t){this._primaryDepth=t},_setupGetterSetterFn:function(e,n,i){this._set=n?t.proxy(e,n):e,this._get=n?t.proxy(e,n):e,this._canObserve=i===!1?!1:!0;var s=u(this,e,n||this);t.simpleExtend(this,s)},_setupProperty:function(e,n,i){var s,u=t.isMapLike(e),o=this;u?(s=function(t,e,n){o.updater(e,n,t.batchNum)},this.hasDependencies=!0,this._get=function(){return e.attr(n)},this._set=function(t){e.attr(n,t)}):(s=function(){o.updater(o._get(),o.value)},this._get=function(){return t.getObject(n,[e])},this._set=function(i){var s=n.split("."),u=s.pop(),o=t.getObject(s.join("."),[e]);o[u]=i}),this._on=function(u){t.bind.call(e,i||n,s),this.value=this._get()},this._off=function(){return t.unbind.call(e,i||n,s)}},_setupSetter:function(e,n,i){this.value=e,this._set=n,t.simpleExtend(this,i)},_setupSettings:function(t,e){if(this.value=t,this._set=e.set||this._set,this._get=e.get||this._get,!e.__selfUpdater){var n=this,i=this.updater;this.updater=function(){i.call(n,n._get(),n.value)}}this._on=e.on?e.on:this._on,this._off=e.off?e.off:this._off},_setupAsyncCompute:function(e,n){var i=this;this.value=e,this._setUpdates=!0,this.lastSetValue=new t.Compute(e),this._set=function(t){return t===i.lastSetValue.get()?this.value:i.lastSetValue.set(t)},this._get=function(){return o.call(n.context,i.lastSetValue.get())};var s,o=n.fn;if(0===o.length)s=u(this,o,n.context);else if(1===o.length)s=u(this,function(){return o.call(n.context,i.lastSetValue.get())},n);else{var a=this.updater,h=function(t){a.call(i,t,i.value)};this.updater=function(t){a.call(i,t,i.value)},s=u(this,function(){var t=o.call(n.context,i.lastSetValue.get(),h);return void 0!==t?t:this.value},this)}t.simpleExtend(this,s)},_setupSimpleValue:function(t){this.value=t},_bindsetup:t.__notObserve(function(){this.bound=!0,this._on(this.updater)}),_bindteardown:function(){this._off(this.updater),this.bound=!1},bind:t.bindAndSetup,unbind:t.unbindAndTeardown,clone:function(e){return e&&"function"==typeof this._args[0]?this._args[1]=e:e&&(this._args[2]=e),new t.Compute(this._args[0],this._args[1],this._args[2],this._args[3])},_on:t.k,_off:t.k,get:function(){var e=t.__isRecordingObserves();return e&&this._canObserve!==!1&&(t.__observe(this,"change"),this.bound||t.Compute.temporarilyBind(this)),this.bound?(e&&this.getDepth&&this.getDepth()>=e.getDepth()&&i.updateUntil(this.readInfo),this.value):this._get()},_get:function(){return this.value},set:function(t){var e=this.value,n=this._set(t,e);return this._setUpdates?this.value:this.hasDependencies?this._get():(void 0===n?this.value=this._get():this.value=n,s(this,this.value,e),this.value)},_set:function(t){return this.value=t},updater:function(t,e,n){this.value=t,s(this,t,e,n)},toFunction:function(){return t.proxy(this._computeFn,this)},_computeFn:function(t){return arguments.length?this.set(t):this.get()}});var s=function(e,n,i,s){var u=n!==i&&!(n!==n&&i!==i);u&&t.batch.trigger(e,{type:"change",batchNum:s},[n,i])},u=function(e,n,s){var u=new i(n,s,e);return{readInfo:u,_on:function(){u.getValueAndBind(),e.value=u.value,e.hasDependencies=!t.isEmptyObject(u.newObserved)},_off:function(){u.teardown()},getDepth:function(){return u.getDepth()}}};t.Compute.temporarilyBind=function(e){var n=e.computeInstance||e;n.bind("change",t.k),o||(o=[],setTimeout(a,10)),o.push(n)};var o,a=function(){for(var e=0,n=o.length;n>e;e++)o[e].unbind("change",t.k);o=null};return t.Compute.async=function(e,n,i){return new t.Compute(e,{fn:n,context:i})},t.Compute.truthy=function(e){return new t.Compute(function(){var t=e.get();return"function"==typeof t&&(t=t.get()),!!t})},t.Compute.read=n,t.Compute.set=n.write,t.Compute}); +/*can/compute/compute*/ +define("can/compute/compute",["can/util/util","can/util/bind/bind","can/util/batch/batch","can/compute/proto_compute"],function(t,n){return t.compute=function(n,e,u,o){var c=new t.Compute(n,e,u,o),r=c.bind,i=c.unbind,p=function(t){return arguments.length?c.set(t):c.get()},m=t.cid(p,"compute"),a="__handler"+m;return p.bind=function(t,n){var e=n&&n[a];return n&&!e&&(e=n[a]=function(){n.apply(p,arguments)}),r.call(c,t,e)},p.unbind=function(t,n){var e=n&&n[a];return e?(delete n[a],c.unbind(t,e)):i.apply(c,arguments)},p.isComputed=c.isComputed,p.clone=function(u){return"function"==typeof n&&(e=u),t.compute(n,e,u,o)},p.computeInstance=c,p},t.compute.truthy=function(n){return t.compute(function(){var t=n();return"function"==typeof t&&(t=t()),!!t})},t.compute.async=function(n,e,u){return t.compute(n,{fn:e,context:u})},t.compute.read=t.Compute.read,t.compute.set=t.Compute.set,t.compute.temporarilyBind=t.Compute.temporarilyBind,t.compute}); +/*can/view/view*/ +define("can/view/view",["can/util/util"],function(e){var r=e.isFunction,n=e.makeArray,t=1,i=function(e){var r=function(){return s.frag(e.apply(this,arguments))};return r.render=function(){return e.apply(e,arguments)},r},u=function(e,r){if(!e.length)throw new Error("can.view: No template or empty template:"+r)},o=function(n,t){if(r(n)){var i=e.Deferred();return i.resolve(n)}var o,a,c,d="string"==typeof n?n:n.url,f=n.engine&&"."+n.engine||d.match(/\.[\w\d]+$/);if(d.match(/^#/)&&(d=d.substr(1)),(a=document.getElementById(d))&&(f="."+a.type.match(/\/(x\-)?(.+)/)[2]),f||s.cached[d]||(d+=f=s.ext),e.isArray(f)&&(f=f[0]),c=s.toId(d),d.match(/^\/\//)&&(d=d.substr(2),d=window.steal?steal.config().root.mapJoin(""+steal.id(d)):d),window.require&&require.toUrl&&(d=require.toUrl(d)),o=s.types[f],s.cached[c])return s.cached[c];if(a)return s.registerView(c,a.innerHTML,o);var p=new e.Deferred;return e.ajax({async:t,url:d,dataType:"text",error:function(e){u("",d),p.reject(e)},success:function(e){u(e,d),s.registerView(c,e,o,p)}}),p},a=function(r){var n=[];if(e.isPromise(r))return[r];for(var t in r)e.isPromise(r[t])&&n.push(r[t]);return n},c=function(r){return e.isArray(r)&&"success"===r[1]?r[0]:r},s=e.view=e.template=function(e,n,t,i){return r(t)&&(i=t,t=void 0),s.renderAs("fragment",e,n,t,i)};return e.extend(s,{frag:function(e,r){return s.hookup(s.fragment(e),r)},fragment:function(r){return e.frag(r,document)},toId:function(r){return e.map(r.toString().split(/\/|\./g),function(e){return e?e:void 0}).join("_")},toStr:function(e){return null==e?"":""+e},hookup:function(r,n){var t,i,u=[];return e.each(r.childNodes?e.makeArray(r.childNodes):r,function(r){1===r.nodeType&&(u.push(r),u.push.apply(u,e.makeArray(r.getElementsByTagName("*"))))}),e.each(u,function(e){e.getAttribute&&(t=e.getAttribute("data-view-id"))&&(i=s.hookups[t])&&(i(e,n,t),delete s.hookups[t],e.removeAttribute("data-view-id"))}),r},hookups:{},hook:function(e){return s.hookups[++t]=e," data-view-id='"+t+"'"},cached:{},cachedRenderers:{},cache:!0,register:function(r){this.types["."+r.suffix]=r,e[r.suffix]=s[r.suffix]=function(e,n){var t,u;if(!n)return u=function(){return t||(t=r.fragRenderer?r.fragRenderer(null,e):i(r.renderer(null,e))),t.apply(this,arguments)},u.render=function(){var n=r.renderer(null,e);return n.apply(n,arguments)},u;var o=function(){return t||(t=r.fragRenderer?r.fragRenderer(e,n):r.renderer(e,n)),t.apply(this,arguments)};return r.fragRenderer?s.preload(e,o):s.preloadStringRenderer(e,o)}},types:{},ext:".ejs",registerScript:function(e,r,n){return"can.view.preloadStringRenderer('"+r+"',"+s.types["."+e].script(r,n)+");"},preload:function(r,n){var t=s.cached[r]=(new e.Deferred).resolve(function(e,r){return n.call(e,e,r)});return t.__view_id=r,s.cachedRenderers[r]=n,n},preloadStringRenderer:function(e,r){return this.preload(e,i(r))},render:function(r,n,t,i,u){return e.view.renderAs("string",r,n,t,i,u)},renderTo:function(e,r,n,t,i){return("string"===e&&r.render?r.render:r)(n,t,i)},renderAs:function(t,i,u,d,f,p){void 0!==f&&"string"==typeof f.expression&&(p=f,f=void 0),r(d)&&(f=d,d=void 0);var l,h,v,g,m=a(u);if(m.length)return l=new e.Deferred,h=e.extend({},u),m.push(o(i,!0)),e.when.apply(e,m).then(function(r){var i,o=n(arguments),a=o.pop();if(e.isPromise(u))h=c(r);else for(var s in u)e.isPromise(u[s])&&(h[s]=c(o.shift()));i=e.view.renderTo(t,a,h,d,p),l.resolve(i,h),f&&f(i,h)},function(){l.reject.apply(l,arguments)}),l;if(v=r(f),l=e.__notObserve(o)(i,v),v)g=l,l.then(function(r){f(u?e.view.renderTo(t,r,u,d,p):r)});else{if("resolved"===l.state()&&l.__view_id){var w=s.cachedRenderers[l.__view_id];return u?e.view.renderTo(t,w,u,d,p):w}l.then(function(r){g=u?e.view.renderTo(t,r,u,d,p):r})}return g},registerView:function(r,n,t,u){var o,a="object"==typeof t?t:s.types[t||s.ext];return o=a.fragRenderer?a.fragRenderer(r,n):i(a.renderer(r,n)),u=u||new e.Deferred,s.cache&&(s.cached[r]=u,u.__view_id=r,s.cachedRenderers[r]=o),u.resolve(o)},simpleHelper:function(r){return function(){var n=[],t=arguments;return e.each(t,function(e,r){if(r<=t.length){for(;e&&e.isComputed;)e=e();n.push(e)}}),r.apply(this,n)}}}),e}); +/*can/view/elements*/ +define("can/view/elements",["can/util/util","can/view/view"],function(e){var t="undefined"!=typeof document?document:null,n=t&&function(){return 1===e.$(document.createComment("~")).length}(),o={tagToContentPropMap:{option:t&&"textContent"in document.createElement("option")?"textContent":"innerText",textarea:"value"},attrMap:e.attr.map,attrReg:/([^\s=]+)[\s]*=[\s]*/,defaultValue:e.attr.defaultValue,tagMap:{"":"span",colgroup:"col",table:"tbody",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},reverseTagMap:{col:"colgroup",tr:"tbody",option:"select",td:"tr",th:"tr",li:"ul"},selfClosingTags:{col:!0},getParentNode:function(e,t){return t&&11===e.parentNode.nodeType?t:e.parentNode},setAttr:e.attr.set,getAttr:e.attr.get,removeAttr:e.attr.remove,contentText:function(e){return"string"==typeof e?e:e||0===e?""+e:""},after:function(t,n){var o=t[t.length-1];o.nextSibling?e.insertBefore(o.parentNode,n,o.nextSibling,e.document):e.appendChild(o.parentNode,n,e.document)},replace:function(t,r){var a,l=t[0].parentNode;"SELECT"===l.nodeName.toUpperCase()&&l.selectedIndex>=0&&(a=l.value),o.after(t,r),e.remove(e.$(t)).lengthn;n++){var o=r[n];if(o.match.test(t)){i=o.handler;break}}return i}"string"==typeof t?a[t]=e:r.push({match:t,handler:e})},a={},r=[],i=/[-\:]/,n=t.view.tag=function(e,a){if(!a){var r=l[e.toLowerCase()];return!r&&i.test(e)&&(r=function(){}),r}t.global.html5&&(t.global.html5.elements+=" "+e,t.global.html5.shivDocument()),l[e.toLowerCase()]=a},l={};return t.view.callbacks={_tags:l,_attributes:a,_regExpAttributes:r,tag:n,attr:e,tagHandler:function(e,a,r){var i,n=r.options.get("tags."+a,{proxyMethods:!1}),o=n||l[a],s=r.scope;if(i=o?t.__notObserve(o)(e,r):s,i&&r.subtemplate){s!==i&&(s=s.add(i));var c=r.subtemplate(s,r.options),v="string"==typeof c?t.view.frag(c):c;t.appendChild(e,v)}}},t.view.callbacks}); +/*can/view/scanner*/ +define("can/view/scanner",["can/view/view","can/view/elements","can/view/callbacks/callbacks"],function(can,elements,viewCallbacks){var newLine=/(\r|\n)+/g,notEndTag=/\//,clean=function(t){return t.split("\\").join("\\\\").split("\n").join("\\n").split('"').join('\\"').split(" ").join("\\t")},getTag=function(t,e,n){if(t)return t;for(;n":">",'"':'"',"'":"'"},this.tokenComplex=[],this.tokenMap={};for(var e,n=0;e=this.tokens[n];n++)e[2]?(this.tokenReg.push(e[2]),this.tokenComplex.push({abbr:e[1],re:new RegExp(e[2]),rescan:e[3]})):(this.tokenReg.push(e[1]),this.tokenSimple[e[1]]=e[0]),this.tokenMap[e[0]]=e[1];this.tokenReg=new RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g")},Scanner.prototype={helpers:[],scan:function(t,e){var n=[],s=0,a=this.tokenSimple,r=this.tokenComplex;t=t.replace(newLine,"\n"),this.transform&&(t=this.transform(t)),t.replace(this.tokenReg,function(e,i){var o=arguments[arguments.length-2];if(o>s&&n.push(t.substring(s,o)),a[e])n.push(e);else for(var u,c=0;u=r[c];c++)if(u.re.test(e)){n.push(u.abbr),u.rescan&&n.push(u.rescan(i));break}s=o+i.length}),s":htmlTag=0;var H="/"===l.substr(l.length-1)||"--"===l.substr(l.length-2),N="";if(k.attributeHookups.length&&(N="attrs: ['"+k.attributeHookups.join("','")+"'], ",k.attributeHookups=[]),v+k.tagHookups.length!==k.lastTagHookup&&v===top(k.tagHookups))H&&(l=l.substr(0,l.length-1)),p.push(put_cmd,'"',clean(l),'"',",can.view.pending({tagName:'"+v+"',"+N+"scope: "+(this.text.scope||"this")+this.text.options),H?(p.push("}));"),l="/>",b()):"<"===n[d]&&n[d+1]==="/"+v?(p.push("}));"),l=u,b()):(p.push(",subtemplate: function("+this.text.argNames+"){\n"+startTxt+(this.text.start||"")),l="");else if(m||!w&&elements.tagToContentPropMap[x[x.length-1]]||N){var R=",can.view.pending({"+N+"scope: "+(this.text.scope||"this")+this.text.options+'}),"';H?h(l.substr(0,l.length-1),R+'/>"'):h(l,R+'>"'),l="",m=0}else l+=u;(H||w)&&(x.pop(),v=x[x.length-1],w=!1),k.attributeHookups=[];break;case"'":case'"':if(htmlTag)if(quote&"e===u){quote=null;var L=getAttrName();if(viewCallbacks.attr(L)&&k.attributeHookups.push(L),T){l+=u,h(l),p.push(finishTxt,"}));\n"),l="",T=!1;break}}else if(null===quote&&(quote=u,beforeQuote=i,c=getAttrName(),"img"===v&&"src"===c||"style"===c)){h(l.replace(attrReg,"")),l="",T=!0,p.push(insert_cmd,"can.view.txt(2,'"+getTag(v,n,d)+"',"+status()+",this,function(){",startTxt),h(c+"="+u);break}default:if("<"===i){v="!--"===u.substr(0,3)?"!--":u.split(/\s/)[0];var S,y=!1;0===v.indexOf("/")&&(y=!0,S=v.substr(1)),y?(top(x)===S&&(v=S,w=!0),top(k.tagHookups)===S&&(h(l.substr(0,l.length-1)),p.push(finishTxt+"}}) );"),l="><",b())):(v.lastIndexOf("/")===v.length-1&&(v=v.substr(0,v.length-1)),"!--"!==v&&viewCallbacks.tag(v)&&("content"===v&&elements.tagMap[top(x)]&&(u=u.replace("content",elements.tagMap[top(x)])),k.tagHookups.push(v)),x.push(v))}l+=u}else switch(u){case _.right:case _.returnRight:switch(f){case _.left:o=bracketNum(l),1===o?(p.push(insert_cmd,"can.view.txt(0,'"+getTag(v,n,d)+"',"+status()+",this,function(){",startTxt,l),g.push({before:"",after:finishTxt+"}));\n"})):(s=g.length&&-1===o?g.pop():{after:";"},s.before&&p.push(s.before),p.push(l,";",s.after));break;case _.escapeLeft:case _.returnLeft:o=bracketNum(l),o&&g.push({before:finishTxt,after:"}));\n"});for(var j=f===_.escapeLeft?1:0,C={insert:insert_cmd,tagName:getTag(v,n,d),status:status(),specialAttribute:T},q=0;q[\s]*\w*/.source&&(j=0);break}}"object"==typeof l?l.startTxt&&l.end&&T?p.push(insert_cmd,"can.view.toStr( ",l.content,"() ) );"):(l.startTxt?p.push(insert_cmd,"can.view.txt(\n"+("string"==typeof status()||(null!=l.escaped?l.escaped:j))+",\n'"+v+"',\n"+status()+",\nthis,\n"):l.startOnlyTxt&&p.push(insert_cmd,"can.view.onlytxt(this,\n"),p.push(l.content),l.end&&p.push("));")):T?p.push(insert_cmd,l,");"):p.push(insert_cmd,"can.view.txt(\n"+("string"==typeof status()||j)+",\n'"+v+"',\n"+status()+",\nthis,\nfunction(){ "+(this.text.escape||"")+"return ",l,o?startTxt:"}));\n"),rescan&&rescan.after&&rescan.after.length&&(h(rescan.after.length),rescan=null)}f=null,l="";break;case _.templateLeft:l+=_.left;break;default:l+=u}i=u}l.length&&h(l),p.push(";");var M=p.join(""),A={out:(this.text.outStart||"")+M+" "+finishTxt+(this.text.outEnd||"")};return myEval.call(A,"this.fn = (function("+this.text.argNames+"){"+A.out+"});\r\n//# sourceURL="+e+".js"),A}},can.view.pending=function(t){var e=can.view.getHooks();return can.view.hook(function(n){can.each(e,function(t){t(n)}),t.templateType="legacy",t.tagName&&viewCallbacks.tagHandler(n,t.tagName,t),can.each(t&&t.attrs||[],function(e){t.attributeName=e;var s=viewCallbacks.attr(e);s&&s(n,t)})})},can.view.tag("content",function(t,e){return e.scope}),can.view.Scanner=Scanner,Scanner}); +/*can/view/node_lists/node_lists*/ +define("can/view/node_lists/node_lists",["can/util/util","can/view/elements"],function(e){var n=!0;try{document.createTextNode("")._=0}catch(r){n=!1}var t={},i={},a="ejs_"+Math.random(),s=0,u=function(e,r){var t=r||i,u=l(e,t);return u?u:n||3!==e.nodeType?(++s,e[a]=(e.nodeName?"element_":"obj_")+s):(++s,t["text_"+s]=e,"text_"+s)},l=function(e,r){if(n||3!==e.nodeType)return e[a];for(var t in r)if(r[t]===e)return t},p=[].splice,c=[].push,d=function(e){for(var n=0,r=0,t=e.length;t>r;r++){var i=e[r];i.nodeType?n++:n+=d(i)}return n},o=function(e,n){for(var r={},t=0,i=e.length;i>t;t++){var a=h.first(e[t]);r[u(a,n)]=e[t]}return r},f=function(e,n,r){for(var t in n)r[t]||e.newDeepChildren.push(n[t])},h={id:u,update:function(n,r){var t=h.unregisterChildren(n);r=e.makeArray(r);var i=n.length;return p.apply(n,[0,i].concat(r)),n.replacements?(h.nestReplacements(n),n.deepChildren=n.newDeepChildren,n.newDeepChildren=[]):h.nestList(n),t},nestReplacements:function(e){for(var n=0,r={},t=o(e.replacements,r),i=e.replacements.length,a={};na;a++){var n=t[a];e[n.tokenType].apply(e,n.args)}return t}var r="A-Za-z0-9",n="-:_"+r,o="[^=>\\s\\/]+",i="\\s*=\\s*",l="\\{[^\\}\\{]\\}",s="\\{\\{[^\\}]\\}\\}\\}?",u="(?:"+i+"(?:(?:"+s+")|(?:"+l+")|(?:\"[^\"]*\")|(?:'[^']*')|[^>\\s]+))?",f="\\{\\{[^\\}]*\\}\\}\\}?",c="\\{\\{([^\\}]*)\\}\\}\\}?",g=new RegExp("^<(["+r+"]["+n+"]*)((?:\\s*(?:(?:(?:"+o+")?"+u+")|(?:"+f+")+))*)\\s*(\\/?)>"),p=new RegExp("^<\\/(["+n+"]+)[^>]*>"),m=new RegExp(c,"g"),d=/<|\{\{/,h=/\s/,b=e("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),v=e("a,address,article,applet,aside,audio,blockquote,button,canvas,center,dd,del,dir,div,dl,dt,fieldset,figcaption,figure,footer,form,frameset,h1,h2,h3,h4,h5,h6,header,hgroup,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,output,p,pre,section,script,table,tbody,td,tfoot,th,thead,tr,ul,video"),S=e("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),k=e("altGlyph,altGlyphDef,altGlyphItem,animateColor,animateMotion,animateTransform,clipPath,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,foreignObject,glyphRef,linearGradient,radialGradient,textPath"),F=e("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),y=e("script"),V="start,end,close,attrStart,attrEnd,attrValue,chars,comment,special,done".split(","),x=function(){},E=function(e,r,n){function o(t,e,a,n){if(e=k[e]?e:e.toLowerCase(),v[e]&&!S[e])for(var o=C.last();o&&S[o]&&!v[o];)i("",o),o=C.last();F[e]&&C.last()===e&&i("",e),n=b[e]||!!n,r.start(e,n),n||C.push(e),E.parseAttrs(a,r),r.end(e,n)}function i(t,e){var a;if(e)for(e=k[e]?e:e.toLowerCase(),a=C.length-1;a>=0&&C[a]!==e;a--);else a=0;if(a>=0){for(var n=C.length-1;n>=a;n--)r.close&&r.close(C[n]);C.length=a}}function l(t,e){r.special&&r.special(e)}if("object"==typeof e)return a(e,r);var s=[];r=r||{},n&&t(V,function(t){var e=r[t]||x;r[t]=function(){e.apply(this,arguments)!==!1&&s.push({tokenType:t,args:[].slice.call(arguments,0)})}});var u,f,c,h=function(){A&&r.chars&&r.chars(A),A=""},C=[],N=e,A="";for(C.last=function(){return this[this.length-1]};e;){if(f=!0,C.last()&&y[C.last()])e=e.replace(new RegExp("([\\s\\S]*?)]*>"),function(t,e){return e=e.replace(/|/g,"$1$2"),r.chars&&r.chars(e),""}),i("",C.last());else if(0===e.indexOf(""),u>=0&&(h(),r.comment&&r.comment(e.substring(4,u)),e=e.substring(u+3),f=!1)):0===e.indexOf("u?e:e.substring(0,u);e=0>u?"":e.substring(u),q&&(A+=q)}if(e===N)throw new Error("Parse Error: "+e);N=e}return h(),i(),r.done(),s},C=function(t,e,a,r){t.attrStart=r.substring("number"==typeof t.nameStart?t.nameStart:e,e),a.attrStart(t.attrStart),t.inName=!1},N=function(t,e,a,r){void 0!==t.valueStart&&t.valueStartn.valueStart?e.attrValue(t.substring(n.valueStart,a)):n.inName&&n.nameStarti&&u>r;){var d=n[i],f=t[r];if(d!==f)if(u>r+1&&t[r+1]===d)s.push({index:r,deleteCount:0,insert:[t[r]]}),i++,r+=2;else{if(!(l>i+1&&n[i+1]===f))return s.push({index:r,deleteCount:l-i,insert:e.call(t,r)}),s;s.push({index:r,deleteCount:1,insert:[]}),i+=2,r++}else i++,r++}return r===u&&i===l?s:(s.push({index:r,deleteCount:l-i,insert:e.call(t,r)}),s)}}); +/*can/view/live/live*/ +define("can/view/live/live",["can/util/util","can/view/elements","can/view/view","can/view/node_lists/node_lists","can/view/parser/parser","can/util/array/diff"],function(t,e,n,r,a,i){e=e||t.view.elements,r=r||t.view.NodeLists,a=a||t.view.parser;var o=function(e,n,r){var a=!1,i=function(){return a||(a=!0,r(o),t.unbind.call(e,"removed",i)),!0},o={teardownCheck:function(t){return t?!1:i()}};return t.bind.call(e,"removed",i),n(o),o},c=function(t){var e=t.childNodes;if("length"in e)return e;for(var n=t.firstChild,r=[];n;)r.push(n),n=n.nextSibling;return r},l=function(t,e,n){return o(t,function(){e.computeInstance.bind("change",n)},function(t){e.computeInstance.unbind("change",n),t.nodeList&&r.unregister(t.nodeList)})},u=function(t){var e,n={};return a.parseAttrs(t,{attrStart:function(t){n[t]="",e=t},attrValue:function(t){n[e]+=t},attrEnd:function(){}}),n},d=[].splice,s=function(t){return t&&t.nodeType},f=function(t){t.firstChild||t.appendChild(t.ownerDocument.createTextNode(""))},p=function(e){var n="string"==typeof e,r=t.frag(e);return n?t.view.hookup(r):r},v=function(e,n,a,i,o){var l=[];n&&(r.register(l,null,!0,!0),l.parentList=n,l.expression="#each SUBEXPRESSION");var u=a.apply(i,o.concat([l])),d=p(u),s=t.makeArray(c(d));return n?(r.update(l,s),e.push(l)):e.push(r.register(s)),d},h=function(e,n,a){var i=e.splice(n+1,a),o=[];return t.each(i,function(t){var e=r.unregister(t);[].push.apply(o,e)}),o},b=function(t,n,r,a){if(n&&0===t.length){var i=[],o=v(i,a,n,t,[t]);e.after([r[0]],o),r.push(i[0])}},g={},C={registerChildMutationCallback:function(t,e){return e?void(g[t]=e):g[t]},callChildMutationCallback:function(t){var e=t&&g[t.nodeName.toLowerCase()];e&&e(t)},list:function(n,a,c,l,u,s,f){var p,g=s||[n],m=[],k=!1,w=!1,N=function(n,a,i){if(k){var o=x.ownerDocument.createDocumentFragment(),u=[],f=[];t.each(a,function(e,n){var r=t.compute(n+i),a=v(u,s,c,l,[e,r]);o.appendChild(a),f.push(r)});var p=i+1;if(!m.length){var b=h(g,0,g.length-1);t.remove(t.$(b))}if(g[p]){var w=r.first(g[p]);t.insertBefore(w.parentNode,o,w)}else e.after(1===p?[x]:[r.last(g[p-1])],o);d.apply(g,[p,0].concat(u)),d.apply(m,[i,0].concat(f));for(var N=i+f.length,y=m.length;y>N;N++)m[N](N);n.callChildMutationCallback!==!1&&C.callChildMutationCallback(x.parentNode)}},y=function(t,e,n){A({},{length:1},n,!0),N({},[e],n)},A=function(e,n,a,i,o){if(k&&(i||!S.teardownCheck(x.parentNode))){0>a&&(a=m.length+a);var c=h(g,a,n.length);m.splice(a,n.length);for(var l=a,u=m.length;u>l;l++)m[l](l);o?r.unregister(g):(b(p,f,g,s),t.remove(t.$(c)),e.callChildMutationCallback!==!1&&C.callChildMutationCallback(x.parentNode))}},M=function(e,n,a,i){if(k){a+=1,i+=1;var o,c=g[a],l=t.frag(r.flatten(g[i]));o=a>i?r.last(c).nextSibling:r.first(c);var u=g[0].parentNode;u.insertBefore(l,o);var d=g[i];[].splice.apply(g,[i,1]),[].splice.apply(g,[a,0,d]),a-=1,i-=1;var s=m[i];[].splice.apply(m,[i,1]),[].splice.apply(m,[a,0,s]);var f=Math.min(i,a),p=m.length;for(p;p>f;f++)m[f](f);e.callChildMutationCallback!==!1&&C.callChildMutationCallback(x.parentNode)}},x=n.ownerDocument.createTextNode(""),_=function(t){p&&p.unbind&&p.unbind("add",N).unbind("set",y).unbind("remove",A).unbind("move",M),A({callChildMutationCallback:!!t},{length:g.length-1},0,!0,t)},P=function(e,n,r){if(!w){if(k=!0,n&&r){p=n||[];var a=i(r,n);r.unbind&&r.unbind("add",N).unbind("set",y).unbind("remove",A).unbind("move",M);for(var o=0,c=a.length;c>o;o++){var l=a[o];l.deleteCount&&A({callChildMutationCallback:!1},{length:l.deleteCount},l.index,!0),l.insert.length&&N({callChildMutationCallback:!1},l.insert,l.index)}}else r&&_(),p=n||[],N({callChildMutationCallback:!1},p,0),b(p,f,g,s);C.callChildMutationCallback(x.parentNode),k=!1,p.bind&&p.bind("add",N).bind("set",y).bind("remove",A).bind("move",M),t.batch.afterPreviousEvents(function(){k=!0})}};u=e.getParentNode(n,u);var S=o(u,function(){t.isFunction(a)&&a.bind("change",P)},function(){t.isFunction(a)&&a.unbind("change",P),_(!0)});s?(e.replace(g,x),r.update(g,[x]),s.unregistered=function(){S.teardownCheck(),w=!0}):C.replace(g,x,S.teardownCheck),P({},t.isFunction(a)?a():a)},html:function(n,a,i,o){var u;i=e.getParentNode(n,i),u=l(i,a,function(t,e,n){var a=r.first(d).parentNode;a&&p(e);var i=r.first(d).parentNode;u.teardownCheck(i),C.callChildMutationCallback(i)});var d=o||[n],p=function(n){var a="function"==typeof n,o=s(n),l=t.frag(a?"":n),u=t.makeArray(d);f(l),o||a||(l=t.view.hookup(l,i)),u=r.update(d,c(l)),a&&n(l.firstChild),e.replace(u,l)};u.nodeList=d,o?o.unregistered=u.teardownCheck:r.register(d,u.teardownCheck),p(a())},replace:function(n,a,i){var o=n.slice(0),l=t.frag(a);return r.register(n,i),"string"==typeof a&&(l=t.view.hookup(l,n[0].parentNode)),r.update(n,c(l)),e.replace(o,l),n},text:function(n,a,i,o){var c=e.getParentNode(n,i),u=l(c,a,function(e,n,r){"unknown"!=typeof d.nodeValue&&(d.nodeValue=t.view.toStr(n)),u.teardownCheck(d.parentNode)}),d=n.ownerDocument.createTextNode(t.view.toStr(a()));o?(o.unregistered=u.teardownCheck,u.nodeList=o,r.update(o,[d]),e.replace([n],d)):u.nodeList=C.replace([n],d,u.teardownCheck)},setAttributes:function(e,n){var r=u(n);for(var a in r)t.attr.set(e,a,r[a])},attributes:function(n,r,a){var i={},o=function(r){var a,o=u(r);for(a in o){var c=o[a],l=i[a];c!==l&&t.attr.set(n,a,c),delete i[a]}for(a in i)e.removeAttr(n,a);i=o};l(n,r,function(t,e){o(e)}),arguments.length>=3?i=u(a):o(r())},attributePlaceholder:"__!!__",attributeReplace:/__!!__/g,attribute:function(n,r,a){l(n,a,function(t,a){e.setAttr(n,r,c.render())});var i,o=t.$(n);i=t.data(o,"hooks"),i||t.data(o,"hooks",i={});var c,u=String(e.getAttr(n,r)),d=u.split(C.attributePlaceholder),s=[];s.push(d.shift(),d.join(C.attributePlaceholder)),i[r]?i[r].computes.push(a):i[r]={render:function(){var t=0,n=u?u.replace(C.attributeReplace,function(){return e.contentText(c.computes[t++]())}):e.contentText(c.computes[t++]());return n},computes:[a],batchNum:void 0},c=i[r],s.splice(1,0,a()),e.setAttr(n,r,s.join(""))},specialAttribute:function(t,n,r){l(t,r,function(r,a){e.setAttr(t,n,k(a))}),e.setAttr(t,n,k(r()))},simpleAttribute:function(t,n,r){l(t,r,function(r,a){e.setAttr(t,n,a)}),e.setAttr(t,n,r())}};C.attr=C.simpleAttribute,C.attrs=C.attributes,C.getAttributeParts=u;var m=/(\r|\n)+/g,k=function(t){var n=/^["'].*["']$/;return t=t.replace(e.attrReg,"").replace(m,""),n.test(t)?t.substr(1,t.length-2):t};return t.view.live=C,C}); +/*can/view/render*/ +define("can/view/render",["can/view/view","can/view/elements","can/view/live/live","can/util/string/string"],function(n,t,e){var i,r=[],u=function(n){var e=t.tagMap[n]||"span";return"span"===e?"@@!!@@":"<"+e+">"+u(e)+""},o=function(t,e){if("string"==typeof t)return t;if(!t&&0!==t)return"";var i=t.hookup&&function(n,e){t.hookup.call(t,n,e)}||"function"==typeof t&&t;return i?e?"<"+e+" "+n.view.hook(i)+">":(r.push(i),""):""+t},c=function(t,e){return"string"==typeof t||"number"==typeof t?n.esc(t):o(t,e)},s=!1,a=function(){};return n.extend(n.view,{live:e,setupLists:function(){var t,e=n.view.lists;return n.view.lists=function(n,e){return t={list:n,renderer:e},Math.random()},function(){return n.view.lists=e,t}},getHooks:function(){var n=r.slice(0);return i=n,r=[],n},onlytxt:function(n,t){return c(t.call(n))},txt:function(f,l,p,v,h){var g,w,d,b,y=t.tagMap[l]||"span",k=!1,m=a;if(s)g=h.call(v);else{("string"==typeof p||1===p)&&(s=!0);var x=n.view.setupLists();m=function(){d.unbind("change",a)},d=n.compute(h,v,!1),d.bind("change",a),w=x(),g=d(),s=!1,k=d.computeInstance.hasDependencies}if(w)return m(),"<"+y+n.view.hook(function(n,t){e.list(n,w.list,w.renderer,v,t)})+">";if(!k||"function"==typeof g)return m(),(s||2===f||!f?o:c)(g,0===p&&y);var M=t.tagToContentPropMap[l];if(0!==p||M)return 1===p?(r.push(function(n){e.attributes(n,d,d()),m()}),d()):2===f?(b=p,r.push(function(n){e.specialAttribute(n,b,d),m()}),d()):(b=0===p?M:p,(0===p?i:r).push(function(n){e.attribute(n,b,d),m()}),e.attributePlaceholder);var C=!!t.selfClosingTags[y];return"<"+y+n.view.hook(f&&"object"!=typeof g?function(n,t){e.text(n,d,t),m()}:function(n,t){e.html(n,d,t),m()})+(C?"/>":">"+u(y)+"")}}),n}); +/*can/view/ejs/ejs*/ +define("can/view/ejs/ejs",["can/util/util","can/view/view","can/util/string/string","can/compute/compute","can/view/scanner","can/view/render"],function(t){var e=t.extend,n=function(t){if(this.constructor!==n){var r=new n(t);return function(t,e){return r.render(t,e)}}return"function"==typeof t?void(this.template={fn:t}):(e(this,t),void(this.template=this.scanner.scan(this.text,this.name)))};return t.EJS=n,n.prototype.render=function(t,e){return t=t||{},this.template.fn.call(t,t,new n.Helpers(t,e||{}))},e(n.prototype,{scanner:new t.view.Scanner({text:{outStart:"with(_VIEW) { with (_CONTEXT) {",outEnd:"}}",argNames:"_CONTEXT,_VIEW",context:"this"},tokens:[["templateLeft","<%%"],["templateRight","%>"],["returnLeft","<%=="],["escapeLeft","<%="],["commentLeft","<%#"],["left","<%"],["right","%>"],["returnRight","%>"]],helpers:[{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(t){var e=/\s*\(([\$\w]+)\)\s*->([^\n]*)/,n=t.match(e);return"can.proxy(function(__){var "+n[1]+"=can.$(__);"+n[2]+"}, this);"}}],transform:function(t){return t.replace(/<%([\s\S]+?)%>/gm,function(t,e){var n,r,i=[];e.replace(/[{}]/gm,function(t,e){i.push([t,e])});do for(n=!1,r=i.length-2;r>=0;r--)if("{"===i[r][0]&&"}"===i[r+1][0]){i.splice(r,2),n=!0;break}while(n);if(i.length>=2){var s,a=["<%"],c=0;for(r=0;s=i[r];r++)a.push(e.substring(c,c=s[1])),"{"===s[0]&&r0?a.push("{"===s[0]?"{ %><% ":" %><% }"):a.push(s[0]),++c;return a.push(e.substring(c),"%>"),a.join("")}return"<%"+e+"%>"})}})}),n.Helpers=function(t,n){this._data=t,this._extras=n,e(this,n)},n.Helpers.prototype={list:function(e,n){t.each(e,function(t,r){n(t,r,e)})},each:function(e,n){t.isArray(e)?this.list(e,n):t.view.lists(e,n)}},t.view.register({suffix:"ejs",script:function(t,e){return"can.EJS(function(_CONTEXT,_VIEW) { "+new n({text:e,name:t}).template.out+" })"},renderer:function(t,e){return n({text:e,name:t})}}),t.ejs.Helpers=n.Helpers,t}); +/*[global-shim-end]*/ +!function(){window._define=window.define,window.define=window.define.orig}(); \ No newline at end of file diff --git a/www/lib/js/colResizable-1.5.min.js b/www/lib/js/colResizable-1.5.min.js new file mode 100644 index 0000000..e811342 --- /dev/null +++ b/www/lib/js/colResizable-1.5.min.js @@ -0,0 +1,2 @@ +// colResizable 1.5 - a jQuery plugin by Alvaro Prieto Lauroba http://www.bacubacu.com/colresizable/ +(function($){var d=$(document),h=$("head"),drag=null,tables=[],count=0,ID="id",PX="px",SIGNATURE="JColResizer",FLEX="JCLRFlex",I=parseInt,M=Math,ie=navigator.userAgent.indexOf('Trident/4.0')>0,S;try{S=sessionStorage}catch(e){};h.append("");var init=function(tb,options){var t=$(tb);t.opt=options;if(t.opt.disable)return destroy(t);var id=t.id=t.attr(ID)||SIGNATURE+ count++;t.p=t.opt.postbackSafe;if(!t.is("table")||tables[id]&&!t.opt.partialRefresh)return;t.addClass(SIGNATURE).attr(ID,id).before('
    ');t.g=[];t.c=[];t.w=t.width();t.gc=t.prev();t.f=t.opt.fixed;if(options.marginLeft)t.gc.css("marginLeft",options.marginLeft);if(options.marginRight)t.gc.css("marginRight",options.marginRight);t.cs=I(ie?tb.cellSpacing||tb.currentStyle.borderSpacing:t.css('border-spacing'))||2;t.b=I(ie?tb.border||tb.currentStyle.borderLeftWidth:t.css('border-left-width'))||1;tables[id]=t;createGrips(t)},destroy=function(t){var id=t.attr(ID),t=tables[id];if(!t||!t.is("table"))return;t.removeClass(SIGNATURE+" "+FLEX).gc.remove();delete tables[id]},createGrips=function(t){var th=t.find(">thead>tr>th,>thead>tr>td");if(!th.length)th=t.find(">tbody>tr:first>th,>tr:first>th,>tbody>tr:first>td, >tr:first>td");th=th.filter(":visible");t.cg=t.find("col");t.ln=th.length;if(t.p&&S&&S[t.id])memento(t,th);th.each(function(i){var c=$(this),g=$(t.gc.append('
    ')[0].lastChild);g.append(t.opt.gripInnerHtml).append('
    ');if(i==t.ln-1){g.addClass("JCLRLastGrip");if(t.f)g.html("")};g.bind('touchstart mousedown',onGripMouseDown);g.t=t;g.i=i;g.c=c;c.w=c.width();t.g.push(g);t.c.push(c);c.width(c.w).removeAttr("width");g.data(SIGNATURE,{i:i,t:t.attr(ID),last:i==t.ln-1})});t.cg.removeAttr("width");syncGrips(t);t.find('td, th').not(th).not('table th, table td').each(function(){$(this).removeAttr('width')});if(!t.f)t.removeAttr('width').addClass(FLEX)},memento=function(t,th){var w,m=0,i=0,aux=[],tw;if(th){t.cg.removeAttr("width");if(t.opt.flush){S[t.id]="";return};w=S[t.id].split(";");tw=w[t.ln+1];if(!t.f&&tw)t.width(tw);for(;i*{cursor:"+t.opt.dragCursor+"!important}");g.addClass(t.opt.draggingClass);drag=g;if(t.c[o.i].l)for(var i=0,c;id;++d)c[d].apply(this,b)}return this},d.prototype.listeners=function(a){return this._callbacks=this._callbacks||{},this._callbacks[a]||[]},d.prototype.hasListeners=function(a){return!!this.listeners(a).length}}),a.register("dropzone/index.js",function(a,b,c){c.exports=b("./lib/dropzone.js")}),a.register("dropzone/lib/dropzone.js",function(a,b,c){!function(){var a,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},k=[].slice;d="undefined"!=typeof Emitter&&null!==Emitter?Emitter:b("emitter"),g=function(){},a=function(a){function b(a,d){var e,f,g;if(this.element=a,this.version=b.version,this.defaultOptions.previewTemplate=this.defaultOptions.previewTemplate.replace(/\n*/g,""),this.clickableElements=[],this.listeners=[],this.files=[],"string"==typeof this.element&&(this.element=document.querySelector(this.element)),!this.element||null==this.element.nodeType)throw new Error("Invalid dropzone element.");if(this.element.dropzone)throw new Error("Dropzone already attached.");if(b.instances.push(this),a.dropzone=this,e=null!=(g=b.optionsForElement(this.element))?g:{},this.options=c({},this.defaultOptions,e,null!=d?d:{}),null==this.options.url&&(this.options.url=this.element.action),!this.options.url)throw new Error("No URL provided.");if(this.options.acceptedFiles&&this.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");return this.options.acceptedMimeTypes&&(this.options.acceptedFiles=this.options.acceptedMimeTypes,delete this.options.acceptedMimeTypes),this.options.method=this.options.method.toUpperCase(),this.options.forceFallback||!b.isBrowserSupported()?this.options.fallback.call(this):((f=this.getExistingFallback())&&f.parentNode&&f.parentNode.removeChild(f),this.previewsContainer=this.options.previewsContainer?b.getElement(this.options.previewsContainer,"previewsContainer"):this.element,this.options.clickable&&(this.clickableElements=this.options.clickable===!0?[this.element]:b.getElements(this.options.clickable,"clickable")),this.init(),void 0)}var c;return j(b,a),b.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","selectedfiles","addedfile","removedfile","thumbnail","error","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset"],b.prototype.defaultOptions={url:null,method:"post",withCredentials:!1,parallelUploads:2,uploadMultiple:!1,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:100,thumbnailHeight:100,params:{},clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,addRemoveLinks:!1,previewsContainer:null,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MB). Max filesize: {{maxFilesize}}MB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,accept:function(a,b){return b()},init:function(){return g},forceFallback:!1,fallback:function(){var a,c,d,e,f,g;for(this.element.className=""+this.element.className+" dz-browser-not-supported",g=this.element.getElementsByTagName("div"),e=0,f=g.length;f>e;e++)a=g[e],/(^| )dz-message($| )/.test(a.className)&&(c=a,a.className="dz-message");return c||(c=b.createElement('
    '),this.element.appendChild(c)),d=c.getElementsByTagName("span")[0],d&&(d.textContent=this.options.dictFallbackMessage),this.element.appendChild(this.getFallbackForm())},resize:function(a){var b,c,d;return b={srcX:0,srcY:0,srcWidth:a.width,srcHeight:a.height},c=a.width/a.height,d=this.options.thumbnailWidth/this.options.thumbnailHeight,a.heightd?(b.srcHeight=a.height,b.srcWidth=b.srcHeight*d):(b.srcWidth=a.width,b.srcHeight=b.srcWidth/d),b.srcX=(a.width-b.srcWidth)/2,b.srcY=(a.height-b.srcHeight)/2,b},drop:function(){return this.element.classList.remove("dz-drag-hover")},dragstart:g,dragend:function(){return this.element.classList.remove("dz-drag-hover")},dragenter:function(){return this.element.classList.add("dz-drag-hover")},dragover:function(){return this.element.classList.add("dz-drag-hover")},dragleave:function(){return this.element.classList.remove("dz-drag-hover")},selectedfiles:function(){return this.element===this.previewsContainer?this.element.classList.add("dz-started"):void 0},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(a){var c=this;return a.previewElement=b.createElement(this.options.previewTemplate),a.previewTemplate=a.previewElement,this.previewsContainer.appendChild(a.previewElement),a.previewElement.querySelector("[data-dz-name]").textContent=a.name,a.previewElement.querySelector("[data-dz-size]").innerHTML=this.filesize(a.size),this.options.addRemoveLinks?(a._removeLink=b.createElement(''+this.options.dictRemoveFile+""),a._removeLink.addEventListener("click",function(d){if(d.preventDefault(),d.stopPropagation(),a.status===b.UPLOADING){if(window.confirm(c.options.dictCancelUploadConfirmation))return c.removeFile(a)}else{if(!c.options.dictRemoveFileConfirmation)return c.removeFile(a);if(window.confirm(c.options.dictRemoveFileConfirmation))return c.removeFile(a)}}),a.previewElement.appendChild(a._removeLink)):void 0},removedfile:function(a){var b;return null!=(b=a.previewElement)?b.parentNode.removeChild(a.previewElement):void 0},thumbnail:function(a,b){var c;return a.previewElement.classList.remove("dz-file-preview"),a.previewElement.classList.add("dz-image-preview"),c=a.previewElement.querySelector("[data-dz-thumbnail]"),c.alt=a.name,c.src=b},error:function(a,b){return a.previewElement.classList.add("dz-error"),a.previewElement.querySelector("[data-dz-errormessage]").textContent=b},processing:function(a){return a.previewElement.classList.add("dz-processing"),a._removeLink?a._removeLink.textContent=this.options.dictCancelUpload:void 0},processingmultiple:g,uploadprogress:function(a,b){return a.previewElement.querySelector("[data-dz-uploadprogress]").style.width=""+b+"%"},totaluploadprogress:g,sending:g,sendingmultiple:g,success:function(a){return a.previewElement.classList.add("dz-success")},successmultiple:g,canceled:function(a){return this.emit("error",a,"Upload canceled.")},canceledmultiple:g,complete:function(a){return a._removeLink?a._removeLink.textContent=this.options.dictRemoveFile:void 0},completemultiple:g,previewTemplate:'
    \n
    \n
    \n
    \n \n
    \n
    \n
    ?
    \n
    ?
    \n
    \n
    '},c=function(){var a,b,c,d,e,f,g;for(d=arguments[0],c=2<=arguments.length?k.call(arguments,1):[],f=0,g=c.length;g>f;f++){b=c[f];for(a in b)e=b[a],d[a]=e}return d},b.prototype.getAcceptedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted&&e.push(a);return e},b.prototype.getRejectedFiles=function(){var a,b,c,d,e;for(d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],a.accepted||e.push(a);return e},b.prototype.getQueuedFiles=function(){var a,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)a=e[c],a.status===b.QUEUED&&f.push(a);return f},b.prototype.getUploadingFiles=function(){var a,c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)a=e[c],a.status===b.UPLOADING&&f.push(a);return f},b.prototype.init=function(){var a,c,d,e,f,g,h,i=this;for("form"===this.element.tagName&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(b.createElement('
    '+this.options.dictDefaultMessage+"
    ")),this.clickableElements.length&&(d=function(){return i.hiddenFileInput&&document.body.removeChild(i.hiddenFileInput),i.hiddenFileInput=document.createElement("input"),i.hiddenFileInput.setAttribute("type","file"),i.hiddenFileInput.setAttribute("multiple","multiple"),null!=i.options.acceptedFiles&&i.hiddenFileInput.setAttribute("accept",i.options.acceptedFiles),i.hiddenFileInput.style.visibility="hidden",i.hiddenFileInput.style.position="absolute",i.hiddenFileInput.style.top="0",i.hiddenFileInput.style.left="0",i.hiddenFileInput.style.height="0",i.hiddenFileInput.style.width="0",document.body.appendChild(i.hiddenFileInput),i.hiddenFileInput.addEventListener("change",function(){var a;return a=i.hiddenFileInput.files,a.length&&(i.emit("selectedfiles",a),i.handleFiles(a)),d()})},d()),this.URL=null!=(g=window.URL)?g:window.webkitURL,h=this.events,e=0,f=h.length;f>e;e++)a=h[e],this.on(a,this.options[a]);return this.on("uploadprogress",function(){return i.updateTotalUploadProgress()}),this.on("removedfile",function(){return i.updateTotalUploadProgress()}),this.on("canceled",function(a){return i.emit("complete",a)}),c=function(a){return a.stopPropagation(),a.preventDefault?a.preventDefault():a.returnValue=!1},this.listeners=[{element:this.element,events:{dragstart:function(a){return i.emit("dragstart",a)},dragenter:function(a){return c(a),i.emit("dragenter",a)},dragover:function(a){return c(a),i.emit("dragover",a)},dragleave:function(a){return i.emit("dragleave",a)},drop:function(a){return c(a),i.drop(a),i.emit("drop",a)},dragend:function(a){return i.emit("dragend",a)}}}],this.clickableElements.forEach(function(a){return i.listeners.push({element:a,events:{click:function(c){return a!==i.element||c.target===i.element||b.elementInside(c.target,i.element.querySelector(".dz-message"))?i.hiddenFileInput.click():void 0}}})}),this.enable(),this.options.init.call(this)},b.prototype.destroy=function(){var a;return this.disable(),this.removeAllFiles(!0),(null!=(a=this.hiddenFileInput)?a.parentNode:void 0)&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone},b.prototype.updateTotalUploadProgress=function(){var a,b,c,d,e,f,g,h;if(d=0,c=0,a=this.getAcceptedFiles(),a.length){for(h=this.getAcceptedFiles(),f=0,g=h.length;g>f;f++)b=h[f],d+=b.upload.bytesSent,c+=b.upload.total;e=100*d/c}else e=100;return this.emit("totaluploadprogress",e,c,d)},b.prototype.getFallbackForm=function(){var a,c,d,e;return(a=this.getExistingFallback())?a:(d='
    ',this.options.dictFallbackText&&(d+="

    "+this.options.dictFallbackText+"

    "),d+='
    ',c=b.createElement(d),"FORM"!==this.element.tagName?(e=b.createElement('
    '),e.appendChild(c)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=e?e:c)},b.prototype.getExistingFallback=function(){var a,b,c,d,e,f;for(b=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)if(b=a[c],/(^| )fallback($| )/.test(b.className))return b},f=["div","form"],d=0,e=f.length;e>d;d++)if(c=f[d],a=b(this.element.getElementsByTagName(c)))return a},b.prototype.setupEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.addEventListener(b,c,!1));return e}());return g},b.prototype.removeEventListeners=function(){var a,b,c,d,e,f,g;for(f=this.listeners,g=[],d=0,e=f.length;e>d;d++)a=f[d],g.push(function(){var d,e;d=a.events,e=[];for(b in d)c=d[b],e.push(a.element.removeEventListener(b,c,!1));return e}());return g},b.prototype.disable=function(){var a,b,c,d,e;for(this.clickableElements.forEach(function(a){return a.classList.remove("dz-clickable")}),this.removeEventListeners(),d=this.files,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(this.cancelUpload(a));return e},b.prototype.enable=function(){return this.clickableElements.forEach(function(a){return a.classList.add("dz-clickable")}),this.setupEventListeners()},b.prototype.filesize=function(a){var b;return a>=1e11?(a/=1e11,b="TB"):a>=1e8?(a/=1e8,b="GB"):a>=1e5?(a/=1e5,b="MB"):a>=100?(a/=100,b="KB"):(a=10*a,b="b"),""+Math.round(a)/10+" "+b},b.prototype.drop=function(a){var b,c;a.dataTransfer&&(b=a.dataTransfer.files,this.emit("selectedfiles",b),b.length&&(c=a.dataTransfer.items,c&&c.length&&(null!=c[0].webkitGetAsEntry||null!=c[0].getAsEntry)?this.handleItems(c):this.handleFiles(b)))},b.prototype.handleFiles=function(a){var b,c,d,e;for(e=[],c=0,d=a.length;d>c;c++)b=a[c],e.push(this.addFile(b));return e},b.prototype.handleItems=function(a){var b,c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],null!=c.webkitGetAsEntry?(b=c.webkitGetAsEntry(),b.isFile?this.addFile(c.getAsFile()):b.isDirectory&&this.addDirectory(b,b.name)):this.addFile(c.getAsFile())},b.prototype.accept=function(a,c){return a.size>1024*1024*this.options.maxFilesize?c(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(a.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):b.isValidFile(a,this.options.acceptedFiles)?this.options.accept.call(this,a,c):c(this.options.dictInvalidFileType)},b.prototype.addFile=function(a){var c=this;return a.upload={progress:0,total:a.size,bytesSent:0},this.files.push(a),a.status=b.ADDED,this.emit("addedfile",a),this.options.createImageThumbnails&&a.type.match(/image.*/)&&a.size<=1024*1024*this.options.maxThumbnailFilesize&&this.createThumbnail(a),this.accept(a,function(b){return b?(a.accepted=!1,c._errorProcessing([a],b)):(a.accepted=!0,c.enqueueFile(a))})},b.prototype.enqueueFiles=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.enqueueFile(b);return null},b.prototype.enqueueFile=function(a){var c=this;if(a.status!==b.ADDED)throw new Error("This file can't be queued because it has already been processed or was rejected.");return a.status=b.QUEUED,this.options.autoProcessQueue?setTimeout(function(){return c.processQueue()},1):void 0},b.prototype.addDirectory=function(a,b){var c,d,e=this;return c=a.createReader(),d=function(c){var d,f;for(d=0,f=c.length;f>d;d++)a=c[d],a.isFile?a.file(function(a){return e.options.ignoreHiddenFiles&&"."===a.name.substring(0,1)?void 0:(a.fullPath=""+b+"/"+a.name,e.addFile(a))}):a.isDirectory&&e.addDirectory(a,""+b+"/"+a.name)},c.readEntries(d,function(a){return"undefined"!=typeof console&&null!==console?"function"==typeof console.log?console.log(a):void 0:void 0})},b.prototype.removeFile=function(a){return a.status===b.UPLOADING&&this.cancelUpload(a),this.files=h(this.files,a),this.emit("removedfile",a),0===this.files.length?this.emit("reset"):void 0},b.prototype.removeAllFiles=function(a){var c,d,e,f;for(null==a&&(a=!1),f=this.files.slice(),d=0,e=f.length;e>d;d++)c=f[d],(c.status!==b.UPLOADING||a)&&this.removeFile(c);return null},b.prototype.createThumbnail=function(a){var b,c=this;return b=new FileReader,b.onload=function(){var d;return d=new Image,d.onload=function(){var b,e,f,g,h,i,j,k;return a.width=d.width,a.height=d.height,f=c.options.resize.call(c,a),null==f.trgWidth&&(f.trgWidth=c.options.thumbnailWidth),null==f.trgHeight&&(f.trgHeight=c.options.thumbnailHeight),b=document.createElement("canvas"),e=b.getContext("2d"),b.width=f.trgWidth,b.height=f.trgHeight,e.drawImage(d,null!=(h=f.srcX)?h:0,null!=(i=f.srcY)?i:0,f.srcWidth,f.srcHeight,null!=(j=f.trgX)?j:0,null!=(k=f.trgY)?k:0,f.trgWidth,f.trgHeight),g=b.toDataURL("image/png"),c.emit("thumbnail",a,g)},d.src=b.result},b.readAsDataURL(a)},b.prototype.processQueue=function(){var a,b,c,d;if(b=this.options.parallelUploads,c=this.getUploadingFiles().length,a=c,!(c>=b)&&(d=this.getQueuedFiles(),d.length>0)){if(this.options.uploadMultiple)return this.processFiles(d.slice(0,b-c));for(;b>a;){if(!d.length)return;this.processFile(d.shift()),a++}}},b.prototype.processFile=function(a){return this.processFiles([a])},b.prototype.processFiles=function(a){var c,d,e;for(d=0,e=a.length;e>d;d++)c=a[d],c.processing=!0,c.status=b.UPLOADING,this.emit("processing",c);return this.options.uploadMultiple&&this.emit("processingmultiple",a),this.uploadFiles(a)},b.prototype._getFilesWithXhr=function(a){var b,c;return c=function(){var c,d,e,f;for(e=this.files,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.xhr===a&&f.push(b);return f}.call(this)},b.prototype.cancelUpload=function(a){var c,d,e,f,g,h,i;if(a.status===b.UPLOADING){for(d=this._getFilesWithXhr(a.xhr),e=0,g=d.length;g>e;e++)c=d[e],c.status=b.CANCELED;for(a.xhr.abort(),f=0,h=d.length;h>f;f++)c=d[f],this.emit("canceled",c);this.options.uploadMultiple&&this.emit("canceledmultiple",d)}else((i=a.status)===b.ADDED||i===b.QUEUED)&&(a.status=b.CANCELED,this.emit("canceled",a),this.options.uploadMultiple&&this.emit("canceledmultiple",[a]));return this.options.autoProcessQueue?this.processQueue():void 0},b.prototype.uploadFile=function(a){return this.uploadFiles([a])},b.prototype.uploadFiles=function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E=this;for(r=new XMLHttpRequest,s=0,w=a.length;w>s;s++)d=a[s],d.xhr=r;r.open(this.options.method,this.options.url,!0),r.withCredentials=!!this.options.withCredentials,o=null,f=function(){var b,c,e;for(e=[],b=0,c=a.length;c>b;b++)d=a[b],e.push(E._errorProcessing(a,o||E.options.dictResponseError.replace("{{statusCode}}",r.status),r));return e},p=function(b){var c,e,f,g,h,i,j,k,l;if(null!=b)for(e=100*b.loaded/b.total,f=0,i=a.length;i>f;f++)d=a[f],d.upload={progress:e,total:b.total,bytesSent:b.loaded};else{for(c=!0,e=100,g=0,j=a.length;j>g;g++)d=a[g],(100!==d.upload.progress||d.upload.bytesSent!==d.upload.total)&&(c=!1),d.upload.progress=e,d.upload.bytesSent=d.upload.total;if(c)return}for(l=[],h=0,k=a.length;k>h;h++)d=a[h],l.push(E.emit("uploadprogress",d,e,d.upload.bytesSent));return l},r.onload=function(c){var d;if(a[0].status!==b.CANCELED&&4===r.readyState){if(o=r.responseText,r.getResponseHeader("content-type")&&~r.getResponseHeader("content-type").indexOf("application/json"))try{o=JSON.parse(o)}catch(e){c=e,o="Invalid JSON response from server."}return p(),200<=(d=r.status)&&300>d?E._finished(a,o,c):f()}},r.onerror=function(){return a[0].status!==b.CANCELED?f():void 0},n=null!=(A=r.upload)?A:r,n.onprogress=p,i={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"},this.options.headers&&c(i,this.options.headers);for(g in i)h=i[g],r.setRequestHeader(g,h);if(e=new FormData,this.options.params){B=this.options.params;for(m in B)q=B[m],e.append(m,q)}for(t=0,x=a.length;x>t;t++)d=a[t],this.emit("sending",d,r,e);if(this.options.uploadMultiple&&this.emit("sendingmultiple",a,r,e),"FORM"===this.element.tagName)for(C=this.element.querySelectorAll("input, textarea, select, button"),u=0,y=C.length;y>u;u++)j=C[u],k=j.getAttribute("name"),l=j.getAttribute("type"),(!l||"checkbox"!==(D=l.toLowerCase())&&"radio"!==D||j.checked)&&e.append(k,j.value);for(v=0,z=a.length;z>v;v++)d=a[v],e.append(""+this.options.paramName+(this.options.uploadMultiple?"[]":""),d,d.name);return r.send(e)},b.prototype._finished=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.SUCCESS,this.emit("success",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("successmultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b.prototype._errorProcessing=function(a,c,d){var e,f,g;for(f=0,g=a.length;g>f;f++)e=a[f],e.status=b.ERROR,this.emit("error",e,c,d),this.emit("complete",e);return this.options.uploadMultiple&&(this.emit("errormultiple",a,c,d),this.emit("completemultiple",a)),this.options.autoProcessQueue?this.processQueue():void 0},b}(d),a.version="3.6.2",a.options={},a.optionsForElement=function(b){return b.id?a.options[e(b.id)]:void 0},a.instances=[],a.forElement=function(a){if("string"==typeof a&&(a=document.querySelector(a)),null==(null!=a?a.dropzone:void 0))throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return a.dropzone},a.autoDiscover=!0,a.discover=function(){var b,c,d,e,f,g;for(document.querySelectorAll?d=document.querySelectorAll(".dropzone"):(d=[],b=function(a){var b,c,e,f;for(f=[],c=0,e=a.length;e>c;c++)b=a[c],/(^| )dropzone($| )/.test(b.className)?f.push(d.push(b)):f.push(void 0);return f},b(document.getElementsByTagName("div")),b(document.getElementsByTagName("form"))),g=[],e=0,f=d.length;f>e;e++)c=d[e],a.optionsForElement(c)!==!1?g.push(new a(c)):g.push(void 0);return g},a.blacklistedBrowsers=[/opera.*Macintosh.*version\/12/i],a.isBrowserSupported=function(){var b,c,d,e,f;if(b=!0,window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if("classList"in document.createElement("a"))for(f=a.blacklistedBrowsers,d=0,e=f.length;e>d;d++)c=f[d],c.test(navigator.userAgent)&&(b=!1);else b=!1;else b=!1;return b},h=function(a,b){var c,d,e,f;for(f=[],d=0,e=a.length;e>d;d++)c=a[d],c!==b&&f.push(c);return f},e=function(a){return a.replace(/[\-_](\w)/g,function(a){return a[1].toUpperCase()})},a.createElement=function(a){var b;return b=document.createElement("div"),b.innerHTML=a,b.childNodes[0]},a.elementInside=function(a,b){if(a===b)return!0;for(;a=a.parentNode;)if(a===b)return!0;return!1},a.getElement=function(a,b){var c;if("string"==typeof a?c=document.querySelector(a):null!=a.nodeType&&(c=a),null==c)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector or a plain HTML element.");return c},a.getElements=function(a,b){var c,d,e,f,g,h,i,j;if(a instanceof Array){e=[];try{for(f=0,h=a.length;h>f;f++)d=a[f],e.push(this.getElement(d,b))}catch(k){c=k,e=null}}else if("string"==typeof a)for(e=[],j=document.querySelectorAll(a),g=0,i=j.length;i>g;g++)d=j[g],e.push(d);else null!=a.nodeType&&(e=[a]);if(null==e||!e.length)throw new Error("Invalid `"+b+"` option provided. Please provide a CSS selector, a plain HTML element or a list of those.");return e},a.isValidFile=function(a,b){var c,d,e,f,g;if(!b)return!0;for(b=b.split(","),d=a.type,c=d.replace(/\/.*$/,""),f=0,g=b.length;g>f;f++)if(e=b[f],e=e.trim(),"."===e.charAt(0)){if(-1!==a.name.indexOf(e,a.name.length-e.length))return!0}else if(/\/\*$/.test(e)){if(c===e.replace(/\/.*$/,""))return!0}else if(d===e)return!0;return!1},"undefined"!=typeof jQuery&&null!==jQuery&&(jQuery.fn.dropzone=function(b){return this.each(function(){return new a(this,b)})}),"undefined"!=typeof c&&null!==c?c.exports=a:window.Dropzone=a,a.ADDED="added",a.QUEUED="queued",a.ACCEPTED=a.QUEUED,a.UPLOADING="uploading",a.PROCESSING=a.UPLOADING,a.CANCELED="canceled",a.ERROR="error",a.SUCCESS="success",f=function(a,b){var c,d,e,f,g,h,i,j,k;if(e=!1,k=!0,d=a.document,j=d.documentElement,c=d.addEventListener?"addEventListener":"attachEvent",i=d.addEventListener?"removeEventListener":"detachEvent",h=d.addEventListener?"":"on",f=function(c){return"readystatechange"!==c.type||"complete"===d.readyState?(("load"===c.type?a:d)[i](h+c.type,f,!1),!e&&(e=!0)?b.call(a,c.type||c):void 0):void 0},g=function(){var a;try{j.doScroll("left")}catch(b){return a=b,setTimeout(g,50),void 0}return f("poll")},"complete"!==d.readyState){if(d.createEventObject&&j.doScroll){try{k=!a.frameElement}catch(l){}k&&g()}return d[c](h+"DOMContentLoaded",f,!1),d[c](h+"readystatechange",f,!1),a[c](h+"load",f,!1)}},a._autoDiscoverFunction=function(){return a.autoDiscover?a.discover():void 0},f(window,a._autoDiscoverFunction)}.call(this)}),a.alias("component-emitter/index.js","dropzone/deps/emitter/index.js"),a.alias("component-emitter/index.js","emitter/index.js"),"object"==typeof exports?module.exports=a("dropzone"):"function"==typeof define&&define.amd?define(function(){return a("dropzone")}):this.Dropzone=a("dropzone")}(); \ No newline at end of file diff --git a/www/lib/js/farbtastic.js b/www/lib/js/farbtastic.js new file mode 100644 index 0000000..d8b5ad9 --- /dev/null +++ b/www/lib/js/farbtastic.js @@ -0,0 +1,345 @@ +/** + * Farbtastic Color Picker 1.2 + * © 2008 Steven Wittens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +jQuery.fn.farbtastic = function (callback) { + $.farbtastic(this, callback); + return this; +}; + +jQuery.farbtastic = function (container, callback) { + var container = $(container).get(0); + return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback)); +} + +jQuery._farbtastic = function (container, callback) { + // Store farbtastic object + var fb = this; + + // Insert markup + $(container).html('
    '); + var e = $('.farbtastic', container); + fb.wheel = $('.wheel', container).get(0); + // Dimensions + fb.radius = 84; + fb.square = 100; + fb.width = 194; + + // Fix background PNGs in IE6 + if (navigator.appVersion.match(/MSIE [0-6]\./)) { + $('*', e).each(function () { + if (this.currentStyle.backgroundImage != 'none') { + var image = this.currentStyle.backgroundImage; + image = this.currentStyle.backgroundImage.substring(5, image.length - 2); + $(this).css({ + 'backgroundImage': 'none', + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" + }); + } + }); + } + + /** + * Link to the given element(s) or callback. + */ + fb.linkTo = function (callback) { + // Unbind previous nodes + if (typeof fb.callback == 'object') { + $(fb.callback).unbind('keyup', fb.updateValue); + } + + // Reset color + fb.color = null; + + // Bind callback or elements + if (typeof callback == 'function') { + fb.callback = callback; + } + else if (typeof callback == 'object' || typeof callback == 'string') { + fb.callback = $(callback); + fb.callback.bind('keyup', fb.updateValue); + if (fb.callback.get(0).value) { + fb.setColor(fb.callback.get(0).value); + } + } + return this; + } + fb.updateValue = function (event) { + if (this.value && this.value != fb.color) { + fb.setColor(this.value); + } + } + + /** + * Change color with HTML syntax #123456 + */ + fb.setColor = function (color) { + var unpack = fb.unpack(color); + if (fb.color != color && unpack) { + fb.color = color; + fb.rgb = unpack; + fb.hsl = fb.RGBToHSL(fb.rgb); + fb.updateDisplay(); + } + return this; + } + + /** + * Change color with HSL triplet [0..1, 0..1, 0..1] + */ + fb.setHSL = function (hsl) { + fb.hsl = hsl; + fb.rgb = fb.HSLToRGB(hsl); + fb.color = fb.pack(fb.rgb); + fb.updateDisplay(); + return this; + } + + ///////////////////////////////////////////////////// + + /** + * Retrieve the coordinates of the given event relative to the center + * of the widget. + */ + fb.widgetCoords = function (event) { + var x, y; + var el = event.target || event.srcElement; + var reference = fb.wheel; + + if (typeof event.offsetX != 'undefined') { + // Use offset coordinates and find common offsetParent + var pos = { x: event.offsetX, y: event.offsetY }; + + // Send the coordinates upwards through the offsetParent chain. + var e = el; + while (e) { + e.mouseX = pos.x; + e.mouseY = pos.y; + pos.x += e.offsetLeft; + pos.y += e.offsetTop; + e = e.offsetParent; + } + + // Look for the coordinates starting from the wheel widget. + var e = reference; + var offset = { x: 0, y: 0 } + while (e) { + if (typeof e.mouseX != 'undefined') { + x = e.mouseX - offset.x; + y = e.mouseY - offset.y; + break; + } + offset.x += e.offsetLeft; + offset.y += e.offsetTop; + e = e.offsetParent; + } + + // Reset stored coordinates + e = el; + while (e) { + e.mouseX = undefined; + e.mouseY = undefined; + e = e.offsetParent; + } + } + else { + // Use absolute coordinates + var pos = fb.absolutePosition(reference); + x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x; + y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y; + } + // Subtract distance to middle + return { x: x - fb.width / 2, y: y - fb.width / 2 }; + } + + /** + * Mousedown handler + */ + fb.mousedown = function (event) { + // Capture mouse + if (!document.dragging) { + $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); + document.dragging = true; + } + + // Check which area is being dragged + var pos = fb.widgetCoords(event); + fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; + + // Process + fb.mousemove(event); + return false; + } + + /** + * Mousemove handler + */ + fb.mousemove = function (event) { + // Get coordinates relative to color picker center + var pos = fb.widgetCoords(event); + + // Set new HSL parameters + if (fb.circleDrag) { + var hue = Math.atan2(pos.x, -pos.y) / 6.28; + if (hue < 0) hue += 1; + fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); + } + else { + var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); + var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); + fb.setHSL([fb.hsl[0], sat, lum]); + } + return false; + } + + /** + * Mouseup handler + */ + fb.mouseup = function () { + // Uncapture mouse + $(document).unbind('mousemove', fb.mousemove); + $(document).unbind('mouseup', fb.mouseup); + document.dragging = false; + } + + /** + * Update the markers and styles + */ + fb.updateDisplay = function () { + // Markers + var angle = fb.hsl[0] * 6.28; + $('.h-marker', e).css({ + left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px', + top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px' + }); + + $('.sl-marker', e).css({ + left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px', + top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px' + }); + + // Saturation/Luminance gradient + $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]))); + + // Linked elements or callback + if (typeof fb.callback == 'object') { + // Set background/foreground color + $(fb.callback).css({ + backgroundColor: fb.color, + color: fb.hsl[2] > 0.5 ? '#000' : '#fff' + }); + + // Change linked value + $(fb.callback).each(function() { + if (this.value && this.value != fb.color) { + this.value = fb.color; + } + }); + } + else if (typeof fb.callback == 'function') { + fb.callback.call(fb, fb.color); + } + } + + /** + * Get absolute position of element + */ + fb.absolutePosition = function (el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + // Resolve relative to offsetParent + if (el.offsetParent) { + var tmp = fb.absolutePosition(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; + }; + + /* Various color utility functions */ + fb.pack = function (rgb) { + var r = Math.round(rgb[0] * 255); + var g = Math.round(rgb[1] * 255); + var b = Math.round(rgb[2] * 255); + return '#' + (r < 16 ? '0' : '') + r.toString(16) + + (g < 16 ? '0' : '') + g.toString(16) + + (b < 16 ? '0' : '') + b.toString(16); + } + + fb.unpack = function (color) { + if (color.length == 7) { + return [parseInt('0x' + color.substring(1, 3)) / 255, + parseInt('0x' + color.substring(3, 5)) / 255, + parseInt('0x' + color.substring(5, 7)) / 255]; + } + else if (color.length == 4) { + return [parseInt('0x' + color.substring(1, 2)) / 15, + parseInt('0x' + color.substring(2, 3)) / 15, + parseInt('0x' + color.substring(3, 4)) / 15]; + } + } + + fb.HSLToRGB = function (hsl) { + var m1, m2, r, g, b; + var h = hsl[0], s = hsl[1], l = hsl[2]; + m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; + m1 = l * 2 - m2; + return [this.hueToRGB(m1, m2, h+0.33333), + this.hueToRGB(m1, m2, h), + this.hueToRGB(m1, m2, h-0.33333)]; + } + + fb.hueToRGB = function (m1, m2, h) { + h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + if (h * 2 < 1) return m2; + if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; + return m1; + } + + fb.RGBToHSL = function (rgb) { + var min, max, delta, h, s, l; + var r = rgb[0], g = rgb[1], b = rgb[2]; + min = Math.min(r, Math.min(g, b)); + max = Math.max(r, Math.max(g, b)); + delta = max - min; + l = (min + max) / 2; + s = 0; + if (l > 0 && l < 1) { + s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); + } + h = 0; + if (delta > 0) { + if (max == r && max != g) h += (g - b) / delta; + if (max == g && max != b) h += (2 + (b - r) / delta); + if (max == b && max != r) h += (4 + (r - g) / delta); + h /= 6; + } + return [h, s, l]; + } + + // Install mousedown handler (the others are set on the document on-demand) + $('*', e).mousedown(fb.mousedown); + + // Init color + fb.setColor('#000000'); + + // Set linked elements/callback + if (callback) { + fb.linkTo(callback); + } +} \ No newline at end of file diff --git a/www/lib/js/html2canvas.min.js b/www/lib/js/html2canvas.min.js new file mode 100644 index 0000000..4dd4709 --- /dev/null +++ b/www/lib/js/html2canvas.min.js @@ -0,0 +1,8 @@ +/* + html2canvas 0.4.1 + Copyright (c) 2013 Niklas von Hertzen + + Released under MIT License +*/ +(function(t,e,n){"use strict";function r(t,e,n){var r,a=t.runtimeStyle&&t.runtimeStyle[e],o=t.style;return!/^-?[0-9]+\.?[0-9]*(?:px)?$/i.test(n)&&/^-?\d/.test(n)&&(r=o.left,a&&(t.runtimeStyle.left=t.currentStyle.left),o.left="fontSize"===e?"1em":n||0,n=o.pixelLeft+"px",o.left=r,a&&(t.runtimeStyle.left=a)),/^(thin|medium|thick)$/i.test(n)?n:Math.round(parseFloat(n))+"px"}function a(t){return parseInt(t,10)}function o(t){return-1!==(""+t).indexOf("%")}function i(t,e,a,o){if(t=(t||"").split(","),t=t[o||0]||t[0]||"auto",t=d.Util.trimText(t).split(" "),"backgroundSize"===a&&t[0]&&t[0].match(/^(cover|contain|auto)$/))return t;if(t[0]=-1===t[0].indexOf("%")?r(e,a+"X",t[0]):t[0],t[1]===n){if("backgroundSize"===a)return t[1]="auto",t;t[1]=t[0]}return t[1]=-1===t[1].indexOf("%")?r(e,a+"Y",t[1]):t[1],t}function l(t,e){var n=[];return{storage:n,width:t,height:e,clip:function(){n.push({type:"function",name:"clip",arguments:arguments})},translate:function(){n.push({type:"function",name:"translate",arguments:arguments})},fill:function(){n.push({type:"function",name:"fill",arguments:arguments})},save:function(){n.push({type:"function",name:"save",arguments:arguments})},restore:function(){n.push({type:"function",name:"restore",arguments:arguments})},fillRect:function(){n.push({type:"function",name:"fillRect",arguments:arguments})},createPattern:function(){n.push({type:"function",name:"createPattern",arguments:arguments})},drawShape:function(){var t=[];return n.push({type:"function",name:"drawShape",arguments:t}),{moveTo:function(){t.push({name:"moveTo",arguments:arguments})},lineTo:function(){t.push({name:"lineTo",arguments:arguments})},arcTo:function(){t.push({name:"arcTo",arguments:arguments})},bezierCurveTo:function(){t.push({name:"bezierCurveTo",arguments:arguments})},quadraticCurveTo:function(){t.push({name:"quadraticCurveTo",arguments:arguments})}}},drawImage:function(){n.push({type:"function",name:"drawImage",arguments:arguments})},fillText:function(){n.push({type:"function",name:"fillText",arguments:arguments})},setVariable:function(t,e){return n.push({type:"variable",name:t,arguments:e}),e}}}var s,c,d={};d.Util={},d.Util.log=function(e){d.logging&&t.console&&t.console.log&&t.console.log(e)},d.Util.trimText=function(t){return function(e){return t?t.apply(e):((e||"")+"").replace(/^\s+|\s+$/g,"")}}(String.prototype.trim),d.Util.asFloat=function(t){return parseFloat(t)},function(){var t=/((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g,e=/(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;d.Util.parseTextShadows=function(n){if(!n||"none"===n)return[];for(var r=n.match(t),a=[],o=0;r&&r.length>o;o++){var i=r[o].match(e);a.push({color:i[0],offsetX:i[1]?i[1].replace("px",""):0,offsetY:i[2]?i[2].replace("px",""):0,blur:i[3]?i[3].replace("px",""):0})}return a}}(),d.Util.parseBackgroundImage=function(t){var e,n,r,a,o,i,l,s,c=" \r\n ",d=[],h=0,u=0,f=function(){e&&('"'===n.substr(0,1)&&(n=n.substr(1,n.length-2)),n&&s.push(n),"-"===e.substr(0,1)&&(a=e.indexOf("-",1)+1)>0&&(r=e.substr(0,a),e=e.substr(a)),d.push({prefix:r,method:e.toLowerCase(),value:o,args:s})),s=[],e=r=n=o=""};f();for(var p=0,g=t.length;g>p;p++)if(i=t[p],!(0===h&&c.indexOf(i)>-1)){switch(i){case'"':l?l===i&&(l=null):l=i;break;case"(":if(l)break;if(0===h){h=1,o+=i;continue}u++;break;case")":if(l)break;if(1===h){if(0===u){h=0,o+=i,f();continue}u--}break;case",":if(l)break;if(0===h){f();continue}if(1===h&&0===u&&!e.match(/^url$/i)){s.push(n),n="",o+=i;continue}}o+=i,0===h?e+=i:n+=i}return f(),d},d.Util.Bounds=function(t){var e,n={};return t.getBoundingClientRect&&(e=t.getBoundingClientRect(),n.top=e.top,n.bottom=e.bottom||e.top+e.height,n.left=e.left,n.width=t.offsetWidth,n.height=t.offsetHeight),n},d.Util.OffsetBounds=function(t){var e=t.offsetParent?d.Util.OffsetBounds(t.offsetParent):{top:0,left:0};return{top:t.offsetTop+e.top,bottom:t.offsetTop+t.offsetHeight+e.top,left:t.offsetLeft+e.left,width:t.offsetWidth,height:t.offsetHeight}},d.Util.getCSS=function(t,n,r){s!==t&&(c=e.defaultView.getComputedStyle(t,null));var o=c[n];if(/^background(Size|Position)$/.test(n))return i(o,t,n,r);if(/border(Top|Bottom)(Left|Right)Radius/.test(n)){var l=o.split(" ");return 1>=l.length&&(l[1]=l[0]),l.map(a)}return o},d.Util.resizeBounds=function(t,e,n,r,a){var o,i,l=n/r,s=t/e;return a&&"auto"!==a?s>l^"contain"===a?(i=r,o=r*s):(o=n,i=n/s):(o=n,i=r),{width:o,height:i}},d.Util.BackgroundPosition=function(t,e,n,r,a){var i,l,s=d.Util.getCSS(t,"backgroundPosition",r);return 1===s.length&&(s=[s[0],s[0]]),i=o(s[0])?(e.width-(a||n).width)*(parseFloat(s[0])/100):parseInt(s[0],10),l="auto"===s[1]?i/n.width*n.height:o(s[1])?(e.height-(a||n).height)*parseFloat(s[1])/100:parseInt(s[1],10),"auto"===s[0]&&(i=l/n.height*n.width),{left:i,top:l}},d.Util.BackgroundSize=function(t,e,n,r){var a,i,l=d.Util.getCSS(t,"backgroundSize",r);if(1===l.length&&(l=[l[0],l[0]]),o(l[0]))a=e.width*parseFloat(l[0])/100;else{if(/contain|cover/.test(l[0]))return d.Util.resizeBounds(n.width,n.height,e.width,e.height,l[0]);a=parseInt(l[0],10)}return i="auto"===l[0]&&"auto"===l[1]?n.height:"auto"===l[1]?a/n.width*n.height:o(l[1])?e.height*parseFloat(l[1])/100:parseInt(l[1],10),"auto"===l[0]&&(a=i/n.height*n.width),{width:a,height:i}},d.Util.BackgroundRepeat=function(t,e){var n=d.Util.getCSS(t,"backgroundRepeat").split(",").map(d.Util.trimText);return n[e]||n[0]},d.Util.Extend=function(t,e){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},d.Util.Children=function(t){var e;try{e=t.nodeName&&"IFRAME"===t.nodeName.toUpperCase()?t.contentDocument||t.contentWindow.document:function(t){var e=[];return null!==t&&function(t,e){var r=t.length,a=0;if("number"==typeof e.length)for(var o=e.length;o>a;a++)t[r++]=e[a];else for(;e[a]!==n;)t[r++]=e[a++];return t.length=r,t}(e,t),e}(t.childNodes)}catch(r){d.Util.log("html2canvas.Util.Children failed with exception: "+r.message),e=[]}return e},d.Util.isTransparent=function(t){return!t||"transparent"===t||"rgba(0, 0, 0, 0)"===t},d.Util.Font=function(){var t={};return function(e,r,a){if(t[e+"-"+r]!==n)return t[e+"-"+r];var o,i,l,s=a.createElement("div"),c=a.createElement("img"),d=a.createElement("span"),h="Hidden Text";return s.style.visibility="hidden",s.style.fontFamily=e,s.style.fontSize=r,s.style.margin=0,s.style.padding=0,a.body.appendChild(s),c.src="data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACwAAAAAAQABAAACAkQBADs=",c.width=1,c.height=1,c.style.margin=0,c.style.padding=0,c.style.verticalAlign="baseline",d.style.fontFamily=e,d.style.fontSize=r,d.style.margin=0,d.style.padding=0,d.appendChild(a.createTextNode(h)),s.appendChild(d),s.appendChild(c),o=c.offsetTop-d.offsetTop+1,s.removeChild(d),s.appendChild(a.createTextNode(h)),s.style.lineHeight="normal",c.style.verticalAlign="super",i=c.offsetTop-s.offsetTop+1,l={baseline:o,lineWidth:1,middle:i},t[e+"-"+r]=l,a.body.removeChild(s),l}}(),function(){function t(t){return function(e){try{t.addColorStop(e.stop,e.color)}catch(r){n.log(["failed to add color stop: ",r,"; tried to add: ",e])}}}var n=d.Util,r={};d.Generate=r;var a=[/^(-webkit-linear-gradient)\(([a-z\s]+)([\w\d\.\s,%\(\)]+)\)$/,/^(-o-linear-gradient)\(([a-z\s]+)([\w\d\.\s,%\(\)]+)\)$/,/^(-webkit-gradient)\((linear|radial),\s((?:\d{1,3}%?)\s(?:\d{1,3}%?),\s(?:\d{1,3}%?)\s(?:\d{1,3}%?))([\w\d\.\s,%\(\)\-]+)\)$/,/^(-moz-linear-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?))([\w\d\.\s,%\(\)]+)\)$/,/^(-webkit-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s([a-z\-]+)([\w\d\.\s,%\(\)]+)\)$/,/^(-moz-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s?([a-z\-]*)([\w\d\.\s,%\(\)]+)\)$/,/^(-o-radial-gradient)\(((?:\d{1,3}%?)\s(?:\d{1,3}%?)),\s(\w+)\s([a-z\-]+)([\w\d\.\s,%\(\)]+)\)$/];r.parseGradient=function(t,e){var n,r,o,i,l,s,c,d,h,u,f,p,g=a.length;for(r=0;g>r&&!(o=t.match(a[r]));r+=1);if(o)switch(o[1]){case"-webkit-linear-gradient":case"-o-linear-gradient":if(n={type:"linear",x0:null,y0:null,x1:null,y1:null,colorStops:[]},l=o[2].match(/\w+/g))for(s=l.length,r=0;s>r;r+=1)switch(l[r]){case"top":n.y0=0,n.y1=e.height;break;case"right":n.x0=e.width,n.x1=0;break;case"bottom":n.y0=e.height,n.y1=0;break;case"left":n.x0=0,n.x1=e.width}if(null===n.x0&&null===n.x1&&(n.x0=n.x1=e.width/2),null===n.y0&&null===n.y1&&(n.y0=n.y1=e.height/2),l=o[3].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}(?:%|px))?)+/g))for(s=l.length,c=1/Math.max(s-1,1),r=0;s>r;r+=1)d=l[r].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/),d[2]?(i=parseFloat(d[2]),i/="%"===d[3]?100:e.width):i=r*c,n.colorStops.push({color:d[1],stop:i});break;case"-webkit-gradient":if(n={type:"radial"===o[2]?"circle":o[2],x0:0,y0:0,x1:0,y1:0,colorStops:[]},l=o[3].match(/(\d{1,3})%?\s(\d{1,3})%?,\s(\d{1,3})%?\s(\d{1,3})%?/),l&&(n.x0=l[1]*e.width/100,n.y0=l[2]*e.height/100,n.x1=l[3]*e.width/100,n.y1=l[4]*e.height/100),l=o[4].match(/((?:from|to|color-stop)\((?:[0-9\.]+,\s)?(?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)\))+/g))for(s=l.length,r=0;s>r;r+=1)d=l[r].match(/(from|to|color-stop)\(([0-9\.]+)?(?:,\s)?((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\)/),i=parseFloat(d[2]),"from"===d[1]&&(i=0),"to"===d[1]&&(i=1),n.colorStops.push({color:d[3],stop:i});break;case"-moz-linear-gradient":if(n={type:"linear",x0:0,y0:0,x1:0,y1:0,colorStops:[]},l=o[2].match(/(\d{1,3})%?\s(\d{1,3})%?/),l&&(n.x0=l[1]*e.width/100,n.y0=l[2]*e.height/100,n.x1=e.width-n.x0,n.y1=e.height-n.y0),l=o[3].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}%)?)+/g))for(s=l.length,c=1/Math.max(s-1,1),r=0;s>r;r+=1)d=l[r].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%)?/),d[2]?(i=parseFloat(d[2]),d[3]&&(i/=100)):i=r*c,n.colorStops.push({color:d[1],stop:i});break;case"-webkit-radial-gradient":case"-moz-radial-gradient":case"-o-radial-gradient":if(n={type:"circle",x0:0,y0:0,x1:e.width,y1:e.height,cx:0,cy:0,rx:0,ry:0,colorStops:[]},l=o[2].match(/(\d{1,3})%?\s(\d{1,3})%?/),l&&(n.cx=l[1]*e.width/100,n.cy=l[2]*e.height/100),l=o[3].match(/\w+/),d=o[4].match(/[a-z\-]*/),l&&d)switch(d[0]){case"farthest-corner":case"cover":case"":h=Math.sqrt(Math.pow(n.cx,2)+Math.pow(n.cy,2)),u=Math.sqrt(Math.pow(n.cx,2)+Math.pow(n.y1-n.cy,2)),f=Math.sqrt(Math.pow(n.x1-n.cx,2)+Math.pow(n.y1-n.cy,2)),p=Math.sqrt(Math.pow(n.x1-n.cx,2)+Math.pow(n.cy,2)),n.rx=n.ry=Math.max(h,u,f,p);break;case"closest-corner":h=Math.sqrt(Math.pow(n.cx,2)+Math.pow(n.cy,2)),u=Math.sqrt(Math.pow(n.cx,2)+Math.pow(n.y1-n.cy,2)),f=Math.sqrt(Math.pow(n.x1-n.cx,2)+Math.pow(n.y1-n.cy,2)),p=Math.sqrt(Math.pow(n.x1-n.cx,2)+Math.pow(n.cy,2)),n.rx=n.ry=Math.min(h,u,f,p);break;case"farthest-side":"circle"===l[0]?n.rx=n.ry=Math.max(n.cx,n.cy,n.x1-n.cx,n.y1-n.cy):(n.type=l[0],n.rx=Math.max(n.cx,n.x1-n.cx),n.ry=Math.max(n.cy,n.y1-n.cy));break;case"closest-side":case"contain":"circle"===l[0]?n.rx=n.ry=Math.min(n.cx,n.cy,n.x1-n.cx,n.y1-n.cy):(n.type=l[0],n.rx=Math.min(n.cx,n.x1-n.cx),n.ry=Math.min(n.cy,n.y1-n.cy))}if(l=o[5].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\)(?:\s\d{1,3}(?:%|px))?)+/g))for(s=l.length,c=1/Math.max(s-1,1),r=0;s>r;r+=1)d=l[r].match(/((?:rgb|rgba)\(\d{1,3},\s\d{1,3},\s\d{1,3}(?:,\s[0-9\.]+)?\))\s*(\d{1,3})?(%|px)?/),d[2]?(i=parseFloat(d[2]),i/="%"===d[3]?100:e.width):i=r*c,n.colorStops.push({color:d[1],stop:i})}return n},r.Gradient=function(n,r){if(0!==r.width&&0!==r.height){var a,o,i=e.createElement("canvas"),l=i.getContext("2d");if(i.width=r.width,i.height=r.height,a=d.Generate.parseGradient(n,r))switch(a.type){case"linear":o=l.createLinearGradient(a.x0,a.y0,a.x1,a.y1),a.colorStops.forEach(t(o)),l.fillStyle=o,l.fillRect(0,0,r.width,r.height);break;case"circle":o=l.createRadialGradient(a.cx,a.cy,0,a.cx,a.cy,a.rx),a.colorStops.forEach(t(o)),l.fillStyle=o,l.fillRect(0,0,r.width,r.height);break;case"ellipse":var s=e.createElement("canvas"),c=s.getContext("2d"),h=Math.max(a.rx,a.ry),u=2*h;s.width=s.height=u,o=c.createRadialGradient(a.rx,a.ry,0,a.rx,a.ry,h),a.colorStops.forEach(t(o)),c.fillStyle=o,c.fillRect(0,0,u,u),l.fillStyle=a.colorStops[a.colorStops.length-1].color,l.fillRect(0,0,i.width,i.height),l.drawImage(s,a.cx-a.rx,a.cy-a.ry,2*a.rx,2*a.ry)}return i}},r.ListAlpha=function(t){var e,n="";do e=t%26,n=String.fromCharCode(e+64)+n,t/=26;while(26*t>26);return n},r.ListRoman=function(t){var e,n=["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"],r=[1e3,900,500,400,100,90,50,40,10,9,5,4,1],a="",o=n.length;if(0>=t||t>=4e3)return t;for(e=0;o>e;e+=1)for(;t>=r[e];)t-=r[e],a+=n[e];return a}}(),d.Parse=function(r,a,o){function i(){var t=be(e.documentElement,"backgroundColor"),n=me.isTransparent(t)&&fe===e.body,r=ce(fe,null,!1,n);s(fe),ue(fe,r,function(){n&&(t=r.backgroundColor),c(),me.log("Done parsing, moving to Render."),o({backgroundColor:t,stack:r})})}function s(t){function n(){for(var t=/:before|:after/,n=e.styleSheets,r=0,a=n.length;a>r;r++)try{for(var o=n[r].cssRules,i=0,s=o.length;s>i;i++)t.test(o[i].selectorText)&&l.push(o[i].selectorText)}catch(c){}for(r=0,a=l.length;a>r;r++)l[r]=l[r].match(/(^[^:]*)/)[1]}function r(){for(var t=e.querySelectorAll(l.join(",")),n=0,r=t.length;r>n;n++)a(t[n])}function a(t){var e=Y(t,":before"),n=Y(t,":after");e&&i.push({type:"before",pseudo:e,el:t}),n&&i.push({type:"after",pseudo:n,el:t})}function o(){i.forEach(function(t){h(t.el,ve+"-parent")}),i.forEach(function(t){"before"===t.type?t.el.insertBefore(t.pseudo,t.el.firstChild):t.el.appendChild(t.pseudo)})}var i=[],l=[];n(),r(t),o()}function c(){xe.removeChild(Ce);for(var t=e.getElementsByClassName(ve+"-element");t.length;)t[0].parentNode.removeChild(t[0]);for(var n=e.getElementsByClassName(ve+"-parent");n.length;)u(n[0],ve+"-parent")}function h(t,e){t.classList?t.classList.add(e):t.className=t.className+" "+e}function u(t,e){t.classList?t.classList.remove(e):t.className=t.className.replace(e,"").trim()}function f(){return Math.max(Math.max(ge.body.scrollWidth,ge.documentElement.scrollWidth),Math.max(ge.body.offsetWidth,ge.documentElement.offsetWidth),Math.max(ge.body.clientWidth,ge.documentElement.clientWidth))}function p(){return Math.max(Math.max(ge.body.scrollHeight,ge.documentElement.scrollHeight),Math.max(ge.body.offsetHeight,ge.documentElement.offsetHeight),Math.max(ge.body.clientHeight,ge.documentElement.clientHeight))}function g(t,e){var n=parseInt(be(t,e),10);return isNaN(n)?0:n}function m(t,e,n,r,a,o){"transparent"!==o&&(t.setVariable("fillStyle",o),t.fillRect(e,n,r,a),pe+=1)}function y(t,e,r){return t.length>0?e+r.toUpperCase():n}function w(t,e){switch(e){case"lowercase":return t.toLowerCase();case"capitalize":return t.replace(/(^|\s|:|-|\(|\))([a-z])/g,y);case"uppercase":return t.toUpperCase();default:return t}}function x(t){return/^(normal|none|0px)$/.test(t)}function b(t,e,n,r){null!==t&&me.trimText(t).length>0&&(r.fillText(t,e,n),pe+=1)}function v(t,e,r,a){var o=!1,i=be(e,"fontWeight"),l=be(e,"fontFamily"),s=be(e,"fontSize"),c=me.parseTextShadows(be(e,"textShadow"));switch(parseInt(i,10)){case 401:i="bold";break;case 400:i="normal"}return t.setVariable("fillStyle",a),t.setVariable("font",[be(e,"fontStyle"),be(e,"fontVariant"),i,s,l].join(" ")),t.setVariable("textAlign",o?"right":"left"),c.length&&(t.setVariable("shadowColor",c[0].color),t.setVariable("shadowOffsetX",c[0].offsetX),t.setVariable("shadowOffsetY",c[0].offsetY),t.setVariable("shadowBlur",c[0].blur)),"none"!==r?me.Font(l,s,ge):n}function C(t,e,n,r,a){switch(e){case"underline":m(t,n.left,Math.round(n.top+r.baseline+r.lineWidth),n.width,1,a);break;case"overline":m(t,n.left,Math.round(n.top),n.width,1,a);break;case"line-through":m(t,n.left,Math.ceil(n.top+r.middle+r.lineWidth),n.width,1,a)}}function k(t,e,n,r,a){var o;if(ye.rangeBounds&&!a)("none"!==n||0!==me.trimText(e).length)&&(o=T(e,t.node,t.textOffset)),t.textOffset+=e.length;else if(t.node&&"string"==typeof t.node.nodeValue){var i=r?t.node.splitText(e.length):null;o=S(t.node,a),t.node=i}return o}function T(t,e,n){var r=ge.createRange();return r.setStart(e,n),r.setEnd(e,n+t.length),r.getBoundingClientRect()}function S(t,e){var n=t.parentNode,r=ge.createElement("wrapper"),a=t.cloneNode(!0);r.appendChild(t.cloneNode(!0)),n.replaceChild(r,t);var o=e?me.OffsetBounds(r):me.Bounds(r);return n.replaceChild(a,r),o}function E(t,e,n){var r,o,i=n.ctx,l=be(t,"color"),s=be(t,"textDecoration"),c=be(t,"textAlign"),d={node:e,textOffset:0};me.trimText(e.nodeValue).length>0&&(e.nodeValue=w(e.nodeValue,be(t,"textTransform")),c=c.replace(["-webkit-auto"],["auto"]),o=!a.letterRendering&&/^(left|right|justify|auto)$/.test(c)&&x(be(t,"letterSpacing"))?e.nodeValue.split(/(\b| )/):e.nodeValue.split(""),r=v(i,t,s,l),a.chinese&&o.forEach(function(t,e){/.*[\u4E00-\u9FA5].*$/.test(t)&&(t=t.split(""),t.unshift(e,1),o.splice.apply(o,t))}),o.forEach(function(t,e){var a=k(d,t,s,o.length-1>e,n.transform.matrix);a&&(b(t,a.left,a.bottom,i),C(i,s,a,r,l))}))}function R(t,e){var n,r,a=ge.createElement("boundelement");return a.style.display="inline",n=t.style.listStyleType,t.style.listStyleType="none",a.appendChild(ge.createTextNode(e)),t.insertBefore(a,t.firstChild),r=me.Bounds(a),t.removeChild(a),t.style.listStyleType=n,r}function M(t){var e=-1,n=1,r=t.parentNode.childNodes;if(t.parentNode){for(;r[++e]!==t;)1===r[e].nodeType&&n++;return n}return-1}function I(t,e){var n,r=M(t);switch(e){case"decimal":n=r;break;case"decimal-leading-zero":n=1===(""+r).length?r="0"+(""+r):""+r;break;case"upper-roman":n=d.Generate.ListRoman(r);break;case"lower-roman":n=d.Generate.ListRoman(r).toLowerCase();break;case"lower-alpha":n=d.Generate.ListAlpha(r).toLowerCase();break;case"upper-alpha":n=d.Generate.ListAlpha(r)}return n+". "}function L(t,e,n){var r,a,o,i=e.ctx,l=be(t,"listStyleType");if(/^(decimal|decimal-leading-zero|upper-alpha|upper-latin|upper-roman|lower-alpha|lower-greek|lower-latin|lower-roman)$/i.test(l)){if(a=I(t,l),o=R(t,a),v(i,t,"none",be(t,"color")),"inside"!==be(t,"listStylePosition"))return;i.setVariable("textAlign","left"),r=n.left,b(a,r,o.bottom,i)}}function O(t){var e=r[t];return e&&e.succeeded===!0?e.img:!1}function z(t,e){var n=Math.max(t.left,e.left),r=Math.max(t.top,e.top),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height);return{left:n,top:r,width:a-n,height:o-r}}function B(t,e,n){var r,a="static"!==e.cssPosition,o=a?be(t,"zIndex"):"auto",i=be(t,"opacity"),l="none"!==be(t,"cssFloat");e.zIndex=r=U(o),r.isPositioned=a,r.isFloated=l,r.opacity=i,r.ownStacking="auto"!==o||1>i,r.depth=n?n.zIndex.depth+1:0,n&&n.zIndex.children.push(e)}function U(t){return{depth:0,zindex:t,children:[]}}function A(t,e,n,r,a){var o=g(e,"paddingLeft"),i=g(e,"paddingTop"),l=g(e,"paddingRight"),s=g(e,"paddingBottom");_(t,n,0,0,n.width,n.height,r.left+o+a[3].width,r.top+i+a[0].width,r.width-(a[1].width+a[3].width+o+l),r.height-(a[0].width+a[2].width+i+s))}function N(t){return["Top","Right","Bottom","Left"].map(function(e){return{width:g(t,"border"+e+"Width"),color:be(t,"border"+e+"Color")}})}function P(t){return["TopLeft","TopRight","BottomRight","BottomLeft"].map(function(e){return be(t,"border"+e+"Radius")})}function F(t,e,n,r){var a=4*((Math.sqrt(2)-1)/3),o=n*a,i=r*a,l=t+n,s=e+r;return{topLeft:V({x:t,y:s},{x:t,y:s-i},{x:l-o,y:e},{x:l,y:e}),topRight:V({x:t,y:e},{x:t+o,y:e},{x:l,y:s-i},{x:l,y:s}),bottomRight:V({x:l,y:e},{x:l,y:e+i},{x:t+o,y:s},{x:t,y:s}),bottomLeft:V({x:l,y:s},{x:l-o,y:s},{x:t,y:e+i},{x:t,y:e})}}function V(t,e,n,r){var a=function(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}};return{start:t,startControl:e,endControl:n,end:r,subdivide:function(o){var i=a(t,e,o),l=a(e,n,o),s=a(n,r,o),c=a(i,l,o),d=a(l,s,o),h=a(c,d,o);return[V(t,i,c,h),V(h,d,s,r)]},curveTo:function(t){t.push(["bezierCurve",e.x,e.y,n.x,n.y,r.x,r.y])},curveToReversed:function(r){r.push(["bezierCurve",n.x,n.y,e.x,e.y,t.x,t.y])}}}function D(t,e,n,r,a,o,i){e[0]>0||e[1]>0?(t.push(["line",r[0].start.x,r[0].start.y]),r[0].curveTo(t),r[1].curveTo(t)):t.push(["line",o,i]),(n[0]>0||n[1]>0)&&t.push(["line",a[0].start.x,a[0].start.y])}function $(t,e,n,r,a,o,i){var l=[];return e[0]>0||e[1]>0?(l.push(["line",r[1].start.x,r[1].start.y]),r[1].curveTo(l)):l.push(["line",t.c1[0],t.c1[1]]),n[0]>0||n[1]>0?(l.push(["line",o[0].start.x,o[0].start.y]),o[0].curveTo(l),l.push(["line",i[0].end.x,i[0].end.y]),i[0].curveToReversed(l)):(l.push(["line",t.c2[0],t.c2[1]]),l.push(["line",t.c3[0],t.c3[1]])),e[0]>0||e[1]>0?(l.push(["line",a[1].end.x,a[1].end.y]),a[1].curveToReversed(l)):l.push(["line",t.c4[0],t.c4[1]]),l}function G(t,e,n){var r=t.left,a=t.top,o=t.width,i=t.height,l=e[0][0],s=e[0][1],c=e[1][0],d=e[1][1],h=e[2][0],u=e[2][1],f=e[3][0],p=e[3][1],g=o-c,m=i-u,y=o-h,w=i-p;return{topLeftOuter:F(r,a,l,s).topLeft.subdivide(.5),topLeftInner:F(r+n[3].width,a+n[0].width,Math.max(0,l-n[3].width),Math.max(0,s-n[0].width)).topLeft.subdivide(.5),topRightOuter:F(r+g,a,c,d).topRight.subdivide(.5),topRightInner:F(r+Math.min(g,o+n[3].width),a+n[0].width,g>o+n[3].width?0:c-n[3].width,d-n[0].width).topRight.subdivide(.5),bottomRightOuter:F(r+y,a+m,h,u).bottomRight.subdivide(.5),bottomRightInner:F(r+Math.min(y,o+n[3].width),a+Math.min(m,i+n[0].width),Math.max(0,h-n[1].width),Math.max(0,u-n[2].width)).bottomRight.subdivide(.5),bottomLeftOuter:F(r,a+w,f,p).bottomLeft.subdivide(.5),bottomLeftInner:F(r+n[3].width,a+w,Math.max(0,f-n[3].width),Math.max(0,p-n[2].width)).bottomLeft.subdivide(.5)}}function W(t,e,n,r,a){var o=be(t,"backgroundClip"),i=[];switch(o){case"content-box":case"padding-box":D(i,r[0],r[1],e.topLeftInner,e.topRightInner,a.left+n[3].width,a.top+n[0].width),D(i,r[1],r[2],e.topRightInner,e.bottomRightInner,a.left+a.width-n[1].width,a.top+n[0].width),D(i,r[2],r[3],e.bottomRightInner,e.bottomLeftInner,a.left+a.width-n[1].width,a.top+a.height-n[2].width),D(i,r[3],r[0],e.bottomLeftInner,e.topLeftInner,a.left+n[3].width,a.top+a.height-n[2].width);break;default:D(i,r[0],r[1],e.topLeftOuter,e.topRightOuter,a.left,a.top),D(i,r[1],r[2],e.topRightOuter,e.bottomRightOuter,a.left+a.width,a.top),D(i,r[2],r[3],e.bottomRightOuter,e.bottomLeftOuter,a.left+a.width,a.top+a.height),D(i,r[3],r[0],e.bottomLeftOuter,e.topLeftOuter,a.left,a.top+a.height)}return i}function H(t,e,n){var r,a,o,i,l,s,c=e.left,d=e.top,h=e.width,u=e.height,f=P(t),p=G(e,f,n),g={clip:W(t,p,n,f,e),borders:[]};for(r=0;4>r;r++)if(n[r].width>0){switch(a=c,o=d,i=h,l=u-n[2].width,r){case 0:l=n[0].width,s=$({c1:[a,o],c2:[a+i,o],c3:[a+i-n[1].width,o+l],c4:[a+n[3].width,o+l]},f[0],f[1],p.topLeftOuter,p.topLeftInner,p.topRightOuter,p.topRightInner);break;case 1:a=c+h-n[1].width,i=n[1].width,s=$({c1:[a+i,o],c2:[a+i,o+l+n[2].width],c3:[a,o+l],c4:[a,o+n[0].width]},f[1],f[2],p.topRightOuter,p.topRightInner,p.bottomRightOuter,p.bottomRightInner);break;case 2:o=o+u-n[2].width,l=n[2].width,s=$({c1:[a+i,o+l],c2:[a,o+l],c3:[a+n[3].width,o],c4:[a+i-n[3].width,o]},f[2],f[3],p.bottomRightOuter,p.bottomRightInner,p.bottomLeftOuter,p.bottomLeftInner);break;case 3:i=n[3].width,s=$({c1:[a,o+l+n[2].width],c2:[a,o],c3:[a+i,o+n[0].width],c4:[a+i,o+l]},f[3],f[0],p.bottomLeftOuter,p.bottomLeftInner,p.topLeftOuter,p.topLeftInner)}g.borders.push({args:s,color:n[r].color})}return g}function j(t,e){var n=t.drawShape();return e.forEach(function(t,e){n[0===e?"moveTo":t[0]+"To"].apply(null,t.slice(1))}),n}function q(t,e,n){"transparent"!==n&&(t.setVariable("fillStyle",n),j(t,e),t.fill(),pe+=1)}function X(t,e,n){var r,a,o=ge.createElement("valuewrap"),i=["lineHeight","textAlign","fontFamily","color","fontSize","paddingLeft","paddingTop","width","height","border","borderLeftWidth","borderTopWidth"];i.forEach(function(e){try{o.style[e]=be(t,e)}catch(n){me.log("html2canvas: Parse: Exception caught in renderFormValue: "+n.message)}}),o.style.borderColor="black",o.style.borderStyle="solid",o.style.display="block",o.style.position="absolute",(/^(submit|reset|button|text|password)$/.test(t.type)||"SELECT"===t.nodeName)&&(o.style.lineHeight=be(t,"height")),o.style.top=e.top+"px",o.style.left=e.left+"px",r="SELECT"===t.nodeName?(t.options[t.selectedIndex]||0).text:t.value,r||(r=t.placeholder),a=ge.createTextNode(r),o.appendChild(a),xe.appendChild(o),E(t,a,n),xe.removeChild(o)}function _(t){t.drawImage.apply(t,Array.prototype.slice.call(arguments,1)),pe+=1}function Y(n,r){var a=t.getComputedStyle(n,r),o=t.getComputedStyle(n);if(a&&a.content&&"none"!==a.content&&"-moz-alt-content"!==a.content&&"none"!==a.display&&o.content!==a.content){var i=a.content+"";("'"===i[0]||'"'===i[0])&&(i=i.replace(/(^['"])|(['"]$)/g,""));var l="url"===i.substr(0,3),s=e.createElement(l?"img":"span");return s.className=ve+"-element ",Object.keys(a).filter(Q).forEach(function(t){try{s.style[t]=a[t]}catch(e){me.log(["Tried to assign readonly property ",t,"Error:",e])}}),l?s.src=me.parseBackgroundImage(i)[0].args[0]:s.innerHTML=i,s}}function Q(e){return isNaN(t.parseInt(e,10))}function J(t,e,n,r){var a=Math.round(r.left+n.left),o=Math.round(r.top+n.top);t.createPattern(e),t.translate(a,o),t.fill(),t.translate(-a,-o)}function K(t,e,n,r,a,o,i,l){var s=[];s.push(["line",Math.round(a),Math.round(o)]),s.push(["line",Math.round(a+i),Math.round(o)]),s.push(["line",Math.round(a+i),Math.round(l+o)]),s.push(["line",Math.round(a),Math.round(l+o)]),j(t,s),t.save(),t.clip(),J(t,e,n,r),t.restore()}function Z(t,e,n){m(t,e.left,e.top,e.width,e.height,n)}function te(t,e,n,r,a){var o=me.BackgroundSize(t,e,r,a),i=me.BackgroundPosition(t,e,r,a,o),l=me.BackgroundRepeat(t,a);switch(r=ne(r,o),l){case"repeat-x":case"repeat no-repeat":K(n,r,i,e,e.left,e.top+i.top,99999,r.height);break;case"repeat-y":case"no-repeat repeat":K(n,r,i,e,e.left+i.left,e.top,r.width,99999);break;case"no-repeat":K(n,r,i,e,e.left+i.left,e.top+i.top,r.width,r.height);break;default:J(n,r,i,{top:e.top,left:e.left,width:r.width,height:r.height})}}function ee(t,e,n){for(var r,a=be(t,"backgroundImage"),o=me.parseBackgroundImage(a),i=o.length;i--;)if(a=o[i],a.args&&0!==a.args.length){var l="url"===a.method?a.args[0]:a.value;r=O(l),r?te(t,e,n,r,i):me.log("html2canvas: Error loading background:",a)}}function ne(t,e){if(t.width===e.width&&t.height===e.height)return t;var n,r=ge.createElement("canvas");return r.width=e.width,r.height=e.height,n=r.getContext("2d"),_(n,t,0,0,t.width,t.height,0,0,e.width,e.height),r}function re(t,e,n){return t.setVariable("globalAlpha",be(e,"opacity")*(n?n.opacity:1))}function ae(t){return t.replace("px","")}function oe(t){var e=/(matrix)\((.+)\)/,n=be(t,"transform")||be(t,"-webkit-transform")||be(t,"-moz-transform")||be(t,"-ms-transform")||be(t,"-o-transform"),r=be(t,"transform-origin")||be(t,"-webkit-transform-origin")||be(t,"-moz-transform-origin")||be(t,"-ms-transform-origin")||be(t,"-o-transform-origin")||"0px 0px";r=r.split(" ").map(ae).map(me.asFloat);var a;if(n&&"none"!==n){var o=n.match(e);if(o)switch(o[1]){case"matrix":a=o[2].split(",").map(me.trimText).map(me.asFloat)}}return{origin:r,matrix:a}}function ie(t,e,n,r){var o=l(e?n.width:f(),e?n.height:p()),i={ctx:o,opacity:re(o,t,e),cssPosition:be(t,"position"),borders:N(t),transform:r,clip:e&&e.clip?me.Extend({},e.clip):null};return B(t,i,e),a.useOverflow===!0&&/(hidden|scroll|auto)/.test(be(t,"overflow"))===!0&&/(BODY)/i.test(t.nodeName)===!1&&(i.clip=i.clip?z(i.clip,n):n),i}function le(t,e,n){var r={left:e.left+t[3].width,top:e.top+t[0].width,width:e.width-(t[1].width+t[3].width),height:e.height-(t[0].width+t[2].width)};return n&&(r=z(r,n)),r}function se(t,e){var n=e.matrix?me.OffsetBounds(t):me.Bounds(t);return e.origin[0]+=n.left,e.origin[1]+=n.top,n}function ce(t,e,n){var r,a=oe(t,e),o=se(t,a),i=ie(t,e,o,a),l=i.borders,s=i.ctx,c=le(l,o,i.clip),d=H(t,o,l),h=we.test(t.nodeName)?"#efefef":be(t,"backgroundColor");switch(j(s,d.clip),s.save(),s.clip(),c.height>0&&c.width>0&&!n?(Z(s,o,h),ee(t,c,s)):n&&(i.backgroundColor=h),s.restore(),d.borders.forEach(function(t){q(s,t.args,t.color)}),t.nodeName){case"IMG":(r=O(t.getAttribute("src")))?A(s,t,r,o,l):me.log("html2canvas: Error loading :"+t.getAttribute("src"));break;case"INPUT":/^(text|url|email|submit|button|reset)$/.test(t.type)&&(t.value||t.placeholder||"").length>0&&X(t,o,i);break;case"TEXTAREA":(t.value||t.placeholder||"").length>0&&X(t,o,i);break;case"SELECT":(t.options||t.placeholder||"").length>0&&X(t,o,i);break;case"LI":L(t,i,c);break;case"CANVAS":A(s,t,t,o,l)}return i}function de(t){return"none"!==be(t,"display")&&"hidden"!==be(t,"visibility")&&!t.hasAttribute("data-html2canvas-ignore")}function he(t,e,r){return r||(r=function(){}),de(t)&&(e=ce(t,e,!1)||e,!we.test(t.nodeName))?ue(t,e,r):(r(),n)}function ue(t,e,n){function r(n){n.nodeType===n.ELEMENT_NODE?he(n,e,o):n.nodeType===n.TEXT_NODE?(E(t,n,e),o()):o()}function o(){0>=--l&&(me.log("finished rendering "+i.length+" children."),n())}var i=me.Children(t),l=i.length+1;o(),a.async?i.forEach(function(t){setTimeout(function(){r(t)},0)}):i.forEach(r)}t.scroll(0,0);var fe=a.elements===n?e.body:a.elements[0],pe=0,ge=fe.ownerDocument,me=d.Util,ye=me.Support(a,ge),we=RegExp("("+a.ignoreElements+")"),xe=ge.body,be=me.getCSS,ve="___html2canvas___pseudoelement",Ce=ge.createElement("style");Ce.innerHTML="."+ve+'-parent:before { content: "" !important; display: none !important; }'+"."+ve+'-parent:after { content: "" !important; display: none !important; }',xe.appendChild(Ce),r=r||{},i()},d.Preload=function(r){function a(t){E.href=t,E.href=E.href;var e=E.protocol+E.host;return e===g}function o(){b.log("html2canvas: start: images: "+x.numLoaded+" / "+x.numTotal+" (failed: "+x.numFailed+")"),!x.firstRun&&x.numLoaded>=x.numTotal&&(b.log("Finished loading images: # "+x.numTotal+" (failed: "+x.numFailed+")"),"function"==typeof r.complete&&r.complete(x))}function i(e,a,i){var l,s,c=r.proxy;E.href=e,e=E.href,l="html2canvas_"+v++,i.callbackname=l,c+=c.indexOf("?")>-1?"&":"?",c+="url="+encodeURIComponent(e)+"&callback="+l,s=k.createElement("script"),t[l]=function(e){"error:"===e.substring(0,6)?(i.succeeded=!1,x.numLoaded++,x.numFailed++,o()):(p(a,i),a.src=e),t[l]=n;try{delete t[l]}catch(r){}s.parentNode.removeChild(s),s=null,delete i.script,delete i.callbackname},s.setAttribute("type","text/javascript"),s.setAttribute("src",c),i.script=s,t.document.body.appendChild(s)}function l(e,n){var r=t.getComputedStyle(e,n),a=r.content;"url"===a.substr(0,3)&&m.loadImage(d.Util.parseBackgroundImage(a)[0].args[0]),u(r.backgroundImage,e)}function s(t){l(t,":before"),l(t,":after")}function c(t,e){var r=d.Generate.Gradient(t,e);r!==n&&(x[t]={img:r,succeeded:!0},x.numTotal++,x.numLoaded++,o())}function h(t){return t&&t.method&&t.args&&t.args.length>0}function u(t,e){var r;d.Util.parseBackgroundImage(t).filter(h).forEach(function(t){"url"===t.method?m.loadImage(t.args[0]):t.method.match(/\-?gradient$/)&&(r===n&&(r=d.Util.Bounds(e)),c(t.value,r))})}function f(t){var e=!1;try{b.Children(t).forEach(f)}catch(r){}try{e=t.nodeType}catch(a){e=!1,b.log("html2canvas: failed to access some element's nodeType - Exception: "+a.message)}if(1===e||e===n){s(t);try{u(b.getCSS(t,"backgroundImage"),t)}catch(r){b.log("html2canvas: failed to get background-image - Exception: "+r.message)}u(t)}}function p(e,a){e.onload=function(){a.timer!==n&&t.clearTimeout(a.timer),x.numLoaded++,a.succeeded=!0,e.onerror=e.onload=null,o()},e.onerror=function(){if("anonymous"===e.crossOrigin&&(t.clearTimeout(a.timer),r.proxy)){var l=e.src;return e=new Image,a.img=e,e.src=l,i(e.src,e,a),n}x.numLoaded++,x.numFailed++,a.succeeded=!1,e.onerror=e.onload=null,o()}}var g,m,y,w,x={numLoaded:0,numFailed:0,numTotal:0,cleanupDone:!1},b=d.Util,v=0,C=r.elements[0]||e.body,k=C.ownerDocument,T=C.getElementsByTagName("img"),S=T.length,E=k.createElement("a"),R=function(t){return t.crossOrigin!==n}(new Image);for(E.href=t.location.href,g=E.protocol+E.host,m={loadImage:function(t){var e,o;t&&x[t]===n&&(e=new Image,t.match(/data:image\/.*;base64,/i)?(e.src=t.replace(/url\(['"]{0,}|['"]{0,}\)$/gi,""),o=x[t]={img:e},x.numTotal++,p(e,o)):a(t)||r.allowTaint===!0?(o=x[t]={img:e},x.numTotal++,p(e,o),e.src=t):R&&!r.allowTaint&&r.useCORS?(e.crossOrigin="anonymous",o=x[t]={img:e},x.numTotal++,p(e,o),e.src=t):r.proxy&&(o=x[t]={img:e},x.numTotal++,i(t,e,o)))},cleanupDOM:function(a){var i,l; +if(!x.cleanupDone){a&&"string"==typeof a?b.log("html2canvas: Cleanup because: "+a):b.log("html2canvas: Cleanup after timeout: "+r.timeout+" ms.");for(l in x)if(x.hasOwnProperty(l)&&(i=x[l],"object"==typeof i&&i.callbackname&&i.succeeded===n)){t[i.callbackname]=n;try{delete t[i.callbackname]}catch(s){}i.script&&i.script.parentNode&&(i.script.setAttribute("src","about:blank"),i.script.parentNode.removeChild(i.script)),x.numLoaded++,x.numFailed++,b.log("html2canvas: Cleaned up failed img: '"+l+"' Steps: "+x.numLoaded+" / "+x.numTotal)}t.stop!==n?t.stop():e.execCommand!==n&&e.execCommand("Stop",!1),e.close!==n&&e.close(),x.cleanupDone=!0,a&&"string"==typeof a||o()}},renderingDone:function(){w&&t.clearTimeout(w)}},r.timeout>0&&(w=t.setTimeout(m.cleanupDOM,r.timeout)),b.log("html2canvas: Preload starts: finding background-images"),x.firstRun=!0,f(C),b.log("html2canvas: Preload: Finding images"),y=0;S>y;y+=1)m.loadImage(T[y].getAttribute("src"));return x.firstRun=!1,b.log("html2canvas: Preload: Done."),x.numTotal===x.numLoaded&&o(),m},d.Renderer=function(t,r){function a(t,e){return"children"===t?-1:"children"===e?1:t-e}function o(t){function e(t){Object.keys(t).sort(a).forEach(function(n){var r=[],a=[],i=[],l=[];t[n].forEach(function(t){t.node.zIndex.isPositioned||1>t.node.zIndex.opacity?i.push(t):t.node.zIndex.isFloated?a.push(t):r.push(t)}),function s(t){t.forEach(function(t){l.push(t),t.children&&s(t.children)})}(r.concat(a,i)),l.forEach(function(t){t.context?e(t.context):o.push(t.node)})})}var r,o=[];return r=function(t){function e(t,r,a){var o="auto"===r.zIndex.zindex?0:Number(r.zIndex.zindex),i=t,l=r.zIndex.isPositioned,s=r.zIndex.isFloated,c={node:r},d=a;r.zIndex.ownStacking?(i=c.context={children:[{node:r,children:[]}]},d=n):(l||s)&&(d=c.children=[]),0===o&&a?a.push(c):(t[o]||(t[o]=[]),t[o].push(c)),r.zIndex.children.forEach(function(t){e(i,t,d)})}var r={};return e(r,t),r}(t),e(r),o}function i(t){var e;if("string"==typeof r.renderer&&d.Renderer[t]!==n)e=d.Renderer[t](r);else{if("function"!=typeof t)throw Error("Unknown renderer");e=t(r)}if("function"!=typeof e)throw Error("Invalid renderer defined");return e}return i(r.renderer)(t,r,e,o(t.stack),d)},d.Util.Support=function(t,e){function r(){var t=new Image,r=e.createElement("canvas"),a=r.getContext===n?!1:r.getContext("2d");if(a===!1)return!1;r.width=r.height=10,t.src=["data:image/svg+xml,","","","
    ","sup","
    ","
    ","
    "].join("");try{a.drawImage(t,0,0),r.toDataURL()}catch(o){return!1}return d.Util.log("html2canvas: Parse: SVG powered rendering available"),!0}function a(){var t,n,r,a,o=!1;return e.createRange&&(t=e.createRange(),t.getBoundingClientRect&&(n=e.createElement("boundtest"),n.style.height="123px",n.style.display="block",e.body.appendChild(n),t.selectNode(n),r=t.getBoundingClientRect(),a=r.height,123===a&&(o=!0),e.body.removeChild(n))),o}return{rangeBounds:a(),svgRendering:t.svgRendering&&r()}},t.html2canvas=function(e,n){e=e.length?e:[e];var r,a={logging:!1,elements:e,background:"#fff",proxy:null,timeout:0,useCORS:!1,allowTaint:!1,svgRendering:!1,ignoreElements:"IFRAME|OBJECT|PARAM",useOverflow:!0,letterRendering:!1,chinese:!1,async:!1,width:null,height:null,taintTest:!0,renderer:"Canvas"};return a=d.Util.Extend(n,a),d.logging=a.logging,a.complete=function(t){("function"!=typeof a.onpreloaded||a.onpreloaded(t)!==!1)&&d.Parse(t,a,function(t){("function"!=typeof a.onparsed||a.onparsed(t)!==!1)&&(r=d.Renderer(t,a),"function"==typeof a.onrendered&&a.onrendered(r))})},t.setTimeout(function(){d.Preload(a)},0),{render:function(t,e){return d.Renderer(t,d.Util.Extend(e,a))},parse:function(t,e){return d.Parse(t,d.Util.Extend(e,a))},preload:function(t){return d.Preload(d.Util.Extend(t,a))},log:d.Util.log}},t.html2canvas.log=d.Util.log,t.html2canvas.Renderer={Canvas:n},d.Renderer.Canvas=function(t){function r(t,e){t.beginPath(),e.forEach(function(e){t[e.name].apply(t,e.arguments)}),t.closePath()}function a(t){if(-1===l.indexOf(t.arguments[0].src)){c.drawImage(t.arguments[0],0,0);try{c.getImageData(0,0,1,1)}catch(e){return s=i.createElement("canvas"),c=s.getContext("2d"),!1}l.push(t.arguments[0].src)}return!0}function o(e,n){switch(n.type){case"variable":e[n.name]=n.arguments;break;case"function":switch(n.name){case"createPattern":if(n.arguments[0].width>0&&n.arguments[0].height>0)try{e.fillStyle=e.createPattern(n.arguments[0],"repeat")}catch(o){h.log("html2canvas: Renderer: Error creating pattern",o.message)}break;case"drawShape":r(e,n.arguments);break;case"drawImage":n.arguments[8]>0&&n.arguments[7]>0&&(!t.taintTest||t.taintTest&&a(n))&&e.drawImage.apply(e,n.arguments);break;default:e[n.name].apply(e,n.arguments)}}}t=t||{};var i=e,l=[],s=e.createElement("canvas"),c=s.getContext("2d"),h=d.Util,u=t.canvas||i.createElement("canvas");return function(t,e,r,a,i){var l,s,c,d=u.getContext("2d"),f=t.stack;return u.width=u.style.width=e.width||f.ctx.width,u.height=u.style.height=e.height||f.ctx.height,c=d.fillStyle,d.fillStyle=h.isTransparent(t.backgroundColor)&&e.background!==n?e.background:t.backgroundColor,d.fillRect(0,0,u.width,u.height),d.fillStyle=c,a.forEach(function(t){d.textBaseline="bottom",d.save(),t.transform.matrix&&(d.translate(t.transform.origin[0],t.transform.origin[1]),d.transform.apply(d,t.transform.matrix),d.translate(-t.transform.origin[0],-t.transform.origin[1])),t.clip&&(d.beginPath(),d.rect(t.clip.left,t.clip.top,t.clip.width,t.clip.height),d.clip()),t.ctx.storage&&t.ctx.storage.forEach(function(t){o(d,t)}),d.restore()}),h.log("html2canvas: Renderer: Canvas renderer done - returning canvas obj"),1===e.elements.length&&"object"==typeof e.elements[0]&&"BODY"!==e.elements[0].nodeName?(s=i.Util.Bounds(e.elements[0]),l=r.createElement("canvas"),l.width=Math.ceil(s.width),l.height=Math.ceil(s.height),d=l.getContext("2d"),d.drawImage(u,s.left,s.top,s.width,s.height,0,0,s.width,s.height),u=null,l):u}}})(window,document); \ No newline at end of file diff --git a/www/lib/js/jquery-ui-1.10.3.dragdropsort.min.js b/www/lib/js/jquery-ui-1.10.3.dragdropsort.min.js new file mode 100644 index 0000000..d0756e7 --- /dev/null +++ b/www/lib/js/jquery-ui-1.10.3.dragdropsort.min.js @@ -0,0 +1,6 @@ +/*! jQuery UI - v1.10.3 - 2013-08-01 +* http://jqueryui.com +* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.sortable.js +* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */ + +(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({focus:function(t){return function(i,s){return"number"==typeof i?this.each(function(){var t=this;setTimeout(function(){e(t).focus(),s&&s.call(t)},i)}):t.apply(this,arguments)}}(e.fn.focus),scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(i){if(i!==t)return this.css("zIndex",i);if(this.length)for(var s,a,n=e(this[0]);n.length&&n[0]!==document;){if(s=n.css("position"),("absolute"===s||"relative"===s||"fixed"===s)&&(a=parseInt(n.css("zIndex"),10),!isNaN(a)&&0!==a))return a;n=n.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++a)})},removeUniqueId:function(){return this.each(function(){n.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(i){return!!e.data(i,t)}}):function(t,i,s){return!!e.data(t,s[3])},focusable:function(t){return i(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var s=e.attr(t,"tabindex"),a=isNaN(s);return(a||s>=0)&&i(t,!a)}}),e("").outerWidth(1).jquery||e.each(["Width","Height"],function(i,s){function a(t,i,s,a){return e.each(n,function(){i-=parseFloat(e.css(t,"padding"+this))||0,s&&(i-=parseFloat(e.css(t,"border"+this+"Width"))||0),a&&(i-=parseFloat(e.css(t,"margin"+this))||0)}),i}var n="Width"===s?["Left","Right"]:["Top","Bottom"],r=s.toLowerCase(),o={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+s]=function(i){return i===t?o["inner"+s].call(this):this.each(function(){e(this).css(r,a(this,i)+"px")})},e.fn["outer"+s]=function(t,i){return"number"!=typeof t?o["outer"+s].call(this,t):this.each(function(){e(this).css(r,a(this,t,!0,i)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(i){return arguments.length?t.call(this,e.camelCase(i)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,i,s){var a,n=e.ui[t].prototype;for(a in s)n.plugins[a]=n.plugins[a]||[],n.plugins[a].push([i,s[a]])},call:function(e,t,i){var s,a=e.plugins[t];if(a&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(s=0;a.length>s;s++)e.options[a[s][0]]&&a[s][1].apply(e.element,i)}},hasScroll:function(t,i){if("hidden"===e(t).css("overflow"))return!1;var s=i&&"left"===i?"scrollLeft":"scrollTop",a=!1;return t[s]>0?!0:(t[s]=1,a=t[s]>0,t[s]=0,a)}})})(jQuery);(function(e,t){var i=0,s=Array.prototype.slice,n=e.cleanData;e.cleanData=function(t){for(var i,s=0;null!=(i=t[s]);s++)try{e(i).triggerHandler("remove")}catch(a){}n(t)},e.widget=function(i,s,n){var a,r,o,h,l={},u=i.split(".")[0];i=i.split(".")[1],a=u+"-"+i,n||(n=s,s=e.Widget),e.expr[":"][a.toLowerCase()]=function(t){return!!e.data(t,a)},e[u]=e[u]||{},r=e[u][i],o=e[u][i]=function(e,i){return this._createWidget?(arguments.length&&this._createWidget(e,i),t):new o(e,i)},e.extend(o,r,{version:n.version,_proto:e.extend({},n),_childConstructors:[]}),h=new s,h.options=e.widget.extend({},h.options),e.each(n,function(i,n){return e.isFunction(n)?(l[i]=function(){var e=function(){return s.prototype[i].apply(this,arguments)},t=function(e){return s.prototype[i].apply(this,e)};return function(){var i,s=this._super,a=this._superApply;return this._super=e,this._superApply=t,i=n.apply(this,arguments),this._super=s,this._superApply=a,i}}(),t):(l[i]=n,t)}),o.prototype=e.widget.extend(h,{widgetEventPrefix:r?h.widgetEventPrefix:i},l,{constructor:o,namespace:u,widgetName:i,widgetFullName:a}),r?(e.each(r._childConstructors,function(t,i){var s=i.prototype;e.widget(s.namespace+"."+s.widgetName,o,i._proto)}),delete r._childConstructors):s._childConstructors.push(o),e.widget.bridge(i,o)},e.widget.extend=function(i){for(var n,a,r=s.call(arguments,1),o=0,h=r.length;h>o;o++)for(n in r[o])a=r[o][n],r[o].hasOwnProperty(n)&&a!==t&&(i[n]=e.isPlainObject(a)?e.isPlainObject(i[n])?e.widget.extend({},i[n],a):e.widget.extend({},a):a);return i},e.widget.bridge=function(i,n){var a=n.prototype.widgetFullName||i;e.fn[i]=function(r){var o="string"==typeof r,h=s.call(arguments,1),l=this;return r=!o&&h.length?e.widget.extend.apply(null,[r].concat(h)):r,o?this.each(function(){var s,n=e.data(this,a);return n?e.isFunction(n[r])&&"_"!==r.charAt(0)?(s=n[r].apply(n,h),s!==n&&s!==t?(l=s&&s.jquery?l.pushStack(s.get()):s,!1):t):e.error("no such method '"+r+"' for "+i+" widget instance"):e.error("cannot call methods on "+i+" prior to initialization; "+"attempted to call method '"+r+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(r||{})._init():e.data(this,a,new n(r,this))}),l}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"
    ",options:{disabled:!1,create:null},_createWidget:function(t,s){s=e(s||this.defaultElement||this)[0],this.element=e(s),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),s!==this&&(e.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===s&&this.destroy()}}),this.document=e(s.style?s.ownerDocument:s.document||s),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(i,s){var n,a,r,o=i;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof i)if(o={},n=i.split("."),i=n.shift(),n.length){for(a=o[i]=e.widget.extend({},this.options[i]),r=0;n.length-1>r;r++)a[n[r]]=a[n[r]]||{},a=a[n[r]];if(i=n.pop(),s===t)return a[i]===t?null:a[i];a[i]=s}else{if(s===t)return this.options[i]===t?null:this.options[i];o[i]=s}return this._setOptions(o),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(i,s,n){var a,r=this;"boolean"!=typeof i&&(n=s,s=i,i=!1),n?(s=a=e(s),this.bindings=this.bindings.add(s)):(n=s,s=this.element,a=this.widget()),e.each(n,function(n,o){function h(){return i||r.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof o?r[o]:o).apply(r,arguments):t}"string"!=typeof o&&(h.guid=o.guid=o.guid||h.guid||e.guid++);var l=n.match(/^(\w+)\s*(.*)$/),u=l[1]+r.eventNamespace,c=l[2];c?a.delegate(c,u,h):s.bind(u,h)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function i(){return("string"==typeof e?s[e]:e).apply(s,arguments)}var s=this;return setTimeout(i,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,i,s){var n,a,r=this.options[t];if(s=s||{},i=e.Event(i),i.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),i.target=this.element[0],a=i.originalEvent)for(n in a)n in i||(i[n]=a[n]);return this.element.trigger(i,s),!(e.isFunction(r)&&r.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,i){e.Widget.prototype["_"+t]=function(s,n,a){"string"==typeof n&&(n={effect:n});var r,o=n?n===!0||"number"==typeof n?i:n.effect||i:t;n=n||{},"number"==typeof n&&(n={duration:n}),r=!e.isEmptyObject(n),n.complete=a,n.delay&&s.delay(n.delay),r&&e.effects&&e.effects.effect[o]?s[t](n):o!==t&&s[o]?s[o](n.duration,n.easing,a):s.queue(function(i){e(this)[t](),a&&a.call(s[0]),i()})}})})(jQuery);(function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.3",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(i){return!0===e.data(i.target,t.widgetName+".preventClickEvent")?(e.removeData(i.target,t.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):undefined}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(i){if(!t){this._mouseStarted&&this._mouseUp(i),this._mouseDownEvent=i;var s=this,n=1===i.which,a="string"==typeof this.options.cancel&&i.target.nodeName?e(i.target).closest(this.options.cancel).length:!1;return n&&!a&&this._mouseCapture(i)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){s.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(i)&&this._mouseDelayMet(i)&&(this._mouseStarted=this._mouseStart(i)!==!1,!this._mouseStarted)?(i.preventDefault(),!0):(!0===e.data(i.target,this.widgetName+".preventClickEvent")&&e.removeData(i.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return s._mouseMove(e)},this._mouseUpDelegate=function(e){return s._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),i.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})})(jQuery);(function(t,e){function i(t,e,i){return[parseFloat(t[0])*(p.test(t[0])?e/100:1),parseFloat(t[1])*(p.test(t[1])?i/100:1)]}function s(e,i){return parseInt(t.css(e,i),10)||0}function n(e){var i=e[0];return 9===i.nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:t.isWindow(i)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:i.preventDefault?{width:0,height:0,offset:{top:i.pageY,left:i.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()}}t.ui=t.ui||{};var a,o=Math.max,r=Math.abs,h=Math.round,l=/left|center|right/,c=/top|center|bottom/,u=/[\+\-]\d+(\.[\d]+)?%?/,d=/^\w+/,p=/%$/,f=t.fn.position;t.position={scrollbarWidth:function(){if(a!==e)return a;var i,s,n=t("
    "),o=n.children()[0];return t("body").append(n),i=o.offsetWidth,n.css("overflow","scroll"),s=o.offsetWidth,i===s&&(s=n[0].clientWidth),n.remove(),a=i-s},getScrollInfo:function(e){var i=e.isWindow?"":e.element.css("overflow-x"),s=e.isWindow?"":e.element.css("overflow-y"),n="scroll"===i||"auto"===i&&e.widths?"left":i>0?"right":"center",vertical:0>a?"top":n>0?"bottom":"middle"};u>p&&p>r(i+s)&&(h.horizontal="center"),d>m&&m>r(n+a)&&(h.vertical="middle"),h.important=o(r(i),r(s))>o(r(n),r(a))?"horizontal":"vertical",e.using.call(this,t,h)}),c.offset(t.extend(C,{using:l}))})},t.ui.position={fit:{left:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollLeft:s.offset.left,a=s.width,r=t.left-e.collisionPosition.marginLeft,h=n-r,l=r+e.collisionWidth-a-n;e.collisionWidth>a?h>0&&0>=l?(i=t.left+h+e.collisionWidth-a-n,t.left+=h-i):t.left=l>0&&0>=h?n:h>l?n+a-e.collisionWidth:n:h>0?t.left+=h:l>0?t.left-=l:t.left=o(t.left-r,t.left)},top:function(t,e){var i,s=e.within,n=s.isWindow?s.scrollTop:s.offset.top,a=e.within.height,r=t.top-e.collisionPosition.marginTop,h=n-r,l=r+e.collisionHeight-a-n;e.collisionHeight>a?h>0&&0>=l?(i=t.top+h+e.collisionHeight-a-n,t.top+=h-i):t.top=l>0&&0>=h?n:h>l?n+a-e.collisionHeight:n:h>0?t.top+=h:l>0?t.top-=l:t.top=o(t.top-r,t.top)}},flip:{left:function(t,e){var i,s,n=e.within,a=n.offset.left+n.scrollLeft,o=n.width,h=n.isWindow?n.scrollLeft:n.offset.left,l=t.left-e.collisionPosition.marginLeft,c=l-h,u=l+e.collisionWidth-o-h,d="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,p="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,f=-2*e.offset[0];0>c?(i=t.left+d+p+f+e.collisionWidth-o-a,(0>i||r(c)>i)&&(t.left+=d+p+f)):u>0&&(s=t.left-e.collisionPosition.marginLeft+d+p+f-h,(s>0||u>r(s))&&(t.left+=d+p+f))},top:function(t,e){var i,s,n=e.within,a=n.offset.top+n.scrollTop,o=n.height,h=n.isWindow?n.scrollTop:n.offset.top,l=t.top-e.collisionPosition.marginTop,c=l-h,u=l+e.collisionHeight-o-h,d="top"===e.my[1],p=d?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,f="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,m=-2*e.offset[1];0>c?(s=t.top+p+f+m+e.collisionHeight-o-a,t.top+p+f+m>c&&(0>s||r(c)>s)&&(t.top+=p+f+m)):u>0&&(i=t.top-e.collisionPosition.marginTop+p+f+m-h,t.top+p+f+m>u&&(i>0||u>r(i))&&(t.top+=p+f+m))}},flipfit:{left:function(){t.ui.position.flip.left.apply(this,arguments),t.ui.position.fit.left.apply(this,arguments)},top:function(){t.ui.position.flip.top.apply(this,arguments),t.ui.position.fit.top.apply(this,arguments)}}},function(){var e,i,s,n,a,o=document.getElementsByTagName("body")[0],r=document.createElement("div");e=document.createElement(o?"div":"body"),s={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},o&&t.extend(s,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in s)e.style[a]=s[a];e.appendChild(r),i=o||document.documentElement,i.insertBefore(e,i.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",n=t(r).offset().left,t.support.offsetFractions=n>10&&11>n,e.innerHTML="",i.removeChild(e)}()})(jQuery);(function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.3",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"!==this.options.helper||/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var i=this.options;return this.helper||i.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(i.iframeFix===!0?"iframe":i.iframeFix).each(function(){e("
    ").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var i=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offsetParent=this.helper.offsetParent(),this.offsetParentCssPosition=this.offsetParent.css("position"),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},this.offset.scroll=!1,e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,i.cursorAt&&this._adjustOffsetFromHelper(i.cursorAt),this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,i){if("fixed"===this.offsetParentCssPosition&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!i){var s=this._uiHash();if(this._trigger("drag",t,s)===!1)return this._mouseUp({}),!1;this.position=s.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var i=this,s=!1;return e.ui.ddmanager&&!this.options.dropBehaviour&&(s=e.ui.ddmanager.drop(this,t)),this.dropped&&(s=this.dropped,this.dropped=!1),"original"!==this.options.helper||e.contains(this.element[0].ownerDocument,this.element[0])?("invalid"===this.options.revert&&!s||"valid"===this.options.revert&&s||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,s)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){return this.options.handle?!!e(t.target).closest(this.element.find(this.options.handle)).length:!0},_createHelper:function(t){var i=this.options,s=e.isFunction(i.helper)?e(i.helper.apply(this.element[0],[t])):"clone"===i.helper?this.element.clone().removeAttr("id"):this.element;return s.parents("body").length||s.appendTo("parent"===i.appendTo?this.element[0].parentNode:i.appendTo),s[0]===this.element[0]||/(fixed|absolute)/.test(s.css("position"))||s.css("position","absolute"),s},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,i,s,n=this.options;return n.containment?"window"===n.containment?(this.containment=[e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,e(window).scrollLeft()+e(window).width()-this.helperProportions.width-this.margins.left,e(window).scrollTop()+(e(window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):"document"===n.containment?(this.containment=[0,0,e(document).width()-this.helperProportions.width-this.margins.left,(e(document).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top],undefined):n.containment.constructor===Array?(this.containment=n.containment,undefined):("parent"===n.containment&&(n.containment=this.helper[0].parentNode),i=e(n.containment),s=i[0],s&&(t="hidden"!==i.css("overflow"),this.containment=[(parseInt(i.css("borderLeftWidth"),10)||0)+(parseInt(i.css("paddingLeft"),10)||0),(parseInt(i.css("borderTopWidth"),10)||0)+(parseInt(i.css("paddingTop"),10)||0),(t?Math.max(s.scrollWidth,s.offsetWidth):s.offsetWidth)-(parseInt(i.css("borderRightWidth"),10)||0)-(parseInt(i.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(s.scrollHeight,s.offsetHeight):s.offsetHeight)-(parseInt(i.css("borderBottomWidth"),10)||0)-(parseInt(i.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=i),undefined):(this.containment=null,undefined)},_convertPositionTo:function(t,i){i||(i=this.position);var s="absolute"===t?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent;return this.offset.scroll||(this.offset.scroll={top:n.scrollTop(),left:n.scrollLeft()}),{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top)*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)*s}},_generatePosition:function(t){var i,s,n,a,o=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=t.pageX,l=t.pageY;return this.offset.scroll||(this.offset.scroll={top:r.scrollTop(),left:r.scrollLeft()}),this.originalPosition&&(this.containment&&(this.relative_container?(s=this.relative_container.offset(),i=[this.containment[0]+s.left,this.containment[1]+s.top,this.containment[2]+s.left,this.containment[3]+s.top]):i=this.containment,t.pageX-this.offset.click.lefti[2]&&(h=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(l=i[3]+this.offset.click.top)),o.grid&&(n=o.grid[1]?this.originalPageY+Math.round((l-this.originalPageY)/o.grid[1])*o.grid[1]:this.originalPageY,l=i?n-this.offset.click.top>=i[1]||n-this.offset.click.top>i[3]?n:n-this.offset.click.top>=i[1]?n-o.grid[1]:n+o.grid[1]:n,a=o.grid[0]?this.originalPageX+Math.round((h-this.originalPageX)/o.grid[0])*o.grid[0]:this.originalPageX,h=i?a-this.offset.click.left>=i[0]||a-this.offset.click.left>i[2]?a:a-this.offset.click.left>=i[0]?a-o.grid[0]:a+o.grid[0]:a)),{top:l-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():this.offset.scroll.top),left:h-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():this.offset.scroll.left)}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,i,s){return s=s||this._uiHash(),e.ui.plugin.call(this,t,[i,s]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,i,s)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,i){var s=e(this).data("ui-draggable"),n=s.options,a=e.extend({},i,{item:s.element});s.sortables=[],e(n.connectToSortable).each(function(){var i=e.data(this,"ui-sortable");i&&!i.options.disabled&&(s.sortables.push({instance:i,shouldRevert:i.options.revert}),i.refreshPositions(),i._trigger("activate",t,a))})},stop:function(t,i){var s=e(this).data("ui-draggable"),n=e.extend({},i,{item:s.element});e.each(s.sortables,function(){this.instance.isOver?(this.instance.isOver=0,s.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=this.shouldRevert),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===s.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,n))})},drag:function(t,i){var s=e(this).data("ui-draggable"),n=this;e.each(s.sortables,function(){var a=!1,o=this;this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(s.sortables,function(){return this.instance.positionAbs=s.positionAbs,this.instance.helperProportions=s.helperProportions,this.instance.offset.click=s.offset.click,this!==o&&this.instance._intersectsWith(this.instance.containerCache)&&e.contains(o.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(n).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return i.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=s.offset.click.top,this.instance.offset.click.left=s.offset.click.left,this.instance.offset.parent.left-=s.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=s.offset.parent.top-this.instance.offset.parent.top,s._trigger("toSortable",t),s.dropped=this.instance.element,s.currentItem=s.element,this.instance.fromOutside=s),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),s._trigger("fromSortable",t),s.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),i=e(this).data("ui-draggable").options;t.css("cursor")&&(i._cursor=t.css("cursor")),t.css("cursor",i.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("opacity")&&(n._opacity=s.css("opacity")),s.css("opacity",n.opacity)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._opacity&&e(i.helper).css("opacity",s._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var i=e(this).data("ui-draggable"),s=i.options,n=!1;i.scrollParent[0]!==document&&"HTML"!==i.scrollParent[0].tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+i.scrollParent[0].offsetHeight-t.pageY=0;c--)r=p.snapElements[c].left,h=r+p.snapElements[c].width,l=p.snapElements[c].top,u=l+p.snapElements[c].height,r-m>v||g>h+m||l-m>y||b>u+m||!e.contains(p.snapElements[c].item.ownerDocument,p.snapElements[c].item)?(p.snapElements[c].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=!1):("inner"!==f.snapMode&&(s=m>=Math.abs(l-y),n=m>=Math.abs(u-b),a=m>=Math.abs(r-v),o=m>=Math.abs(h-g),s&&(i.position.top=p._convertPositionTo("relative",{top:l-p.helperProportions.height,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h}).left-p.margins.left)),d=s||n||a||o,"outer"!==f.snapMode&&(s=m>=Math.abs(l-b),n=m>=Math.abs(u-y),a=m>=Math.abs(r-g),o=m>=Math.abs(h-v),s&&(i.position.top=p._convertPositionTo("relative",{top:l,left:0}).top-p.margins.top),n&&(i.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(i.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),o&&(i.position.left=p._convertPositionTo("relative",{top:0,left:h-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[c].snapping&&(s||n||a||o||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[c].item})),p.snapElements[c].snapping=s||n||a||o||d)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,i=this.data("ui-draggable").options,s=e.makeArray(e(i.stack)).sort(function(t,i){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(i).css("zIndex"),10)||0)});s.length&&(t=parseInt(e(s[0]).css("zIndex"),10)||0,e(s).each(function(i){e(this).css("zIndex",t+i)}),this.css("zIndex",t+s.length))}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,i){var s=e(i.helper),n=e(this).data("ui-draggable").options;s.css("zIndex")&&(n._zIndex=s.css("zIndex")),s.css("zIndex",n.zIndex)},stop:function(t,i){var s=e(this).data("ui-draggable").options;s._zIndex&&e(i.helper).css("zIndex",s._zIndex)}})})(jQuery);(function(e){function t(e,t,i){return e>t&&t+i>e}e.widget("ui.droppable",{version:"1.10.3",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,i=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(i)?i:function(e){return e.is(i)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,i=e.ui.ddmanager.droppables[this.options.scope];i.length>t;t++)i[t]===this&&i.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,i){"accept"===t&&(this.accept=e.isFunction(i)?i:function(e){return e.is(i)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),i&&this._trigger("activate",t,this.ui(i))},_deactivate:function(t){var i=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),i&&this._trigger("deactivate",t,this.ui(i))},_over:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(i)))},_out:function(t){var i=e.ui.ddmanager.current;i&&(i.currentItem||i.element)[0]!==this.element[0]&&this.accept.call(this.element[0],i.currentItem||i.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(i)))},_drop:function(t,i){var s=i||e.ui.ddmanager.current,n=!1;return s&&(s.currentItem||s.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===s.options.scope&&t.accept.call(t.element[0],s.currentItem||s.element)&&e.ui.intersect(s,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(n=!0,!1):undefined}),n?!1:this.accept.call(this.element[0],s.currentItem||s.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(s)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,i,s){if(!i.offset)return!1;var n,a,o=(e.positionAbs||e.position.absolute).left,r=o+e.helperProportions.width,h=(e.positionAbs||e.position.absolute).top,l=h+e.helperProportions.height,u=i.offset.left,c=u+i.proportions.width,d=i.offset.top,p=d+i.proportions.height;switch(s){case"fit":return o>=u&&c>=r&&h>=d&&p>=l;case"intersect":return o+e.helperProportions.width/2>u&&c>r-e.helperProportions.width/2&&h+e.helperProportions.height/2>d&&p>l-e.helperProportions.height/2;case"pointer":return n=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,d,i.proportions.height)&&t(n,u,i.proportions.width);case"touch":return(h>=d&&p>=h||l>=d&&p>=l||d>h&&l>p)&&(o>=u&&c>=o||r>=u&&c>=r||u>o&&r>c);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,i){var s,n,a=e.ui.ddmanager.droppables[t.options.scope]||[],o=i?i.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(s=0;a.length>s;s++)if(!(a[s].options.disabled||t&&!a[s].accept.call(a[s].element[0],t.currentItem||t.element))){for(n=0;r.length>n;n++)if(r[n]===a[s].element[0]){a[s].proportions.height=0;continue e}a[s].visible="none"!==a[s].element.css("display"),a[s].visible&&("mousedown"===o&&a[s]._activate.call(a[s],i),a[s].offset=a[s].element.offset(),a[s].proportions={width:a[s].element[0].offsetWidth,height:a[s].element[0].offsetHeight})}},drop:function(t,i){var s=!1;return e.each((e.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(s=this._drop.call(this,i)||s),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,i)))}),s},dragStart:function(t,i){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)})},drag:function(t,i){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,i),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var s,n,a,o=e.ui.intersect(t,this,this.options.tolerance),r=!o&&this.isover?"isout":o&&!this.isover?"isover":null;r&&(this.options.greedy&&(n=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===n}),a.length&&(s=e.data(a[0],"ui-droppable"),s.greedyChild="isover"===r)),s&&"isover"===r&&(s.isover=!1,s.isout=!0,s._out.call(s,i)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,i),s&&"isout"===r&&(s.isout=!1,s.isover=!0,s._over.call(s,i)))}})},dragStop:function(t,i){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,i)}}})(jQuery);(function(t){function e(t,e,i){return t>e&&e+i>t}function i(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))}t.widget("ui.sortable",t.ui.mouse,{version:"1.10.3",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var t=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===t.axis||i(this.items[0].item):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_setOption:function(e,i){"disabled"===e?(this.options[e]=i,this.widget().toggleClass("ui-sortable-disabled",!!i)):t.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(e,i){var s=null,n=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,a.widgetName+"-item")===a?(s=t(this),!1):undefined}),t.data(e.target,a.widgetName+"-item")===a&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,a,o=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(a=this.document.find("body"),this.storedCursor=a.css("cursor"),a.css("cursor",o.cursor),this.storedStylesheet=t("").appendTo(a)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!o.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,a,o=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],a=this._intersectsWithPointer(s),a&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),a=this.options.axis,o={};a&&"x"!==a||(o.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft)),a&&"y"!==a||(o.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,a=t.left,o=a+t.width,r=t.top,h=r+t.height,l=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+l>r&&h>s+l,d="y"===this.options.axis||e+c>a&&o>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>a&&o>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&h>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var i="x"===this.options.axis||e(this.positionAbs.top+this.offset.click.top,t.top,t.height),s="y"===this.options.axis||e(this.positionAbs.left+this.offset.click.left,t.left,t.width),n=i&&s,a=this._getDragVerticalDirection(),o=this._getDragHorizontalDirection();return n?this.floating?o&&"right"===o||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(t){var i=e(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),s=e(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),n=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&s||"left"===a&&!s:n&&("down"===n&&i||"up"===n&&!i)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){var i,s,n,a,o=[],r=[],h=this._connectWith();if(h&&e)for(i=h.length-1;i>=0;i--)for(n=t(h[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&r.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(r.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),i=r.length-1;i>=0;i--)r[i][0].each(function(){o.push(this)});return t(o)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,a,o,r,h,l,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i]),s=n.length-1;s>=0;s--)a=t.data(n[s],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(u.push([t.isFunction(a.options.items)?a.options.items.call(a.element[0],e,{item:this.currentItem}):t(a.options.items,a.element),a]),this.containers.push(a));for(i=u.length-1;i>=0;i--)for(o=u[i][1],r=u[i][0],s=0,l=r.length;l>s;s++)h=t(r[s]),h.data(this.widgetName+"-item",o),c.push({item:h,instance:o,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,a;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),a=n.offset(),s.left=a.left,s.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)a=this.containers[i].element.offset(),this.containers[i].containerCache.left=a.left,this.containers[i].containerCache.top=a.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("<"+s+">",e.document[0]).addClass(i||e.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper");return"tr"===s?e.currentItem.children().each(function(){t(" ",e.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(n)}):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_contactContainers:function(s){var n,a,o,r,h,l,c,u,d,p,f=null,m=null;for(n=this.containers.length-1;n>=0;n--)if(!t.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(f&&t.contains(this.containers[n].element[0],f.element[0]))continue;f=this.containers[n],m=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",s,this._uiHash(this)),this.containers[n].containerCache.over=0);if(f)if(1===this.containers.length)this.containers[m].containerCache.over||(this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1);else{for(o=1e4,r=null,p=f.floating||i(this.currentItem),h=p?"left":"top",l=p?"width":"height",c=this.positionAbs[h]+this.offset.click[h],a=this.items.length-1;a>=0;a--)t.contains(this.containers[m].element[0],this.items[a].item[0])&&this.items[a].item[0]!==this.currentItem[0]&&(!p||e(this.positionAbs.top+this.offset.click.top,this.items[a].top,this.items[a].height))&&(u=this.items[a].item.offset()[h],d=!1,Math.abs(u-c)>Math.abs(u+this.items[a][l]-c)&&(d=!0,u+=this.items[a][l]),o>Math.abs(u-c)&&(o=Math.abs(u-c),r=this.items[a],this.direction=d?"up":"down"));if(!r&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[m])return;r?this._rearrange(s,r,null,!0):this._rearrange(s,null,this.containers[m].element,!0),this._trigger("change",s,this._uiHash()),this.containers[m]._trigger("change",s,this._uiHash(this)),this.currentContainer=this.containers[m],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[m]._trigger("over",s,this._uiHash(this)),this.containers[m].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,t("document"===n.containment?document:window).width()-this.helperProportions.width-this.margins.left,(t("document"===n.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:n.scrollLeft())*s}},_generatePosition:function(e){var i,s,n=this.options,a=e.pageX,o=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,h=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==document&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.leftthis.containment[2]&&(a=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(o=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((o-this.originalPageY)/n.grid[1])*n.grid[1],o=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top<=this.containment[3]?i:i-this.offset.click.top>=this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((a-this.originalPageX)/n.grid[0])*n.grid[0],a=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left<=this.containment[2]?s:s-this.offset.click.left>=this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:o-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():h?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():h?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)e||s.push(function(t){return function(e){t._trigger("deactivate",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(function(t){return function(e){t._trigger("out",e,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!e){for(this._trigger("beforeStop",t,this._uiHash()),i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!e){for(i=0;s.length>i;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})})(jQuery); \ No newline at end of file diff --git a/www/lib/js/jquery-ui-timepicker-addon-1.2.2.js b/www/lib/js/jquery-ui-timepicker-addon-1.2.2.js new file mode 100644 index 0000000..cb5949e --- /dev/null +++ b/www/lib/js/jquery-ui-timepicker-addon-1.2.2.js @@ -0,0 +1,1949 @@ +/* + * jQuery timepicker addon + * By: Trent Richardson [http://trentrichardson.com] + * Version 1.2.2 + * Last Modified: 04/13/2013 + * + * Copyright 2013 Trent Richardson + * You may use this project under MIT or GPL licenses. + * http://trentrichardson.com/Impromptu/GPL-LICENSE.txt + * http://trentrichardson.com/Impromptu/MIT-LICENSE.txt + */ + +/*jslint evil: true, white: false, undef: false, nomen: false */ + +(function($) { + + /* + * Lets not redefine timepicker, Prevent "Uncaught RangeError: Maximum call stack size exceeded" + */ + $.ui.timepicker = $.ui.timepicker || {}; + if ($.ui.timepicker.version) { + return; + } + + /* + * Extend jQueryUI, get it started with our version number + */ + $.extend($.ui, { + timepicker: { + version: "1.2.2" + } + }); + + /* + * Timepicker manager. + * Use the singleton instance of this class, $.timepicker, to interact with the time picker. + * Settings for (groups of) time pickers are maintained in an instance object, + * allowing multiple different settings on the same page. + */ + var Timepicker = function() { + this.regional = []; // Available regional settings, indexed by language code + this.regional[''] = { // Default regional settings + currentText: 'Now', + closeText: 'Done', + amNames: ['AM', 'A'], + pmNames: ['PM', 'P'], + timeFormat: 'HH:mm', + timeSuffix: '', + timeOnlyTitle: 'Choose Time', + timeText: 'Time', + hourText: 'Hour', + minuteText: 'Minute', + secondText: 'Second', + millisecText: 'Millisecond', + timezoneText: 'Time Zone', + isRTL: false + }; + this._defaults = { // Global defaults for all the datetime picker instances + showButtonPanel: true, + timeOnly: false, + showHour: true, + showMinute: true, + showSecond: false, + showMillisec: false, + showTimezone: false, + showTime: true, + stepHour: 1, + stepMinute: 1, + stepSecond: 1, + stepMillisec: 1, + hour: 0, + minute: 0, + second: 0, + millisec: 0, + timezone: null, + useLocalTimezone: false, + defaultTimezone: "+0000", + hourMin: 0, + minuteMin: 0, + secondMin: 0, + millisecMin: 0, + hourMax: 23, + minuteMax: 59, + secondMax: 59, + millisecMax: 999, + minDateTime: null, + maxDateTime: null, + onSelect: null, + hourGrid: 0, + minuteGrid: 0, + secondGrid: 0, + millisecGrid: 0, + alwaysSetTime: true, + separator: ' ', + altFieldTimeOnly: true, + altTimeFormat: null, + altSeparator: null, + altTimeSuffix: null, + pickerTimeFormat: null, + pickerTimeSuffix: null, + showTimepicker: true, + timezoneIso8601: false, + timezoneList: null, + addSliderAccess: false, + sliderAccessArgs: null, + controlType: 'slider', + defaultValue: null, + parse: 'strict' + }; + $.extend(this._defaults, this.regional['']); + }; + + $.extend(Timepicker.prototype, { + $input: null, + $altInput: null, + $timeObj: null, + inst: null, + hour_slider: null, + minute_slider: null, + second_slider: null, + millisec_slider: null, + timezone_select: null, + hour: 0, + minute: 0, + second: 0, + millisec: 0, + timezone: null, + defaultTimezone: "+0000", + hourMinOriginal: null, + minuteMinOriginal: null, + secondMinOriginal: null, + millisecMinOriginal: null, + hourMaxOriginal: null, + minuteMaxOriginal: null, + secondMaxOriginal: null, + millisecMaxOriginal: null, + ampm: '', + formattedDate: '', + formattedTime: '', + formattedDateTime: '', + timezoneList: null, + units: ['hour','minute','second','millisec'], + control: null, + + /* + * Override the default settings for all instances of the time picker. + * @param settings object - the new settings to use as defaults (anonymous object) + * @return the manager object + */ + setDefaults: function(settings) { + extendRemove(this._defaults, settings || {}); + return this; + }, + + /* + * Create a new Timepicker instance + */ + _newInst: function($input, o) { + var tp_inst = new Timepicker(), + inlineSettings = {}, + fns = {}, + overrides, i; + + for (var attrName in this._defaults) { + if(this._defaults.hasOwnProperty(attrName)){ + var attrValue = $input.attr('time:' + attrName); + if (attrValue) { + try { + inlineSettings[attrName] = eval(attrValue); + } catch (err) { + inlineSettings[attrName] = attrValue; + } + } + } + } + overrides = { + beforeShow: function (input, dp_inst) { + if ($.isFunction(tp_inst._defaults.evnts.beforeShow)) { + return tp_inst._defaults.evnts.beforeShow.call($input[0], input, dp_inst, tp_inst); + } + }, + onChangeMonthYear: function (year, month, dp_inst) { + // Update the time as well : this prevents the time from disappearing from the $input field. + tp_inst._updateDateTime(dp_inst); + if ($.isFunction(tp_inst._defaults.evnts.onChangeMonthYear)) { + tp_inst._defaults.evnts.onChangeMonthYear.call($input[0], year, month, dp_inst, tp_inst); + } + }, + onClose: function (dateText, dp_inst) { + if (tp_inst.timeDefined === true && $input.val() !== '') { + tp_inst._updateDateTime(dp_inst); + } + if ($.isFunction(tp_inst._defaults.evnts.onClose)) { + tp_inst._defaults.evnts.onClose.call($input[0], dateText, dp_inst, tp_inst); + } + } + }; + for (i in overrides) { + if (overrides.hasOwnProperty(i)) { + fns[i] = o[i] || null; + } + } + tp_inst._defaults = $.extend({}, this._defaults, inlineSettings, o, overrides, { + evnts:fns, + timepicker: tp_inst // add timepicker as a property of datepicker: $.datepicker._get(dp_inst, 'timepicker'); + }); + tp_inst.amNames = $.map(tp_inst._defaults.amNames, function(val) { + return val.toUpperCase(); + }); + tp_inst.pmNames = $.map(tp_inst._defaults.pmNames, function(val) { + return val.toUpperCase(); + }); + + // controlType is string - key to our this._controls + if(typeof(tp_inst._defaults.controlType) === 'string'){ + if($.fn[tp_inst._defaults.controlType] === undefined){ + tp_inst._defaults.controlType = 'select'; + } + tp_inst.control = tp_inst._controls[tp_inst._defaults.controlType]; + } + // controlType is an object and must implement create, options, value methods + else{ + tp_inst.control = tp_inst._defaults.controlType; + } + + if (tp_inst._defaults.timezoneList === null) { + var timezoneList = ['-1200', '-1100', '-1000', '-0930', '-0900', '-0800', '-0700', '-0600', '-0500', '-0430', '-0400', '-0330', '-0300', '-0200', '-0100', '+0000', + '+0100', '+0200', '+0300', '+0330', '+0400', '+0430', '+0500', '+0530', '+0545', '+0600', '+0630', '+0700', '+0800', '+0845', '+0900', '+0930', + '+1000', '+1030', '+1100', '+1130', '+1200', '+1245', '+1300', '+1400']; + + if (tp_inst._defaults.timezoneIso8601) { + timezoneList = $.map(timezoneList, function(val) { + return val == '+0000' ? 'Z' : (val.substring(0, 3) + ':' + val.substring(3)); + }); + } + tp_inst._defaults.timezoneList = timezoneList; + } + + tp_inst.timezone = tp_inst._defaults.timezone; + tp_inst.hour = tp_inst._defaults.hour < tp_inst._defaults.hourMin? tp_inst._defaults.hourMin : + tp_inst._defaults.hour > tp_inst._defaults.hourMax? tp_inst._defaults.hourMax : tp_inst._defaults.hour; + tp_inst.minute = tp_inst._defaults.minute < tp_inst._defaults.minuteMin? tp_inst._defaults.minuteMin : + tp_inst._defaults.minute > tp_inst._defaults.minuteMax? tp_inst._defaults.minuteMax : tp_inst._defaults.minute; + tp_inst.second = tp_inst._defaults.second < tp_inst._defaults.secondMin? tp_inst._defaults.secondMin : + tp_inst._defaults.second > tp_inst._defaults.secondMax? tp_inst._defaults.secondMax : tp_inst._defaults.second; + tp_inst.millisec = tp_inst._defaults.millisec < tp_inst._defaults.millisecMin? tp_inst._defaults.millisecMin : + tp_inst._defaults.millisec > tp_inst._defaults.millisecMax? tp_inst._defaults.millisecMax : tp_inst._defaults.millisec; + tp_inst.ampm = ''; + tp_inst.$input = $input; + + if (o.altField) { + tp_inst.$altInput = $(o.altField).css({ + cursor: 'pointer' + }).focus(function() { + $input.trigger("focus"); + }); + } + + if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { + tp_inst._defaults.minDate = new Date(); + } + if (tp_inst._defaults.maxDate === 0 || tp_inst._defaults.maxDateTime === 0) { + tp_inst._defaults.maxDate = new Date(); + } + + // datepicker needs minDate/maxDate, timepicker needs minDateTime/maxDateTime.. + if (tp_inst._defaults.minDate !== undefined && tp_inst._defaults.minDate instanceof Date) { + tp_inst._defaults.minDateTime = new Date(tp_inst._defaults.minDate.getTime()); + } + if (tp_inst._defaults.minDateTime !== undefined && tp_inst._defaults.minDateTime instanceof Date) { + tp_inst._defaults.minDate = new Date(tp_inst._defaults.minDateTime.getTime()); + } + if (tp_inst._defaults.maxDate !== undefined && tp_inst._defaults.maxDate instanceof Date) { + tp_inst._defaults.maxDateTime = new Date(tp_inst._defaults.maxDate.getTime()); + } + if (tp_inst._defaults.maxDateTime !== undefined && tp_inst._defaults.maxDateTime instanceof Date) { + tp_inst._defaults.maxDate = new Date(tp_inst._defaults.maxDateTime.getTime()); + } + tp_inst.$input.bind('focus', function() { + tp_inst._onFocus(); + }); + + return tp_inst; + }, + + /* + * add our sliders to the calendar + */ + _addTimePicker: function(dp_inst) { + var currDT = (this.$altInput && this._defaults.altFieldTimeOnly) ? this.$input.val() + ' ' + this.$altInput.val() : this.$input.val(); + + this.timeDefined = this._parseTime(currDT); + this._limitMinMaxDateTime(dp_inst, false); + this._injectTimePicker(); + }, + + /* + * parse the time string from input value or _setTime + */ + _parseTime: function(timeString, withDate) { + if (!this.inst) { + this.inst = $.datepicker._getInst(this.$input[0]); + } + + if (withDate || !this._defaults.timeOnly) { + var dp_dateFormat = $.datepicker._get(this.inst, 'dateFormat'); + try { + var parseRes = parseDateTimeInternal(dp_dateFormat, this._defaults.timeFormat, timeString, $.datepicker._getFormatConfig(this.inst), this._defaults); + if (!parseRes.timeObj) { + return false; + } + $.extend(this, parseRes.timeObj); + } catch (err) { + $.timepicker.log("Error parsing the date/time string: " + err + + "\ndate/time string = " + timeString + + "\ntimeFormat = " + this._defaults.timeFormat + + "\ndateFormat = " + dp_dateFormat); + return false; + } + return true; + } else { + var timeObj = $.datepicker.parseTime(this._defaults.timeFormat, timeString, this._defaults); + if (!timeObj) { + return false; + } + $.extend(this, timeObj); + return true; + } + }, + + /* + * generate and inject html for timepicker into ui datepicker + */ + _injectTimePicker: function() { + var $dp = this.inst.dpDiv, + o = this.inst.settings, + tp_inst = this, + litem = '', + uitem = '', + max = {}, + gridSize = {}, + size = null, + i=0, + l=0; + + // Prevent displaying twice + if ($dp.find("div.ui-timepicker-div").length === 0 && o.showTimepicker) { + var noDisplay = ' style="display:none;"', + html = '
    ' + '
    ' + o.timeText + '
    ' + + '
    '; + + // Create the markup + for(i=0,l=this.units.length; i' + o[litem +'Text'] + '' + + '
    '; + + if (o['show'+uitem] && o[litem+'Grid'] > 0) { + html += '
    '; + + if(litem == 'hour'){ + for (var h = o[litem+'Min']; h <= max[litem]; h += parseInt(o[litem+'Grid'], 10)) { + gridSize[litem]++; + var tmph = $.datepicker.formatTime(useAmpm(o.pickerTimeFormat || o.timeFormat)? 'hht':'HH', {hour:h}, o); + html += ''; + } + } + else{ + for (var m = o[litem+'Min']; m <= max[litem]; m += parseInt(o[litem+'Grid'], 10)) { + gridSize[litem]++; + html += ''; + } + } + + html += '
    ' + tmph + '' + ((m < 10) ? '0' : '') + m + '
    '; + } + html += '
    '; + } + + // Timezone + html += '
    ' + o.timezoneText + '
    '; + html += '
    '; + + // Create the elements from string + html += '
    '; + var $tp = $(html); + + // if we only want time picker... + if (o.timeOnly === true) { + $tp.prepend('
    ' + '
    ' + o.timeOnlyTitle + '
    ' + '
    '); + $dp.find('.ui-datepicker-header, .ui-datepicker-calendar').hide(); + } + + // add sliders, adjust grids, add events + for(i=0,l=tp_inst.units.length; i 0) { + size = 100 * gridSize[litem] * o[litem+'Grid'] / (max[litem] - o[litem+'Min']); + $tp.find('.ui_tpicker_'+litem+' table').css({ + width: size + "%", + marginLeft: o.isRTL? '0' : ((size / (-2 * gridSize[litem])) + "%"), + marginRight: o.isRTL? ((size / (-2 * gridSize[litem])) + "%") : '0', + borderCollapse: 'collapse' + }).find("td").click(function(e){ + var $t = $(this), + h = $t.html(), + n = parseInt(h.replace(/[^0-9]/g),10), + ap = h.replace(/[^apm]/ig), + f = $t.data('for'); // loses scope, so we use data-for + + if(f == 'hour'){ + if(ap.indexOf('p') !== -1 && n < 12){ + n += 12; + } + else{ + if(ap.indexOf('a') !== -1 && n === 12){ + n = 0; + } + } + } + + tp_inst.control.value(tp_inst, tp_inst[f+'_slider'], litem, n); + + tp_inst._onTimeChange(); + tp_inst._onSelectHandler(); + }).css({ + cursor: 'pointer', + width: (100 / gridSize[litem]) + '%', + textAlign: 'center', + overflow: 'hidden' + }); + } // end if grid > 0 + } // end for loop + + // Add timezone options + this.timezone_select = $tp.find('.ui_tpicker_timezone').append('').find("select"); + $.fn.append.apply(this.timezone_select, + $.map(o.timezoneList, function(val, idx) { + return $("
      ",{"class":"ui-fancytree fancytree-container"}).appendTo(this.$div),this.$container=c,this.rootNode.ul=c[0],null==this.options.debugLevel&&(this.options.debugLevel=t.debugLevel),this.$container.attr("tabindex",this.options.tabbable?"0":"-1"),this.options.aria&&this.$container.attr("role","tree").attr("aria-multiselectable",!0)}if(a.ui&&a.ui.fancytree)return void a.ui.fancytree.warn("Fancytree: ignored duplicate include");e(a.ui,"Fancytree requires jQuery UI (http://jqueryui.com)");var s,t=null,u={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"},v="active expanded focus folder hideCheckbox lazy selected unselectable".split(" "),w={},x="expanded extraClasses folder hideCheckbox key lazy refKey selected title tooltip unselectable".split(" "),y={},z={active:!0,children:!0,data:!0,focus:!0};for(s=0;sb;b++)if(d[b].key===a)return d[b]}else{if("number"==typeof a)return this.children[a];if(a.parent===this)return a}return null},_setChildren:function(a){e(a&&(!this.children||0===this.children.length),"only init supported"),this.children=[];for(var b=0,c=a.length;c>b;b++)this.children.push(new q(this,a[b]))},addChildren:function(b,c){var d,f,g,h=null,i=[];for(a.isPlainObject(b)&&(b=[b]),this.children||(this.children=[]),d=0,f=b.length;f>d;d++)i.push(new q(this,b[d]));return h=i[0],null==c?this.children=this.children.concat(i):(c=this._findDirectChild(c),g=a.inArray(c,this.children),e(g>=0,"insertBefore must be an existing child"),this.children.splice.apply(this.children,[g,0].concat(i))),(!this.parent||this.parent.ul||this.tr)&&this.render(),3===this.tree.options.selectMode&&this.fixSelection3FromEndNodes(),h},addNode:function(a,b){switch((b===d||"over"===b)&&(b="child"),b){case"after":return this.getParent().addChildren(a,this.getNextSibling());case"before":return this.getParent().addChildren(a,this);case"firstChild":var c=this.children?this.children[0]:null;return this.addChildren(a,c);case"child":case"over":return this.addChildren(a)}e(!1,"Invalid mode: "+b)},appendSibling:function(a){return this.addNode(a,"after")},applyPatch:function(b){if(null===b)return this.remove(),k(this);var c,d,e,f={children:!0,expanded:!0,parent:!0};for(c in b)e=b[c],f[c]||a.isFunction(e)||(y[c]?this[c]=e:this.data[c]=e);return b.hasOwnProperty("children")&&(this.removeChildren(),b.children&&this._setChildren(b.children)),this.isVisible()&&(this.renderTitle(),this.renderStatus()),d=b.hasOwnProperty("expanded")?this.setExpanded(b.expanded):k(this)},collapseSiblings:function(){return this.tree._callHook("nodeCollapseSiblings",this)},copyTo:function(a,b,c){return a.addNode(this.toDict(!0,c),b)},countChildren:function(a){var b,c,d,e=this.children;if(!e)return 0;if(d=e.length,a!==!1)for(b=0,c=d;c>b;b++)d+=e[b].countChildren();return d},debug:function(){this.tree.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},discard:function(){return this.warn("FancytreeNode.discard() is deprecated since 2014-02-16. Use .resetLazy() instead."),this.resetLazy()},findAll:function(b){b=a.isFunction(b)?b:o(b);var c=[];return this.visit(function(a){b(a)&&c.push(a)}),c},findFirst:function(b){b=a.isFunction(b)?b:o(b);var c=null;return this.visit(function(a){return b(a)?(c=a,!1):void 0}),c},_changeSelectStatusAttrs:function(a){var b=!1;switch(a){case!1:b=this.selected||this.partsel,this.selected=!1,this.partsel=!1;break;case!0:b=!this.selected||!this.partsel,this.selected=!0,this.partsel=!0;break;case d:b=this.selected||!this.partsel,this.selected=!1,this.partsel=!0;break;default:e(!1,"invalid state: "+a)}return b&&this.renderStatus(),b},fixSelection3AfterClick:function(){var a=this.isSelected();this.visit(function(b){b._changeSelectStatusAttrs(a)}),this.fixSelection3FromEndNodes()},fixSelection3FromEndNodes:function(){function a(b){var c,e,f,g,h,i,j,k=b.children;if(k&&k.length){for(i=!0,j=!1,c=0,e=k.length;e>c;c++)f=k[c],g=a(f),g!==!1&&(j=!0),g!==!0&&(i=!1);h=i?!0:j?d:!1}else h=!!b.selected;return b._changeSelectStatusAttrs(h),h}e(3===this.tree.options.selectMode,"expected selectMode 3"),a(this),this.visitParents(function(a){var b,c,e,f,g=a.children,h=!0,i=!1;for(b=0,c=g.length;c>b;b++)e=g[b],(e.selected||e.partsel)&&(i=!0),e.unselectable||e.selected||(h=!1);f=h?!0:i?d:!1,a._changeSelectStatusAttrs(f)})},fromDict:function(b){for(var c in b)y[c]?this[c]=b[c]:"data"===c?a.extend(this.data,b.data):a.isFunction(b[c])||z[c]||(this.data[c]=b[c]);b.children&&(this.removeChildren(),this.addChildren(b.children)),this.renderTitle()},getChildren:function(){return this.hasChildren()===d?d:this.children},getFirstChild:function(){return this.children?this.children[0]:null},getIndex:function(){return a.inArray(this,this.parent.children)},getIndexHier:function(b){b=b||".";var c=[];return a.each(this.getParentList(!1,!0),function(a,b){c.push(b.getIndex()+1)}),c.join(b)},getKeyPath:function(a){var b=[],c=this.tree.options.keyPathSeparator;return this.visitParents(function(a){a.parent&&b.unshift(a.key)},!a),c+b.join(c)},getLastChild:function(){return this.children?this.children[this.children.length-1]:null},getLevel:function(){for(var a=0,b=this.parent;b;)a++,b=b.parent;return a},getNextSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=0,b=c.length-1;b>a;a++)if(c[a]===this)return c[a+1]}return null},getParent:function(){return this.parent},getParentList:function(a,b){for(var c=[],d=b?this:this.parent;d;)(a||d.parent)&&c.unshift(d),d=d.parent;return c},getPrevSibling:function(){if(this.parent){var a,b,c=this.parent.children;for(a=1,b=c.length;b>a;a++)if(c[a]===this)return c[a-1]}return null},hasChildren:function(){return this.lazy?null==this.children?d:0===this.children.length?!1:1===this.children.length&&this.children[0].isStatusNode()?d:!0:!(!this.children||!this.children.length)},hasFocus:function(){return this.tree.hasFocus()&&this.tree.focusNode===this},info:function(){this.tree.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},isActive:function(){return this.tree.activeNode===this},isChildOf:function(a){return this.parent&&this.parent===a},isDescendantOf:function(a){if(!a||a.tree!==this.tree)return!1;for(var b=this.parent;b;){if(b===a)return!0;b=b.parent}return!1},isExpanded:function(){return!!this.expanded},isFirstSibling:function(){var a=this.parent;return!a||a.children[0]===this},isFolder:function(){return!!this.folder},isLastSibling:function(){var a=this.parent;return!a||a.children[a.children.length-1]===this},isLazy:function(){return!!this.lazy},isLoaded:function(){return!this.lazy||this.hasChildren()!==d},isLoading:function(){return!!this._isLoading},isRoot:function(){return this.isRootNode()},isRootNode:function(){return this.tree.rootNode===this},isSelected:function(){return!!this.selected},isStatusNode:function(){return!!this.statusNodeType},isTopLevel:function(){return this.tree.rootNode===this.parent},isUndefined:function(){return this.hasChildren()===d},isVisible:function(){var a,b,c=this.getParentList(!1,!1);for(a=0,b=c.length;b>a;a++)if(!c[a].expanded)return!1;return!0},lazyLoad:function(a){return this.warn("FancytreeNode.lazyLoad() is deprecated since 2014-02-16. Use .load() instead."),this.load(a)},load:function(a){var b,c,d=this;return e(this.isLazy(),"load() requires a lazy node"),a||this.isUndefined()?(this.isLoaded()&&this.resetLazy(),c=this.tree._triggerNodeEvent("lazyLoad",this),c===!1?k(this):(e("boolean"!=typeof c,"lazyLoad event must return source in data.result"),b=this.tree._callHook("nodeLoadChildren",this,c),this.expanded&&b.always(function(){d.render()}),b)):k(this)},makeVisible:function(b){var c,d=this,e=[],f=new a.Deferred,g=this.getParentList(!1,!1),h=g.length,i=!(b&&b.noAnimation===!0),j=!(b&&b.scrollIntoView===!1);for(c=h-1;c>=0;c--)e.push(g[c].setExpanded(!0,b));return a.when.apply(a,e).done(function(){j?d.scrollIntoView(i).done(function(){f.resolve()}):f.resolve()}),f.promise()},moveTo:function(b,c,f){(c===d||"over"===c)&&(c="child");var g,h=this.parent,i="child"===c?b:b.parent;if(this!==b){if(!this.parent)throw"Cannot move system root";if(i.isDescendantOf(this))throw"Cannot move a node to its own descendant";if(1===this.parent.children.length){if(this.parent===i)return;this.parent.children=this.parent.lazy?[]:null,this.parent.expanded=!1}else g=a.inArray(this,this.parent.children),e(g>=0),this.parent.children.splice(g,1);if(this.parent=i,i.hasChildren())switch(c){case"child":i.children.push(this);break;case"before":g=a.inArray(b,i.children),e(g>=0),i.children.splice(g,0,this);break;case"after":g=a.inArray(b,i.children),e(g>=0),i.children.splice(g+1,0,this);break;default:throw"Invalid mode "+c}else i.children=[this];f&&b.visit(f,!0),this.tree!==b.tree&&(this.warn("Cross-tree moveTo is experimantal!"),this.visit(function(a){a.tree=b.tree},!0)),h.isDescendantOf(i)||h.render(),i.isDescendantOf(h)||i===h||i.render()}},navigate:function(b,c){function d(d){if(d){try{d.makeVisible()}catch(e){}return a(d.span).is(":visible")?c===!1?d.setFocus():d.setActive():(d.debug("Navigate: skipping hidden node"),void d.navigate(b,c))}}var e,f,g=!0,h=a.ui.keyCode,i=null;switch(b){case h.BACKSPACE:this.parent&&this.parent.parent&&d(this.parent);break;case h.LEFT:this.expanded?(this.setExpanded(!1),d(this)):this.parent&&this.parent.parent&&d(this.parent);break;case h.RIGHT:this.expanded||!this.children&&!this.lazy?this.children&&this.children.length&&d(this.children[0]):(this.setExpanded(),d(this));break;case h.UP:for(i=this.getPrevSibling();i&&!a(i.span).is(":visible");)i=i.getPrevSibling();for(;i&&i.expanded&&i.children&&i.children.length;)i=i.children[i.children.length-1];!i&&this.parent&&this.parent.parent&&(i=this.parent),d(i);break;case h.DOWN:if(this.expanded&&this.children&&this.children.length)i=this.children[0];else for(f=this.getParentList(!1,!0),e=f.length-1;e>=0;e--){for(i=f[e].getNextSibling();i&&!a(i.span).is(":visible");)i=i.getNextSibling();if(i)break}d(i);break;default:g=!1}},remove:function(){return this.parent.removeChild(this)},removeChild:function(a){return this.tree._callHook("nodeRemoveChild",this,a)},removeChildren:function(){return this.tree._callHook("nodeRemoveChildren",this)},render:function(a,b){return this.tree._callHook("nodeRender",this,a,b)},renderTitle:function(){return this.tree._callHook("nodeRenderTitle",this)},renderStatus:function(){return this.tree._callHook("nodeRenderStatus",this)},resetLazy:function(){this.removeChildren(),this.expanded=!1,this.lazy=!0,this.children=d,this.renderStatus()},scheduleAction:function(a,b){this.tree.timer&&clearTimeout(this.tree.timer),this.tree.timer=null;var c=this;switch(a){case"cancel":break;case"expand":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger expand"),c.setExpanded(!0)},b);break;case"activate":this.tree.timer=setTimeout(function(){c.tree.debug("setTimeout: trigger activate"),c.setActive(!0)},b);break;default:throw"Invalid mode "+a}},scrollIntoView:function(f,h){h!==d&&g(h)&&(this.warn("scrollIntoView() with 'topNode' option is deprecated since 2014-05-08. Use 'options.topNode' instead."),h={topNode:h});var i,j,k,l,m=a.extend({effects:f===!0?{duration:200,queue:!1}:f,scrollOfs:this.tree.options.scrollOfs,scrollParent:this.tree.options.scrollParent||this.tree.$container,topNode:null},h),n=new a.Deferred,o=this,p=a(this.span).height(),q=a(m.scrollParent),r=m.scrollOfs.top||0,s=m.scrollOfs.bottom||0,t=q.height(),u=q.scrollTop(),v=q,w=q[0]===b,x=m.topNode||null,y=null;return e(a(this.span).is(":visible"),"scrollIntoView node is invisible"),w?(j=a(this.span).offset().top,i=x&&x.span?a(x.span).offset().top:0,v=a("html,body")):(e(q[0]!==c&&q[0]!==c.body,"scrollParent should be an simple element or `window`, not document or body."),l=q.offset().top,j=a(this.span).offset().top-l+u,i=x?a(x.span).offset().top-l+u:0,k=Math.max(0,q.innerHeight()-q[0].clientHeight),t-=k),u+r>j?y=j-r:j+p>u+t-s&&(y=j+p-t+s,x&&(e(x.isRoot()||a(x.span).is(":visible"),"topNode must be visible"),y>i&&(y=i-r))),null!==y?m.effects?(m.effects.complete=function(){n.resolveWith(o)},v.stop(!0).animate({scrollTop:y},m.effects)):(v[0].scrollTop=y,n.resolveWith(this)):n.resolveWith(this),n.promise()},setActive:function(a,b){return this.tree._callHook("nodeSetActive",this,a,b)},setExpanded:function(a,b){return this.tree._callHook("nodeSetExpanded",this,a,b)},setFocus:function(a){return this.tree._callHook("nodeSetFocus",this,a)},setSelected:function(a){return this.tree._callHook("nodeSetSelected",this,a)},setStatus:function(a,b,c){return this.tree._callHook("nodeSetStatus",this,a,b,c)},setTitle:function(a){this.title=a,this.renderTitle()},sortChildren:function(a,b){var c,d,e=this.children;if(e){if(a=a||function(a,b){var c=a.title.toLowerCase(),d=b.title.toLowerCase();return c===d?0:c>d?1:-1},e.sort(a),b)for(c=0,d=e.length;d>c;c++)e[c].children&&e[c].sortChildren(a,"$norender$");"$norender$"!==b&&this.render()}},toDict:function(b,c){var d,e,f,g={},h=this;if(a.each(x,function(a,b){(h[b]||h[b]===!1)&&(g[b]=h[b])}),a.isEmptyObject(this.data)||(g.data=a.extend({},this.data),a.isEmptyObject(g.data)&&delete g.data),c&&c(g),b&&this.hasChildren())for(g.children=[],d=0,e=this.children.length;e>d;d++)f=this.children[d],f.isStatusNode()||g.children.push(f.toDict(!0,c));return g},toggleExpanded:function(){return this.tree._callHook("nodeToggleExpanded",this)},toggleSelected:function(){return this.tree._callHook("nodeToggleSelected",this)},toString:function(){return""},visit:function(a,b){var c,d,e=!0,f=this.children;if(b===!0&&(e=a(this),e===!1||"skip"===e))return e;if(f)for(c=0,d=f.length;d>c&&(e=f[c].visit(a,!0),e!==!1);c++);return e},visitAndLoad:function(b,c,d){var e,f,g,h=this;return b&&c===!0&&(f=b(h),f===!1||"skip"===f)?d?f:k():h.children||h.lazy?(e=new a.Deferred,g=[],h.load().done(function(){for(var c=0,d=h.children.length;d>c;c++){if(f=h.children[c].visitAndLoad(b,!0,!0),f===!1){e.reject();break}"skip"!==f&&g.push(f)}a.when.apply(this,g).then(function(){e.resolve()})}),e.promise()):k()},visitParents:function(a,b){if(b&&a(this)===!1)return!1;for(var c=this.parent;c;){if(a(c)===!1)return!1;c=c.parent}return!0},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},r.prototype={_makeHookContext:function(b,c,e){var f,g;return b.node!==d?(c&&b.originalEvent!==c&&a.error("invalid args"),f=b):b.tree?(g=b.tree,f={node:b,tree:g,widget:g.widget,options:g.widget.options,originalEvent:c}):b.widget?f={node:null,tree:b,widget:b.widget,options:b.widget.options,originalEvent:c}:a.error("invalid args"),e&&a.extend(f,e),f},_callHook:function(b,c){var d=this._makeHookContext(c),e=this[b],f=Array.prototype.slice.call(arguments,2);return a.isFunction(e)||a.error("_callHook('"+b+"') is not a function"),f.unshift(d),e.apply(this,f)},_requireExtension:function(b,c,d,f){d=!!d;var g=this._local.name,h=this.options.extensions,i=a.inArray(b,h)d;d++)f=b[d],e(2===f.length,"patchList must be an array of length-2-arrays"),g=f[0],h=f[1],i=null===g?this.rootNode:this.getNodeByKey(g),i?(c=new a.Deferred,k.push(c),i.applyPatch(h).always(m(c,i))):this.warn("could not find node with key '"+g+"'");return a.when.apply(a,k).promise()},count:function(){return this.rootNode.countChildren()},debug:function(){this.options.debugLevel>=2&&(Array.prototype.unshift.call(arguments,this.toString()),f("log",arguments))},findNextNode:function(b,c){var d=null,e=c.parent.children,f=null,g=function(a,b,c){var d,e,f=a.children,h=f.length,i=f[b];if(i&&c(i)===!1)return!1;if(i&&i.children&&i.expanded&&g(i,0,c)===!1)return!1;for(d=b+1;h>d;d++)if(g(a,d,c)===!1)return!1;return e=a.parent,e?g(e,e.children.indexOf(a)+1,c):g(a,0,c)};return b="string"==typeof b?p(b):b,c=c||this.getFirstChild(),g(c.parent,e.indexOf(c),function(e){return e===d?!1:(d=d||e,a(e.span).is(":visible")?b(e)&&(f=e,f!==c)?!1:void 0:void e.debug("quicksearch: skipping hidden node"))}),f},generateFormElements:function(b,c){var d,e=b!==!1?"ft_"+this._id+"[]":b,f=c!==!1?"ft_"+this._id+"_active":c,g="fancytree_result_"+this._id,h=a("#"+g);h.length?h.empty():h=a("
      ",{id:g}).hide().insertAfter(this.$container),e&&(d=this.getSelectedNodes(3===this.options.selectMode),a.each(d,function(b,c){h.append(a("",{type:"checkbox",name:e,value:c.key,checked:!0}))})),f&&this.activeNode&&h.append(a("",{type:"radio",name:f,value:this.activeNode.key,checked:!0}))},getActiveNode:function(){return this.activeNode},getFirstChild:function(){return this.rootNode.getFirstChild()},getFocusNode:function(){return this.focusNode},getNodeByKey:function(a,b){var d,e;return!b&&(d=c.getElementById(this.options.idPrefix+a))?d.ftnode?d.ftnode:null:(b=b||this.rootNode,e=null,b.visit(function(b){return b.key===a?(e=b,!1):void 0},!0),e)},getRootNode:function(){return this.rootNode},getSelectedNodes:function(a){var b=[];return this.rootNode.visit(function(c){return c.selected&&(b.push(c),a===!0)?"skip":void 0}),b},hasFocus:function(){return!!this._hasFocus},info:function(){this.options.debugLevel>=1&&(Array.prototype.unshift.call(arguments,this.toString()),f("info",arguments))},loadKeyPath:function(b,c,e){function f(a,b,d){c.call(r,b,"loading"),b.load().done(function(){r.loadKeyPath.call(r,l[a],c,b).always(m(d,r))}).fail(function(){r.warn("loadKeyPath: error loading: "+a+" (parent: "+o+")"),c.call(r,b,"error"),d.reject()})}var g,h,i,j,k,l,n,o,p,q=this.options.keyPathSeparator,r=this;for(a.isArray(b)||(b=[b]),l={},i=0;i"},_triggerNodeEvent:function(a,b,c,e){var f=this._makeHookContext(b,c,e),g=this.widget._trigger(a,c,f);return g!==!1&&f.result!==d?f.result:g},_triggerTreeEvent:function(a,b,c){var e=this._makeHookContext(this,b,c),f=this.widget._trigger(a,b,e);return f!==!1&&e.result!==d?e.result:f},visit:function(a){return this.rootNode.visit(a,!1)},warn:function(){Array.prototype.unshift.call(arguments,this.toString()),f("warn",arguments)}},a.extend(r.prototype,{nodeClick:function(a){var b,c,d=a.targetType,e=a.node;if("expander"===d)this._callHook("nodeToggleExpanded",a);else if("checkbox"===d)this._callHook("nodeToggleSelected",a),a.options.focusOnSelect&&this._callHook("nodeSetFocus",a,!0);else{if(c=!1,b=!0,e.folder)switch(a.options.clickFolderMode){case 2:c=!0,b=!1;break;case 3:b=!0,c=!0}b&&(this.nodeSetFocus(a),this._callHook("nodeSetActive",a,!0)),c&&this._callHook("nodeToggleExpanded",a)}},nodeCollapseSiblings:function(a,b){var c,d,e,f=a.node;if(f.parent)for(c=f.parent.children,d=0,e=c.length;e>d;d++)c[d]!==f&&c[d].expanded&&this._callHook("nodeSetExpanded",c[d],!1,b)},nodeDblclick:function(a){"title"===a.targetType&&4===a.options.clickFolderMode&&this._callHook("nodeToggleExpanded",a),"title"===a.targetType&&a.originalEvent.preventDefault()},nodeKeydown:function(b){var c,d,e,f=b.originalEvent,g=b.node,h=b.tree,i=b.options,j=f.which,k=String.fromCharCode(j),l=!(f.altKey||f.ctrlKey||f.metaKey||f.shiftKey),m=a(f.target),n=!0,o=!(f.ctrlKey||!i.autoActivate),p=a.ui.keyCode;if(g||(this.getFirstChild().setFocus(),g=b.node=this.focusNode,g.debug("Keydown force focus on first node")),i.quicksearch&&l&&/\w/.test(k)&&!m.is(":input:enabled"))return d=(new Date).getTime(),d-h.lastQuicksearchTime>500&&(h.lastQuicksearchTerm=""),h.lastQuicksearchTime=d,h.lastQuicksearchTerm+=k,c=h.findNextNode(h.lastQuicksearchTerm,h.getActiveNode()),c&&c.setActive(),void f.preventDefault();switch(j){case p.NUMPAD_ADD:case 187:h.nodeSetExpanded(b,!0);break;case p.NUMPAD_SUBTRACT:case 189:h.nodeSetExpanded(b,!1);break;case p.SPACE:i.checkbox?h.nodeToggleSelected(b):h.nodeSetActive(b,!0);break;case p.ENTER:h.nodeSetActive(b,!0);break;case p.BACKSPACE:case p.LEFT:case p.RIGHT:case p.UP:case p.DOWN:e=g.navigate(f.which,o);break;default:n=!1}n&&f.preventDefault()},nodeLoadChildren:function(b,c){var d,f,g,h=b.tree,i=b.node;return a.isFunction(c)&&(c=c()),c.url&&(d=a.extend({},b.options.ajax,c),d.debugDelay?(f=d.debugDelay,a.isArray(f)&&(f=f[0]+Math.random()*(f[1]-f[0])),i.debug("nodeLoadChildren waiting debug delay "+Math.round(f)+"ms"),d.debugDelay=!1,g=a.Deferred(function(b){setTimeout(function(){a.ajax(d).done(function(){b.resolveWith(this,arguments)}).fail(function(){b.rejectWith(this,arguments)})},f)})):g=a.ajax(d),c=new a.Deferred,g.done(function(d){var e,f;if("string"==typeof d&&a.error("Ajax request returned a string (did you get the JSON dataType wrong?)."),b.options.postProcess){if(f=h._triggerNodeEvent("postProcess",b,b.originalEvent,{response:d,error:null,dataType:this.dataType}),f.error)return e=a.isPlainObject(f.error)?f.error:{message:f.error},e=h._makeHookContext(i,null,e),void c.rejectWith(this,[e]);d=a.isArray(f)?f:d}else d&&d.hasOwnProperty("d")&&b.options.enableAspx&&(d="string"==typeof d.d?a.parseJSON(d.d):d.d);c.resolveWith(this,[d])}).fail(function(a,b,d){var e=h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:d,details:a.status+": "+d});c.rejectWith(this,[e])})),a.isFunction(c.promise)&&(e(!i.isLoading()),h.nodeSetStatus(b,"loading"),c.done(function(){h.nodeSetStatus(b,"ok")}).fail(function(a){var c;c=a.node&&a.error&&a.message?a:h._makeHookContext(i,null,{error:a,args:Array.prototype.slice.call(arguments),message:a?a.message||a.toString():""}),h._triggerNodeEvent("loadError",c,null)!==!1&&h.nodeSetStatus(b,"error",c.message,c.details)})),a.when(c).done(function(b){var c;a.isPlainObject(b)&&(e(a.isArray(b.children),"source must contain (or be) an array of children"),e(i.isRoot(),"source may only be an object for root nodes"),c=b,b=b.children,delete c.children,a.extend(h.data,c)),e(a.isArray(b),"expected array of children"),i._setChildren(b),h._triggerNodeEvent("loadChildren",i)})},nodeLoadKeyPath:function(){},nodeRemoveChild:function(b,c){var d,f=b.node,g=b.options,h=a.extend({},b,{node:c}),i=f.children;return 1===i.length?(e(c===i[0]),this.nodeRemoveChildren(b)):(this.activeNode&&(c===this.activeNode||this.activeNode.isDescendantOf(c))&&this.activeNode.setActive(!1),this.focusNode&&(c===this.focusNode||this.focusNode.isDescendantOf(c))&&(this.focusNode=null),this.nodeRemoveMarkup(h),this.nodeRemoveChildren(h),d=a.inArray(c,i),e(d>=0),c.visit(function(a){a.parent=null},!0),this._callHook("treeRegisterNode",this,!1,c),g.removeNode&&g.removeNode.call(b.tree,{type:"removeNode"},h),void i.splice(d,1))},nodeRemoveChildMarkup:function(b){var c=b.node;c.ul&&(c.isRoot()?a(c.ul).empty():(a(c.ul).remove(),c.ul=null),c.visit(function(a){a.li=a.ul=null}))},nodeRemoveChildren:function(b){var c,d=b.tree,e=b.node,f=e.children,g=b.options;f&&(this.activeNode&&this.activeNode.isDescendantOf(e)&&this.activeNode.setActive(!1),this.focusNode&&this.focusNode.isDescendantOf(e)&&(this.focusNode=null),this.nodeRemoveChildMarkup(b),c=a.extend({},b),e.visit(function(a){a.parent=null,d._callHook("treeRegisterNode",d,!1,a),g.removeNode&&(c.node=a,g.removeNode.call(b.tree,{type:"removeNode"},c))}),e.children=e.lazy?[]:null,this.nodeRenderStatus(b))},nodeRemoveMarkup:function(b){var c=b.node;c.li&&(a(c.li).remove(),c.li=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,d,f,g,h){var i,j,k,l,m,n,o,p=b.node,q=b.tree,r=b.options,s=r.aria,t=!1,u=p.parent,v=!u,w=p.children;if(v||u.ul){if(e(v||u.ul,"parent UL must exist"),v||(p.li&&(d||p.li.parentNode!==p.parent.ul)&&(p.li.parentNode!==p.parent.ul&&this.warn("unlink "+p+" (must be child of "+p.parent+")"),this.nodeRemoveMarkup(b)),p.li?this.nodeRenderStatus(b):(t=!0,p.li=c.createElement("li"),p.li.ftnode=p,p.key&&r.generateIds&&(p.li.id=r.idPrefix+p.key),p.span=c.createElement("span"),p.span.className="fancytree-node",s&&a(p.span).attr("aria-labelledby","ftal_"+p.key),p.li.appendChild(p.span),this.nodeRenderTitle(b),r.createNode&&r.createNode.call(q,{type:"createNode"},b)),r.renderNode&&r.renderNode.call(q,{type:"renderNode"},b)),w){if(v||p.expanded||f===!0){for(p.ul||(p.ul=c.createElement("ul"),(g===!0&&!h||!p.expanded)&&(p.ul.style.display="none"),s&&a(p.ul).attr("role","group"),p.li?p.li.appendChild(p.ul):p.tree.$div.append(p.ul)),l=0,m=w.length;m>l;l++)o=a.extend({},b,{node:w[l]}),this.nodeRender(o,d,f,!1,!0);for(i=p.ul.firstChild;i;)k=i.ftnode,k&&k.parent!==p?(p.debug("_fixParent: remove missing "+k,i),n=i.nextSibling,i.parentNode.removeChild(i),i=n):i=i.nextSibling;for(i=p.ul.firstChild,l=0,m=w.length-1;m>l;l++)j=w[l],k=i.ftnode,j!==k?p.ul.insertBefore(j.li,k.li):i=i.nextSibling}}else p.ul&&(this.warn("remove child markup for "+p),this.nodeRemoveChildMarkup(b));v||t&&u.ul.appendChild(p.li)}},nodeRenderTitle:function(a,b){var c,e,f,g,h,i,j=a.node,k=a.tree,l=a.options,m=l.aria,n=j.getLevel(),o=[],p=j.data.icon;b!==d&&(j.title=b),j.span&&(n1&&o.push(m?"":"")):o.push(m?"":""),l.checkbox&&j.hideCheckbox!==!0&&!j.isStatusNode()&&o.push(m?"":""),g=m?" role='img'":"",(p===!0||p!==!1&&l.icons!==!1)&&(p&&"string"==typeof p?(p="/"===p.charAt(0)?p:(l.imagePath||"")+p,o.push("")):(e=l.iconClass&&l.iconClass.call(k,j,a)||j.data.iconclass||null,o.push(e?"":""))),f="",l.renderTitle&&(f=l.renderTitle.call(k,{type:"renderTitle"},a)||""),f||(i=j.tooltip?" title='"+t.escapeHtml(j.tooltip)+"'":"",c=m?" id='ftal_"+j.key+"'":"",g=m?" role='treeitem'":"",h=l.titlesTabbable?" tabindex='0'":"",f=""+j.title+""),o.push(f),j.span.innerHTML=o.join(""),this.nodeRenderStatus(a))},nodeRenderStatus:function(b){var c=b.node,d=b.tree,e=b.options,f=c.hasChildren(),g=c.isLastSibling(),h=e.aria,i=a(c.span).find(".fancytree-title"),j=e._classNames,k=[],l=c[d.statusClassPropName];l&&(k.push(j.node),d.activeNode===c&&k.push(j.active),d.focusNode===c?(k.push(j.focused),h&&i.attr("aria-activedescendant",!0)):h&&i.removeAttr("aria-activedescendant"),c.expanded?(k.push(j.expanded),h&&i.attr("aria-expanded",!0)):h&&i.removeAttr("aria-expanded"),c.folder&&k.push(j.folder),f!==!1&&k.push(j.hasChildren),g&&k.push(j.lastsib),c.lazy&&null==c.children&&k.push(j.lazy),c.partsel&&k.push(j.partsel),c.unselectable&&k.push(j.unselectable),c._isLoading&&k.push(j.loading),c._error&&k.push(j.error),c.selected?(k.push(j.selected),h&&i.attr("aria-selected",!0)):h&&i.attr("aria-selected",!1),c.extraClasses&&k.push(c.extraClasses),k.push(f===!1?j.combinedExpanderPrefix+"n"+(g?"l":""):j.combinedExpanderPrefix+(c.expanded?"e":"c")+(c.lazy&&null==c.children?"d":"")+(g?"l":"")),k.push(j.combinedIconPrefix+(c.expanded?"e":"c")+(c.folder?"f":"")),l.className=k.join(" "),c.li&&(c.li.className=g?j.lastsib:"")) +},nodeSetActive:function(b,c,d){d=d||{};var f,g=b.node,h=b.tree,i=b.options,j=d.noEvents===!0,m=g===h.activeNode;return c=c!==!1,m===c?k(g):c&&!j&&this._triggerNodeEvent("beforeActivate",g,b.originalEvent)===!1?l(g,["rejected"]):void(c?(h.activeNode&&(e(h.activeNode!==g,"node was active (inconsistency)"),f=a.extend({},b,{node:h.activeNode}),h.nodeSetActive(f,!1),e(null===h.activeNode,"deactivate was out of sync?")),i.activeVisible&&g.makeVisible({scrollIntoView:!1}),h.activeNode=g,h.nodeRenderStatus(b),h.nodeSetFocus(b),j||h._triggerNodeEvent("activate",g,b.originalEvent)):(e(h.activeNode===g,"node was not active (inconsistency)"),h.activeNode=null,this.nodeRenderStatus(b),j||b.tree._triggerNodeEvent("deactivate",g,b.originalEvent)))},nodeSetExpanded:function(b,c,e){e=e||{};var f,g,h,i,j,m,n=b.node,o=b.tree,p=b.options,q=e.noAnimation===!0,r=e.noEvents===!0;if(c=c!==!1,n.expanded&&c||!n.expanded&&!c)return k(n);if(c&&!n.lazy&&!n.hasChildren())return k(n);if(!c&&n.getLevel()h;h++)this._callHook("nodeCollapseSiblings",j[h],e)}finally{p.autoCollapse=m}}return g.done(function(){c&&p.autoScroll&&!q?n.getLastChild().scrollIntoView(!0,{topNode:n}).always(function(){r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}):r||b.tree._triggerNodeEvent(c?"expand":"collapse",b)}),f=function(d){var e,f,g,h;if(n.expanded=c,o._callHook("nodeRender",b,!1,!1,!0),n.ul)if(g="none"!==n.ul.style.display,h=!!n.expanded,g===h)n.warn("nodeSetExpanded: UL.style.display already set");else{if(p.fx&&!q)return e=p.fx.duration||200,f=p.fx.easing,void a(n.ul).animate(p.fx,e,f,function(){d()});n.ul.style.display=n.expanded||!parent?"":"none"}d()},c&&n.lazy&&n.hasChildren()===d?n.load().done(function(){g.notifyWith&&g.notifyWith(n,["loaded"]),f(function(){g.resolveWith(n)})}).fail(function(a){f(function(){g.rejectWith(n,["load failed ("+a+")"])})}):f(function(){g.resolveWith(n)}),g.promise()},nodeSetFocus:function(b,c){var d,e=b.tree,f=b.node;if(c=c!==!1,e.focusNode){if(e.focusNode===f&&c)return;d=a.extend({},b,{node:e.focusNode}),e.focusNode=null,this._triggerNodeEvent("blur",d),this._callHook("nodeRenderStatus",d)}c&&(this.hasFocus()||(f.debug("nodeSetFocus: forcing container focus"),this._callHook("treeSetFocus",b,!0,!0)),f.makeVisible({scrollIntoView:!1}),e.focusNode=f,this._triggerNodeEvent("focus",b),b.options.autoScroll&&f.scrollIntoView(),this._callHook("nodeRenderStatus",b))},nodeSetSelected:function(a,b){var c=a.node,d=a.tree,e=a.options;if(b=b!==!1,c.debug("nodeSetSelected("+b+")",a),!c.unselectable){if(c.selected&&b||!c.selected&&!b)return!!c.selected;if(this._triggerNodeEvent("beforeSelect",c,a.originalEvent)===!1)return!!c.selected;b&&1===e.selectMode?d.lastSelectedNode&&d.lastSelectedNode.setSelected(!1):3===e.selectMode&&(c.selected=b,c.fixSelection3AfterClick()),c.selected=b,this.nodeRenderStatus(a),d.lastSelectedNode=b?c:null,d._triggerNodeEvent("select",a)}},nodeSetStatus:function(b,c,d,e){function f(){var a=h.children?h.children[0]:null;if(a&&a.isStatusNode()){try{h.ul&&(h.ul.removeChild(a.li),a.li=null)}catch(b){}1===h.children.length?h.children=[]:h.children.shift()}}function g(b,c){var d=h.children?h.children[0]:null;return d&&d.isStatusNode()?(a.extend(d,b),i._callHook("nodeRenderTitle",d)):(b.key="_statusNode",h._setChildren([b]),h.children[0].statusNodeType=c,i.render()),h.children[0]}var h=b.node,i=b.tree;switch(c){case"ok":f(),h._isLoading=!1,h._error=null,h.renderStatus();break;case"loading":h.parent||g({title:i.options.strings.loading+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-wait"},c),h._isLoading=!0,h._error=null,h.renderStatus();break;case"error":g({title:i.options.strings.loadError+(d?" ("+d+") ":""),tooltip:e,extraClasses:"fancytree-statusnode-error"},c),h._isLoading=!1,h._error={message:d,details:e},h.renderStatus();break;default:a.error("invalid node status "+c)}},nodeToggleExpanded:function(a){return this.nodeSetExpanded(a,!a.node.expanded)},nodeToggleSelected:function(a){return this.nodeSetSelected(a,!a.node.selected)},treeClear:function(a){var b=a.tree;b.activeNode=null,b.focusNode=null,b.$div.find(">ul.fancytree-container").empty(),b.rootNode.children=null},treeCreate:function(){},treeDestroy:function(){},treeInit:function(a){this.treeLoad(a)},treeLoad:function(b,c){var d,e,f,g=b.tree,h=b.widget.element,i=a.extend({},b,{node:this.rootNode});if(g.rootNode.children&&this.treeClear(b),c=c||this.options.source)"string"==typeof c&&a.error("Not implemented");else switch(d=h.data("type")||"html"){case"html":e=h.find(">ul:first"),e.addClass("ui-fancytree-source ui-helper-hidden"),c=a.ui.fancytree.parseHtml(e),this.data=a.extend(this.data,n(e));break;case"json":c=a.parseJSON(h.text()),c.children&&(c.title&&(g.title=c.title),c=c.children);break;default:a.error("Invalid data-type: "+d)}return f=this.nodeLoadChildren(i,c).done(function(){g.render(),3===b.options.selectMode&&g.rootNode.fixSelection3FromEndNodes(),g._triggerTreeEvent("init",null,{status:!0})}).fail(function(){g.render(),g._triggerTreeEvent("init",null,{status:!1})})},treeRegisterNode:function(){},treeSetFocus:function(a,b){b=b!==!1,b!==this.hasFocus()&&(this._hasFocus=b,this.$container.toggleClass("fancytree-treefocus",b),this._triggerTreeEvent(b?"focusTree":"blurTree"))}}),a.widget("ui.fancytree",{options:{activeVisible:!0,ajax:{type:"GET",cache:!1,dataType:"json"},aria:!1,autoActivate:!0,autoCollapse:!1,autoScroll:!1,checkbox:!1,clickFolderMode:4,debugLevel:null,disabled:!1,enableAspx:!0,extensions:[],fx:{height:"toggle",duration:200},generateIds:!1,icons:!0,idPrefix:"ft_",focusOnSelect:!1,keyboard:!0,keyPathSeparator:"/",minExpandLevel:1,quicksearch:!1,scrollOfs:{top:0,bottom:0},scrollParent:null,selectMode:2,strings:{loading:"Loading…",loadError:"Load error!"},tabbable:!0,titlesTabbable:!1,_classNames:{node:"fancytree-node",folder:"fancytree-folder",combinedExpanderPrefix:"fancytree-exp-",combinedIconPrefix:"fancytree-ico-",hasChildren:"fancytree-has-children",active:"fancytree-active",selected:"fancytree-selected",expanded:"fancytree-expanded",lazy:"fancytree-lazy",focused:"fancytree-focused",partsel:"fancytree-partsel",unselectable:"fancytree-unselectable",lastsib:"fancytree-lastsib",loading:"fancytree-loading",error:"fancytree-error"},lazyLoad:null,postProcess:null},_create:function(){this.tree=new r(this),this.$source=this.source||"json"===this.element.data("type")?this.element:this.element.find(">ul:first");var b,c,f,g=this.options.extensions,h=this.tree;for(f=0;f"),d&&a.Widget.prototype._setOption.apply(this,arguments),e&&this.tree.render(!0,!1)},destroy:function(){this._unbind(),this.tree._callHook("treeDestroy",this.tree),this.tree.$div.find(">ul.fancytree-container").remove(),this.$source&&this.$source.removeClass("ui-helper-hidden"),a.Widget.prototype.destroy.call(this)},_unbind:function(){var b=this.tree._ns;this.element.unbind(b),this.tree.$container.unbind(b),a(c).unbind(b)},_bind:function(){var a=this,b=this.options,c=this.tree,d=c._ns;this._unbind(),c.$container.on("focusin"+d+" focusout"+d,function(a){var b=t.getNode(a),d="focusin"===a.type;b?c._callHook("nodeSetFocus",b,d):c._callHook("treeSetFocus",c,d)}).on("selectstart"+d,"span.fancytree-title",function(a){a.preventDefault()}).on("keydown"+d,function(a){if(b.disabled||b.keyboard===!1)return!0;var d,e=c.focusNode,f=c._makeHookContext(e||c,a),g=c.phase;try{return c.phase="userEvent",d=e?c._triggerNodeEvent("keydown",e,a):c._triggerTreeEvent("keydown",a),"preventNav"===d?d=!0:d!==!1&&(d=c._callHook("nodeKeydown",f)),d}finally{c.phase=g}}).on("click"+d+" dblclick"+d,function(c){if(b.disabled)return!0;var d,e=t.getEventTarget(c),f=e.node,g=a.tree,h=g.phase;if(!f)return!0;d=g._makeHookContext(f,c);try{switch(g.phase="userEvent",c.type){case"click":return d.targetType=e.type,g._triggerNodeEvent("click",d,c)===!1?!1:g._callHook("nodeClick",d);case"dblclick":return d.targetType=e.type,g._triggerNodeEvent("dblclick",d,c)===!1?!1:g._callHook("nodeDblclick",d)}}finally{g.phase=h}})},getActiveNode:function(){return this.tree.activeNode},getNodeByKey:function(a){return this.tree.getNodeByKey(a)},getRootNode:function(){return this.tree.rootNode},getTree:function(){return this.tree}}),t=a.ui.fancytree,a.extend(a.ui.fancytree,{version:"2.6.0",buildType: "production",debugLevel: 1,_nextId:1,_nextNodeKey:1,_extensions:{},_FancytreeClass:r,_FancytreeNodeClass:q,jquerySupports:{positionMyOfs:h(a.ui.version,1,9)},assert:function(a,b){return e(a,b)},debounce:function(a,b,c,d){var e;return 3===arguments.length&&"boolean"!=typeof c&&(d=c,c=!1),function(){var f=arguments;d=d||this,c&&!e&&b.apply(d,f),clearTimeout(e),e=setTimeout(function(){c||b.apply(d,f),e=null},a)}},debug:function(){a.ui.fancytree.debugLevel>=2&&f("log",arguments)},error:function(){f("error",arguments)},escapeHtml:function(a){return(""+a).replace(/[&<>"'\/]/g,function(a){return u[a]})},unescapeHtml:function(a){var b=c.createElement("div");return b.innerHTML=a,0===b.childNodes.length?"":b.childNodes[0].nodeValue},getEventTargetType:function(a){return this.getEventTarget(a).type},getEventTarget:function(b){var c=b&&b.target?b.target.className:"",e={node:this.getNode(b.target),type:d};return/\bfancytree-title\b/.test(c)?e.type="title":/\bfancytree-expander\b/.test(c)?e.type=e.node.hasChildren()===!1?"prefix":"expander":/\bfancytree-checkbox\b/.test(c)||/\bfancytree-radio\b/.test(c)?e.type="checkbox":/\bfancytree-icon\b/.test(c)?e.type="icon":/\bfancytree-node\b/.test(c)?e.type="title":b&&b.target&&a(b.target).closest(".fancytree-title").length&&(e.type="title"),e},getNode:function(a){if(a instanceof q)return a;for(a.selector!==d?a=a[0]:a.originalEvent!==d&&(a=a.target);a;){if(a.ftnode)return a.ftnode;a=a.parentNode}return null},info:function(){a.ui.fancytree.debugLevel>=1&&f("info",arguments)},parseHtml:function(b){var c,e,f,g,h,i,j,k,l=b.find(">li"),m=[];return l.each(function(){var l,o=a(this),p=o.find(">span:first",this),q=p.length?null:o.find(">a:first"),r={tooltip:null,data:{}};for(p.length?r.title=p.html():q&&q.length?(r.title=q.html(),r.data.href=q.attr("href"),r.data.target=q.attr("target"),r.tooltip=q.attr("title")):(r.title=o.html(),g=r.title.search(/
        =0&&(r.title=r.title.substring(0,g))),r.title=a.trim(r.title),e=0,f=v.length;f>e;e++)r[v[e]]=d;for(j=this.className.split(" "),c=[],e=0,f=j.length;f>e;e++)k=j[e],w[k]?r[k]=!0:c.push(k);if(r.extraClasses=c.join(" "),h=o.attr("title"),h&&(r.tooltip=h),h=o.attr("id"),h&&(r.key=h),l=n(o),l&&!a.isEmptyObject(l)){for(e=0,f=x.length;f>e;e++)h=x[e],i=l[h],null!=i&&(delete l[h],r[h]=i);a.extend(r.data,l)}b=o.find(">ul:first"),r.children=b.length?a.ui.fancytree.parseHtml(b):r.lazy?d:null,m.push(r)}),m},registerExtension:function(b){e(null!=b.name,"extensions must have a `name` property."),e(null!=b.version,"extensions must have a `version` property."),a.ui.fancytree._extensions[b.name]=b},warn:function(){f("warn",arguments)}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.childcounter.min.js' */ +!function(a){"use strict";a.ui.fancytree._FancytreeClass.prototype.countSelected=function(a){{var b=this;b.options}return b.getSelectedNodes(a).length},a.ui.fancytree._FancytreeNodeClass.prototype.toUpper=function(){var a=this;return a.setTitle(a.title.toUpperCase())},a.ui.fancytree.prototype.widgetMethod1=function(a){this.tree;return a},a.ui.fancytree.registerExtension({name:"childcounter",version:"1.0.0",options:{deep:!0,hideZeros:!0,hideExpanded:!1},foo:42,_appendCounter:function(){},treeInit:function(a){a.options,a.options.childcounter;this._super(a),this.$container.addClass("fancytree-ext-childcounter")},treeDestroy:function(a){this._super(a)},nodeRenderTitle:function(b,c){var d=b.node,e=b.options.childcounter,f=null==d.data.childCounter?d.countChildren(e.deep):+d.data.childCounter;this._super(b,c),!f&&e.hideZeros||d.isExpanded()&&e.hideExpanded||a("span.fancytree-icon",d.span).append(a("").text(f))},nodeSetExpanded:function(a,b,c){{var d=a.tree;a.node}return this._super(a,b,c).always(function(){d.nodeRenderTitle(a)})}})}(jQuery); + +/*! Extension 'jquery.fancytree.clones.min.js' */ +!function(a){"use strict";function b(b,c){b||(c=c?": "+c:"",a.error("Assertion failed"+c))}function c(a,b){var c;for(c=a.length-1;c>=0;c--)if(a[c]===b)return a.splice(c,1),!0;return!1}function d(a,b,c){for(var d,e,f=3&a.length,g=a.length-f,h=c,i=3432918353,j=461845907,k=0;g>k;)e=255&a.charCodeAt(k)|(255&a.charCodeAt(++k))<<8|(255&a.charCodeAt(++k))<<16|(255&a.charCodeAt(++k))<<24,++k,e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e,h=h<<13|h>>>19,d=5*(65535&h)+((5*(h>>>16)&65535)<<16)&4294967295,h=(65535&d)+27492+(((d>>>16)+58964&65535)<<16);switch(e=0,f){case 3:e^=(255&a.charCodeAt(k+2))<<16;case 2:e^=(255&a.charCodeAt(k+1))<<8;case 1:e^=255&a.charCodeAt(k),e=(65535&e)*i+(((e>>>16)*i&65535)<<16)&4294967295,e=e<<15|e>>>17,e=(65535&e)*j+(((e>>>16)*j&65535)<<16)&4294967295,h^=e}return h^=a.length,h^=h>>>16,h=2246822507*(65535&h)+((2246822507*(h>>>16)&65535)<<16)&4294967295,h^=h>>>13,h=3266489909*(65535&h)+((3266489909*(h>>>16)&65535)<<16)&4294967295,h^=h>>>16,b?("0000000"+(h>>>0).toString(16)).substr(-8):h>>>0}function e(b){var c,e=a.map(b.getParentList(!1,!0),function(a){return a.refKey||a.key});return e=e.join("/"),c="id_"+d(e,!0)}a.ui.fancytree._FancytreeNodeClass.prototype.getCloneList=function(b){var c,d=this.tree,e=d.refMap[this.refKey]||null,f=d.keyMap;return e&&(c=this.key,b?e=a.map(e,function(a){return f[a]}):(e=a.map(e,function(a){return a===c?null:f[a]}),e.length<1&&(e=null))),e},a.ui.fancytree._FancytreeNodeClass.prototype.isClone=function(){var a=this.refKey||null,b=a&&this.tree.refMap[a]||null;return!!(b&&b.length>1)},a.ui.fancytree._FancytreeNodeClass.prototype.reRegister=function(b,c){b=null==b?null:""+b,c=null==c?null:""+c;var d=this.tree,e=this.key,f=this.refKey,g=d.keyMap,h=d.refMap,i=h[f]||null,j=!1;return null!=b&&b!==this.key&&(g[b]&&a.error("[ext-clones] reRegister("+b+"): already exists: "+this),delete g[e],g[b]=this,i&&(h[f]=a.map(i,function(a){return a===e?b:a})),this.key=b,j=!0),null!=c&&c!==this.refKey&&(i&&(1===i.length?delete h[f]:h[f]=a.map(i,function(a){return a===e?null:a})),h[c]?h[c].append(b):h[c]=[this.key],this.refKey=c,j=!0),j},a.ui.fancytree._FancytreeClass.prototype.getNodesByRef=function(b,c){var d=this.keyMap,e=this.refMap[b]||null;return e&&(e=c?a.map(e,function(a){var b=d[a];return b.isDescendantOf(c)?b:null}):a.map(e,function(a){return d[a]}),e.length<1&&(e=null)),e},a.ui.fancytree._FancytreeClass.prototype.changeRefKey=function(a,b){var c,d,e=this.keyMap,f=this.refMap[a]||null;if(f){for(c=0;c=h?(b(1===h),b(g[0]===l),delete k[m]):(c(g,l),2===h&&d.options.clones.highlightClones&&j[g[0]].renderStatus())))),this._super(d,e,f))},nodeRenderStatus:function(b){var c,d,e=b.node;return d=this._super(b),b.options.clones.highlightClones&&(c=a(e[b.tree.statusClassPropName]),c.length&&e.isClone()&&c.addClass("fancytree-clone")),d},nodeSetActive:function(b,c){var d,e=b.tree.statusClassPropName,f=b.node;return d=this._super(b,c),b.options.clones.highlightActiveClones&&f.isClone()&&a.each(f.getCloneList(!0),function(b,d){a(d[e]).toggleClass("fancytree-active-clone",c!==!1)}),d}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.dnd.min.js' */ +!function(a,b,c,d){"use strict";function e(a){return 0===a?"":a>0?"+"+a:""+a}function f(b){var c=b.options.dnd||null;c&&g(),c&&c.dragStart&&b.widget.element.draggable(a.extend({addClasses:!1,appendTo:b.$container,containment:!1,delay:0,distance:4,revert:!1,scroll:!0,scrollSpeed:7,scrollSensitivity:10,connectToFancytree:!0,helper:function(b){var c,d=a.ui.fancytree.getNode(b.target),e=a(d.span);return d?(c=a("
        ").css({zIndex:3,position:"relative"}).append(e.find("span.fancytree-title").clone()),c.data("ftSourceNode",d),c):"
        ERROR?: helper requested but sourceNode not found
        "},start:function(a,b){var c=b.helper.data("ftSourceNode");return!!c}},b.options.dnd.draggable)),c&&c.dragDrop&&b.widget.element.droppable(a.extend({addClasses:!1,tolerance:"intersect",greedy:!1},b.options.dnd.droppable))}function g(){h||(a.ui.plugin.add("draggable","connectToFancytree",{start:function(b,c){var d=a(this).data("ui-draggable")||a(this).data("draggable"),e=c.helper.data("ftSourceNode")||null;return e?(d.offset.click.top=-2,d.offset.click.left=16,e.tree.ext.dnd._onDragEvent("start",e,null,b,c,d)):void 0},drag:function(b,c){var d,e,f=a(this).data("ui-draggable")||a(this).data("draggable"),g=c.helper.data("ftSourceNode")||null,h=c.helper.data("ftTargetNode")||null,i=a.ui.fancytree.getNode(b.target);return b.target&&!i&&(d=a(b.target).closest("div.fancytree-drag-helper,#fancytree-drop-marker").length>0)?(e=g||h||a.ui.fancytree,void e.debug("Drag event over helper: ignored.")):(c.helper.data("ftTargetNode",i),h&&h!==i&&h.tree.ext.dnd._onDragEvent("leave",h,g,b,c,f),void(i&&i.tree.options.dnd.dragDrop&&(i===h?i.tree.ext.dnd._onDragEvent("over",i,g,b,c,f):i.tree.ext.dnd._onDragEvent("enter",i,g,b,c,f))))},stop:function(b,c){var d,e=a(this).data("ui-draggable")||a(this).data("draggable"),f=c.helper.data("ftSourceNode")||null,g=c.helper.data("ftTargetNode")||null,h=b.type,i="mouseup"===h&&1===b.which;i||(d=f||g||a.ui.fancytree,d.debug("Drag was cancelled")),g&&(i&&g.tree.ext.dnd._onDragEvent("drop",g,f,b,c,e),g.tree.ext.dnd._onDragEvent("leave",g,f,b,c,e)),f&&f.tree.ext.dnd._onDragEvent("stop",f,null,b,c,e)}}),h=!0)}var h=!1;a.ui.fancytree.registerExtension({name:"dnd",version:"0.1.0",options:{autoExpandMS:1e3,draggable:null,droppable:null,focusOnClick:!1,preventVoidMoves:!0,preventRecursiveMoves:!0,dragStart:null,dragStop:null,dragEnter:null,dragOver:null,dragDrop:null,dragLeave:null},treeInit:function(b){var c=b.tree;this._super(b),c.options.dnd.dragStart&&c.$container.on("mousedown",function(d){if(!c.hasFocus()&&b.options.dnd.focusOnClick){var e=a.ui.fancytree.getNode(d);e.debug("Re-enable focus that was prevented by jQuery UI draggable."),setTimeout(function(){a(d.target).closest(":tabbable").focus()},10)}}),f(c)},nodeKeydown:function(b){var c=b.originalEvent;return c.which===a.ui.keyCode.ESCAPE&&this._local._cancelDrag(),this._super(b)},nodeClick:function(a){return this._super(a)},_setDndStatus:function(b,c,d,f,g){var h,i=0,j="center",k=this._local,l=b?a(b.span):null,m=a(c.span);if(k.$dropMarker||(k.$dropMarker=a("
        ").hide().css({"z-index":1e3}).prependTo(a(this.$div).parent())),"after"===f||"before"===f||"over"===f){switch(f){case"before":k.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-over").addClass("fancytree-drop-before"),j="top";break;case"after":k.$dropMarker.removeClass("fancytree-drop-before fancytree-drop-over").addClass("fancytree-drop-after"),j="bottom";break;default:k.$dropMarker.removeClass("fancytree-drop-after fancytree-drop-before").addClass("fancytree-drop-over"),m.addClass("fancytree-drop-target"),i=8}h=a.ui.fancytree.jquerySupports.positionMyOfs?{my:"left"+e(i)+" center",at:"left "+j,of:m}:{my:"left center",at:"left "+j,of:m,offset:""+i+" 0"},k.$dropMarker.show().position(h)}else m.removeClass("fancytree-drop-target"),k.$dropMarker.hide();"after"===f?m.addClass("fancytree-drop-after"):m.removeClass("fancytree-drop-after"),"before"===f?m.addClass("fancytree-drop-before"):m.removeClass("fancytree-drop-before"),g===!0?(l&&l.addClass("fancytree-drop-accept"),m.addClass("fancytree-drop-accept"),d.addClass("fancytree-drop-accept")):(l&&l.removeClass("fancytree-drop-accept"),m.removeClass("fancytree-drop-accept"),d.removeClass("fancytree-drop-accept")),g===!1?(l&&l.addClass("fancytree-drop-reject"),m.addClass("fancytree-drop-reject"),d.addClass("fancytree-drop-reject")):(l&&l.removeClass("fancytree-drop-reject"),m.removeClass("fancytree-drop-reject"),d.removeClass("fancytree-drop-reject"))},_onDragEvent:function(b,c,e,f,g,h){"over"!==b&&this.debug("tree.ext.dnd._onDragEvent(%s, %o, %o) - %o",b,c,e,this);var i,j,k,l,m,n,o=this.options,p=o.dnd,q=this._makeHookContext(c,f,{otherNode:e,ui:g,draggable:h}),r=null,s=a(c.span);switch(b){case"start":c.isStatusNode()?r=!1:p.dragStart&&(r=p.dragStart(c,q)),r===!1?(this.debug("tree.dragStart() cancelled"),g.helper.trigger("mouseup").hide()):s.addClass("fancytree-drag-source");break;case"enter":n=p.preventRecursiveMoves&&c.isDescendantOf(e)?!1:p.dragEnter?p.dragEnter(c,q):null,r=n?a.isArray(n)?{over:a.inArray("over",n)>=0,before:a.inArray("before",n)>=0,after:a.inArray("after",n)>=0}:{over:n===!0||"over"===n,before:n===!0||"before"===n,after:n===!0||"after"===n}:!1,g.helper.data("enterResponse",r),this.debug("helper.enterResponse: %o",r);break;case"over":l=g.helper.data("enterResponse"),m=null,l===!1||("string"==typeof l?m=l:(i=s.offset(),j={x:f.pageX-i.left,y:f.pageY-i.top},k={x:j.x/s.width(),y:j.y/s.height()},l.after&&k.y>.75?m="after":!l.over&&l.after&&k.y>.5?m="after":l.before&&k.y<=.25?m="before":!l.over&&l.before&&k.y<=.5?m="before":l.over&&(m="over"),p.preventVoidMoves&&(c===e?(this.debug(" drop over source node prevented"),m=null):"before"===m&&e&&c===e.getNextSibling()?(this.debug(" drop after source node prevented"),m=null):"after"===m&&e&&c===e.getPrevSibling()?(this.debug(" drop before source node prevented"),m=null):"over"===m&&e&&e.parent===c&&e.isLastSibling()&&(this.debug(" drop last child over own parent prevented"),m=null)),g.helper.data("hitMode",m))),"over"===m&&p.autoExpandMS&&c.hasChildren()!==!1&&!c.expanded&&c.scheduleAction("expand",p.autoExpandMS),m&&p.dragOver&&(q.hitMode=m,r=p.dragOver(c,q)),this._local._setDndStatus(e,c,g.helper,m,r!==!1&&null!==m);break;case"drop":m=g.helper.data("hitMode"),m&&p.dragDrop&&(q.hitMode=m,p.dragDrop(c,q));break;case"leave":c.scheduleAction("cancel"),g.helper.data("enterResponse",null),g.helper.data("hitMode",null),this._local._setDndStatus(e,c,g.helper,"out",d),p.dragLeave&&p.dragLeave(c,q);break;case"stop":s.removeClass("fancytree-drag-source"),p.dragStop&&p.dragStop(c,q);break;default:a.error("Unsupported drag event: "+b)}return r},_cancelDrag:function(){var b=a.ui.ddmanager.current;b&&b.cancel()}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.edit.min.js' */ +!function(a,b,c){"use strict";var d=/Mac/.test(navigator.platform),e=a.ui.fancytree.escapeHtml,f=a.ui.fancytree.unescapeHtml;a.ui.fancytree._FancytreeNodeClass.prototype.editStart=function(){var b,d=this,e=this.tree,g=e.ext.edit,h=e.options.edit,i=a(".fancytree-title",d.span),j={node:d,tree:e,options:e.options,isNew:a(d.span).hasClass("fancytree-edit-new"),orgTitle:d.title,input:null,dirty:!1};return h.beforeEdit.call(d,{type:"beforeEdit"},j)===!1?!1:(a.ui.fancytree.assert(!g.currentNode,"recursive edit"),g.currentNode=this,g.eventData=j,e.widget._unbind(),a(c).on("mousedown.fancytree-edit",function(b){a(b.target).hasClass("fancytree-edit-input")||d.editEnd(!0,b)}),b=a("",{"class":"fancytree-edit-input",type:"text",value:f(j.orgTitle)}),g.eventData.input=b,null!=h.adjustWidthOfs&&b.width(i.width()+h.adjustWidthOfs),null!=h.inputCss&&b.css(h.inputCss),i.html(b),b.focus().change(function(){b.addClass("fancytree-edit-dirty")}).keydown(function(b){switch(b.which){case a.ui.keyCode.ESCAPE:d.editEnd(!1,b);break;case a.ui.keyCode.ENTER:return d.editEnd(!0,b),!1}b.stopPropagation()}).blur(function(a){return d.editEnd(!0,a)}),void h.edit.call(d,{type:"edit"},j))},a.ui.fancytree._FancytreeNodeClass.prototype.editEnd=function(b){var d,f=this,g=this.tree,h=g.ext.edit,i=h.eventData,j=g.options.edit,k=a(".fancytree-title",f.span),l=k.find("input.fancytree-edit-input");return j.trim&&l.val(a.trim(l.val())),d=l.val(),i.dirty=d!==f.title,i.save=b===!1?!1:i.isNew?""!==d:i.dirty&&""!==d,j.beforeClose.call(f,{type:"beforeClose"},i)===!1?!1:i.save&&j.save.call(f,{type:"save"},i)===!1?!1:(l.removeClass("fancytree-edit-dirty").unbind(),a(c).off(".fancytree-edit"),i.save?(f.setTitle(e(d)),f.setFocus()):i.isNew?(f.remove(),f=i.node=null,h.relatedNode.setFocus()):(f.renderTitle(),f.setFocus()),h.eventData=null,h.currentNode=null,h.relatedNode=null,g.widget._bind(),a(g.$container).focus(),i.input=null,j.close.call(f,{type:"close"},i),!0)},a.ui.fancytree._FancytreeNodeClass.prototype.editCreateNode=function(b,c){var d,e=this;return b=b||"child",null==c?c={title:""}:"string"==typeof c?c={title:c}:a.ui.fancytree.assert(a.isPlainObject(c)),"child"!==b||this.isExpanded()||this.hasChildren()===!1?(d=this.addNode(c,b),d.makeVisible(),a(d.span).addClass("fancytree-edit-new"),this.tree.ext.edit.relatedNode=this,void d.editStart()):void this.setExpanded().done(function(){e.editCreateNode(b,c)})},a.ui.fancytree._FancytreeClass.prototype.isEditing=function(){return this.ext.edit.currentNode},a.ui.fancytree._FancytreeNodeClass.prototype.isEditing=function(){return this.tree.ext.edit.currentNode===this},a.ui.fancytree.registerExtension({name:"edit",version:"0.2.0",options:{adjustWidthOfs:4,allowEmpty:!1,inputCss:{minWidth:"3em"},triggerCancel:["esc","tab","click"],triggerStart:["f2","shift+click","mac+enter"],trim:!0,beforeClose:a.noop,beforeEdit:a.noop,close:a.noop,edit:a.noop,save:a.noop},currentNode:null,treeInit:function(a){this._super(a),this.$container.addClass("fancytree-ext-edit")},nodeClick:function(b){return a.inArray("shift+click",b.options.edit.triggerStart)>=0&&b.originalEvent.shiftKey?(b.node.editStart(),!1):this._super(b)},nodeDblclick:function(b){return a.inArray("dblclick",b.options.edit.triggerStart)>=0?(b.node.editStart(),!1):this._super(b)},nodeKeydown:function(b){switch(b.originalEvent.which){case 113:if(a.inArray("f2",b.options.edit.triggerStart)>=0)return b.node.editStart(),!1;break;case a.ui.keyCode.ENTER:if(a.inArray("mac+enter",b.options.edit.triggerStart)>=0&&d)return b.node.editStart(),!1}return this._super(b)}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.filter.min.js' */ +!function(a){"use strict";function b(a){return(a+"").replace(/([.?*+\^\$\[\]\\(){}|-])/g,"\\$1")}a.ui.fancytree._FancytreeClass.prototype._applyFilterImpl=function(a,c,d){var e,f,g=0,h="hide"===this.options.filter.mode;return d=!!d&&!c,"string"==typeof a&&(e=b(a),f=new RegExp(".*"+e+".*","i"),a=function(a){return!!f.exec(a.title)}),this.enableFilter=!0,this.lastFilterArgs=arguments,this.$div.addClass("fancytree-ext-filter"),this.$div.addClass(h?"fancytree-ext-filter-hide":"fancytree-ext-filter-dimm"),this.visit(function(a){delete a.match,delete a.subMatch}),this.visit(function(b){return d&&null!=b.children||!a(b)||(g++,b.match=!0,b.visitParents(function(a){a.subMatch=!0}),!c)?void 0:(b.visit(function(a){a.match=!0}),"skip")}),this.render(),g},a.ui.fancytree._FancytreeClass.prototype.filterNodes=function(a,b){return this._applyFilterImpl(a,!1,b)},a.ui.fancytree._FancytreeClass.prototype.applyFilter=function(){return this.warn("Fancytree.applyFilter() is deprecated since 2014-05-10. Use .filterNodes() instead."),this.filterNodes.apply(this,arguments)},a.ui.fancytree._FancytreeClass.prototype.filterBranches=function(a){return this._applyFilterImpl(a,!0,null)},a.ui.fancytree._FancytreeClass.prototype.clearFilter=function(){this.visit(function(a){delete a.match,delete a.subMatch}),this.enableFilter=!1,this.lastFilterArgs=null,this.$div.removeClass("fancytree-ext-filter fancytree-ext-filter-dimm fancytree-ext-filter-hide"),this.render()},a.ui.fancytree.registerExtension({name:"filter",version:"0.3.0",options:{autoApply:!0,mode:"dimm"},treeInit:function(a){this._super(a)},nodeLoadChildren:function(a,b){return this._super(a,b).done(function(){a.tree.enableFilter&&a.tree.lastFilterArgs&&a.options.filter.autoApply&&a.tree._applyFilterImpl.apply(a.tree,a.tree.lastFilterArgs)})},nodeRenderStatus:function(b){var c,d=b.node,e=b.tree,f=a(d[e.statusClassPropName]);return c=this._super(b),f.length&&e.enableFilter?(f.toggleClass("fancytree-match",!!d.match).toggleClass("fancytree-submatch",!!d.subMatch).toggleClass("fancytree-hide",!(d.match||d.subMatch)),c):c}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.glyph.min.js' */ +!function(a){"use strict";function b(a,b){return a.map[b]}a.ui.fancytree.registerExtension({name:"glyph",version:"0.2.0",options:{map:{checkbox:"icon-check-empty",checkboxSelected:"icon-check",checkboxUnknown:"icon-check icon-muted",error:"icon-exclamation-sign",expanderClosed:"icon-caret-right",expanderLazy:"icon-angle-right",expanderOpen:"icon-caret-down",doc:"icon-file-alt",noExpander:"",docOpen:"icon-file-alt",loading:"icon-refresh icon-spin",folder:"icon-folder-close-alt",folderOpen:"icon-folder-open-alt"}},treeInit:function(a){var b=a.tree;this._super(a),b.$container.addClass("fancytree-ext-glyph")},nodeRenderStatus:function(c){var d,e,f=c.node,g=a(f.span),h=c.options.glyph,i=h.map;this._super(c),f.isRoot()||(e=g.children("span.fancytree-expander").get(0),e&&(d=f.isLoading()?"loading":f.expanded?"expanderOpen":f.isUndefined()?"expanderLazy":f.hasChildren()?"expanderClosed":"noExpander",e.className="fancytree-expander "+i[d]),e=f.tr?a("td",f.tr).children("span.fancytree-checkbox").get(0):g.children("span.fancytree-checkbox").get(0),e&&(d=f.selected?"checkboxSelected":f.partsel?"checkboxUnknown":"checkbox",e.className="fancytree-checkbox "+i[d]),e=g.children("span.fancytree-icon").get(0),e&&(d=f.folder?f.expanded?b(h,"folderOpen"):b(h,"folder"):f.expanded?b(h,"docOpen"):b(h,"doc"),e.className="fancytree-icon "+d))},nodeSetStatus:function(c,d,e,f){var g,h=c.options.glyph,i=c.node;this._super(c,d,e,f),g=i.parent?a("span.fancytree-expander",i.span).get(0):a(".fancytree-statusnode-wait, .fancytree-statusnode-error",i[this.nodeContainerAttrName]).find("span.fancytree-expander").get(0),"loading"===d?g.className="fancytree-expander "+b(h,"loading"):"error"===d&&(g.className="fancytree-expander "+b(h,"error"))}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.gridnav.min.js' */ +!function(a){"use strict";function b(b,c){var d,e=c.get(0),f=0;return b.children().each(function(){return this===e?!1:(d=a(this).prop("colspan"),void(f+=d?d:1))}),f}function c(b,c){var d,e=null,f=0;return b.children().each(function(){return f>=c?(e=a(this),!1):(d=a(this).prop("colspan"),void(f+=d?d:1))}),e}function d(a,d){var f,g,h=a.closest("td"),i=null;switch(d){case e.LEFT:i=h.prev();break;case e.RIGHT:i=h.next();break;case e.UP:case e.DOWN:for(f=h.parent(),g=b(f,h);;){if(f=d===e.UP?f.prev():f.next(),!f.length)break;if(!f.is(":hidden")&&(i=c(f,g),i&&i.find(":input").length))break}}return i}var e=a.ui.keyCode,f={text:[e.UP,e.DOWN],checkbox:[e.UP,e.DOWN,e.LEFT,e.RIGHT],radiobutton:[e.UP,e.DOWN,e.LEFT,e.RIGHT],"select-one":[e.LEFT,e.RIGHT],"select-multiple":[e.LEFT,e.RIGHT]};a.ui.fancytree.registerExtension({name:"gridnav",version:"0.0.1",options:{autofocusInput:!1,handleCursorKeys:!0},treeInit:function(b){this._requireExtension("table",!0,!0),this._super(b),this.$container.addClass("fancytree-ext-gridnav"),this.$container.on("focusin",function(c){var d,e=a.ui.fancytree.getNode(c.target);e&&!e.isActive()&&(d=b.tree._makeHookContext(e,c),b.tree._callHook("nodeSetActive",d,!0))})},nodeSetActive:function(b,c){var d,e=b.options.gridnav,f=b.node,g=b.originalEvent||{},h=a(g.target).is(":input");c=c!==!1,this._super(b,c),c&&(b.options.titlesTabbable?(h||(a(f.span).find("span.fancytree-title").focus(),f.setFocus()),b.tree.$container.attr("tabindex","-1")):e.autofocusInput&&!h&&(d=a(f.tr||f.span),d.find(":input:enabled:first").focus()))},nodeKeydown:function(b){var c,e,g,h=b.options.gridnav,i=b.originalEvent,j=a(i.target);return c=j.is(":input:enabled")?j.prop("type"):null,c&&h.handleCursorKeys?(e=f[c],e&&a.inArray(i.which,e)>=0&&(g=d(j,i.which),g&&g.length)?(g.find(":input:enabled").focus(),!1):!0):(b.tree.debug("ext-gridnav NOT HANDLED",i,c),this._super(b))}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.persist.min.js' */ +!function(a,b,c,d){"use strict";function e(b,c,d,f,g){var i,j,k,l,m=!1,n=[],o=[];for(d=d||[],g=g||a.Deferred(),i=0,k=d.length;k>i;i++)j=d[i],l=b.getNodeByKey(j),l?f&&l.isUndefined()?(m=!0,b.debug("_loadLazyNodes: "+l+" is lazy: loading..."),n.push("expand"===f?l.setExpanded():l.load())):(b.debug("_loadLazyNodes: "+l+" already loaded."),l.setExpanded()):(o.push(j),b.debug("_loadLazyNodes: "+l+" was not yet found."));return a.when.apply(a,n).always(function(){if(m&&o.length>0)e(b,c,o,f,g);else{if(o.length)for(b.warn("_loadLazyNodes: could not load those keys: ",o),i=0,k=o.length;k>i;i++)j=d[i],c._appendKey(h,d[i],!1);g.resolve()}}),g}var f=a.ui.fancytree.assert,g="active",h="expanded",i="focus",j="selected";a.ui.fancytree._FancytreeClass.prototype.clearCookies=function(a){var b=this.ext.persist,c=b.cookiePrefix;a=a||"active expanded focus selected",a.indexOf(g)>=0&&b._data(c+g,null),a.indexOf(h)>=0&&b._data(c+h,null),a.indexOf(i)>=0&&b._data(c+i,null),a.indexOf(j)>=0&&b._data(c+j,null)},a.ui.fancytree._FancytreeClass.prototype.getPersistData=function(){var a=this.ext.persist,b=a.cookiePrefix,c=a.cookieDelimiter,d={};return d[g]=a._data(b+g),d[h]=(a._data(b+h)||"").split(c),d[j]=(a._data(b+j)||"").split(c),d[i]=a._data(b+i),d},a.ui.fancytree.registerExtension({name:"persist",version:"0.3.0",options:{cookieDelimiter:"~",cookiePrefix:d,cookie:{raw:!1,expires:"",path:"",domain:"",secure:!1},expandLazy:!1,overrideSource:!0,store:"auto",types:"active expanded focus selected"},_data:function(b,c){var e=this._local.localStorage;return c===d?e?e.getItem(b):a.cookie(b):void(null===c?e?e.removeItem(b):a.removeCookie(b):e?e.setItem(b,c):a.cookie(b,c,this.options.persist.cookie))},_appendKey:function(b,c,d){c=""+c;var e=this._local,f=this.options.persist,g=f.cookieDelimiter,h=e.cookiePrefix+b,i=e._data(h),j=i?i.split(g):[],k=a.inArray(c,j);k>=0&&j.splice(k,1),d&&j.push(c),e._data(h,j.join(g))},treeInit:function(c){var k=c.tree,l=c.options,m=this._local,n=this.options.persist;return f("localStore"===n.store||a.cookie,"Missing required plugin for 'persist' extension: jquery.cookie.js"),m.cookiePrefix=n.cookiePrefix||"fancytree-"+k._id+"-",m.storeActive=n.types.indexOf(g)>=0,m.storeExpanded=n.types.indexOf(h)>=0,m.storeSelected=n.types.indexOf(j)>=0,m.storeFocus=n.types.indexOf(i)>=0,m.localStorage="cookie"!==n.store&&b.localStorage?"local"===n.store?b.localStorage:b.sessionStorage:null,k.$div.bind("fancytreeinit",function(){var b,c,f,o,p,q=a.cookie(m.cookiePrefix+i);b=m._data(m.cookiePrefix+h),o=b&&b.split(n.cookieDelimiter),c=m.storeExpanded?e(k,m,o,n.expandLazy?"expand":!1,null):(new a.Deferred).resolve(),c.done(function(){if(m.storeSelected){if(b=m._data(m.cookiePrefix+j))for(o=b.split(n.cookieDelimiter),f=0;f1&&h[0]!==b)for(c=a.inArray(b,h),f=h[c-1],d(f.tr);f.children&&(e=f.children[f.children.length-1],e.tr);)f=e;else f=g;return f}a.ui.fancytree.registerExtension({name:"table",version:"0.2.0",options:{checkboxColumnIdx:null,customStatus:!1,indentation:16,nodeColumnIdx:0},treeInit:function(b){var d,e,f,g=b.tree,h=g.widget.element;for(h.addClass("fancytree-container fancytree-ext-table"),g.tbody=h.find("> tbody")[0],g.columnCount=a("thead >tr >th",h).length,a(g.tbody).empty(),g.rowFragment=c.createDocumentFragment(),e=a(""),f="",b.options.aria&&(e.attr("role","row"),f=" role='gridcell'"),d=0;d":"");g.rowFragment.appendChild(e.get(0)),g.statusClassPropName="tr",g.ariaPropName="tr",this.nodeContainerAttrName="tr",this._super(b),a(g.rootNode.ul).remove(),g.rootNode.ul=null,g.$container=h,this.$container.attr("tabindex",this.options.tabbable?"0":"-1"),this.options.aria&&g.$container.attr("role","treegrid").attr("aria-readonly",!0)},nodeRemoveChildMarkup:function(b){var c=b.node;c.visit(function(b){b.tr&&(a(b.tr).remove(),b.tr=null)})},nodeRemoveMarkup:function(b){var c=b.node;c.tr&&(a(c.tr).remove(),c.tr=null),this.nodeRemoveChildMarkup(b)},nodeRender:function(b,c,h,i,j){var k,l,m,n,o,p,q,r,s=b.tree,t=b.node,u=b.options,v=!t.parent;if(j||(b.hasCollapsedParents=t.parent&&!t.parent.expanded),!v)if(t.tr)c?this.nodeRenderTitle(b):this.nodeRenderStatus(b);else{if(b.hasCollapsedParents)return void t.debug("nodeRender ignored due to unrendered parent");o=s.rowFragment.firstChild.cloneNode(!0),p=g(t),d(p),i===!0&&j?o.style.display="none":h&&b.hasCollapsedParents&&(o.style.display="none"),p.tr?e(p.tr,o):(d(!p.parent,"prev. row must have a tr, or is system root"),s.tbody.appendChild(o)),t.tr=o,t.key&&u.generateIds&&(t.tr.id=u.idPrefix+t.key),t.tr.ftnode=t,u.aria&&a(t.tr).attr("aria-labelledby","ftal_"+t.key),t.span=a("span.fancytree-node",t.tr).get(0),this.nodeRenderTitle(b),u.createNode&&u.createNode.call(s,{type:"createNode"},b)}if(u.renderNode&&u.renderNode.call(s,{type:"renderNode"},b),k=t.children,k&&(v||h||t.expanded))for(m=0,n=k.length;n>m;m++)r=a.extend({},b,{node:k[m]}),r.hasCollapsedParents=r.hasCollapsedParents||!t.expanded,this.nodeRender(r,c,h,i,!0);k&&!j&&(q=t.tr||null,l=s.tbody.firstChild,t.visit(function(a){if(a.tr){if(a.parent.expanded||"none"===a.tr.style.display||(a.tr.style.display="none",f(a,!1)),a.tr.previousSibling!==q){t.debug("_fixOrder: mismatch at node: "+a);var b=q?q.nextSibling:l;s.tbody.insertBefore(a.tr,b)}q=a.tr}}))},nodeRenderTitle:function(b){var c,d=b.node,e=b.options;this._super(b),e.checkbox&&null!=e.table.checkboxColumnIdx&&(c=a("span.fancytree-checkbox",d.span).detach(),a(d.tr).find("td:first").html(c)),d.isRoot()||this.nodeRenderStatus(b),!e.table.customStatus&&d.isStatusNode()||e.renderColumns&&e.renderColumns.call(b.tree,{type:"renderColumns"},b)},nodeRenderStatus:function(b){var c,d=b.node,e=b.options;this._super(b),a(d.tr).removeClass("fancytree-node"),c=(d.getLevel()-1)*e.table.indentation,a(d.span).css({marginLeft:c+"px"})},nodeSetExpanded:function(b,c,d){function e(a){c=c!==!1,f(b.node,c),a?c&&b.options.autoScroll&&!d.noAnimation&&b.node.hasChildren()?b.node.getLastChild().scrollIntoView(!0,{topNode:b.node}).always(function(){d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.resolveWith(b.node)}):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.resolveWith(b.node)):(d.noEvents||b.tree._triggerNodeEvent(c?"expand":"collapse",b),g.rejectWith(b.node))}var g=new a.Deferred,h=a.extend({},d,{noEvents:!0,noAnimation:!0});return d=d||{},this._super(b,c,h).done(function(){e(!0)}).fail(function(){e(!1)}),g.promise()},nodeSetStatus:function(b,c,d,e){if("ok"===c){var f=b.node,g=f.children?f.children[0]:null;g&&g.isStatusNode()&&a(g.tr).remove()}this._super(b,c,d,e)},treeClear:function(a){return this.nodeRemoveChildMarkup(this._makeHookContext(this.rootNode)),this._super(a)}})}(jQuery,window,document); + +/*! Extension 'jquery.fancytree.themeroller.min.js' */ +!function(a){"use strict";a.ui.fancytree.registerExtension({name:"themeroller",version:"0.0.1",options:{activeClass:"ui-state-active",foccusClass:"ui-state-focus",hoverClass:"ui-state-hover",selectedClass:"ui-state-highlight"},treeInit:function(b){this._super(b);var c=b.widget.element;"TABLE"===c[0].nodeName?(c.addClass("ui-widget ui-corner-all"),c.find(">thead tr").addClass("ui-widget-header"),c.find(">tbody").addClass("ui-widget-conent")):c.addClass("ui-widget ui-widget-content ui-corner-all"),c.delegate(".fancytree-node","mouseenter mouseleave",function(b){var c=a.ui.fancytree.getNode(b.target),d="mouseenter"===b.type;c.debug("hover: "+d),a(c.span).toggleClass("ui-state-hover ui-corner-all",d)})},treeDestroy:function(a){this._super(a),a.widget.element.removeClass("ui-widget ui-widget-content ui-corner-all")},nodeRenderStatus:function(b){var c=b.node,d=a(c.span);this._super(b),d.toggleClass("ui-state-active",c.isActive()),d.toggleClass("ui-state-focus",c.hasFocus()),d.toggleClass("ui-state-highlight",c.isSelected())}})}(jQuery,window,document); +})); diff --git a/www/lib/js/jquery.inputmask.bundle.min.js b/www/lib/js/jquery.inputmask.bundle.min.js new file mode 100644 index 0000000..a8f8b33 --- /dev/null +++ b/www/lib/js/jquery.inputmask.bundle.min.js @@ -0,0 +1,92 @@ +/* + Input Mask plugin for jquery + http://github.com/RobinHerbots/jquery.inputmask + Copyright (c) 2010 - 2014 Robin Herbots + Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php) + Version: 2.5.8 +*/ +(function(e){if(void 0===e.fn.inputmask){var a=function(a){var c=document.createElement("input");a="on"+a;var d=a in c;d||(c.setAttribute(a,"return;"),d="function"==typeof c[a]);return d},f=function(a,c,d){return(a=d.aliases[a])?(a.alias&&f(a.alias,void 0,d),e.extend(!0,d,a),e.extend(!0,d,c),!0):!1},b=function(a){function c(d){a.numericInput&&(d=d.split("").reverse().join(""));var b=!1,f=0,g=a.greedy,x=a.repeat;"*"==x&&(g=!1);1==d.length&&!1==g&&0!=x&&(a.placeholder="");d=e.map(d.split(""),function(d, +c){var e=[];if(d==a.escapeChar)b=!0;else if(d!=a.optionalmarker.start&&d!=a.optionalmarker.end||b){var g=a.definitions[d];if(g&&!b)for(var x=0;x=l?h[l-1]:[],k=A.validator,A=A.cardinality;g.push({fn:k?"string"==typeof k?RegExp(k):new function(){this.test=k}:/./,cardinality:A?A:1,optionality:c,newBlockMarker:!0==c?f:!1,offset:0,casing:x.casing,def:x.definitionSymbol||d});!0==c&&(f=!1)}g.push({fn:x.validator?"string"==typeof x.validator?RegExp(x.validator):new function(){this.test= +x.validator}:/./,cardinality:x.cardinality,optionality:c,newBlockMarker:f,offset:0,casing:x.casing,def:x.definitionSymbol||d})}else g.push({fn:null,cardinality:0,optionality:c,newBlockMarker:f,offset:0,casing:null,def:d}),b=!1;f=!1;return g}c=!1}else c=!0;f=!0}})}function f(d){for(var c=d.length,e=0;ee;y--)v+=H(da,b-(y-1)); +f&&(v+=f);return null!=c.tests[b].fn?c.tests[b].fn.test(v,da,a,N,d):f==H(c._buffer.slice(),a,!0)||f==d.skipOptionalPartCharacter?{refresh:!0,c:H(c._buffer.slice(),a,!0),pos:a}:!1}if(v=!0===v){var g=y(N,f(),b,v);!0===g&&(g={pos:N});return g}var h=[],g=!1,k=c,A=l().slice(),t=f().lastValidPosition;F(N);var m=[];e.each(a,function(a,d){if("object"==typeof d){c=a;var e=N,B=f().lastValidPosition,q;if(B==t){if(1=t||c==k)&&0<=e&&ed.result.pos)&&(v=d.result.pos,g=d.activeMasksetIndex)});d=e.map(d,function(d,f){if(-1!=e.inArray(d.activeMasksetIndex,c)){if(d.result.pos==v)return d;if(!1!==d.result){for(var k=N;kb.lastValidPosition?(b.activeMasksetIndex=a,b.lastValidPosition=f().lastValidPosition,b.next=p(f().lastValidPosition)):f().lastValidPosition== +b.lastValidPosition&&(-1==b.next||b.next>p(f().lastValidPosition))&&(b.activeMasksetIndex=a,b.lastValidPosition=f().lastValidPosition,b.next=p(f().lastValidPosition)))});c=-1!=b.lastValidPosition&&a[d].lastValidPosition==b.lastValidPosition?d:b.activeMasksetIndex;d!=c&&(W(l(),p(b.lastValidPosition),n()),f().writeOutBuffer=!0);s.data("_inputmask").activeMasksetIndex=c}function r(a){a=D(a);a=q()[a];return void 0!=a?a.fn:!1}function D(a){return a%q().length}function n(){var a=t(),c=f().greedy,b=f().repeat, +y=l();if(e.isFunction(d.getMaskLength))return d.getMaskLength(a,c,b,y,d);var g=a.length;c||("*"==b?g=y.length+1:1=d)return d;for(;++a=a)return 0;for(;0<--a&&!r(a););return a}function G(a,d,c,f){f&&(d=ca(a,d));f=q()[D(d)];var b=c;if(void 0!=b&&void 0!=f)switch(f.casing){case "upper":b=c.toUpperCase();break;case "lower":b=c.toLowerCase()}a[d]=b}function H(a,d,c){c&&(d=ca(a,d));return a[d]}function ca(a, +d){for(var c;void 0==a[d]&&a.lengthf().p});!0===v&&-1!=f().p&&(f().lastValidPosition=F(f().p))}function ea(a){return e.inputmask.escapeRegex.call(this,a)}function X(a){return a.replace(RegExp("("+ea(t().join(""))+")*$"),"")}function Y(a){var d=l(),c=d.slice(),f,b;for(b=c.length- +1;0<=b;b--)if(f=D(b),q()[f].optionality)if(r(b)&&R(b,d[b],!0))break;else c.pop();else break;I(a,c)}function la(a,c){if(!q()||!0!==c&&a.hasClass("hasDatepicker"))return a[0]._valueGet();var f=e.map(l(),function(a,d){return r(d)&&R(d,a,!0)?a:null}),f=(z?f.reverse():f).join("");return e.isFunction(d.onUnMask)?d.onUnMask.call(a,l().join(""),f,d):f}function K(a){!z||"number"!=typeof a||d.greedy&&""==d.placeholder||(a=l().length-a);return a}function w(a,c,f){var b=a.jquery&&0=g&&d.lastValidPosition==e){for(var y=!0,h=0;h<=e;h++){var k=r(h),l=D(h);if(k&&(void 0==f[h]||f[h]==O(h))||!k&&f[h]!=t()[l]){y=!1;break}}if(b=b||y)return!1}g=d.lastValidPosition}});c=y;return b}}function ma(a){a= +e._data(a).events;e.each(a,function(a,d){e.each(d,function(a,d){if("inputmask"==d.namespace&&"setvalue"!=d.type){var c=d.handler;d.handler=function(a){if(this.readOnly||this.disabled)a.preventDefault;else return c.apply(this,arguments)}}})})}function na(a){function d(a){if(void 0==e.valHooks[a]||!0!=e.valHooks[a].inputmaskpatch){var c=e.valHooks[a]&&e.valHooks[a].get?e.valHooks[a].get:function(a){return a.value},f=e.valHooks[a]&&e.valHooks[a].set?e.valHooks[a].set:function(a,d){a.value=d;return a}; +e.valHooks[a]={get:function(a){var d=e(a);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");a=c(a);d=d.data("_inputmask");return a!=d.masksets[d.activeMasksetIndex]._buffer.join("")?a:""}return c(a)},set:function(a,d){var c=e(a),b=f(a,d);c.data("_inputmask")&&c.triggerHandler("setvalue.inputmask");return b},inputmaskpatch:!0}}}var c;Object.getOwnPropertyDescriptor&&(c=Object.getOwnPropertyDescriptor(a,"value"));if(c&&c.get){if(!a._valueGet){var f= +c.get,b=c.set;a._valueGet=function(){return z?f.call(this).split("").reverse().join(""):f.call(this)};a._valueSet=function(a){b.call(this,z?a.split("").reverse().join(""):a)};Object.defineProperty(a,"value",{get:function(){var a=e(this),d=e(this).data("_inputmask"),c=d.masksets,b=d.activeMasksetIndex;return d&&d.opts.autoUnmask?a.inputmask("unmaskedvalue"):f.call(this)!=c[b]._buffer.join("")?f.call(this):""},set:function(a){b.call(this,a);e(this).triggerHandler("setvalue.inputmask")}})}}else document.__lookupGetter__&& +a.__lookupGetter__("value")?a._valueGet||(f=a.__lookupGetter__("value"),b=a.__lookupSetter__("value"),a._valueGet=function(){return z?f.call(this).split("").reverse().join(""):f.call(this)},a._valueSet=function(a){b.call(this,z?a.split("").reverse().join(""):a)},a.__defineGetter__("value",function(){var a=e(this),d=e(this).data("_inputmask"),c=d.masksets,b=d.activeMasksetIndex;return d&&d.opts.autoUnmask?a.inputmask("unmaskedvalue"):f.call(this)!=c[b]._buffer.join("")?f.call(this):""}),a.__defineSetter__("value", +function(a){b.call(this,a);e(this).triggerHandler("setvalue.inputmask")})):(a._valueGet||(a._valueGet=function(){return z?this.value.split("").reverse().join(""):this.value},a._valueSet=function(a){this.value=z?a.split("").reverse().join(""):a}),d(a.type))}function fa(a,d,c,b){var e=l();if(!1!==b)for(;!r(a)&&0<=a-1;)a--;for(b=a;ba&&0<=e;e--)if(r(e)){var g=F(e),h=H(b,g);h!=O(g)&&!1!==R(e,h,!0)&&q()[D(e)].def==q()[D(g)].def&&(G(b,e,h,!0),U(b,g))}else U(b,e);void 0!=c&&H(b,a)==O(a)&&G(b,a,c);a=b.length;if(!1==f().greedy){c=X(b.join("")).split("");b.length=c.length;e=0;for(g=b.length;e=C;)e=0==e?-1:F(e);e>=C?(ga(C,n(),r),h=f().lastValidPosition,e=p(h),e!=n()&&h>=C&&H(l().slice(),e,!0)!=O(e)&&(f().lastValidPosition=e)):f().writeOutBuffer=!1}else G(h,C,r,!0);if(-1==E||E>p(C))E=p(C)}else!A&&(h=Ch)&&(E=h);E>f().p&&(f().p=E)}});!0!==A&&(c=u,ba());if(!1!==k)if(e.each(h,function(a,d){if(d.activeMasksetIndex==c)return s=d,!1}),void 0!=s){var D= +this;setTimeout(function(){d.onKeyValidation.call(D,s.result,d)},0);if(f().writeOutBuffer&&!1!==s.result){var J=l();k=g?void 0:d.numericInput?C>S?F(E):r==d.radixPoint?E-1:F(E-1):E;I(this,J,k);!0!==g&&setTimeout(function(){!0===Q(J)&&q.trigger("complete");aa=!0;q.trigger("input")},0)}else t&&(f().buffer=f().undoBuffer.split(""))}else t&&(f().buffer=f().undoBuffer.split(""));d.showTooltip&&q.prop("title",f().mask);b&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}}function ja(a){var c=e(this), +b=a.keyCode,f=l();d.onKeyUp.call(this,a,f,d);b==d.keyCode.TAB&&d.showMaskOnFocus&&(c.hasClass("focus.inputmask")&&0==this._valueGet().length?(f=t().slice(),I(this,f),w(this,0),L=l().join("")):(I(this,f),f.join("")==t().join("")&&-1!=e.inArray(d.radixPoint,f)?(w(this,K(0)),c.click()):w(this,K(0),K(n()))))}function ka(a){if(!0===aa&&"input"==a.type)return aa=!1,!0;var c=this,b=e(c);if("propertychange"==a.type&&c._valueGet().length<=n())return!0;setTimeout(function(){var a=e.isFunction(d.onBeforePaste)? +d.onBeforePaste.call(c,c._valueGet(),d):c._valueGet();J(c,!1,!1,a.split(""),!0);I(c,l());!0===Q(l())&&b.trigger("complete");b.click()},0)}function oa(a){var c=e(this),b=w(this),f=this._valueGet(),f=f.replace(RegExp("("+ea(t().join(""))+")*"),"");b.begin>f.length&&(w(this,f.length),b=w(this));1!=l().length-f.length||f.charAt(b.begin)==l()[b.begin]||f.charAt(b.begin+1)==l()[b.begin]||r(b.begin)?(J(this,!1,!1,f.split("")),I(this,l()),!0===Q(l())&&c.trigger("complete"),c.click()):(a.keyCode=d.keyCode.BACKSPACE, +Z.call(this,a));a.preventDefault()}function pa(b){s=e(b);if(s.is(":input")){s.data("_inputmask",{masksets:a,activeMasksetIndex:c,opts:d,isRTL:!1});d.showTooltip&&s.prop("title",f().mask);f().greedy=f().greedy?f().greedy:0==f().repeat;if(null!=s.attr("maxLength")){var h=s.prop("maxLength");-1=h&&-1f;f++)a[f]=function(){var a=f;return{validator:function(f,c,e,k,m){if(m.regex["urlpre"+(a+1)]){var u=f;0e)return a;if(ff?a:f}return e},onKeyUp:function(a,f,b){f=e(this);a.ctrlKey&&a.keyCode== +b.keyCode.RIGHT&&(a=new Date,f.val(a.getDate().toString()+(a.getMonth()+1).toString()+a.getFullYear().toString()))},definitions:{1:{validator:function(a,f,b,e,c){var h=c.regex.val1.test(a);return e||h||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1))||!(h=c.regex.val1.test("0"+a.charAt(0)))?h:(f[b-1]="0",{pos:b,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=c.regex.val1pre.test(a);return e||h||!(h=c.regex.val1.test("0"+a))?h:(f[b]="0",b++,{pos:b})},cardinality:1}]}, +2:{validator:function(a,f,b,e,c){var h=f.join("").substr(0,3);-1!=h.indexOf(c.placeholder[0])&&(h="01"+c.separator);var k=c.regex.val2(c.separator).test(h+a);return e||k||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1))||!(k=c.regex.val2(c.separator).test(h+"0"+a.charAt(0)))?k:(f[b-1]="0",{pos:b,c:a.charAt(0)})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=f.join("").substr(0,3);-1!=h.indexOf(c.placeholder[0])&&(h="01"+c.separator);var k=c.regex.val2pre(c.separator).test(h+ +a);return e||k||!(k=c.regex.val2(c.separator).test(h+"0"+a))?k:(f[b]="0",b++,{pos:b})},cardinality:1}]},y:{validator:function(a,f,b,e,c){if(c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear)){if(f.join("").substr(0,6)!=c.leapday)return!0;a=parseInt(a,10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return!1},cardinality:4,prevalidator:[{validator:function(a,f,b,e,c){var h=c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear);if(!e&&!h){e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear, +a+"0").toString().slice(0,1);if(h=c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[0],{pos:b};e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,a+"0").toString().slice(0,2);if(h=c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[0],f[b++]=e[1],{pos:b}}return h},cardinality:1},{validator:function(a,f,b,e,c){var h=c.isInYearRange(a,c.yearrange.minyear,c.yearrange.maxyear);if(!e&&!h){e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear, +a).toString().slice(0,2);if(h=c.isInYearRange(a[0]+e[1]+a[1],c.yearrange.minyear,c.yearrange.maxyear))return f[b++]=e[1],{pos:b};e=c.determinebaseyear(c.yearrange.minyear,c.yearrange.maxyear,a).toString().slice(0,2);c.isInYearRange(e+a,c.yearrange.minyear,c.yearrange.maxyear)?f.join("").substr(0,6)!=c.leapday?h=!0:(c=parseInt(a,10),h=0===c%4?0===c%100?0===c%400?!0:!1:!0:!1):h=!1;if(h)return f[b-1]=e[0],f[b++]=e[1],f[b++]=a[0],{pos:b}}return h},cardinality:2},{validator:function(a,f,b,e,c){return c.isInYearRange(a, +c.yearrange.minyear,c.yearrange.maxyear)},cardinality:3}]}},insertMode:!1,autoUnmask:!1},"mm/dd/yyyy":{placeholder:"mm/dd/yyyy",alias:"dd/mm/yyyy",regex:{val2pre:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[13-9]|1[012])"+a+"[0-3])|(02"+a+"[0-2])")},val2:function(a){a=e.inputmask.escapeRegex.call(this,a);return RegExp("((0[1-9]|1[012])"+a+"(0[1-9]|[12][0-9]))|((0[13-9]|1[012])"+a+"30)|((0[13578]|1[02])"+a+"31)")},val1pre:/[01]/,val1:/0[1-9]|1[012]/},leapday:"02/29/",onKeyUp:function(a, +f,b){f=e(this);a.ctrlKey&&a.keyCode==b.keyCode.RIGHT&&(a=new Date,f.val((a.getMonth()+1).toString()+a.getDate().toString()+a.getFullYear().toString()))}},"yyyy/mm/dd":{mask:"y/1/2",placeholder:"yyyy/mm/dd",alias:"mm/dd/yyyy",leapday:"/02/29",onKeyUp:function(a,f,b){f=e(this);a.ctrlKey&&a.keyCode==b.keyCode.RIGHT&&(a=new Date,f.val(a.getFullYear().toString()+(a.getMonth()+1).toString()+a.getDate().toString()))},definitions:{2:{validator:function(a,f,b,e,c){var h=f.join("").substr(5,3);-1!=h.indexOf(c.placeholder[5])&& +(h="01"+c.separator);var k=c.regex.val2(c.separator).test(h+a);if(!(e||k||a.charAt(1)!=c.separator&&-1=="-./".indexOf(a.charAt(1)))&&(k=c.regex.val2(c.separator).test(h+"0"+a.charAt(0))))return f[b-1]="0",{pos:b,c:a.charAt(0)};if(k){if(f.join("").substr(4,4)+a!=c.leapday)return!0;a=parseInt(f.join("").substr(0,4),10);return 0===a%4?0===a%100?0===a%400?!0:!1:!0:!1}return k},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=f.join("").substr(5,3);-1!=h.indexOf(c.placeholder[5])&&(h="01"+ +c.separator);var k=c.regex.val2pre(c.separator).test(h+a);return e||k||!(k=c.regex.val2(c.separator).test(h+"0"+a))?k:(f[b]="0",b++,{pos:b})},cardinality:1}]}}},"dd.mm.yyyy":{mask:"1.2.y",placeholder:"dd.mm.yyyy",leapday:"29.02.",separator:".",alias:"dd/mm/yyyy"},"dd-mm-yyyy":{mask:"1-2-y",placeholder:"dd-mm-yyyy",leapday:"29-02-",separator:"-",alias:"dd/mm/yyyy"},"mm.dd.yyyy":{mask:"1.2.y",placeholder:"mm.dd.yyyy",leapday:"02.29.",separator:".",alias:"mm/dd/yyyy"},"mm-dd-yyyy":{mask:"1-2-y",placeholder:"mm-dd-yyyy", +leapday:"02-29-",separator:"-",alias:"mm/dd/yyyy"},"yyyy.mm.dd":{mask:"y.1.2",placeholder:"yyyy.mm.dd",leapday:".02.29",separator:".",alias:"yyyy/mm/dd"},"yyyy-mm-dd":{mask:"y-1-2",placeholder:"yyyy-mm-dd",leapday:"-02-29",separator:"-",alias:"yyyy/mm/dd"},datetime:{mask:"1/2/y h:s",placeholder:"dd/mm/yyyy hh:mm",alias:"dd/mm/yyyy",regex:{hrspre:/[012]/,hrs24:/2[0-9]|1[3-9]/,hrs:/[01][0-9]|2[0-3]/,ampm:/^[a|p|A|P][m|M]/},timeseparator:":",hourFormat:"24",definitions:{h:{validator:function(a,f,b,e, +c){var h=c.regex.hrs.test(a);return e||h||a.charAt(1)!=c.timeseparator&&-1=="-.:".indexOf(a.charAt(1))||!(h=c.regex.hrs.test("0"+a.charAt(0)))?h&&"24"!==c.hourFormat&&c.regex.hrs24.test(a)?(a=parseInt(a,10),f[b+5]=24==a?"a":"p",f[b+6]="m",a-=12,10>a?(f[b]=a.toString(),f[b-1]="0"):(f[b]=a.toString().charAt(1),f[b-1]=a.toString().charAt(0)),{pos:b,c:f[b]}):h:(f[b-1]="0",f[b]=a.charAt(0),b++,{pos:b})},cardinality:2,prevalidator:[{validator:function(a,f,b,e,c){var h=c.regex.hrspre.test(a);return e||h|| +!(h=c.regex.hrs.test("0"+a))?h:(f[b]="0",b++,{pos:b})},cardinality:1}]},t:{validator:function(a,e,b,g,c){return c.regex.ampm.test(a+"m")},casing:"lower",cardinality:1}},insertMode:!1,autoUnmask:!1},datetime12:{mask:"1/2/y h:s t\\m",placeholder:"dd/mm/yyyy hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"h:s t":{mask:"h:s t\\m",placeholder:"hh:mm xm",alias:"datetime",hourFormat:"12"},"hh:mm:ss":{mask:"h:s:s",autoUnmask:!1}, +"hh:mm":{mask:"h:s",autoUnmask:!1},date:{alias:"dd/mm/yyyy"},"mm/yyyy":{mask:"1/y",placeholder:"mm/yyyy",leapday:"donotuse",separator:"/",alias:"mm/dd/yyyy"}})})(jQuery); +(function(e){e.extend(e.inputmask.defaults.aliases,{decimal:{mask:"~",placeholder:"",repeat:"*",greedy:!1,numericInput:!1,isNumeric:!0,digits:"*",groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,allowPlus:!0,allowMinus:!0,integerDigits:"*",defaultValue:"",prefix:"",suffix:"",getMaskLength:function(a,f,b,g,c){var h=a.length;f||("*"==b?h=g.length+1:1=b&&"0"===f[0]&&/[\d-]/.test(a)&&1==f.join("").length)return f[0]="",{pos:0};var k=g?f.slice(0,b):f.slice();k.splice(b,0,a);var k=k.join(""),m=e.inputmask.escapeRegex.call(this,c.groupSeparator),k=k.replace(RegExp(m,"g"),"");g&&k.lastIndexOf(c.radixPoint)==k.length-1&&(m=e.inputmask.escapeRegex.call(this,c.radixPoint),k=k.replace(RegExp(m,"g"),""));if(!g&&""==k)return!1;m=c.regex.number(h).test(k);if(!m&&(k+="0",m=c.regex.number(h).test(k), +!m)){m=k.lastIndexOf(c.groupSeparator);for(m=k.length-m;3>=m;m++)k+="0";m=c.regex.number(h).test(k);if(!m&&!g&&a==c.radixPoint&&(m=c.regex.number(h).test("0"+k+"0")))return f[b]="0",b++,{pos:b}}return!1==m||g||a==c.radixPoint?m:{pos:c.postFormat(f,b,"-"==a||"+"==a?!0:!1,c)}},cardinality:1,prevalidator:null}},insertMode:!0,autoUnmask:!1},integer:{regex:{number:function(a){var f=e.inputmask.escapeRegex.call(this,a.groupSeparator);return RegExp("^"+(a.allowPlus||a.allowMinus?"["+(a.allowPlus?"+":"")+ +(a.allowMinus?"-":"")+"]?":"")+"(\\d+|\\d{1,"+a.groupSize+"}(("+f+"\\d{"+a.groupSize+"})?)+)$")}},alias:"decimal"}})})(jQuery); +(function(e){e.extend(e.inputmask.defaults.aliases,{Regex:{mask:"r",greedy:!1,repeat:"*",regex:null,regexTokens:null,tokenizer:/\[\^?]?(?:[^\\\]]+|\\[\S\s]?)*]?|\\(?:0(?:[0-3][0-7]{0,2}|[4-7][0-7]?)?|[1-9][0-9]*|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|c[A-Za-z]|[\S\s]?)|\((?:\?[:=!]?)?|(?:[?*+]|\{[0-9]+(?:,[0-9]*)?\})\??|[^.?*+^${[()|\\]+|./g,quantifierFilter:/[0-9]+[^,]/,isComplete:function(a,e){return RegExp(e.regex).test(a.join(""))},definitions:{r:{validator:function(a,e,b,g,c){function h(a,b){this.matches= +[];this.isGroup=a||!1;this.isQuantifier=b||!1;this.quantifier={min:1,max:1};this.repeaterPart=void 0}function k(){var a=new h,b,e=[];for(c.regexTokens=[];b=c.tokenizer.exec(c.regex);)switch(b=b[0],b.charAt(0)){case "(":e.push(new h(!0));break;case ")":var d=e.pop();0u.length&&!(c=m(f,!0)););(c=c||m(f,!0))&&(e.repeaterPart=u);u=h+e.quantifier.max}else{for(var g=0,k=e.quantifier.max-1;g
      ').addClass(c&&c.position?c.position:a.jGrowl.defaults.position).appendTo(c&&c.appendTo?c.appendTo:a.jGrowl.defaults.appendTo),a("#jGrowl").jGrowl(b,c)},a.fn.jGrowl=function(b,c){if(void 0===c&&a.isPlainObject(b)&&(c=b,b=c.message),a.isFunction(this.each)){var d=arguments;return this.each(function(){void 0===a(this).data("jGrowl.instance")&&(a(this).data("jGrowl.instance",a.extend(new a.fn.jGrowl,{notifications:[],element:null,interval:null})),a(this).data("jGrowl.instance").startup(this)),a.isFunction(a(this).data("jGrowl.instance")[b])?a(this).data("jGrowl.instance")[b].apply(a(this).data("jGrowl.instance"),a.makeArray(d).slice(1)):a(this).data("jGrowl.instance").create(b,c)})}},a.extend(a.fn.jGrowl.prototype,{defaults:{pool:0,header:"",group:"",sticky:!1,position:"top-right",appendTo:"body",glue:"after",theme:"default",themeState:"highlight",corners:"10px",check:250,life:3e3,closeDuration:"normal",openDuration:"normal",easing:"swing",closer:!0,closeTemplate:"×",closerTemplate:"
      [ close all ]
      ",log:function(){},beforeOpen:function(){},afterOpen:function(){},open:function(){},beforeClose:function(){},close:function(){},click:function(){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},notifications:[],element:null,interval:null,create:function(b,c){var d=a.extend({},this.defaults,c);"undefined"!=typeof d.speed&&(d.openDuration=d.speed,d.closeDuration=d.speed),this.notifications.push({message:b,options:d}),d.log.apply(this.element,[this.element,b,d])},render:function(b){var c=this,d=b.message,e=b.options;e.themeState=""===e.themeState?"":"ui-state-"+e.themeState;var f=a("
      ").addClass("jGrowl-notification alert "+e.themeState+" ui-corner-all"+(void 0!==e.group&&""!==e.group?" "+e.group:"")).append(a("')).addClass("ui-multiselect ui-widget ui-state-default ui-corner-all").addClass(b.classes).attr({title:a.attr("title"),"aria-haspopup":!0,tabIndex:a.attr("tabIndex")}).insertAfter(a);(this.buttonlabel=d("")).html(b.noneSelectedText).appendTo(a);var a=(this.menu=d("
      ")).addClass("ui-multiselect-menu ui-widget ui-widget-content ui-corner-all").addClass(b.classes).appendTo(document.body),c=(this.header=d("
      ")).addClass("ui-widget-header ui-corner-all ui-multiselect-header ui-helper-clearfix").appendTo(a);(this.headerLinkContainer=d("
        ")).addClass("ui-helper-reset").html(function(){return!0===b.header?'
      • '+b.checkAllText+'
      • '+b.uncheckAllText+"
      • ":"string"===typeof b.header?"
      • "+b.header+"
      • ":""}).append('
      • ').appendTo(c);(this.checkboxContainer=d("
          ")).addClass("ui-multiselect-checkboxes ui-helper-reset").appendTo(a);this._bindEvents();this.refresh(!0);b.multiple||a.addClass("ui-multiselect-single")},_init:function(){!1===this.options.header&&this.header.hide();this.options.multiple||this.headerLinkContainer.find(".ui-multiselect-all, .ui-multiselect-none").hide();this.options.autoOpen&&this.open();this.element.is(":disabled")&&this.disable()},refresh:function(a){var b=this.element,c=this.options,f=this.menu,h=this.checkboxContainer,g=[],e="",i=b.attr("id")||k++;b.find("option").each(function(b){d(this);var a=this.parentNode,f=this.innerHTML,h=this.title,k=this.value,b="ui-multiselect-"+(this.id||i+"-option-"+b),l=this.disabled,n=this.selected,m=["ui-corner-all"],o=(l?"ui-multiselect-disabled ":" ")+this.className,j;"OPTGROUP"===a.tagName&&(j=a.getAttribute("label"),-1===d.inArray(j,g)&&(e+='
        • '+j+"
        • ",g.push(j)));l&&m.push("ui-state-disabled");n&&!c.multiple&&m.push("ui-state-active");e+='
        • ';e+='
        • "});h.html(e);this.labels=f.find("label");this.inputs=this.labels.children("input");this._setButtonWidth();this._setMenuWidth();this.button[0].defaultValue=this.update();a||this._trigger("refresh")},update:function(){var a=this.options,b=this.inputs,c=b.filter(":checked"),f=c.length,a=0===f?a.noneSelectedText:d.isFunction(a.selectedText)?a.selectedText.call(this,f,b.length,c.get()):/\d/.test(a.selectedList)&&0' + (opts.label.length ? opts.label : '') + '
      ').prependTo(this.header)); + + // reference to the actual inputs + this.inputs = instance.menu.find('input[type="checkbox"], input[type="radio"]'); + + // build the input box + this.input = wrapper.find('input').bind({ + keydown: function(e) { + // prevent the enter key from submitting the form / closing the widget + if(e.which === 13) { + e.preventDefault(); + } + }, + keyup: $.proxy(this._handler, this), + click: $.proxy(this._handler, this) + }); + + // cache input values for searching + this.updateCache(); + + // rewrite internal _toggleChecked fn so that when checkAll/uncheckAll is fired, + // only the currently filtered elements are checked + instance._toggleChecked = function(flag, group) { + var $inputs = (group && group.length) ? group : this.labels.find('input'); + var _self = this; + + // do not include hidden elems if the menu isn't open. + var selector = instance._isOpen ? ':disabled, :hidden' : ':disabled'; + + $inputs = $inputs + .not(selector) + .each(this._toggleState('checked', flag)); + + // update text + this.update(); + + // gather an array of the values that actually changed + var values = $inputs.map(function() { + return this.value; + }).get(); + + // select option tags + this.element.find('option').filter(function() { + if(!this.disabled && $.inArray(this.value, values) > -1) { + _self._toggleState('selected', flag).call(this); + } + }); + + // trigger the change event on the select + if($inputs.length) { + this.element.trigger('change'); + } + }; + + // rebuild cache when multiselect is updated + var doc = $(document).bind('multiselectrefresh', $.proxy(function() { + this.updateCache(); + this._handler(); + }, this)); + + // automatically reset the widget on close? + if(this.options.autoReset) { + doc.bind('multiselectclose', $.proxy(this._reset, this)); + } + }, + + // thx for the logic here ben alman + _handler: function(e) { + var term = $.trim(this.input[0].value.toLowerCase()), + + // speed up lookups + rows = this.rows, inputs = this.inputs, cache = this.cache; + + if(!term) { + rows.show(); + } else { + rows.hide(); + + var regex = new RegExp(term.replace(rEscape, "\\$&"), 'gi'); + + this._trigger("filter", e, $.map(cache, function(v, i) { + if(v.search(regex) !== -1) { + rows.eq(i).show(); + return inputs.get(i); + } + + return null; + })); + } + + // show/hide optgroups + this.instance.menu.find(".ui-multiselect-optgroup-label").each(function() { + var $this = $(this); + var isVisible = $this.nextUntil('.ui-multiselect-optgroup-label').filter(function() { + return $.css(this, "display") !== 'none'; + }).length; + + $this[isVisible ? 'show' : 'hide'](); + }); + }, + + _reset: function() { + this.input.val('').trigger('keyup'); + }, + + updateCache: function() { + // each list item + this.rows = this.instance.menu.find(".ui-multiselect-checkboxes li:not(.ui-multiselect-optgroup-label)"); + + // cache + this.cache = this.element.children().map(function() { + var elem = $(this); + + // account for optgroups + if(this.tagName.toLowerCase() === "optgroup") { + elem = elem.children(); + } + + return elem.map(function() { + return this.innerHTML.toLowerCase(); + }).get(); + }).get(); + }, + + widget: function() { + return this.wrapper; + }, + + destroy: function() { + $.Widget.prototype.destroy.call(this); + this.input.val('').trigger("keyup"); + this.wrapper.remove(); + } + }); + +})(jQuery); diff --git a/www/lib/js/jquery.ui.datepicker.min.js b/www/lib/js/jquery.ui.datepicker.min.js new file mode 100644 index 0000000..bd4b62e --- /dev/null +++ b/www/lib/js/jquery.ui.datepicker.min.js @@ -0,0 +1,5 @@ +/*! jQuery UI - v1.10.3 - 2013-05-03 +* http://jqueryui.com +* Copyright 2013 jQuery Foundation and other contributors; Licensed MIT */ +(function(t,e){function i(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:""},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},t.extend(this._defaults,this.regional[""]),this.dpDiv=s(t("
      "))}function s(e){var i="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return e.delegate(i,"mouseout",function(){t(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).removeClass("ui-datepicker-next-hover")}).delegate(i,"mouseover",function(){t.datepicker._isDisabledDatepicker(a.inline?e.parent()[0]:a.input[0])||(t(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),t(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&t(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&t(this).addClass("ui-datepicker-next-hover"))})}function n(e,i){t.extend(e,i);for(var s in i)null==i[s]&&(e[s]=i[s]);return e}t.extend(t.ui,{datepicker:{version:"1.10.3"}});var a,r="datepicker";t.extend(i.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return n(this._defaults,t||{}),this},_attachDatepicker:function(e,i){var s,n,a;s=e.nodeName.toLowerCase(),n="div"===s||"span"===s,e.id||(this.uuid+=1,e.id="dp"+this.uuid),a=this._newInst(t(e),n),a.settings=t.extend({},i||{}),"input"===s?this._connectDatepicker(e,a):n&&this._inlineDatepicker(e,a)},_newInst:function(e,i){var n=e[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1");return{id:n,input:e,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:i,dpDiv:i?s(t("
      ")):this.dpDiv}},_connectDatepicker:function(e,i){var s=t(e);i.append=t([]),i.trigger=t([]),s.hasClass(this.markerClassName)||(this._attachments(s,i),s.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp),this._autoSize(i),t.data(e,r,i),i.settings.disabled&&this._disableDatepicker(e))},_attachments:function(e,i){var s,n,a,r=this._get(i,"appendText"),o=this._get(i,"isRTL");i.append&&i.append.remove(),r&&(i.append=t(""+r+""),e[o?"before":"after"](i.append)),e.unbind("focus",this._showDatepicker),i.trigger&&i.trigger.remove(),s=this._get(i,"showOn"),("focus"===s||"both"===s)&&e.focus(this._showDatepicker),("button"===s||"both"===s)&&(n=this._get(i,"buttonText"),a=this._get(i,"buttonImage"),i.trigger=t(this._get(i,"buttonImageOnly")?t("").addClass(this._triggerClass).attr({src:a,alt:n,title:n}):t("").addClass(this._triggerClass).html(a?t("").attr({src:a,alt:n,title:n}):n)),e[o?"before":"after"](i.trigger),i.trigger.click(function(){return t.datepicker._datepickerShowing&&t.datepicker._lastInput===e[0]?t.datepicker._hideDatepicker():t.datepicker._datepickerShowing&&t.datepicker._lastInput!==e[0]?(t.datepicker._hideDatepicker(),t.datepicker._showDatepicker(e[0])):t.datepicker._showDatepicker(e[0]),!1}))},_autoSize:function(t){if(this._get(t,"autoSize")&&!t.inline){var e,i,s,n,a=new Date(2009,11,20),r=this._get(t,"dateFormat");r.match(/[DM]/)&&(e=function(t){for(i=0,s=0,n=0;t.length>n;n++)t[n].length>i&&(i=t[n].length,s=n);return s},a.setMonth(e(this._get(t,r.match(/MM/)?"monthNames":"monthNamesShort"))),a.setDate(e(this._get(t,r.match(/DD/)?"dayNames":"dayNamesShort"))+20-a.getDay())),t.input.attr("size",this._formatDate(t,a).length)}},_inlineDatepicker:function(e,i){var s=t(e);s.hasClass(this.markerClassName)||(s.addClass(this.markerClassName).append(i.dpDiv),t.data(e,r,i),this._setDate(i,this._getDefaultDate(i),!0),this._updateDatepicker(i),this._updateAlternate(i),i.settings.disabled&&this._disableDatepicker(e),i.dpDiv.css("display","block"))},_dialogDatepicker:function(e,i,s,a,o){var h,l,c,u,d,p=this._dialogInst;return p||(this.uuid+=1,h="dp"+this.uuid,this._dialogInput=t(""),this._dialogInput.keydown(this._doKeyDown),t("body").append(this._dialogInput),p=this._dialogInst=this._newInst(this._dialogInput,!1),p.settings={},t.data(this._dialogInput[0],r,p)),n(p.settings,a||{}),i=i&&i.constructor===Date?this._formatDate(p,i):i,this._dialogInput.val(i),this._pos=o?o.length?o:[o.pageX,o.pageY]:null,this._pos||(l=document.documentElement.clientWidth,c=document.documentElement.clientHeight,u=document.documentElement.scrollLeft||document.body.scrollLeft,d=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[l/2-100+u,c/2-150+d]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),p.settings.onSelect=s,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),t.blockUI&&t.blockUI(this.dpDiv),t.data(this._dialogInput[0],r,p),this},_destroyDatepicker:function(e){var i,s=t(e),n=t.data(e,r);s.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),t.removeData(e,r),"input"===i?(n.append.remove(),n.trigger.remove(),s.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)):("div"===i||"span"===i)&&s.removeClass(this.markerClassName).empty())},_enableDatepicker:function(e){var i,s,n=t(e),a=t.data(e,r);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!1,a.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().removeClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var i,s,n=t(e),a=t.data(e,r);n.hasClass(this.markerClassName)&&(i=e.nodeName.toLowerCase(),"input"===i?(e.disabled=!0,a.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):("div"===i||"span"===i)&&(s=n.children("."+this._inlineClass),s.children().addClass("ui-state-disabled"),s.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=t.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;this._disabledInputs.length>e;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(e){try{return t.data(e,r)}catch(i){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(i,s,a){var r,o,h,l,c=this._getInst(i);return 2===arguments.length&&"string"==typeof s?"defaults"===s?t.extend({},t.datepicker._defaults):c?"all"===s?t.extend({},c.settings):this._get(c,s):null:(r=s||{},"string"==typeof s&&(r={},r[s]=a),c&&(this._curInst===c&&this._hideDatepicker(),o=this._getDateDatepicker(i,!0),h=this._getMinMaxDate(c,"min"),l=this._getMinMaxDate(c,"max"),n(c.settings,r),null!==h&&r.dateFormat!==e&&r.minDate===e&&(c.settings.minDate=this._formatDate(c,h)),null!==l&&r.dateFormat!==e&&r.maxDate===e&&(c.settings.maxDate=this._formatDate(c,l)),"disabled"in r&&(r.disabled?this._disableDatepicker(i):this._enableDatepicker(i)),this._attachments(t(i),c),this._autoSize(c),this._setDate(c,o),this._updateAlternate(c),this._updateDatepicker(c)),e)},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){var e=this._getInst(t);e&&this._updateDatepicker(e)},_setDateDatepicker:function(t,e){var i=this._getInst(t);i&&(this._setDate(i,e),this._updateDatepicker(i),this._updateAlternate(i))},_getDateDatepicker:function(t,e){var i=this._getInst(t);return i&&!i.inline&&this._setDateFromField(i,e),i?this._getDate(i):null},_doKeyDown:function(e){var i,s,n,a=t.datepicker._getInst(e.target),r=!0,o=a.dpDiv.is(".ui-datepicker-rtl");if(a._keyEvent=!0,t.datepicker._datepickerShowing)switch(e.keyCode){case 9:t.datepicker._hideDatepicker(),r=!1;break;case 13:return n=t("td."+t.datepicker._dayOverClass+":not(."+t.datepicker._currentClass+")",a.dpDiv),n[0]&&t.datepicker._selectDay(e.target,a.selectedMonth,a.selectedYear,n[0]),i=t.datepicker._get(a,"onSelect"),i?(s=t.datepicker._formatDate(a),i.apply(a.input?a.input[0]:null,[s,a])):t.datepicker._hideDatepicker(),!1;case 27:t.datepicker._hideDatepicker();break;case 33:t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(a,"stepBigMonths"):-t.datepicker._get(a,"stepMonths"),"M");break;case 34:t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(a,"stepBigMonths"):+t.datepicker._get(a,"stepMonths"),"M");break;case 35:(e.ctrlKey||e.metaKey)&&t.datepicker._clearDate(e.target),r=e.ctrlKey||e.metaKey;break;case 36:(e.ctrlKey||e.metaKey)&&t.datepicker._gotoToday(e.target),r=e.ctrlKey||e.metaKey;break;case 37:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,o?1:-1,"D"),r=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?-t.datepicker._get(a,"stepBigMonths"):-t.datepicker._get(a,"stepMonths"),"M");break;case 38:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,-7,"D"),r=e.ctrlKey||e.metaKey;break;case 39:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,o?-1:1,"D"),r=e.ctrlKey||e.metaKey,e.originalEvent.altKey&&t.datepicker._adjustDate(e.target,e.ctrlKey?+t.datepicker._get(a,"stepBigMonths"):+t.datepicker._get(a,"stepMonths"),"M");break;case 40:(e.ctrlKey||e.metaKey)&&t.datepicker._adjustDate(e.target,7,"D"),r=e.ctrlKey||e.metaKey;break;default:r=!1}else 36===e.keyCode&&e.ctrlKey?t.datepicker._showDatepicker(this):r=!1;r&&(e.preventDefault(),e.stopPropagation())},_doKeyPress:function(i){var s,n,a=t.datepicker._getInst(i.target);return t.datepicker._get(a,"constrainInput")?(s=t.datepicker._possibleChars(t.datepicker._get(a,"dateFormat")),n=String.fromCharCode(null==i.charCode?i.keyCode:i.charCode),i.ctrlKey||i.metaKey||" ">n||!s||s.indexOf(n)>-1):e},_doKeyUp:function(e){var i,s=t.datepicker._getInst(e.target);if(s.input.val()!==s.lastVal)try{i=t.datepicker.parseDate(t.datepicker._get(s,"dateFormat"),s.input?s.input.val():null,t.datepicker._getFormatConfig(s)),i&&(t.datepicker._setDateFromField(s),t.datepicker._updateAlternate(s),t.datepicker._updateDatepicker(s))}catch(n){}return!0},_showDatepicker:function(e){if(e=e.target||e,"input"!==e.nodeName.toLowerCase()&&(e=t("input",e.parentNode)[0]),!t.datepicker._isDisabledDatepicker(e)&&t.datepicker._lastInput!==e){var i,s,a,r,o,h,l;i=t.datepicker._getInst(e),t.datepicker._curInst&&t.datepicker._curInst!==i&&(t.datepicker._curInst.dpDiv.stop(!0,!0),i&&t.datepicker._datepickerShowing&&t.datepicker._hideDatepicker(t.datepicker._curInst.input[0])),s=t.datepicker._get(i,"beforeShow"),a=s?s.apply(e,[e,i]):{},a!==!1&&(n(i.settings,a),i.lastVal=null,t.datepicker._lastInput=e,t.datepicker._setDateFromField(i),t.datepicker._inDialog&&(e.value=""),t.datepicker._pos||(t.datepicker._pos=t.datepicker._findPos(e),t.datepicker._pos[1]+=e.offsetHeight),r=!1,t(e).parents().each(function(){return r|="fixed"===t(this).css("position"),!r}),o={left:t.datepicker._pos[0],top:t.datepicker._pos[1]},t.datepicker._pos=null,i.dpDiv.empty(),i.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),t.datepicker._updateDatepicker(i),o=t.datepicker._checkOffset(i,o,r),i.dpDiv.css({position:t.datepicker._inDialog&&t.blockUI?"static":r?"fixed":"absolute",display:"none",left:o.left+"px",top:o.top+"px"}),i.inline||(h=t.datepicker._get(i,"showAnim"),l=t.datepicker._get(i,"duration"),i.dpDiv.zIndex(t(e).zIndex()+1),t.datepicker._datepickerShowing=!0,t.effects&&t.effects.effect[h]?i.dpDiv.show(h,t.datepicker._get(i,"showOptions"),l):i.dpDiv[h||"show"](h?l:null),t.datepicker._shouldFocusInput(i)&&i.input.focus(),t.datepicker._curInst=i))}},_updateDatepicker:function(e){this.maxRows=4,a=e,e.dpDiv.empty().append(this._generateHTML(e)),this._attachHandlers(e),e.dpDiv.find("."+this._dayOverClass+" a").mouseover();var i,s=this._getNumberOfMonths(e),n=s[1],r=17;e.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),n>1&&e.dpDiv.addClass("ui-datepicker-multi-"+n).css("width",r*n+"em"),e.dpDiv[(1!==s[0]||1!==s[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),e.dpDiv[(this._get(e,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),e===t.datepicker._curInst&&t.datepicker._datepickerShowing&&t.datepicker._shouldFocusInput(e)&&e.input.focus(),e.yearshtml&&(i=e.yearshtml,setTimeout(function(){i===e.yearshtml&&e.yearshtml&&e.dpDiv.find("select.ui-datepicker-year:first").replaceWith(e.yearshtml),i=e.yearshtml=null},0))},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(e,i,s){var n=e.dpDiv.outerWidth(),a=e.dpDiv.outerHeight(),r=e.input?e.input.outerWidth():0,o=e.input?e.input.outerHeight():0,h=document.documentElement.clientWidth+(s?0:t(document).scrollLeft()),l=document.documentElement.clientHeight+(s?0:t(document).scrollTop());return i.left-=this._get(e,"isRTL")?n-r:0,i.left-=s&&i.left===e.input.offset().left?t(document).scrollLeft():0,i.top-=s&&i.top===e.input.offset().top+o?t(document).scrollTop():0,i.left-=Math.min(i.left,i.left+n>h&&h>n?Math.abs(i.left+n-h):0),i.top-=Math.min(i.top,i.top+a>l&&l>a?Math.abs(a+o):0),i},_findPos:function(e){for(var i,s=this._getInst(e),n=this._get(s,"isRTL");e&&("hidden"===e.type||1!==e.nodeType||t.expr.filters.hidden(e));)e=e[n?"previousSibling":"nextSibling"];return i=t(e).offset(),[i.left,i.top]},_hideDatepicker:function(e){var i,s,n,a,o=this._curInst;!o||e&&o!==t.data(e,r)||this._datepickerShowing&&(i=this._get(o,"showAnim"),s=this._get(o,"duration"),n=function(){t.datepicker._tidyDialog(o)},t.effects&&(t.effects.effect[i]||t.effects[i])?o.dpDiv.hide(i,t.datepicker._get(o,"showOptions"),s,n):o.dpDiv["slideDown"===i?"slideUp":"fadeIn"===i?"fadeOut":"hide"](i?s:null,n),i||n(),this._datepickerShowing=!1,a=this._get(o,"onClose"),a&&a.apply(o.input?o.input[0]:null,[o.input?o.input.val():"",o]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),t.blockUI&&(t.unblockUI(),t("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(e){if(t.datepicker._curInst){var i=t(e.target),s=t.datepicker._getInst(i[0]);(i[0].id!==t.datepicker._mainDivId&&0===i.parents("#"+t.datepicker._mainDivId).length&&!i.hasClass(t.datepicker.markerClassName)&&!i.closest("."+t.datepicker._triggerClass).length&&t.datepicker._datepickerShowing&&(!t.datepicker._inDialog||!t.blockUI)||i.hasClass(t.datepicker.markerClassName)&&t.datepicker._curInst!==s)&&t.datepicker._hideDatepicker()}},_adjustDate:function(e,i,s){var n=t(e),a=this._getInst(n[0]);this._isDisabledDatepicker(n[0])||(this._adjustInstDate(a,i+("M"===s?this._get(a,"showCurrentAtPos"):0),s),this._updateDatepicker(a))},_gotoToday:function(e){var i,s=t(e),n=this._getInst(s[0]);this._get(n,"gotoCurrent")&&n.currentDay?(n.selectedDay=n.currentDay,n.drawMonth=n.selectedMonth=n.currentMonth,n.drawYear=n.selectedYear=n.currentYear):(i=new Date,n.selectedDay=i.getDate(),n.drawMonth=n.selectedMonth=i.getMonth(),n.drawYear=n.selectedYear=i.getFullYear()),this._notifyChange(n),this._adjustDate(s)},_selectMonthYear:function(e,i,s){var n=t(e),a=this._getInst(n[0]);a["selected"+("M"===s?"Month":"Year")]=a["draw"+("M"===s?"Month":"Year")]=parseInt(i.options[i.selectedIndex].value,10),this._notifyChange(a),this._adjustDate(n)},_selectDay:function(e,i,s,n){var a,r=t(e);t(n).hasClass(this._unselectableClass)||this._isDisabledDatepicker(r[0])||(a=this._getInst(r[0]),a.selectedDay=a.currentDay=t("a",n).html(),a.selectedMonth=a.currentMonth=i,a.selectedYear=a.currentYear=s,this._selectDate(e,this._formatDate(a,a.currentDay,a.currentMonth,a.currentYear)))},_clearDate:function(e){var i=t(e);this._selectDate(i,"")},_selectDate:function(e,i){var s,n=t(e),a=this._getInst(n[0]);i=null!=i?i:this._formatDate(a),a.input&&a.input.val(i),this._updateAlternate(a),s=this._get(a,"onSelect"),s?s.apply(a.input?a.input[0]:null,[i,a]):a.input&&a.input.trigger("change"),a.inline?this._updateDatepicker(a):(this._hideDatepicker(),this._lastInput=a.input[0],"object"!=typeof a.input[0]&&a.input.focus(),this._lastInput=null)},_updateAlternate:function(e){var i,s,n,a=this._get(e,"altField");a&&(i=this._get(e,"altFormat")||this._get(e,"dateFormat"),s=this._getDate(e),n=this.formatDate(i,s,this._getFormatConfig(e)),t(a).each(function(){t(this).val(n)}))},noWeekends:function(t){var e=t.getDay();return[e>0&&6>e,""]},iso8601Week:function(t){var e,i=new Date(t.getTime());return i.setDate(i.getDate()+4-(i.getDay()||7)),e=i.getTime(),i.setMonth(0),i.setDate(1),Math.floor(Math.round((e-i)/864e5)/7)+1},parseDate:function(i,s,n){if(null==i||null==s)throw"Invalid arguments";if(s="object"==typeof s?""+s:s+"",""===s)return null;var a,r,o,h,l=0,c=(n?n.shortYearCutoff:null)||this._defaults.shortYearCutoff,u="string"!=typeof c?c:(new Date).getFullYear()%100+parseInt(c,10),d=(n?n.dayNamesShort:null)||this._defaults.dayNamesShort,p=(n?n.dayNames:null)||this._defaults.dayNames,f=(n?n.monthNamesShort:null)||this._defaults.monthNamesShort,m=(n?n.monthNames:null)||this._defaults.monthNames,g=-1,v=-1,_=-1,b=-1,y=!1,x=function(t){var e=i.length>a+1&&i.charAt(a+1)===t;return e&&a++,e},k=function(t){var e=x(t),i="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,n=RegExp("^\\d{1,"+i+"}"),a=s.substring(l).match(n);if(!a)throw"Missing number at position "+l;return l+=a[0].length,parseInt(a[0],10)},w=function(i,n,a){var r=-1,o=t.map(x(i)?a:n,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(t.each(o,function(t,i){var n=i[1];return s.substr(l,n.length).toLowerCase()===n.toLowerCase()?(r=i[0],l+=n.length,!1):e}),-1!==r)return r+1;throw"Unknown name at position "+l},D=function(){if(s.charAt(l)!==i.charAt(a))throw"Unexpected literal at position "+l;l++};for(a=0;i.length>a;a++)if(y)"'"!==i.charAt(a)||x("'")?D():y=!1;else switch(i.charAt(a)){case"d":_=k("d");break;case"D":w("D",d,p);break;case"o":b=k("o");break;case"m":v=k("m");break;case"M":v=w("M",f,m);break;case"y":g=k("y");break;case"@":h=new Date(k("@")),g=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"!":h=new Date((k("!")-this._ticksTo1970)/1e4),g=h.getFullYear(),v=h.getMonth()+1,_=h.getDate();break;case"'":x("'")?D():y=!0;break;default:D()}if(s.length>l&&(o=s.substr(l),!/^\s+/.test(o)))throw"Extra/unparsed characters found in date: "+o;if(-1===g?g=(new Date).getFullYear():100>g&&(g+=(new Date).getFullYear()-(new Date).getFullYear()%100+(u>=g?0:-100)),b>-1)for(v=1,_=b;;){if(r=this._getDaysInMonth(g,v-1),r>=_)break;v++,_-=r}if(h=this._daylightSavingAdjust(new Date(g,v-1,_)),h.getFullYear()!==g||h.getMonth()+1!==v||h.getDate()!==_)throw"Invalid date";return h},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:1e7*60*60*24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925)),formatDate:function(t,e,i){if(!e)return"";var s,n=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,a=(i?i.dayNames:null)||this._defaults.dayNames,r=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,o=(i?i.monthNames:null)||this._defaults.monthNames,h=function(e){var i=t.length>s+1&&t.charAt(s+1)===e;return i&&s++,i},l=function(t,e,i){var s=""+e;if(h(t))for(;i>s.length;)s="0"+s;return s},c=function(t,e,i,s){return h(t)?s[e]:i[e]},u="",d=!1;if(e)for(s=0;t.length>s;s++)if(d)"'"!==t.charAt(s)||h("'")?u+=t.charAt(s):d=!1;else switch(t.charAt(s)){case"d":u+=l("d",e.getDate(),2);break;case"D":u+=c("D",e.getDay(),n,a);break;case"o":u+=l("o",Math.round((new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()-new Date(e.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=l("m",e.getMonth()+1,2);break;case"M":u+=c("M",e.getMonth(),r,o);break;case"y":u+=h("y")?e.getFullYear():(10>e.getYear()%100?"0":"")+e.getYear()%100;break;case"@":u+=e.getTime();break;case"!":u+=1e4*e.getTime()+this._ticksTo1970;break;case"'":h("'")?u+="'":d=!0;break;default:u+=t.charAt(s)}return u},_possibleChars:function(t){var e,i="",s=!1,n=function(i){var s=t.length>e+1&&t.charAt(e+1)===i;return s&&e++,s};for(e=0;t.length>e;e++)if(s)"'"!==t.charAt(e)||n("'")?i+=t.charAt(e):s=!1;else switch(t.charAt(e)){case"d":case"m":case"y":case"@":i+="0123456789";break;case"D":case"M":return null;case"'":n("'")?i+="'":s=!0;break;default:i+=t.charAt(e)}return i},_get:function(t,i){return t.settings[i]!==e?t.settings[i]:this._defaults[i]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),a=n,r=this._getFormatConfig(t);try{a=this.parseDate(i,s,r)||n}catch(o){s=e?"":s}t.selectedDay=a.getDate(),t.drawMonth=t.selectedMonth=a.getMonth(),t.drawYear=t.selectedYear=a.getFullYear(),t.currentDay=s?a.getDate():0,t.currentMonth=s?a.getMonth():0,t.currentYear=s?a.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(e,i,s){var n=function(t){var e=new Date;return e.setDate(e.getDate()+t),e},a=function(i){try{return t.datepicker.parseDate(t.datepicker._get(e,"dateFormat"),i,t.datepicker._getFormatConfig(e))}catch(s){}for(var n=(i.toLowerCase().match(/^c/)?t.datepicker._getDate(e):null)||new Date,a=n.getFullYear(),r=n.getMonth(),o=n.getDate(),h=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,l=h.exec(i);l;){switch(l[2]||"d"){case"d":case"D":o+=parseInt(l[1],10);break;case"w":case"W":o+=7*parseInt(l[1],10);break;case"m":case"M":r+=parseInt(l[1],10),o=Math.min(o,t.datepicker._getDaysInMonth(a,r));break;case"y":case"Y":a+=parseInt(l[1],10),o=Math.min(o,t.datepicker._getDaysInMonth(a,r))}l=h.exec(i)}return new Date(a,r,o)},r=null==i||""===i?s:"string"==typeof i?a(i):"number"==typeof i?isNaN(i)?s:n(i):new Date(i.getTime());return r=r&&"Invalid Date"==""+r?s:r,r&&(r.setHours(0),r.setMinutes(0),r.setSeconds(0),r.setMilliseconds(0)),this._daylightSavingAdjust(r)},_daylightSavingAdjust:function(t){return t?(t.setHours(t.getHours()>12?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,a=t.selectedYear,r=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=r.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=r.getMonth(),t.drawYear=t.selectedYear=t.currentYear=r.getFullYear(),n===t.selectedMonth&&a===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){var e=!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return e},_attachHandlers:function(e){var i=this._get(e,"stepMonths"),s="#"+e.id.replace(/\\\\/g,"\\");e.dpDiv.find("[data-handler]").map(function(){var e={prev:function(){t.datepicker._adjustDate(s,-i,"M")},next:function(){t.datepicker._adjustDate(s,+i,"M")},hide:function(){t.datepicker._hideDatepicker()},today:function(){t.datepicker._gotoToday(s)},selectDay:function(){return t.datepicker._selectDay(s,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return t.datepicker._selectMonthYear(s,this,"M"),!1},selectYear:function(){return t.datepicker._selectMonthYear(s,this,"Y"),!1}};t(this).bind(this.getAttribute("data-event"),e[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,a,r,o,h,l,c,u,d,p,f,m,g,v,_,b,y,x,k,w,D,T,C,M,S,N,I,P,A,z,H,E,F,O,W,j,R=new Date,L=this._daylightSavingAdjust(new Date(R.getFullYear(),R.getMonth(),R.getDate())),Y=this._get(t,"isRTL"),B=this._get(t,"showButtonPanel"),J=this._get(t,"hideIfNoPrevNext"),K=this._get(t,"navigationAsDateFormat"),Q=this._getNumberOfMonths(t),V=this._get(t,"showCurrentAtPos"),U=this._get(t,"stepMonths"),q=1!==Q[0]||1!==Q[1],X=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),G=this._getMinMaxDate(t,"min"),$=this._getMinMaxDate(t,"max"),Z=t.drawMonth-V,te=t.drawYear;if(0>Z&&(Z+=12,te--),$)for(e=this._daylightSavingAdjust(new Date($.getFullYear(),$.getMonth()-Q[0]*Q[1]+1,$.getDate())),e=G&&G>e?G:e;this._daylightSavingAdjust(new Date(te,Z,1))>e;)Z--,0>Z&&(Z=11,te--);for(t.drawMonth=Z,t.drawYear=te,i=this._get(t,"prevText"),i=K?this.formatDate(i,this._daylightSavingAdjust(new Date(te,Z-U,1)),this._getFormatConfig(t)):i,s=this._canAdjustMonth(t,-1,te,Z)?""+i+"":J?"":""+i+"",n=this._get(t,"nextText"),n=K?this.formatDate(n,this._daylightSavingAdjust(new Date(te,Z+U,1)),this._getFormatConfig(t)):n,a=this._canAdjustMonth(t,1,te,Z)?""+n+"":J?"":""+n+"",r=this._get(t,"currentText"),o=this._get(t,"gotoCurrent")&&t.currentDay?X:L,r=K?this.formatDate(r,o,this._getFormatConfig(t)):r,h=t.inline?"":"",l=B?"
      "+(Y?h:"")+(this._isInRange(t,o)?"":"")+(Y?"":h)+"
      ":"",c=parseInt(this._get(t,"firstDay"),10),c=isNaN(c)?0:c,u=this._get(t,"showWeek"),d=this._get(t,"dayNames"),p=this._get(t,"dayNamesMin"),f=this._get(t,"monthNames"),m=this._get(t,"monthNamesShort"),g=this._get(t,"beforeShowDay"),v=this._get(t,"showOtherMonths"),_=this._get(t,"selectOtherMonths"),b=this._getDefaultDate(t),y="",k=0;Q[0]>k;k++){for(w="",this.maxRows=4,D=0;Q[1]>D;D++){if(T=this._daylightSavingAdjust(new Date(te,Z,t.selectedDay)),C=" ui-corner-all",M="",q){if(M+="
      "}for(M+="
      "+(/all|left/.test(C)&&0===k?Y?a:s:"")+(/all|right/.test(C)&&0===k?Y?s:a:"")+this._generateMonthYearHeader(t,Z,te,G,$,k>0||D>0,f,m)+"
      "+"",S=u?"":"",x=0;7>x;x++)N=(x+c)%7,S+="=5?" class='ui-datepicker-week-end'":"")+">"+""+p[N]+"";for(M+=S+"",I=this._getDaysInMonth(te,Z),te===t.selectedYear&&Z===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,I)),P=(this._getFirstDayOfMonth(te,Z)-c+7)%7,A=Math.ceil((P+I)/7),z=q?this.maxRows>A?this.maxRows:A:A,this.maxRows=z,H=this._daylightSavingAdjust(new Date(te,Z,1-P)),E=0;z>E;E++){for(M+="",F=u?"":"",x=0;7>x;x++)O=g?g.apply(t.input?t.input[0]:null,[H]):[!0,""],W=H.getMonth()!==Z,j=W&&!_||!O[0]||G&&G>H||$&&H>$,F+="",H.setDate(H.getDate()+1),H=this._daylightSavingAdjust(H);M+=F+""}Z++,Z>11&&(Z=0,te++),M+="
      "+this._get(t,"weekHeader")+"
      "+this._get(t,"calculateWeek")(H)+""+(W&&!v?" ":j?""+H.getDate()+"":""+H.getDate()+"")+"
      "+(q?"
      "+(Q[0]>0&&D===Q[1]-1?"
      ":""):""),w+=M}y+=w}return y+=l,t._keyEvent=!1,y},_generateMonthYearHeader:function(t,e,i,s,n,a,r,o){var h,l,c,u,d,p,f,m,g=this._get(t,"changeMonth"),v=this._get(t,"changeYear"),_=this._get(t,"showMonthAfterYear"),b="
      ",y="";if(a||!g)y+=""+r[e]+"";else{for(h=s&&s.getFullYear()===i,l=n&&n.getFullYear()===i,y+=""}if(_||(b+=y+(!a&&g&&v?"":" ")),!t.yearshtml)if(t.yearshtml="",a||!v)b+=""+i+"";else{for(u=this._get(t,"yearRange").split(":"),d=(new Date).getFullYear(),p=function(t){var e=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?d+parseInt(t,10):parseInt(t,10); +return isNaN(e)?d:e},f=p(u[0]),m=Math.max(f,p(u[1]||"")),f=s?Math.max(f,s.getFullYear()):f,m=n?Math.min(m,n.getFullYear()):m,t.yearshtml+="",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),_&&(b+=(!a&&g&&v?"":" ")+y),b+="
      "},_adjustInstDate:function(t,e,i){var s=t.drawYear+("Y"===i?e:0),n=t.drawMonth+("M"===i?e:0),a=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),r=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,a)));t.selectedDay=r.getDate(),t.drawMonth=t.selectedMonth=r.getMonth(),t.drawYear=t.selectedYear=r.getFullYear(),("M"===i||"Y"===i)&&this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=i&&i>e?i:e;return s&&n>s?s:n},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){var e=this._get(t,"numberOfMonths");return null==e?[1,1]:"number"==typeof e?[1,e]:e},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),a=this._daylightSavingAdjust(new Date(i,s+(0>e?e:n[0]*n[1]),1));return 0>e&&a.setDate(this._getDaysInMonth(a.getFullYear(),a.getMonth())),this._isInRange(t,a)},_isInRange:function(t,e){var i,s,n=this._getMinMaxDate(t,"min"),a=this._getMinMaxDate(t,"max"),r=null,o=null,h=this._get(t,"yearRange");return h&&(i=h.split(":"),s=(new Date).getFullYear(),r=parseInt(i[0],10),o=parseInt(i[1],10),i[0].match(/[+\-].*/)&&(r+=s),i[1].match(/[+\-].*/)&&(o+=s)),(!n||e.getTime()>=n.getTime())&&(!a||e.getTime()<=a.getTime())&&(!r||e.getFullYear()>=r)&&(!o||o>=e.getFullYear())},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),{shortYearCutoff:e,dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);var n=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),n,this._getFormatConfig(t))}}),t.fn.datepicker=function(e){if(!this.length)return this;t.datepicker.initialized||(t(document).mousedown(t.datepicker._checkExternalClick),t.datepicker.initialized=!0),0===t("#"+t.datepicker._mainDivId).length&&t("body").append(t.datepicker.dpDiv);var i=Array.prototype.slice.call(arguments,1);return"string"!=typeof e||"isDisabled"!==e&&"getDate"!==e&&"widget"!==e?"option"===e&&2===arguments.length&&"string"==typeof arguments[1]?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i)):this.each(function(){"string"==typeof e?t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this].concat(i)):t.datepicker._attachDatepicker(this,e)}):t.datepicker["_"+e+"Datepicker"].apply(t.datepicker,[this[0]].concat(i))},t.datepicker=new i,t.datepicker.initialized=!1,t.datepicker.uuid=(new Date).getTime(),t.datepicker.version="1.10.3"})(jQuery); \ No newline at end of file diff --git a/www/lib/js/jquery.ui.touch-punch.min.js b/www/lib/js/jquery.ui.touch-punch.min.js new file mode 100644 index 0000000..33d6f97 --- /dev/null +++ b/www/lib/js/jquery.ui.touch-punch.min.js @@ -0,0 +1,11 @@ +/* + * jQuery UI Touch Punch 0.2.2 + * + * Copyright 2011, Dave Furfero + * Dual licensed under the MIT or GPL Version 2 licenses. + * + * Depends: + * jquery.ui.widget.js + * jquery.ui.mouse.js + */ +(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery); \ No newline at end of file diff --git a/www/lib/js/jquery.wakeup.js b/www/lib/js/jquery.wakeup.js new file mode 100644 index 0000000..bb45988 --- /dev/null +++ b/www/lib/js/jquery.wakeup.js @@ -0,0 +1,74 @@ +/*! + * jQuery WakeUp plugin + * + * A JQuery plugin that will help detecting waking up from sleep and/or + * hibernation and executing assigned functions. + * + * Based on code provided by Andrew Mu: + * http://stackoverflow.com/questions/4079115 + * + * Copyright (c) 2013, Paul Okopny + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +(function ($, document, undefined) { + var default_wakeup_interval = 5000; + var wake_up_ids = new Array(); + // returns intervalId, which can be used to cancel future waking + $.wakeUp = function (on_wakeup, params, interval) { + + if ((!interval) || typeof(interval) !== 'number' ) { + interval = default_wakeup_interval; + } + // on_wakeup should be a function + if (typeof(on_wakeup) !== "function") { + return null; + } + var lastTime = (new Date()).getTime(); + var intervalId = setInterval(function() { + var currentTime = (new Date()).getTime(); + if (currentTime > (lastTime + interval + 5000)) { // + var sleepTime = currentTime - lastTime; + lastTime = currentTime; + if (params) { + on_wakeup(sleepTime, params); + } else { + on_wakeup(sleepTime); + } + } else { + lastTime = currentTime; + } + }, interval); + //add interval id to wake_up_ids array + wake_up_ids.push(intervalId); + return intervalId; + }; + + $.ignoreBell = function (interval_id) { + if (interval_id) { + // delete only one wakeUp call + wake_up_ids.splice($.inArray(interval_id, wake_up_ids),1); + clearInterval(interval_id); + } + }; + + $.dreamOn = function() { + // delete all current wake Up calls + $.each(wake_up_ids, function (index_of, interval_id) { + clearInterval(interval_id) + }); + wake_up_ids = []; + }; + +})(jQuery, document); \ No newline at end of file diff --git a/www/lib/js/jqueryui.selectmenu.js b/www/lib/js/jqueryui.selectmenu.js new file mode 100644 index 0000000..8e822aa --- /dev/null +++ b/www/lib/js/jqueryui.selectmenu.js @@ -0,0 +1,468 @@ +/*! + * jQuery UI Selectmenu @VERSION + * http://jqueryui.com + * + * Copyright 2013 jQuery Foundation and other contributors + * Released under the MIT license. + * http://jquery.org/license + * + * http://api.jqueryui.com/selectmenu + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.position.js + * jquery.ui.menu.js + */ +(function( $, undefined ) { + + $.widget( "ui.selectmenu", { + version: "@VERSION", + defaultElement: " + $(".translateV").each(function (idx) { + var text = $(this).attr('data-lang'); + if (!text) { + text = $(this).attr('value'); + $(this).attr('data-lang', text); + } + + var transText = translateWord(text, lang, dictionary); + if (transText) { + $(this).attr('value', transText); + } + }); + $(".translateB").each(function (idx) { + //Save + var text = $(this).attr('data-lang'); + if (!text) { + text = $(this).html().match(/\>([\w ]+)\ 1) { + text = text[1]; + } else { + text = $(this).html(); + $(this).attr('data-lang-pure', true); + } + $(this).attr('data-lang', text); + } + var transText = translateWord(text, lang, dictionary); + if (transText) { + if ($(this).attr('data-lang-pure')) { + $(this).html(transText); + } else { + $(this).html($(this).html().replace(/>[\w ]+' + transText + '<')); + } + } + }); + $(".translateT").each(function (idx) { + //Save + var text = $(this).attr('data-lang'); + if (!text) { + text = $(this).attr('title'); + $(this).attr('data-lang', text); + } + var transText = translateWord(text, lang, dictionary); + if (transText) { + $(this).attr('title', transText); + } + }); +} + +// make possible _('words to translate') +var _ = function (text, arg1, arg2, arg3) { + text = translateWord(text); + + var pos = text.indexOf('%s'); + if (pos != -1) { + text = text.replace('%s', arg1); + } else { + return text; + } + + pos = text.indexOf('%s'); + if (pos != -1) { + text = text.replace('%s', arg2); + } else { + return text; + } + + pos = text.indexOf('%s'); + if (pos != -1) { + text = text.replace('%s', arg3); + } + + return text; +}; + diff --git a/www/offline.html b/www/offline.html new file mode 100644 index 0000000..5b0afa5 --- /dev/null +++ b/www/offline.html @@ -0,0 +1,11 @@ + + +
      + + No connection to Server + +
      +

      +reload + + diff --git a/www/signals/fire.png b/www/signals/fire.png new file mode 100644 index 0000000..0f87fd6 Binary files /dev/null and b/www/signals/fire.png differ diff --git a/www/signals/fireColor.png b/www/signals/fireColor.png new file mode 100644 index 0000000..ef1363d Binary files /dev/null and b/www/signals/fireColor.png differ diff --git a/www/signals/lowbattery.png b/www/signals/lowbattery.png new file mode 100644 index 0000000..076e364 Binary files /dev/null and b/www/signals/lowbattery.png differ diff --git a/www/signals/motion.png b/www/signals/motion.png new file mode 100644 index 0000000..e45e587 Binary files /dev/null and b/www/signals/motion.png differ diff --git a/www/signals/motionColor.png b/www/signals/motionColor.png new file mode 100644 index 0000000..357cba3 Binary files /dev/null and b/www/signals/motionColor.png differ diff --git a/www/signals/online.png b/www/signals/online.png new file mode 100644 index 0000000..27956e3 Binary files /dev/null and b/www/signals/online.png differ diff --git a/www/signals/waterColor.png b/www/signals/waterColor.png new file mode 100644 index 0000000..4cc863e Binary files /dev/null and b/www/signals/waterColor.png differ diff --git a/www/signals/waterDrops.png b/www/signals/waterDrops.png new file mode 100644 index 0000000..92ccf21 Binary files /dev/null and b/www/signals/waterDrops.png differ diff --git a/www/signals/wifiColor.png b/www/signals/wifiColor.png new file mode 100644 index 0000000..f7c3b45 Binary files /dev/null and b/www/signals/wifiColor.png differ diff --git a/www/signals/wifiColorRed.png b/www/signals/wifiColorRed.png new file mode 100644 index 0000000..b67ff34 Binary files /dev/null and b/www/signals/wifiColorRed.png differ diff --git a/www/widgets/basic.html b/www/widgets/basic.html new file mode 100644 index 0000000..ac8a21b --- /dev/null +++ b/www/widgets/basic.html @@ -0,0 +1,3124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/widgets/basic/css/table.css b/www/widgets/basic/css/table.css new file mode 100644 index 0000000..e6ff4bc --- /dev/null +++ b/www/widgets/basic/css/table.css @@ -0,0 +1,92 @@ +/* ---------------------- Sample for table widget ------------------------- */ +.tclass-overflow { + overflow-y: auto; +} +.tclass { + border: 0px solid black; + width: 100%; + table-layout: fixed; + font-family: Arial; +} +.tclass-inner { + border: 0px solid black; + width: 100%; + table-layout: fixed; + height: 100%; +} +.tclass-inner-overflow { + overflow-y: auto; + height: calc(100% - 30px); +} +.tclass-th { + background-color: black; + color: white; + font-weight: bold; +} +.tclass-th1 { + width: 20px; + text-align: center; +} +.tclass-th2 { + width: 20px; + text-align: center; +} +.tclass-th3 { + width: 150px; +} +.tclass-th4 { + width: 200px; +} +.tclass-tr { + color: black; +} +.tclass-tr-even { + background-color: darkgray; +} +.tclass-tr-odd { + background-color: lightgray; +} +.tclass-tr:hover { + color:blue; + cursor: pointer; +} +.tclass-tr-selected { + background-color: lightblue; + /* color: white;*/ +} +.tclass-detail { + width: 100% +} +.tclass-detail-tr { + width: 100% +} +.tclass-detail-tr-even { +} +.tclass-detail-tr-odd { +} +.tclass-detail-td-name { + width:200px; + font-weight: bold; +} + +.tclass-detail-td-value { +} +.tclass-print-button { + position: absolute; + bottom: 5%; + right: 5%; +} +.tclass-tr-error { + color:red; +} +.tclass-tr-warning { + color:yellow; +} +.tclass-img-type { + width:16px; + height:16px +} +.tclass-img-person { + width:16px; + height:16px +} \ No newline at end of file diff --git a/www/widgets/basic/doc.html b/www/widgets/basic/doc.html new file mode 100644 index 0000000..429e956 --- /dev/null +++ b/www/widgets/basic/doc.html @@ -0,0 +1,393 @@ + + + + Dokumentation Widget-Set basic + + + +

      container - view in widget

      + +Dieses Widget kann Views innerhalb von Views darstellen. Sinnvoll z.B. für eine Navigation: Man baut eine View mit +Navigations-Elementen auf und bindet diese dann in beliebig vielen anderen Views ein. + +

      Attribute

      +
      +
      contains_view
      +
      Name der View die im Container angezeigt werden soll.
      +
      + +
      + +

      static - HTML

      + +Dieses Widget stellt beliebigen HTML-Code dar. Es ist auch möglich Javascript innerhalb des Widgets zu verwenden. +

      Attribute

      +
      +
      html
      +
      Selbsterklärend ;) ...hier den HTML-Code einfügen
      +
      +
      + +

      static - iFrame

      +Dieses Widget bindet ein iFrame ein +

      Attribute

      +
      +
      src
      +
      Die URL (src Attribut)
      +
      refreshInterval
      +
      iFrame in Intervall neuladen: Angabe in milli-sekunden
      +
      +
      + + +

      static - Image

      +Dieses Widget stellt ein Bild dar. (HTML <img> Tag) +

      Attribute

      +
      +
      src
      +
      Die Bild-URL
      +
      refreshInterval
      +
      Bild in Intervall neuladen: Angabe in milli-sekunden
      +
      +
      + + +

      static - link

      +Dieses Widget entspricht dem Widget "static - HTML" ist aber zusätzlich auf seiner ganzen Fläche +ein klickbarer Link. Kann für die Navigation zwischen Views oder für externe Links genutzt werden. + +
      +
      html
      +
      Selbsterklärend ;) ...hier den HTML-Code einfügen
      + +
      href
      +
      Die Link-URL. Um einen Link auf eine andere View zu nutzen einfach den View-Namen mit vorangestelltem Hash-Symbol (#) + eintragen
      + +
      target
      +
      Das Ziel des Links. Leer lassen um im gleichen Browser-Fenster zu bleiben, möchte man ein neues Fenster öffnen _blank eintragen
      +
      + +
      + +

      stateful/container - view in widget 8

      + +Zeigt eine von 8 Views in Abhängigkeit von einem Zustand an. + +
      +
      persistent
      +
      Views die einmal gerendert wurden nicht mehr aus dem DOM Entfernen
      +
      + +
      + +

      stateful - iFrame 8

      +Zeigt einen von 8 iFrames in Abhängigkeit von einem Zustand an. + + +
      + +

      stateful - Image 8

      + +Zeigt eines von 8 Bildern in Abhängigkeit von einem Zustand an. + +
      + +

      navigation - HTML

      +Dieses Widget dient dazu eine Navigation zwischen den Views aufzubauen. Entspricht dem Widget "static - link", +ist jedoch ausschließlich für die Navigation zwischen den Views nutzbar und bietet zusätzlich die Möglichkeit animierte +Effekte beim Wechsel der Views zu verwenden. + +

      Attribute

      +
      +
      html
      +
      Selbsterklärend ;) ...hier den HTML-Code einfügen
      + +
      nav_view
      +
      Hier muss der Name der View zu der navigiert werden soll eingetragen werden
      + +
      hide_effect
      +
      Hier kann der Name eines jQueryUI Effektes eingetragen werden der beim verlassen der View genutzt wird. + Verfügbare Effekte sind: Blind, Bounce, Clip, Drop, Explode, Fade, Fold, Highlight, Puff, Pulsate, Scale, Shake, Size, + Slide und Transfer. + Hier gibt es Demos der Effekte. +
      + +
      hide_duration
      +
      Dauer des Effekts in ms
      + +
      show_effect
      +
      siehe oben, das gleiche aber dieses mal für das einblenden der neuen View
      + +
      show_duration
      +
      Siehe oben, Zeit in ms für das einblenden der neuen View
      +
      +
      + +

      hm_val - Number

      +Dieses Widget stellt einen Zahlenwert dar (sowohl für Integer als auch Float verwendbar) +

      Attribute

      +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Zahlenwert angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Zahlenwert angezeigt wird
      + +
      digits
      +
      Anzahl der dargestellten Nachkommastellen
      + +
      factor
      +
      Faktor mit dem der Zahlenwert multipliziert wird
      +
      +

      Beispiel

      + + +
      + +

      hm_val - String

      +Dieses Widget stellt einen Datenpunkt vom Typ Zeichenkette dar. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem String angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem String angezeigt wird
      +
      +
      + +

      hm_val - String (unescaped)

      +Dieses Widget stellt einen Datenpunkt vom Typ Zeichenkette dar. Im Unterschied zum Widget "hm_val - String" +werden dabei keine Sonderzeichen "escaped" - d.h. die Variable kann auch HTML-Code enthalten und dieser wird dann dargestellt. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem String angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem String angezeigt wird
      +
      + +
      + +

      hm_val - String img src

      +Diesem Widget kann ein Variable vom Typ Zeichenkette zugeordnet werden, eine dort enthaltene URL wird dann als Bild dargestellt +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      +
      +
      + + +

      hm_val - ValueList Text

      +Dieses Widget stellt eine Variable vom Typ Werteliste dar. +
      +
      valuelist
      +
      Eine Semikolon-getrennte Liste von Texten für die jeweiligen Werte.
      + +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      +
      +
      + +

      hm_val - ValueList HTML

      +Dieses Widget stellt eine Variable vom Typ Werteliste dar. Entspricht dem Widget "hm_val - ValueList Text, +allerdings wird nicht "escaped", d.h. in valuelist kann HTML-Code eingetragen werden. +
      +
      valuelist
      +
      Eine Semikolon-getrennte Liste von HTML-Code für die jeweiligen Werte.
      + +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      +
      +
      + +

      hm_val - ValueList HTML 8

      +Dieses Widget stellt eine Variable vom Typ Werteliste dar. Entspricht dem Widget "hm_val - ValueList HTML, +bietet aber die Möglichkeit für 8 verschiedene Werte (0-7) auch 8 verschiedene CSS-Angaben zu verwenden. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      + +
      value0 bis value7
      +
      Text oder HTML-Code für die Werte 0 bis 7
      + +
      style0 bis style7
      +
      CSS-Angaben für die Werte 0 bis 7
      + + +
      +
      + +

      hm_val - Bool HTML

      +Dieses Widget stellt Bool-Werte dar. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      + +
      html_true
      +
      Text oder HTML-Code der im True-Fall angezeigt wird
      + +
      html_false
      +
      Text oder HTML-Code der im False-Fall angezeigt wird
      + + +
      + + +
      + +

      hm_ctrl - Bool Checkbox

      +Dieses Widget zeigt Bool-Werte als einfache Checkbox an und erlaubt außerdem den Wert zu umzuschalten. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor der Checkbox angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter der Checkbox angezeigt wird
      +
      +
      + +

      hm_ctrl - Bool Select

      +Dieses Widget stellt Bool-Werte als Dropdown dar und erlaubt außerdem den Wert umzuschalten. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      + +
      text_true
      +
      Text für den True-Fall
      + +
      text_false
      +
      Text für den False-Fall
      + + +
      + +
      +

      hm_ctrl - Bool HTML

      +Dieses Widget stellt Bool-Werte dar und erlaubt außerdem den Wert auf Klick innerhalb der Widget-Fläche umzuschalten. +
      +
      html_prepend
      +
      Text oder HTML-Code der vor dem Bild angezeigt wird
      + +
      html_append
      +
      Text oder HTML-Code der hinter dem Bild angezeigt wird
      + +
      html_true
      +
      Text oder HTML-Code der im True-Fall angezeigt wird
      + +
      html_false
      +
      Text oder HTML-Code der im False-Fall angezeigt wird
      + +
      + +
      + + +

      hm_ctrl - HTML State

      +Dieses Widget setzt bei Klick innerhalb der Widget-Fläche einen Wert. +
      +
      html
      +
      Text oder HTML-Code der angezeigt wird
      + +
      value
      +
      Wert der gesetzt werden soll
      + +
      + +
      + +

      hm_val - Hide on 0/false

      +Dieses Widget verschwindet wenn der Wert des zugeordneten Datenpunkts 0 bzw false ist. Geschickt z.B. für die Anzeige von Servicemeldungen + +
      + +

      hm_val - Red Number

      +Anzeige eines numerischen Werts im Stil der iOS Benachrichtigungs-Symbole. Verschwindet beim Wert 0. + + +
      + +

      hm_val - Bulb on/off

      +Dieses Widget stellt einen Wert als ausgeschaltete oder leuchtende Glühbirne auf schwarzem Hintergrund dar. Ist für Bool und Float-Werte (Dimmer) einsetzbar. + +
      + +

      hm_ctrl - Bulb on/off

      +Dieses Widget stellt einen Wert als ausgeschaltete oder leuchtende Glühbirne auf schwarzem Hintergrund dar. Bei Klick auf das Widget +wird der Wert umgeschaltet. + +
      + +

      hm_val - Drehgriff

      +Dieses Widget stellt eine Drehgriff-Sensor mit den originalen Homematic-Icons dar. +
      + +

      hm_val - TFK

      +Dieses Widget stellt einen Tür-/Fenster-Kontakt mit den originalen Homematic-Icons dar. +
      + +

      hm_val - Bar Horizontal

      +Dieses Widget stellt einen Wert von 0-100 als horizontalen Balken dar. +
      +
      factor
      +
      Faktor mit dem der Wert multipliziert wird. Beispiel: für einen Dimmer (der von 0.00 bis 1.00 geht) muss 100 eingetragen werden.
      + +
      color
      +
      CSS-Eigenschaft background-color des Balkens
      + +
      border
      +
      CSS-Eigenschaft border des Balkens
      + +
      shadow
      +
      CSS-Eigenschaft box-shadow des Balkens
      + +
      reverse
      +
      Wenn hier true eingetragen wird wird der Balken von rechts nach links statt von links nach rechts angezeigt
      + + +
      + +
      + +

      hm_val - Bar Vertical

      +Entspricht dem Widget "hm_val - Bar Horizontal, allerdings vertikal statt horiziontal. +
      +
      factor
      +
      Faktor mit dem der Wert multipliziert wird. Beispiel: für einen Dimmer (der von 0.00 bis 1.00 geht) muss 100 eingetragen werden.
      + +
      color
      +
      CSS-Eigenschaft background-color des Balkens
      + +
      border
      +
      CSS-Eigenschaft border des Balkens
      + +
      shadow
      +
      CSS-Eigenschaft box-shadow des Balkens
      + +
      reverse
      +
      Wenn hier true eingetragen wird wird der Balken von unten nach oben statt von oben nach unten angezeigt
      + + +
      +
      + + + \ No newline at end of file diff --git a/www/widgets/basic/img/Prev_AckBool.png b/www/widgets/basic/img/Prev_AckBool.png new file mode 100644 index 0000000..69496df Binary files /dev/null and b/www/widgets/basic/img/Prev_AckBool.png differ diff --git a/www/widgets/basic/img/Prev_BasicState.png b/www/widgets/basic/img/Prev_BasicState.png new file mode 100644 index 0000000..90f4ecf Binary files /dev/null and b/www/widgets/basic/img/Prev_BasicState.png differ diff --git a/www/widgets/basic/img/Prev_BulbOnOffCtrl.png b/www/widgets/basic/img/Prev_BulbOnOffCtrl.png new file mode 100644 index 0000000..008985f Binary files /dev/null and b/www/widgets/basic/img/Prev_BulbOnOffCtrl.png differ diff --git a/www/widgets/basic/img/Prev_ContainerView.png b/www/widgets/basic/img/Prev_ContainerView.png new file mode 100644 index 0000000..6548d03 Binary files /dev/null and b/www/widgets/basic/img/Prev_ContainerView.png differ diff --git a/www/widgets/basic/img/Prev_FilterDropdown.png b/www/widgets/basic/img/Prev_FilterDropdown.png new file mode 100644 index 0000000..8126d31 Binary files /dev/null and b/www/widgets/basic/img/Prev_FilterDropdown.png differ diff --git a/www/widgets/basic/img/Prev_FullScreen.png b/www/widgets/basic/img/Prev_FullScreen.png new file mode 100644 index 0000000..36091e8 Binary files /dev/null and b/www/widgets/basic/img/Prev_FullScreen.png differ diff --git a/www/widgets/basic/img/Prev_HTML.png b/www/widgets/basic/img/Prev_HTML.png new file mode 100644 index 0000000..1200cd6 Binary files /dev/null and b/www/widgets/basic/img/Prev_HTML.png differ diff --git a/www/widgets/basic/img/Prev_HTMLnavigation.png b/www/widgets/basic/img/Prev_HTMLnavigation.png new file mode 100644 index 0000000..97aa52d Binary files /dev/null and b/www/widgets/basic/img/Prev_HTMLnavigation.png differ diff --git a/www/widgets/basic/img/Prev_HtmlLogout.png b/www/widgets/basic/img/Prev_HtmlLogout.png new file mode 100644 index 0000000..b9125f3 Binary files /dev/null and b/www/widgets/basic/img/Prev_HtmlLogout.png differ diff --git a/www/widgets/basic/img/Prev_Image.png b/www/widgets/basic/img/Prev_Image.png new file mode 100644 index 0000000..d7ef5d4 Binary files /dev/null and b/www/widgets/basic/img/Prev_Image.png differ diff --git a/www/widgets/basic/img/Prev_Note.png b/www/widgets/basic/img/Prev_Note.png new file mode 100644 index 0000000..f68cc78 Binary files /dev/null and b/www/widgets/basic/img/Prev_Note.png differ diff --git a/www/widgets/basic/img/Prev_RedNumber.png b/www/widgets/basic/img/Prev_RedNumber.png new file mode 100644 index 0000000..b8b4e83 Binary files /dev/null and b/www/widgets/basic/img/Prev_RedNumber.png differ diff --git a/www/widgets/basic/img/Prev_ScreenResolution.png b/www/widgets/basic/img/Prev_ScreenResolution.png new file mode 100644 index 0000000..dca8c3f Binary files /dev/null and b/www/widgets/basic/img/Prev_ScreenResolution.png differ diff --git a/www/widgets/basic/img/Prev_Shape.png b/www/widgets/basic/img/Prev_Shape.png new file mode 100644 index 0000000..0abf5d1 Binary files /dev/null and b/www/widgets/basic/img/Prev_Shape.png differ diff --git a/www/widgets/basic/img/Prev_Speech2Text.png b/www/widgets/basic/img/Prev_Speech2Text.png new file mode 100644 index 0000000..b3307cc Binary files /dev/null and b/www/widgets/basic/img/Prev_Speech2Text.png differ diff --git a/www/widgets/basic/img/Prev_StatefulContainerView8.png b/www/widgets/basic/img/Prev_StatefulContainerView8.png new file mode 100644 index 0000000..5bdb164 Binary files /dev/null and b/www/widgets/basic/img/Prev_StatefulContainerView8.png differ diff --git a/www/widgets/basic/img/Prev_StatefulIFrame8.png b/www/widgets/basic/img/Prev_StatefulIFrame8.png new file mode 100644 index 0000000..8c508e1 Binary files /dev/null and b/www/widgets/basic/img/Prev_StatefulIFrame8.png differ diff --git a/www/widgets/basic/img/Prev_StatefulImage.png b/www/widgets/basic/img/Prev_StatefulImage.png new file mode 100644 index 0000000..1700a9c Binary files /dev/null and b/www/widgets/basic/img/Prev_StatefulImage.png differ diff --git a/www/widgets/basic/img/Prev_TableBody.png b/www/widgets/basic/img/Prev_TableBody.png new file mode 100644 index 0000000..253f6da Binary files /dev/null and b/www/widgets/basic/img/Prev_TableBody.png differ diff --git a/www/widgets/basic/img/Prev_ValueBool.png b/www/widgets/basic/img/Prev_ValueBool.png new file mode 100644 index 0000000..fd53678 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueBool.png differ diff --git a/www/widgets/basic/img/Prev_ValueBoolCheckbox.png b/www/widgets/basic/img/Prev_ValueBoolCheckbox.png new file mode 100644 index 0000000..a9c511b Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueBoolCheckbox.png differ diff --git a/www/widgets/basic/img/Prev_ValueBoolCtrl.png b/www/widgets/basic/img/Prev_ValueBoolCtrl.png new file mode 100644 index 0000000..732915a Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueBoolCtrl.png differ diff --git a/www/widgets/basic/img/Prev_ValueBoolCtrlSvg.png b/www/widgets/basic/img/Prev_ValueBoolCtrlSvg.png new file mode 100644 index 0000000..fb9087f Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueBoolCtrlSvg.png differ diff --git a/www/widgets/basic/img/Prev_ValueBoolSelect.png b/www/widgets/basic/img/Prev_ValueBoolSelect.png new file mode 100644 index 0000000..8d04867 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueBoolSelect.png differ diff --git a/www/widgets/basic/img/Prev_ValueFloat.png b/www/widgets/basic/img/Prev_ValueFloat.png new file mode 100644 index 0000000..b7bd0fd Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueFloat.png differ diff --git a/www/widgets/basic/img/Prev_ValueFloatBar.png b/www/widgets/basic/img/Prev_ValueFloatBar.png new file mode 100644 index 0000000..49ca007 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueFloatBar.png differ diff --git a/www/widgets/basic/img/Prev_ValueGesture.png b/www/widgets/basic/img/Prev_ValueGesture.png new file mode 100644 index 0000000..21a60e3 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueGesture.png differ diff --git a/www/widgets/basic/img/Prev_ValueInput.png b/www/widgets/basic/img/Prev_ValueInput.png new file mode 100644 index 0000000..e1c5e46 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueInput.png differ diff --git a/www/widgets/basic/img/Prev_ValueLastchange.png b/www/widgets/basic/img/Prev_ValueLastchange.png new file mode 100644 index 0000000..eb6c3a3 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueLastchange.png differ diff --git a/www/widgets/basic/img/Prev_ValueList.png b/www/widgets/basic/img/Prev_ValueList.png new file mode 100644 index 0000000..8da9b52 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueList.png differ diff --git a/www/widgets/basic/img/Prev_ValueListHtml.png b/www/widgets/basic/img/Prev_ValueListHtml.png new file mode 100644 index 0000000..9aefc05 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueListHtml.png differ diff --git a/www/widgets/basic/img/Prev_ValueListHtml8.png b/www/widgets/basic/img/Prev_ValueListHtml8.png new file mode 100644 index 0000000..3643cc6 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueListHtml8.png differ diff --git a/www/widgets/basic/img/Prev_ValueString.png b/www/widgets/basic/img/Prev_ValueString.png new file mode 100644 index 0000000..3e98d51 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueString.png differ diff --git a/www/widgets/basic/img/Prev_ValueStringImg.png b/www/widgets/basic/img/Prev_ValueStringImg.png new file mode 100644 index 0000000..d2f49b9 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueStringImg.png differ diff --git a/www/widgets/basic/img/Prev_ValueStringRaw.png b/www/widgets/basic/img/Prev_ValueStringRaw.png new file mode 100644 index 0000000..8e51d8d Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueStringRaw.png differ diff --git a/www/widgets/basic/img/Prev_ValueTimestamp.png b/www/widgets/basic/img/Prev_ValueTimestamp.png new file mode 100644 index 0000000..919e889 Binary files /dev/null and b/www/widgets/basic/img/Prev_ValueTimestamp.png differ diff --git a/www/widgets/basic/img/Prev_iFrame.png b/www/widgets/basic/img/Prev_iFrame.png new file mode 100644 index 0000000..2168d6e Binary files /dev/null and b/www/widgets/basic/img/Prev_iFrame.png differ diff --git a/www/widgets/basic/img/Prev_tplFrame.png b/www/widgets/basic/img/Prev_tplFrame.png new file mode 100644 index 0000000..ff66318 Binary files /dev/null and b/www/widgets/basic/img/Prev_tplFrame.png differ diff --git a/www/widgets/basic/img/Prev_tplLink.png b/www/widgets/basic/img/Prev_tplLink.png new file mode 100644 index 0000000..b9a8623 Binary files /dev/null and b/www/widgets/basic/img/Prev_tplLink.png differ diff --git a/www/widgets/basic/img/doc_example_hm_val_number.png b/www/widgets/basic/img/doc_example_hm_val_number.png new file mode 100644 index 0000000..f0fa90c Binary files /dev/null and b/www/widgets/basic/img/doc_example_hm_val_number.png differ diff --git a/www/widgets/basic/img/micActive.svg b/www/widgets/basic/img/micActive.svg new file mode 100644 index 0000000..6a1fe11 --- /dev/null +++ b/www/widgets/basic/img/micActive.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/www/widgets/basic/img/micDetected.svg b/www/widgets/basic/img/micDetected.svg new file mode 100644 index 0000000..b48b333 --- /dev/null +++ b/www/widgets/basic/img/micDetected.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/www/widgets/basic/img/micInactive.svg b/www/widgets/basic/img/micInactive.svg new file mode 100644 index 0000000..e5d4fff --- /dev/null +++ b/www/widgets/basic/img/micInactive.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/www/widgets/basic/img/micSent.svg b/www/widgets/basic/img/micSent.svg new file mode 100644 index 0000000..725054d --- /dev/null +++ b/www/widgets/basic/img/micSent.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/www/widgets/basic/img/micStarted.svg b/www/widgets/basic/img/micStarted.svg new file mode 100644 index 0000000..4145f66 --- /dev/null +++ b/www/widgets/basic/img/micStarted.svg @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/www/widgets/basic/img/pin_red5.svg b/www/widgets/basic/img/pin_red5.svg new file mode 100644 index 0000000..f20b2a4 --- /dev/null +++ b/www/widgets/basic/img/pin_red5.svg @@ -0,0 +1,152 @@ + + + + + Webimage/svg+xml2013-12-01T17:40:25+09:002013-12-01T17:40:25+09:002013-12-01T17:40:25+09:00Adobe Illustrator CS6 (Macintosh)176256JPEG/9j/4AAQSkZJRgABAgEBXgFeAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABABXgAAAAEA +AQFeAAAAAQAB/+4ADkFkb2JlAGTAAAAAAf/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoK +DBAMDAwMDAwQDA4PEA8ODBMTFBQTExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8f +Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgBAACwAwER +AAIRAQMRAf/EAaIAAAAHAQEBAQEAAAAAAAAAAAQFAwIGAQAHCAkKCwEAAgIDAQEBAQEAAAAAAAAA +AQACAwQFBgcICQoLEAACAQMDAgQCBgcDBAIGAnMBAgMRBAAFIRIxQVEGE2EicYEUMpGhBxWxQiPB +UtHhMxZi8CRygvElQzRTkqKyY3PCNUQnk6OzNhdUZHTD0uIIJoMJChgZhJRFRqS0VtNVKBry4/PE +1OT0ZXWFlaW1xdXl9WZ2hpamtsbW5vY3R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo+Ck5SVlpeYmZ +qbnJ2en5KjpKWmp6ipqqusra6voRAAICAQIDBQUEBQYECAMDbQEAAhEDBCESMUEFURNhIgZxgZEy +obHwFMHR4SNCFVJicvEzJDRDghaSUyWiY7LCB3PSNeJEgxdUkwgJChgZJjZFGidkdFU38qOzwygp +0+PzhJSktMTU5PRldYWVpbXF1eX1RlZmdoaWprbG1ub2R1dnd4eXp7fH1+f3OEhYaHiImKi4yNjo ++DlJWWl5iZmpucnZ6fkqOkpaanqKmqq6ytrq+v/aAAwDAQACEQMRAD8A9U4q7FXYq7FXYqxLzP8A +mj5Q8vM8NxdfWr1NjZ2oEjg+DNUInyZq+2YmbW48exNnyd1oOwNVqd4x4Yd8tv2n5PMtc/P7zBcl +k0izhsIj0kk/fy/Pfig/4E5rMvasz9Ip6zSex+CO+WRmfLYfr+1hmo+f/OuoEm61m6IbqkchhQ/7 +CLgv4ZhT1WWXORd7h7H0mL6ccfiL+02kk9zcztynleVv5nYsd/nlJJPN2EIRjyAClgZI601zWrMg +2moXNsR0MU0if8RI8MnHLIciQ0ZNJin9UIy94BZLpX5v+fdPYf7kPrkY6xXSLID82+GT/hsyYdoZ +Y9b97qdR7N6LJ/Bwn+ia/Z9jP/L/APzkBp0xWLXbB7Rjsbm2Pqx18TGaOo+RbM/F2rE/WKeb1nsd +kjvhlxeUtj8+X3PTdH13R9ZtBd6Xdx3cB6tGalSezKfiU+zDNnjyxmLibeT1Oky4JcOSJifP8bo7 +LHHdirsVdirsVdirsVdirsVdirsVSnzL5q0Ty5YG91WcRJuIol3lkYfsxp3P4DvlObPHGLkXN0PZ ++XVT4MYv7h73gnnT83vMXmBpLazdtM0s1Aghakrr/wAWSCh3/lWg+eaHUa+eTYemL6N2X7N4NNUp +fvMneeQ9w/Tz9zA8wXonYq7FXYq7FXYq7FXYqjNK1fVNJvEvNNupLS5TpJExUkeBHRh4g7ZKGSUD +cTRadRpseaPDkiJR83tPkT877W+aPT/MvC1umoqaivwwueg9Qf7rPv8AZ/1c3Wl7SEtp7HveD7X9 +lZY7np/VH+b1Hu7/AL/e9YVlZQykFSKgjcEHNs8YRTsVdirsVdirsVdirsVdirGfPfnvTPKemevP +Sa+mBFnZg0Z2H7TeCDucxtVqo4o2efQO27J7JyazJQ2gPql3ftfNXmDzFq2v6lJqGqTma4fZR0RF +7Ii9FUf575zWXNLJK5Pquj0WLTYxDGKH3+ZS3K3KdirsVdirsVdirsVdirsVdirsVek/lj+a1zoM +sWk6xI02iMeMchqz2xPcdzH4r26jwOx0WuOP0y+n7nlu3vZ6OoByYhWX/dft8/m+gYZoZ4UmhdZI +ZFDxyIQysrCoII6g50AIIsPmsomJIIohfhYuxV2KuxV2KuxVKPNfmbT/AC3ok+qXpqsY4wwg0aWU +/ZRfn+A3ynPmGOJkXN7P0E9VlGOHXme4d75b8w6/qWv6tPqmoSc7iY7AfZRB9lEHZVH+dc5fLllk +lxF9e0Wjx6bEMcBUR9vmUtytynYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXqn5N/mM2m3Ufl3VJf9x1 +w1LGZztDKx+wT/I5+4/M5tOz9XwnglyPJ4/2m7F8WJz4x64/UO8d/vH2h7zm+fOnYq7FXYq7FXYq ++a/za86t5i8xPbWzk6VpzNDbAH4XcGkkv0kUX2+ec3r9T4k6H0h9V9nOyxpsHFIfvJ7nyHQfr82D +ZgvQOxV2KuxVE6dpmoaldpZ6fbyXV1J9iGJSzHxO3YdzkoQMjQFlqzZ4YomUyIxHUvTvL/5A6zco +s2t3qWCnc20I9aX5FqhF+jlmyxdlSO8jTyes9sMUTWGJn5nYfr+5mtl+RnkS3UCeO5vGHVpZitf+ +RQjzOj2ZiHOy6DL7WayXIxj7h+u0ZJ+TX5dOtF0toz/MtxcV/wCGkYZM9nYe77S0x9p9cP47/wA2 +P6kh1X/nH/y7OpOmX9xZy9hLxnj+6kbf8NmPPsqB+kkOx0/tjnj/AHkYyHlsf0j7Hm3mr8qvNvl5 +HuJYBe2Cbtd2tXVR4uhAdfnSnvmtz6LJj3Isd4ep7P8AaDTak8IPDPul+jofvYdmI7x2KuxV2Kux +V9J/lF50bzH5e+r3b8tU03jFcMTvIhr6cnzIFG9xXvnSaDU+JCj9QfK/aPsv8rn4oj93PceR6hnW +ZzzzsVdirsVYd+a/mY6D5PuXhbjeX3+iWxHUGQHmw/1UBp70zD12bw8Zrmdneez2g/MaqIP0w9R+ +HL7XzHnMvrLsVdirsVZF5J8k6p5r1QWloPTtY6NeXjCqRIf1sf2V/hU5fptNLLKg6ztXtXHo8fFL +eR+mPf8As7y+kfK3lDQ/LNiLXTIArED17lqGWUju7fw6DOkwaeGIVEPlnaHaWbVz4sh9w6D3J1l7 +gOxV2KuxV2KvLPzI/J6z1GGXVfLsK2+pLV5rJKLHP3PAdEf8D8981Ws7PEvVDn3PYdh+0ssRGPOe +LH0l1j7+8fc8HkjkikaORSkiEq6MCGDA0IIPQjNEQ+iRkCLHJbil2KuxVlP5a+Z28u+bbS6Z+Nnc +EW16O3pSEDkf9RqN9GZWjzeHkB6dXUduaD8zppRH1D1R94/XyfUmdQ+QuxV2KuxV4D+fmtm68zW2 +lI1YtNgDOP8Ai2ejH/hAmaDtTJcxHu/S+keyGl4NPLIec5fZH9tvMM1j1rsVdiqM0jSrzVtTttNs +k9S6upBHEvap7nwAG5PhkoQMpCI5lp1OohhxyyT+mIt9U+U/LFh5a0SDS7MAiMcp5qUaWUj45G+f +bwFBnVafAMcREPj3aOvnqsxyT68h3DoE4y5wXYq7FXYq7FXYq7FXjP54+REVf8U6fHxNQmqRqNjX +ZJvv+FvoPjml7T0v+UHx/W937KdrH/Fpn+p+mP6Q8YzTvdOxV2KuxV9U/lzrZ1nyXpd67cphF6M5 +7+pCTGSfduPL6c6nSZOPEC+P9t6XwNXOA5XY9x3/AGMkzJdU7FXYq+T/AD1qB1DzjrN3Xkr3cqxn +/Ijb00/4VRnKamfFkkfN9l7Jw+Fpccf6I+Z3P2pFlDsHYq7FXr3/ADj95dSa9v8AX5lqLYC1tSf5 +3HKRvmEoP9kc23ZWGyZnps8T7Y60xhHCP4vUfcOX2/c9vzePAOxV2KuxV2KuxV2KuxVD6hY22oWN +xY3S87e6jaGZfFXHE/ryM4CQIPItmHLLHMTj9UTY+D5G1nTJtK1a802feWzmeFj2PBitR7HrnI5I +GMjE9H2rTZxmxRyDlIA/NB5FvdirsVe7/wDOPeoGXQNTsCa/VblZQPATpT9cRze9kzuBHcXzv2yw +1mhP+dGvkf2vVs2rxzsVdir41nlaaaSZ/tSMXb5sanONJs2+5wjwgAdFmLJ2KuxV9K/kvYrbfl/Y +yAUe7kmnf5+oYx/wsYzpOzY1hHnb5V7UZePWyH80RH2X95Zxmc8+7FXYq7FXYq7FXYq7FXYq+bPz +qsVtfP8AeOoot3FDPT3KBD95Q5zXaMazHzfVPZfLx6KI/mkj7b/SwXMJ6F2KuxV67/zjxKw1PWYR +9l4YXPzR2A/4kc23ZJ9UnivbSP7vGfM/cHuGbx8/dirsVfGbKysVYEMDQg7EEZxr7qDbWKuxV2Kv +p/8AKV1b8vNHKmo4Sj6RO4P4jOm0H9zH4/e+S+0QrXZPeP8Achl2ZjpHYq7FXYq7FXYq7FXYq7FX +zv8Anu6t55ABqUs4Vb2PJz+o5zvaZ/e/B9O9kRWj/wA8/oedZr3p3Yq7FXrf/OPKt+mNXah4i3jB +Papc0/Vm27J+qXueM9sz+6x/1j9z3LN4+euxV2Kvkjzbp507zPqtkRQQXUyp2+DmSh+laZyWeHDO +Q832ns7N4unxz74j7t0pypzHYq7FX0D+QmrLdeU7jTif3un3DUXwjmHNT9Lh83/ZeS8Zj3F829r9 +NwakT6Tj9o2+6npmbN5N2KuxV2KuxV2KuxV2KuxV8s/mXqyap551e6jNYlm9CMjoRAoiqPmUrnLa +yfFlkfP7n1/sLTnDo8cTzq/9Nv8ApYxmM7Z2KuxV7h/zjxp5TTdY1EjaaaK3U/8AGFS7U/5GjN32 +TD0yL5/7Z5ryY4dwJ+e36Hrubd4p2KuxV8+fnvoTWXmyPU0WkGqQqxbt60IEbj/gOBzn+1MXDk4v +5z6X7JavxNMcZ54z9h3H2281zWvVOxV2Ks0/KfzZH5d81xG5fhp9+Pq10xNAnIgpIf8AVbr7E5ma +HP4eTfkdnRe0XZx1OmPD9cPUP0j5fbT6Zzpnyd2KuxV2KuxV2KuxV2KsZ/MTzXH5a8sXN4GAvZgY +LFO5mcGjfJB8R+WYusz+HjJ69Hbdi9nnVaiMP4RvL3ft5Plkkk1O5PU5y76+1irsVdir6k/LHQjo +3krTbZ143EyfWbgHY85vjoR4qpC/RnUaLFwYgPi+Rdvavx9XOQ+kHhHw2/aynMp07sVdirDvzX8r +N5g8o3CQJyvrE/WrUDqSgPNB/rJWg8aZh67B4mM1zG7vPZ7tD8tqQT9E/Sf0H4H7HzHnMvrLsVdi +rsVe7/lB+ZsN/bQeXdYl46hEBHY3DnaZB9mNif8Adi9B/MPfrvOz9bYEJc+j537SdhHHI58Q9B+o +fzfP3fd7nq2bZ452KuxV2KuxV2KoTVdV0/SdPm1DUJlgtIF5SSN+AA6kk7ADrkMmQQFnk3afTzzT +EIC5F8y/mD53u/NmtG6YNFYQVSwtj+whO7NTbm9Kt93bOZ1WpOWV9Oj6z2N2VHR4uHnM/Ufx0DF8 +xnbOxV2Ksm/Lry0fMHmm0tZF5WcJFxe+HpRkEqf9c0X6cydHg8TIB06uo7c1/wCV00pD6jtH3n9X +N9Ro4oKZ1L5CqA4q7FXYq7FXzf8Am95Jby95ga8tY+OlakzSwcR8McvWSL23+JfbbtnOa/TeHOx9 +JfU/ZvtT8zg4JH95DY+Y6H9fn72BZgPROxV2KtqzIwdCVZSCrA0II6EHFSL2L1zyN+eU1rHHYeZ1 +e4iUBY9SQcpQB09Vf2/9Yb+xObbTdpkbT383iu1vZQTJnp/Sf5vT4d3u5e57FpGuaPrFsLnS7yK7 +h2q0TAla9mXqp9iM3GPLGYuJt4fU6TLglw5ImJ8/xujsscd2KuxViPmr80vKfl5HjkuRe361AsrY +h2DeDsPhT6TX2OYefXY8fWz3B3fZ/YGp1JsR4YfzpbfLqfxu8F86ef8AXfNd0HvX9GyjatvYRk+m +nap/nan7R+imaHUaqeU78u59F7L7Hw6ONQ3mecjzP6h5MazHdq7FXYq7rsMVe8/ldoSaDo3OYAah +ekSXPiqj7Ef+xBqfc50mg03hw3+ovlPtF2p+az1E/u4bDz7z+Oj0K3uQwG+ZzoEbG9cVVQcVdirs +VSnzT5bsfMeiXGlXgokorFKBVo5R9iRfcH7xtlWfCMkTEub2frp6XMMkOn2jqHyxr2h6hoerXGmX +8fp3Nu3E/wArL+y6nurDcZyuXEYSMTzfX9Jq4ajGMkDcZfikvyDkuxV2KuxVWtby7tJhPaTyW8y/ +ZliZkYfJlIOESINhhkxxmKkBIee7J7L81/zAs1Cx6xJIo7TpHMT82kVm/HMmOuzR/idTl9ntFPc4 +wPdY+4ot/wA6PzDZaDUUQ/zLbwV/FCMn/KObv+wNA9l9CP4D/ppfrSLVfO3m3VkKahq1zNEftQ8y +kZ+aJxU/dlGTUZJ8yXY6fsrTYTcMcQe+t/md0kylz3Yq7FXYq7FWS+TdKSS8W/uVrDCawqf2nHf5 +L+vNp2dpeI8cuQ5PIe1HbHhQ8DGfXL6vId3vP3e96rYaoSRvm+fOWS6ffcgN8VT22n5AYqjkaoxV +firsVdirCfzP/L2LzVpfr2qqmtWak2sh29Rephc+B/ZPY+xOYWt0nixsfUHf9g9snR5Kl/dS5+Xn ++vyfNk8E1vNJBOhjmiYpJGwoyspoQR4g5zRBBovqkJiQBBsFTxZOxV2KuxV2KuxV2KuxV2KuxV2K +omwszcy0O0a/bb+AzK0mlOWX9Ec3Tdtdrx0eK+eSX0j9J8gy60mWJVRBxRRRQOwzpoxERQ5Pk+XL +LJIykbkeaeafekEb5JrZZpV7ULvirLNPuKgYqnMD1GKokYq7FXYq7FXlv5v/AJbDVoZNe0mL/cpC +tbuBBvcRqOoH86gf7IbdaZq9fo+Mccfq+9672b7d8EjDlP7s8j/NP6j9jwTNC+juxV2KuxV2KuxV +2KuxV2KuxVVt4HnkCL9J8Bl2DBLLLhDgdpdo49JiOSfwHee5PYIkhjEaCgH450+HFHHHhi+R63WZ +NTkOTIbkfs8giI3IOWuKmdlMQwxVlWkTn4d8VZrpcpIGKsjtWqBiqNXFW8VdirjiqHmagxV4B+bv +kxNN1A61YJSyvH/0mNRtHMd6j/Jf9fzGaDtHS8B4xyP3vo/sv2x40PAmfXAbecf1j7nnOax652Ku +xV2KuxV2KuxV2KtqpZgoFSdgMIBJoMcmSMImUjQG5TyztlgiC9XO7n3zp9JphihXXq+R9s9qS1mY +y/gG0R5frKvmU6hemKo+0ryGKso0ivw4qzfSa0H0Yqyez6D5Yqj1xVdirsVabFUJctQHFWKeY7W3 +vrGezuV5wToUdfY9x7jqMhkgJxMTyLdp888OQZIGpRNvnbWNLm0vUp7Kbdomor9mU7qw+Yzlc2I4 +5GJ6Pseg1sdThjlj1+w9Qgsqcx2KuxV2KuxV2KuxVMtKtus7D2T+Jzcdmab/ACh+Dw3tb2pX+DQP +nL9A/SfgmWbp4N2Kqka74qmVnGSwxVlWkQn4cVZtpUdAMVZJarRRiqOXFW8VdirTYqgrrpirGdVB +o304q8p/MTSfXhF9GtZrfZ6dTGf+aTv9+avtPT8UeMc4/c9Z7KdpeFm8GR9OTl/W/by+TzzNC+ku +xV2KuxV2KuxVUgiaWVY16sdz4DLMOI5JCI6uJr9ZHTYZZJfwj5noE/RFRAiiiqKAZ1kICIAHIPjW +bNLLMzkblI2W8k1L1WuKoqCEk9MVTvT7UkjbFWXaTaGi7Yqy7ToKAbYqnkCUAxVEjFXYq7FWmxVC +3K1BxVjuqRVU4qwzWbUOHVhVWqCD3BGAixRZRkYkEcw8d1Wxaxv5bY/ZU1Q+KncZymow+HMxfY+y +9cNVp45Op5+8c0JlLsHYq7FXYq7FU00mCiNMerbL8h1zd9l4KBmevJ899r+0OLIMEeUdz7zy+Q+9 +MQM27xi9UriqJhgJPTFU2s7IkjbFWSabp+42xVlemWVANsVZHaQcQMVTCNaDFVTFXYq7FXHFVGVa +jFUnv4Kg7YqxXVbMmu3jirzHz7pJESXqrvEeEh/yWO33N+vNT2phuImOj2XshruDLLAeU9x7x+sf +cwjNG+huxV2KuxVdHG0kiovVjQZLHAykIjq0anURw45ZJcoi2RRRBEVF6KKDOtxwEYiI6Pi+ozyy +5JTl9UjavHETk2lGQWrHtiqbWensSNsVZBYaYdvhxVkun6dSm2KshtLXiBtiqZxR0xVWAxVvFXYq +7FXYqtcYqg7iGoOKpFqFmCDtirDte0hLm2mgcfDKjKdule+QyQE4mJ6t+mzyw5I5I84m3iVxBJb3 +EkEopJExRx7qaHORlExJB6PtWHLHJATj9MhY+KngbHYq7FUx0eDnM0pGyCg+Z/szadl4rmZdzx/t +hreDDHCOczZ9w/b9yexQk5vnzpMLazLdsVTqy02tNsVZBY6X02/DFWRWWmgU2xVOra0C02xVMYog +BiquBireKuxV2KuxV2KuOKqbpUYql91b1BxVj2pWQIO2KvE/zH0k2WuC4VaR3i8v9mlFb8KHOe7T +xcOTi/nPpnslrPE0xxnnjP2HcfpYnmuepdirsVZPpFmUtYwR8TfE30/2Z0+hxcGIee75H2/rPH1c +yPpj6R8P22U8tLMkjbMt0yf2Gm1ptirI7HTOm2Kp/aaeBTbFU2gtQB0xVGRxAYqrAYq3irsVdirs +VdirsVdiriMVUJUqMVSu9twQdsVeY/mpo3r6C9wq/vLNxKD34n4WH41+jNf2li4sV/zXpPZXV+Fq +xE8sgr48x+r4vG8519RdiqvY25uLuKECvNhy+Q3P4Zdp8fHMR73B7T1X5fTzydQNvfyH2s+s7OtN +s6x8YZHp+m1ptirJtP00Cm2Kp/a2QAG2KpnDbgDpiqJVAMVVAMVdirsVdirsVdirsVdirsVdirTD +FUHcx1U4qxrXdPiurWe2lFY50aNx7MtD+vIziJAg9WzDlOOYnHnEg/J803dtLa3U1tKKSwO0bj/K +Q0P6s5CUTEkHo+24coyQE48pAH5qWBsZF5NsDPdyzkVEShV+bf2DNr2VjuRl3PG+2Oq4cUMQ/iNn +3D9p+x6Lp2n1ptm9fPGU6fp9KbYqyG0tAANsVTOKEDFVdVxVdirsVdirsVdirsVdirsVdirsVdir +jiqjMtRiqT38VQcVfPf5maZ9R81zsBSO7VZ1+ZHFv+GUnOb7Rx8OU+e76p7L6nxdHEdYEx/SPsLF +MwXoXp3kPSCmjQykfFcM0p27V4j8Fzo+zsfDiB793yz2o1PiayQ6QAj+k/aWf6dp9KbZnvOsjs7Q +ADFU0iiAGKogLireKuxV2KuxV2KuxV2KuxV2KuxV2KuxV2KrHG2Kpfdx1BxV49+delf6LYaio/up +GgkPtIOS1+XA/fmo7Wx7Rl8HtfYzUVkni7wJfLb9LymKJ5ZUijHJ5GCoPEk0GaQCzT305iIJPIPo +bR9HS1tbe2UfDAixj/YgDOvxw4Ygdz4lqMxy5JTPORJ+bJLO0AA2ybSm0MVBiqIVcVXYq7FXYq7F +XYq7FXYq7FXYq7FXYq7FXYq7FWmGKoWdK4qwn8zNI+u+TtTULV4Y/rCHw9Eh2/4VSMxNdDixS+bu +fZ/P4WsxnvPD/ptvveLfl5ph1HzjpsNKpHJ67+whBkH/AAygZotFDiyxHx+T6J2/qPC0eQ944f8A +TbPoy3tACNs6h8iTKCGgxVFKtMVXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq7FXYq44qputcVQd5 +ZRXNvLbyisUyNHIPFWFD+BwSFiizxzMJCQ5g28z/ACx/LLWvL+vXl/qoj4LE0FoUcNz5OCZKD7Io +vfxzV6HRSxzJk9b7Q9vYdVgjDHfOz5bcvtepJCBm1ePV1WmKr8VdirsVdirsVdirsVdirsVdirsV +dirsVdirsVdirsVcRiq0rirXDFVwXFW8VdirsVdirsVdirsVdirsVdirsVdirsVdirsVdirsVdir +sVdirsVdirsVdirsVdirsVdirsVdirsVdirsVf/Zxmp.iid:C115011CC922681192B09E6A7B598D13xmp.did:C115011CC922681192B09E6A7B598D13uuid:65E6390686CF11DBA6E2D887CEACB407proof:pdfconvertedfrom application/pdf to <unknown>savedxmp.iid:D47F11740720681191099C3B601C45482008-04-17T14:19:21+05:30Adobe Illustrator CS4/convertedfrom application/pdf to <unknown>convertedfrom application/pdf to <unknown>savedxmp.iid:FD7F11740720681197C1BF14D1759E832008-05-16T17:01:20-07:00Adobe Illustrator CS4/savedxmp.iid:F77F117407206811BC18AC99CBA78E832008-05-19T18:10:15-07:00Adobe Illustrator CS4/convertedfrom application/vnd.adobe.illustrator to application/vnd.adobe.illustratorsavedxmp.iid:FB7F117407206811B628E3BF27C8C41B2008-05-22T14:26:44-07:00Adobe Illustrator CS4/convertedfrom application/vnd.adobe.illustrator to application/vnd.adobe.illustratorsavedxmp.iid:08C3BD25102DDD1181B594070CEB88D92008-05-28T16:51:46-07:00Adobe Illustrator CS4/convertedfrom application/vnd.adobe.illustrator to application/vnd.adobe.illustratorsavedxmp.iid:F77F11740720681192B0DFFC927805D72008-05-30T21:26:38-07:00Adobe Illustrator CS4/convertedfrom application/vnd.adobe.illustrator to application/vnd.adobe.illustratorsavedxmp.iid:F87F11740720681192B0DFFC927805D72008-05-30T21:27-07:00Adobe Illustrator CS4/convertedfrom application/vnd.adobe.illustrator to application/vnd.adobe.illustratorsavedxmp.iid:F97F1174072068119098B097FDA39BEF2008-06-02T13:26:10-07:00Adobe Illustrator CS4/savedxmp.iid:FFE440664A3DDD11BD33D3EB8D3A10682008-06-18T22:23:18+07:00Adobe Illustrator CS4/savedxmp.iid:686AE2A5723EDD11A6F1BABF7C5A7A512008-06-19T20:14:43-07:00Adobe Illustrator CS4/savedxmp.iid:696AE2A5723EDD11A6F1BABF7C5A7A512008-06-19T20:29:57-07:00Adobe Illustrator CS4/savedxmp.iid:DB723F068C41DD119455A51FA525B1842008-06-24T10:59:19+09:00Adobe Illustrator CS4/savedxmp.iid:50264E71200811689FE8CB9EA85C54592008-06-26T05:55:57-07:00Adobe Illustrator CS4/savedxmp.iid:C67EA9A97648DD11BB47877F8DDF90792008-07-02T13:38:56-07:00Adobe Illustrator CS4/savedxmp.iid:0680117407206811AFFDD882A25629F82008-07-21T11:57:28+05:30Adobe Illustrator CS4/savedxmp.iid:FD7F117407206811994C86F197F76F892008-07-24T10:28:13+07:00Adobe Illustrator CS4/savedxmp.iid:FE7F117407206811994C86F197F76F892008-07-24T10:28:23+07:00Adobe Illustrator CS4/savedxmp.iid:FE7F117407206811B1A4D030930957B12008-07-30T14:28:46+07:00Adobe Illustrator CS4/savedxmp.iid:FF7F117407206811B1A4D030930957B12008-07-30T14:29:09+07:00Adobe Illustrator CS4/savedxmp.iid:FC7F1174072068119457E9CE7EF899B02008-07-30T17:45:29+07:00Adobe Illustrator CS4/savedxmp.iid:FD7F1174072068119457E9CE7EF899B02008-07-30T17:45:48+07:00Adobe Illustrator CS4/savedxmp.iid:0780117407206811994CDBD53340AB822008-07-31T12:31:50+07:00Adobe Illustrator CS4/savedxmp.iid:238DFF4E58206811822A8DCC646C11D42013-12-01T17:40:25+09:00Adobe Illustrator CS6 (Macintosh)/xmp.iid:238DFF4E58206811822A8DCC646C11D4xmp.did:238DFF4E58206811822A8DCC646C11D4uuid:65E6390686CF11DBA6E2D887CEACB407proof:pdfWeb290.000000400.000000PixelsFalseTrue1CyanMagentaYellow初期設定のスウォッチグループ0ホワイトRGBPROCESS255255255ブラックRGBPROCESS000RGB レッドRGBPROCESS25500RGB イエローRGBPROCESS2552550RGB グリーンRGBPROCESS02550RGB シアンRGBPROCESS0255255RGB ブルーRGBPROCESS00255RGB マゼンタRGBPROCESS2550255R=193 G=39 B=45RGBPROCESS1933945R=237 G=28 B=36RGBPROCESS2372836R=241 G=90 B=36RGBPROCESS2419036R=247 G=147 B=30RGBPROCESS24714730R=251 G=176 B=59RGBPROCESS25117659R=252 G=238 B=33RGBPROCESS25223833R=217 G=224 B=33RGBPROCESS21722433R=140 G=198 B=63RGBPROCESS14019863R=57 G=181 B=74RGBPROCESS5718174R=0 G=146 B=69RGBPROCESS014669R=0 G=104 B=55RGBPROCESS010455R=34 G=181 B=115RGBPROCESS34181115R=0 G=169 B=157RGBPROCESS0169157R=41 G=171 B=226RGBPROCESS41171226R=0 G=113 B=188RGBPROCESS0113188R=46 G=49 B=146RGBPROCESS4649146R=27 G=20 B=100RGBPROCESS2720100R=102 G=45 B=145RGBPROCESS10245145R=147 G=39 B=143RGBPROCESS14739143R=158 G=0 B=93RGBPROCESS158093R=212 G=20 B=90RGBPROCESS2122090R=237 G=30 B=121RGBPROCESS23730121R=199 G=178 B=153RGBPROCESS199178153R=153 G=134 B=117RGBPROCESS153134117R=115 G=99 B=87RGBPROCESS1159987R=83 G=71 B=65RGBPROCESS837165R=198 G=156 B=109RGBPROCESS198156109R=166 G=124 B=82RGBPROCESS16612482R=140 G=98 B=57RGBPROCESS1409857R=117 G=76 B=36RGBPROCESS1177636R=96 G=56 B=19RGBPROCESS965619R=66 G=33 B=11RGBPROCESS663311グレースケール1R=0 G=0 B=0RGBPROCESS000R=26 G=26 B=26RGBPROCESS262626R=51 G=51 B=51RGBPROCESS515151R=77 G=77 B=77RGBPROCESS777777R=102 G=102 B=102RGBPROCESS102102102R=128 G=128 B=128RGBPROCESS128128128R=153 G=153 B=153RGBPROCESS153153153R=179 G=179 B=179RGBPROCESS179179179R=204 G=204 B=204RGBPROCESS204204204R=230 G=230 B=230RGBPROCESS230230230R=242 G=242 B=242RGBPROCESS242242242Web カラーグループ1R=63 G=169 B=245RGBPROCESS63169245R=122 G=201 B=67RGBPROCESS12220167R=255 G=147 B=30RGBPROCESS25514730R=255 G=29 B=37RGBPROCESS2552937R=255 G=123 B=172RGBPROCESS255123172R=189 G=204 B=212RGBPROCESS189204212Adobe PDF library 9.00 + + + + + + + + + + + + + + Ebene 1 + + + \ No newline at end of file diff --git a/www/widgets/basic/js/table.js b/www/widgets/basic/js/table.js new file mode 100644 index 0000000..de91ef3 --- /dev/null +++ b/www/widgets/basic/js/table.js @@ -0,0 +1,615 @@ +"use strict"; +// Following classes should be used if variable table_class="tclass" +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +//
      TimeEvent
      12:34:34Door opened
      12:34:35Door closed
      12:34:36Window opened
      +// +// following json string or object is expected: +// '[\ +// {"Time": "12:34:34", "Event": "Door opened", "_data":{"Type": "1", "Event" : "SomeEvent1"}, "_class": "selected"},\ +// {"Time": "12:34:35", "Event": "Door closed", "_data":{"Type": "2", "Event" : "SomeEvent2"}, "_class": "red" },\ +// {"Time": "12:34:36", "Event": "Window opened", "_data":{"Type": "3", "Event" : "SomeEvent3"}}\ +// ]' +// +// If _detail object found and detailed_wid is defined +// following object will be created by selecting of one row: +// +// +// +//
      Type1
      EventSomeEvent1
      +// +// Dialog +// Can be opened by writing "open" into trigger_id. +// As dialog closed the trigger_id will be written with the text of button +// "show" option is active only in edit mode and has no effect +// + +if (vis.editMode) { + // Add words for basic widgets + $.extend(true, systemDictionary, { + "table_oid": {"en": "Table Object ID", "de": "Table Object ID", "ru": "ID таблицы"}, + "static_value": {"en": "Static JSON(If no ID)", "de": "Static JSON(If no ID)", "ru": "Значение, если нет ID таблицы"}, + "event_oid": {"en": "Event ID", "de": "Ereigniss ID", "ru": "ID события"}, + "hide_header": {"en": "Hide header", "de": "Kein Header", "ru": "Скрыть заголовок"}, + "show_scroll": {"en": "Show scroll", "de": "Zeige Scrollbar", "ru": "Показать прокрутку"}, + "detailed_wid": {"en": "Detailed widget", "de": "Detailed widget", "ru": "Виджет детализации"}, + "colCount": {"en": "Column count", "de": "Kolumnanzahl", "ru": "Кол-во колонок"}, + "group_header": {"en": "Headers", "de": "Headers", "ru": "Заголовок"}, + "colName": {"en": "Name", "de": "Name", "ru": "Имя"}, + "colWidth": {"en": "Width", "de": "Width", "ru": "Ширина"}, + "colAttr": {"en": "Attribute in JSON", "de": "Attribut in JSON", "ru": "Атрибут в JSON"}, + "ack_oid": {"en": "Acknowledge ID", "de": "Bestätigung ID", "ru": "ID для подтверждения"}, + "new_on_top": {"en": "New event on top", "de": "Neus Ereignis am Anfang", "ru": "Новые события сначала"} + }); +} + +vis.binds.table = { + getBrowserScrollSize: function (){ + var css = { + "border": "none", + "height": "200px", + "margin": "0", + "padding": "0", + "width": "200px" + }; + + var inner = $("
      ").css($.extend({}, css)); + var outer = $("
      ").css($.extend({ + "left": "-1000px", + "overflow": "scroll", + "position": "absolute", + "top": "-1000px" + }, css)).append(inner).appendTo("body") + .scrollLeft(1000) + .scrollTop(1000); + + var scrollSize = { + height: (outer.offset().top - inner.offset().top) || 0, + width: (outer.offset().left - inner.offset().left) || 0 + }; + + outer.remove(); + return scrollSize; + }, + + // Show detailed information + onRowClick: function () { + var $this = $(this); + var data = $this.data('options'); + + // Deselect all rows + $('#' + data.wid + ' .vis-table-row').removeClass(data.tClass + '-tr-selected'); + // Select a new one + $this.addClass(data.tClass + '-tr-selected'); + + // Get container for detailed information + var $el = $('#' + data.detailed_wid); + if ($el.length) { + var text = ''; + + if (data.content._detail) { + text += ''; + // Show that object + var r = 0; + var obj = '_detail'; + // Go through all attributes + if (typeof data.content[obj] == 'object') { + for (var odata in data.content[obj]) { + if (typeof data.content[obj][odata] === 'function') continue; + var val = data.content[obj][odata].toString(); + if (odata.length > 1 && odata[0] === '_' && obj !== '_class' && obj.substring(0, 4) !== '_btn' && obj !== '_id') { + continue; + } + text += '' + + ''; + if (val && val.length > 6 && val.substring(val.length - 6) === ' ') { + text += ''; + } + r++; + } + } else { + var val = data.content[obj].toString(); + + text += '' + + ''; + + if (val && val.length > 6 && val.substring(val.length - 6) === ' ') { + text += ''; + } + r++; + } + text += '
      ' + odata + '' + val + '
       
      ' + obj.substring(1) + '' + val + '
       
      '; + } else { + // Try to find special attributes starting with '_' + for (var obj in data.content) { + if (!data.content.hasOwnProperty(obj) || typeof data.content[obj] === 'function') continue; + if (obj.length > 0 && obj[0] === '_' && obj !== '_class' && obj.substring(0, 4) !== '_btn' && obj !== '_id') { + text += ''; + // Show that object + var r = 0; + // Go through all attributes + if (typeof data.content[obj] === 'object') { + for (var odata in data.content[obj]) { + if (typeof data.content[obj][odata] === 'function') continue; + var val = data.content[obj][odata].toString(); + if (odata.length > 1 && odata[0] === '_' && obj !== '_class' && obj.substring(0, 4) !== '_btn' && obj !== '_id') { + continue; + } + text += '' + + ''; + if (val && val.length > 6 && val.substring(val.length - 6) === ' ') { + text += ''; + } + r++; + } + } else { + var val = data.content[obj].toString(); + + text += '' + + ''; + + if (val && val.length > 6 && val.substring(val.length - 6) === ' ') { + text += ''; + } + r++; + } + text += '
      ' + odata + '' + val + '
       
      ' + obj.substring(1) + '' + val + '
       
      '; + } + } + } + + + // If no special _data object found => show standard elements + if (!text) { + text = ''; + // Go through all attributes + var row = 0; + for (var data_obj in data.content) { + // Show that object + if (!data.content.hasOwnProperty(data_obj) || + (data_obj.length > 1 && data_obj[0] === '_' && data_obj !== '_class' && data_obj.substring(0, 4) !== '_btn' && data_obj !== '_id')) { + continue; + } + var val = data.content[data_obj].toString(); + + text += '' + + ''; + + if (val.length > 6 && val.substring(val.length - 6) === ' ') { + text += ''; + } + row++; + } + text += '
      ' + data_obj + '' + data.content[data_obj]+'
       
      '; + } + + $el.html(text); + + /*if (options.btn_print) { + $(el).append (''); + var btn = document.getElementById ('print_'+that._parent._wid); + btn._parent = that._parent; + btn._print_id = that._data._print_id || JSON.stringify(that._data); + + if (btn && !vis.editMode) { + $(btn).bind('click', function () { + if (that._parent._options.ack_oid) { + vis.setValue(that._parent._options.ack_oid, that._print_id); + } + + if (that._parent._options.view_for_print) { + vis.changeView(that._parent._options.view_for_print); + } + setTimeout(function () { + window.print(); + window.location.reload() + }, 500); + }); + } + }*/ + } + }, + + onAckButton: function () { + var data = $(this).data('options'); + if (data.ack_oid) { + vis.setValue(data.ack_oid, data.ack_id); + } + }, + + createRow: function (rowData, wid, options, rowNumber, noTR, index, serverID) { + var tClass = options['class'] || 'tclass'; + var _classes = rowData['_class'] ? rowData['_class'].split(' ') : null; + var text; + // Create row + if (!noTR) { + text = ''; + } else { + text = ''; + } + var k = 1; + for (var obj in rowData) { + if (!rowData.hasOwnProperty(obj) || + obj.match(/^jQuery/) || + typeof rowData[obj] === 'function') { + continue; + } + + var attr = options['colAttr' + k] || obj; + + if (attr && attr[0] === '_') { + if (attr.match(/^_btn/) || options['colAttr' + k]) { + var btnText = ''; + var btnClass = ''; + text += ''; + if (attr.match(/^_btn/)){ + if (typeof rowData[attr] === 'string') { + btnText = rowData[attr]; + } else { + btnText = rowData[attr].caption; + btnClass = rowData[attr]._class; + } + if (btnText) { + text += ''; + } + } else { + text += rowData[attr]; + } + + text += ''; + k++; + } + + continue; + } + + if (!options.colCount || k <= options.colCount) { + text += '' + rowData[attr] + ''; + } + k++; + } + + if (!noTR) text += ''; + + return text; + }, + + showTable: function (view, wid, options) { + var $div = $('#' + wid); + if (!$div.length) { + setTimeout(function () { + vis.binds.table.showTable(view, wid, options); + }, 100); + return; + } + //vis.binds.table.initTable(); + var tClass = options['class'] || 'tclass'; + + // read actual table as json string + var tableJson = options.table_oid ? vis.states.attr(options.table_oid + '.val') : (options.static_value || ''); + var table = []; + if (typeof app !== 'undefined' && app.replaceFilePathJson) { + tableJson = app.replaceFilePathJson(tableJson); + } + if (tableJson && typeof tableJson === 'string') { + try { + table = JSON.parse(tableJson); + } + catch (e) { + console.log ("showTable: Cannot parse json table"); + table = []; + } + } else { + table = tableJson; + } + + if (!table) table = []; + + // Create widget container + var $elem = $('#' + wid); + + // Start creation of table + var header = ''; + var text = '
      '; + var headerDone = false; + var j = 0; + var selectedId = null; + + if (options.max_rows) options.max_rows = parseInt(options.max_rows); + + // Go through all lines + for (var ii = 0, ilen = table.length; ii < ilen; ii++) { + if (!table[ii]) continue; + + var _classes = table[ii]['_class'] ? table[ii]['_class'].split(' ') : null; + + // Create table header + if (!headerDone) { + header += ''; + var k = 1; + for (var obj in table[ii]) { + if (!table[ii].hasOwnProperty(obj) || + obj.match(/^jQuery/) || + typeof table[ii][obj] === 'function') { + continue; + } + + var attr = options['colAttr' + k] || obj; + + if (attr && attr[0] === '_') { + if (attr.match(/^_btn/) || options['colAttr' + k]) { + header += ''; + k++; + } + continue; + } + if (!options.colCount || k <= options.colCount) { + header += ''; + } + k++; + } + if (options.show_scroll !== 'false' && options.show_scroll !== false && options.show_scroll !== undefined){ + // Get the scroll width once + if (!vis.binds.table.scrollSize) vis.binds.table.scrollSize = vis.binds.table.getBrowserScrollSize(); + + header += ''; + } + //header += ''; + headerDone = true; + } + + if (_classes &&_classes.indexOf('selected') !== -1) selectedId = ii; + + text += vis.binds.table.createRow(table[ii], wid, options, j, false, ii, table[ii]._id); + j++; + if (options.max_rows && j >= options.max_rows) break; + } + text += '
      ' + (options['colName' + k] || '') + '' + (options['colName' + k] || attr) + '
      \n'; + header += '\n'; + + $elem.find('.vis-table-div').remove(); + $elem.find('.vis-table-header').remove(); + // Insert table into container + $elem.append((options.hide_header ? '' : header) + text); + var data = { + options: options, + wid: wid, + view: view + }; + + $elem.find('.vis-table-ack-button').unbind('click touchstart').bind('click touchstart', function (e) { + // Protect against two events + if (vis.detectBounce(this)) return; + + vis.binds.table.onAckButton.call(this, e); + }); + + // Set additional data for every row + for (var i = 0, len = table.length; i < len; i++) { + if (!table[i]) continue; + + $elem.find('.vis-table-ack-button[data-index="' + i + '"]') + .data('options', { + ack_id: table[i]._ack_id || JSON.stringify(table[i]), + ack_oid: options.ack_oid + }); + } + // If detailed information desired + if (options.detailed_wid) { + // Bind on click event for every row + $elem.find('.vis-table-row').unbind('click touchstart').bind('click touchstart', function (e) { + // Protect against two events + if (vis.detectBounce(this)) return; + + vis.binds.table.onRowClick.call(this, e); + }); + + // Set additional data for every row + for (i = 0, len = table.length; i < len; i++) { + if (!table[i]) continue; + $elem.find('.vis-table-row[data-index="' + i + '"]') + .data('options', { + content: table[i], + detailed_wid: options.detailed_wid, + tClass: tClass, + wid: wid + }); + } + + if (selectedId) { + setTimeout (function () { + $elem.find('.vis-table-row[data-index="' + selectedId + '"]').trigger('click'); + }, 200); + } + } + + // Remember index to calculate even or odd + data.rowNum = options.new_on_top ? 0 : ((j - 1) >= 0 ? j - 1 : 0); + + function cbNewTable (e, newVal, oldVal) { + $elem.trigger('newTable', newVal); + } + function cbNewEvent (e, newVal, oldVal) { + $elem.trigger('newEvent', newVal); + } + + if (!$('#' + wid).data('inited')) { + $('#' + wid).data('inited', true); + // New event coming + $elem.on('newEvent', function (e, newVal) { + if (e.handled) return; + e.handled = true; + var newEvent; + var data = $(this).data('options'); + // Convert event to json + if (newVal) { + if (typeof newVal === 'string') { + try { + newEvent = JSON.parse(newVal); + } + catch (e) + { + console.log('elem.triggered: Cannot parse json new event ' + newVal); + return; + } + } else { + newEvent = newVal; + } + } + else { + return; + } + + // Try to find, if this event yet exists + var $row = (newEvent._id !== undefined) ? $(this).find('tr[data-index="' + newEvent._id + '"]') : []; + + // get next row number for new line + if (!$row.length) data.rowNum++; + + var text = vis.binds.table.createRow(newEvent, data.wid, data.options, data.rowNum, ($row.length > 0), (newEvent._id === undefined) ? data.rowNum : newEvent._id); + + if ($row.length) { + $row.html(text).addClass(newEvent._class || ''); + } else { + // If add to the top of table + if (data.options.new_on_top) { + $('#' + this.id).find('.vis-table-body').prepend(text); + } else { + // Add to the bottom of table + $('#' + this.id).find('.vis-table-body').append(text); + } + } + var $el; + // If detailed widget desired + if (data.options.detailed_wid) { + $el = $('#' + this.id).find('.vis-table-row[data-index="' + ((newEvent._id === undefined) ? data.rowNum : newEvent._id) + '"]') + .data('options', { + content: newEvent, + detailed_wid: options.detailed_wid, + tClass: tClass, + wid: wid + }).unbind('click touchstart').bind('click touchstart', function (e) { + // Protect against two events + if (vis.detectBounce(this)) return; + + vis.binds.table.onRowClick.call(this, e); + }); + $el = $(this).find('.tr_' + ((newEvent._id === undefined) ? data.rowNum : newEvent._id)); + } + + $('#' + this.id).find('.ack_button_' + ((newEvent._id === undefined) ? data.rowNum : newEvent._id)) + .data('options', {data: newEvent, parent: this, ack_id: newEvent._ack_id || JSON.stringify(newEvent)}) + .unbind('click touchstart').bind('click touchstart', function (e) { + // Protect against two events + if (vis.detectBounce(this)) return; + + vis.binds.table.onAckButton.call(this, e); + }); + }) + .on('newTable', function (e, newVal) { + if (e.handled) return; + e.handled = true; + var data = $(this).data('options'); + // Update whole table + _setTimeout(vis.binds.table.showTable, 50, data.view, data.wid, data.options); + }); + } + $('#' + wid).data('options', data); + + if (options.event_oid) { + if ($('#' + wid).data('binded') !== options.event_oid) { + $('#' + wid).data('binded', options.event_oid); + vis.states.bind(options.event_oid + '.val', cbNewEvent); + } + } else { + if ($('#' + wid).data('binded') !== options.table_oid) { + $('#' + wid).data('binded', options.table_oid); + vis.states.bind(options.table_oid + '.val', cbNewTable); + } + } + }, + + showDialog: function (view, wid, options) { + var trigger_value = vis.states.attr(options.trigger_id + '.val'); + // Register callback in dashUI + if (options.trigger_id) vis.binds.table.registerIds(wid, options.trigger_id); + + // Create widget container + $('#' + wid).remove(); + $('#visview_' + view).append('
      ' + + '
      ' + (options.image ? '': '') + '' + options.text + '
      ' + + '
      '); + + var elem = document.getElementById(wid); + + var buttons = {}; + for (var t = 0, len = options.buttons.length; t < len; t++) { + if (options.buttons[t]) { + buttons[options.buttons[t]] = { + text: options.buttons[t], + data: {data: options.buttons[t], trigger_id: options.trigger_id}, + click: function (evt, ui) { + if (1 || !vis.editMode) { + if (vis.binds.dialog_trigger_id) { + vis.setValue(vis.binds.dialog_trigger_id, evt.currentTarget.textContent); + } + } + $(this).dialog('close'); + } + } + } + } + elem._options = options; + + // Disable autofocus in edit mode + if (vis.editMode) { + $.ui.dialog.prototype._focusTabbable = function () { + }; + } + + $(elem).dialog({ + resizable: false, + height: options.height || 200, + width: options.width || 400, + autoOpen: false, + modal: (options.modal === true || options.modal === 'true'), + draggable: false, + buttons: buttons + }); + + if ((vis.editMode && options.show) || trigger_value === 'open') { + $(elem).dialog('open'); + vis.binds.dialog_trigger_id = options.trigger_id; + } + + elem.triggered = function (objId, _newEvent) { + if (_newEvent === 'open') { + $(this).dialog('open'); + vis.binds.dialog_trigger_id = this._options.trigger_id; + } + } + } +}; diff --git a/www/widgets/jqplot.html b/www/widgets/jqplot.html new file mode 100644 index 0000000..26e6c1b --- /dev/null +++ b/www/widgets/jqplot.html @@ -0,0 +1,174 @@ + + + + + + + diff --git a/www/widgets/jqplot/css/jquery.jqplot.min.css b/www/widgets/jqplot/css/jquery.jqplot.min.css new file mode 100644 index 0000000..0f84835 --- /dev/null +++ b/www/widgets/jqplot/css/jquery.jqplot.min.css @@ -0,0 +1 @@ +.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em}.jqplot-axis{font-size:.75em}.jqplot-xaxis{margin-top:10px}.jqplot-x2axis{margin-bottom:10px}.jqplot-yaxis{margin-right:10px}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis,.jqplot-yMidAxis{margin-left:10px;margin-right:10px}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick,.jqplot-yMidAxis-tick{position:absolute;white-space:pre}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom}.jqplot-yaxis-tick{right:0;top:15px;text-align:right}.jqplot-yaxis-tick.jqplot-breakTick{right:-20px;margin-right:0;padding:1px 5px 1px 5px;z-index:2;font-size:1.5em}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left}.jqplot-yMidAxis-tick{text-align:center;white-space:nowrap}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute}.jqplot-yMidAxis-label{font-size:11pt;position:absolute}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;margin-left:10px;position:absolute}.jqplot-meterGauge-tick{font-size:.75em;color:#999}.jqplot-meterGauge-label{font-size:1em;color:#999}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em}td.jqplot-table-legend{vertical-align:middle}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer}.jqplot-table-legend .jqplot-series-hidden{text-decoration:line-through}div.jqplot-table-legend-swatch-outline{border:1px solid #ccc;padding:1px}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-highlighter-tooltip,.jqplot-canvasOverlay-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-point-label{font-size:.75em;z-index:2}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em}.jqplot-error{text-align:center}.jqplot-error-message{position:relative;top:46%;display:inline-block}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%)}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7)}div.jqplot-noData-container{text-align:center;background-color:rgba(96%,96%,96%,0.3)} \ No newline at end of file diff --git a/www/widgets/jqplot/doc.html b/www/widgets/jqplot/doc.html new file mode 100644 index 0000000..de93793 --- /dev/null +++ b/www/widgets/jqplot/doc.html @@ -0,0 +1,21 @@ + + + + Dokumentation Widget-Set jqplot + + + +

      hm_val - MeterGauge

      + +

      Attribute

      +
      + +
      +
      + + +
      + + + + \ No newline at end of file diff --git a/www/widgets/jqplot/img/Prev_MeterGauge.png b/www/widgets/jqplot/img/Prev_MeterGauge.png new file mode 100644 index 0000000..94b3ef0 Binary files /dev/null and b/www/widgets/jqplot/img/Prev_MeterGauge.png differ diff --git a/www/widgets/jqplot/js/jquery.jqplot.min.js b/www/widgets/jqplot/js/jquery.jqplot.min.js new file mode 100644 index 0000000..aaba2cc --- /dev/null +++ b/www/widgets/jqplot/js/jquery.jqplot.min.js @@ -0,0 +1,61 @@ +/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com + jsDate | (c) 2010-2013 Chris Leonello + */(function(L){var u;L.fn.emptyForce=function(){for(var ah=0,ai;(ai=L(this)[ah])!=null;ah++){if(ai.nodeType===1){L.cleanData(ai.getElementsByTagName("*"))}if(L.jqplot.use_excanvas){ai.outerHTML=""}else{while(ai.firstChild){ai.removeChild(ai.firstChild)}}ai=null}return L(this)};L.fn.removeChildForce=function(ah){while(ah.firstChild){this.removeChildForce(ah.firstChild);ah.removeChild(ah.firstChild)}};L.fn.jqplot=function(){var ah=[];var aj=[];for(var ak=0,ai=arguments.length;ak'+ao+"
      ");L("#"+an).addClass("jqplot-error");document.getElementById(an).style.background=L.jqplot.config.errorBackground;document.getElementById(an).style.border=L.jqplot.config.errorBorder;document.getElementById(an).style.fontFamily=L.jqplot.config.errorFontFamily;document.getElementById(an).style.fontSize=L.jqplot.config.errorFontSize;document.getElementById(an).style.fontStyle=L.jqplot.config.errorFontStyle;document.getElementById(an).style.fontWeight=L.jqplot.config.errorFontWeight}}else{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}};L.jqplot.version="1.0.8";L.jqplot.revision="1250";L.jqplot.targetCounter=1;L.jqplot.CanvasManager=function(){if(typeof L.jqplot.CanvasManager.canvases=="undefined"){L.jqplot.CanvasManager.canvases=[];L.jqplot.CanvasManager.free=[]}var ah=[];this.getCanvas=function(){var ak;var aj=true;if(!L.jqplot.use_excanvas){for(var al=0,ai=L.jqplot.CanvasManager.canvases.length;al887){L.jqplot.support_canvas_text.result=true}else{L.jqplot.support_canvas_text.result=!!(document.createElement("canvas").getContext&&typeof document.createElement("canvas").getContext("2d").fillText=="function")}}return L.jqplot.support_canvas_text.result};L.jqplot.use_excanvas=((!L.support.boxModel||!L.support.objectAll||!$support.leadingWhitespace)&&!L.jqplot.support_canvas())?true:false;L.jqplot.preInitHooks=[];L.jqplot.postInitHooks=[];L.jqplot.preParseOptionsHooks=[];L.jqplot.postParseOptionsHooks=[];L.jqplot.preDrawHooks=[];L.jqplot.postDrawHooks=[];L.jqplot.preDrawSeriesHooks=[];L.jqplot.postDrawSeriesHooks=[];L.jqplot.preDrawLegendHooks=[];L.jqplot.addLegendRowHooks=[];L.jqplot.preSeriesInitHooks=[];L.jqplot.postSeriesInitHooks=[];L.jqplot.preParseSeriesOptionsHooks=[];L.jqplot.postParseSeriesOptionsHooks=[];L.jqplot.eventListenerHooks=[];L.jqplot.preDrawSeriesShadowHooks=[];L.jqplot.postDrawSeriesShadowHooks=[];L.jqplot.ElemContainer=function(){this._elem;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null}};L.jqplot.ElemContainer.prototype.createElement=function(ak,am,ai,aj,an){this._offsets=am;var ah=ai||"jqplot";var al=document.createElement(ak);this._elem=L(al);this._elem.addClass(ah);this._elem.css(aj);this._elem.attr(an);al=null;return this._elem};L.jqplot.ElemContainer.prototype.getWidth=function(){if(this._elem){return this._elem.outerWidth(true)}else{return null}};L.jqplot.ElemContainer.prototype.getHeight=function(){if(this._elem){return this._elem.outerHeight(true)}else{return null}};L.jqplot.ElemContainer.prototype.getPosition=function(){if(this._elem){return this._elem.position()}else{return{top:null,left:null,bottom:null,right:null}}};L.jqplot.ElemContainer.prototype.getTop=function(){return this.getPosition().top};L.jqplot.ElemContainer.prototype.getLeft=function(){return this.getPosition().left};L.jqplot.ElemContainer.prototype.getBottom=function(){return this._elem.css("bottom")};L.jqplot.ElemContainer.prototype.getRight=function(){return this._elem.css("right")};function w(ah){L.jqplot.ElemContainer.call(this);this.name=ah;this._series=[];this.show=false;this.tickRenderer=L.jqplot.AxisTickRenderer;this.tickOptions={};this.labelRenderer=L.jqplot.AxisLabelRenderer;this.labelOptions={};this.label=null;this.showLabel=true;this.min=null;this.max=null;this.autoscale=false;this.pad=1.2;this.padMax=null;this.padMin=null;this.ticks=[];this.numberTicks;this.tickInterval;this.renderer=L.jqplot.LinearAxisRenderer;this.rendererOptions={};this.showTicks=true;this.showTickMarks=true;this.showMinorTicks=true;this.drawMajorGridlines=true;this.drawMinorGridlines=false;this.drawMajorTickMarks=true;this.drawMinorTickMarks=true;this.useSeriesColor=false;this.borderWidth=null;this.borderColor=null;this.scaleToHiddenSeries=false;this._dataBounds={min:null,max:null};this._intervalStats=[];this._offsets={min:null,max:null};this._ticks=[];this._label=null;this.syncTicks=null;this.tickSpacing=75;this._min=null;this._max=null;this._tickInterval=null;this._numberTicks=null;this.__ticks=null;this._options={}}w.prototype=new L.jqplot.ElemContainer();w.prototype.constructor=w;w.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.tickOptions.axis=this.name;if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTicks}if(this.tickOptions.showMark==null){this.tickOptions.showMark=this.showTickMarks}if(this.tickOptions.showLabel==null){this.tickOptions.showLabel=this.showTicks}if(this.label==null||this.label==""){this.showLabel=false}else{this.labelOptions.label=this.label}if(this.showLabel==false){this.labelOptions.show=false}if(this.pad==0){this.pad=1}if(this.padMax==0){this.padMax=1}if(this.padMin==0){this.padMin=1}if(this.padMax==null){this.padMax=(this.pad-1)/2+1}if(this.padMin==null){this.padMin=(this.pad-1)/2+1}this.pad=this.padMax+this.padMin-1;if(this.min!=null||this.max!=null){this.autoscale=false}if(this.syncTicks==null&&this.name.indexOf("y")>-1){this.syncTicks=true}else{if(this.syncTicks==null){this.syncTicks=false}}this.renderer.init.call(this,this.rendererOptions)};w.prototype.draw=function(ah,ai){if(this.__ticks){this.__ticks=null}return this.renderer.draw.call(this,ah,ai)};w.prototype.set=function(){this.renderer.set.call(this)};w.prototype.pack=function(ai,ah){if(this.show){this.renderer.pack.call(this,ai,ah)}if(this._min==null){this._min=this.min;this._max=this.max;this._tickInterval=this.tickInterval;this._numberTicks=this.numberTicks;this.__ticks=this._ticks}};w.prototype.reset=function(){this.renderer.reset.call(this)};w.prototype.resetScale=function(ah){L.extend(true,this,{min:null,max:null,numberTicks:null,tickInterval:null,_ticks:[],ticks:[]},ah);this.resetDataBounds()};w.prototype.resetDataBounds=function(){var ao=this._dataBounds;ao.min=null;ao.max=null;var ai,ap,am;var aj=(this.show)?true:false;for(var al=0;alao.max)||ao.max==null){ao.max=am[ak][0]}}else{if((am[ak][ah]!=null&&am[ak][ah]ao.max)||ao.max==null){ao.max=am[ak][an]}}}if(aj&&ap.renderer.constructor!==L.jqplot.BarRenderer){aj=false}else{if(aj&&this._options.hasOwnProperty("forceTickAt0")&&this._options.forceTickAt0==false){aj=false}else{if(aj&&ap.renderer.constructor===L.jqplot.BarRenderer){if(ap.barDirection=="vertical"&&this.name!="xaxis"&&this.name!="x2axis"){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}else{if(ap.barDirection=="horizontal"&&(this.name=="xaxis"||this.name=="x2axis")){if(this._options.pad!=null||this._options.padMin!=null){aj=false}}}}}}}}if(aj&&this.renderer.constructor===L.jqplot.LinearAxisRenderer&&ao.min>=0){this.padMin=1;this.forceTickAt0=true}};function q(ah){L.jqplot.ElemContainer.call(this);this.show=false;this.location="ne";this.labels=[];this.showLabels=true;this.showSwatches=true;this.placement="insideGrid";this.xoffset=0;this.yoffset=0;this.border;this.background;this.textColor;this.fontFamily;this.fontSize;this.rowSpacing="0.5em";this.renderer=L.jqplot.TableLegendRenderer;this.rendererOptions={};this.preDraw=false;this.marginTop=null;this.marginRight=null;this.marginBottom=null;this.marginLeft=null;this.escapeHtml=false;this._series=[];L.extend(true,this,ah)}q.prototype=new L.jqplot.ElemContainer();q.prototype.constructor=q;q.prototype.setOptions=function(ah){L.extend(true,this,ah);if(this.placement=="inside"){this.placement="insideGrid"}if(this.xoffset>0){if(this.placement=="insideGrid"){switch(this.location){case"nw":case"w":case"sw":if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break;case"ne":case"e":case"se":default:if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break}}else{if(this.placement=="outside"){switch(this.location){case"nw":case"w":case"sw":if(this.marginRight==null){this.marginRight=this.xoffset+"px"}this.marginLeft="0px";break;case"ne":case"e":case"se":default:if(this.marginLeft==null){this.marginLeft=this.xoffset+"px"}this.marginRight="0px";break}}}this.xoffset=0}if(this.yoffset>0){if(this.placement=="outside"){switch(this.location){case"sw":case"s":case"se":if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break;case"ne":case"n":case"nw":default:if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break}}else{if(this.placement=="insideGrid"){switch(this.location){case"sw":case"s":case"se":if(this.marginBottom==null){this.marginBottom=this.yoffset+"px"}this.marginTop="0px";break;case"ne":case"n":case"nw":default:if(this.marginTop==null){this.marginTop=this.yoffset+"px"}this.marginBottom="0px";break}}}this.yoffset=0}};q.prototype.init=function(){if(L.isFunction(this.renderer)){this.renderer=new this.renderer()}this.renderer.init.call(this,this.rendererOptions)};q.prototype.draw=function(ai,aj){for(var ah=0;ah
      ');this.target.append(az);az.height(aD);az.width(aA);az.css("top",this.eventCanvas._offsets.top);az.css("left",this.eventCanvas._offsets.left);var aC=L('
      ');az.append(aC);aC.html(this.noDataIndicator.indicator);var aB=aC.height();var ax=aC.width();aC.height(aB);aC.width(ax);aC.css("top",(aD-aB)/2+"px")})}}this.data=L.extend(true,[],ar);this.parseOptions(ay);if(this.textColor){this.target.css("color",this.textColor)}if(this.fontFamily){this.target.css("font-family",this.fontFamily)}if(this.fontSize){this.target.css("font-size",this.fontSize)}this.title.init();this.legend.init();this._sumy=0;this._sumx=0;this.computePlotData();for(var at=0;at0){for(var aq=au;aq--;){var an=this._plotData[aq][ap][av];if(aw*an>=0){this._plotData[au][ap][av]+=an;this._stackData[au][ap][av]+=an;break}}}}}else{for(var ar=0;ar0){at._prevPlotData=this.series[au-1]._plotData}at._sumy=0;at._sumx=0;for(ar=at.data.length-1;ar>-1;ar--){at._sumy+=at.data[ar][1];at._sumx+=at.data[ar][0]}}};this.populatePlotData=function(au,av){this._plotData=[];this._stackData=[];au._stackData=[];au._plotData=[];var ay={x:[],y:[]};if(this.stackSeries&&!au.disableStack){au._stack=true;var ax=(au._stackAxis==="x")?0:1;var az=L.extend(true,[],au.data);var aA=L.extend(true,[],au.data);var an,am,ao,aw,al;for(var ar=0;ar=0){aA[aq][ax]+=aw}}}for(var at=0;at0){au._prevPlotData=this.series[av-1]._plotData}au._sumy=0;au._sumx=0;for(at=au.data.length-1;at>-1;at--){au._sumy+=au.data[at][1];au._sumx+=au.data[at][0]}};this.getNextSeriesColor=(function(am){var al=0;var an=am.seriesColors;return function(){if(al=0&&an>=0){al.top+=aK;al.bottom+=aK;al.left+=an;al.right+=an}}var am=["top","bottom","left","right"];for(var aB in am){if(this._gridPadding[am[aB]]==null&&al[am[aB]]>0){this._gridPadding[am[aB]]=al[am[aB]]}else{if(this._gridPadding[am[aB]]==null){this._gridPadding[am[aB]]=this._defaultGridPadding[am[aB]]}}}var aA=this._gridPadding;if(this.legend.placement==="outsideGrid"){aA={top:this.title.getHeight(),left:0,right:0,bottom:0};if(this.legend.location==="s"){aA.left=this._gridPadding.left;aA.right=this._gridPadding.right}}ar.xaxis.pack({position:"absolute",bottom:this._gridPadding.bottom-ar.xaxis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});ar.yaxis.pack({position:"absolute",top:0,left:this._gridPadding.left-ar.yaxis.getWidth(),height:this._height},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});ar.x2axis.pack({position:"absolute",top:this._gridPadding.top-ar.x2axis.getHeight(),left:0,width:this._width},{min:this._gridPadding.left,max:this._width-this._gridPadding.right});for(aH=8;aH>0;aH--){ar[aG[aH-1]].pack({position:"absolute",top:0,right:this._gridPadding.right-az[aH-1]},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top})}var au=(this._width-this._gridPadding.left-this._gridPadding.right)/2+this._gridPadding.left-ar.yMidAxis.getWidth()/2;ar.yMidAxis.pack({position:"absolute",top:0,left:au,zIndex:9,textAlign:"center"},{min:this._height-this._gridPadding.bottom,max:this._gridPadding.top});this.target.append(this.grid.createElement(this._gridPadding,this));this.grid.draw();var aq=this.series;var aJ=aq.length;for(aH=0,aE=aJ;aHax)?av:ax;var ar=this.series[aw];var aq=this.series[au];if(aq.renderer.smooth){var ap=aq.renderer._smoothedData.slice(0).reverse()}else{var ap=aq.gridData.slice(0).reverse()}if(ar.renderer.smooth){var at=ar.renderer._smoothedData.concat(ap)}else{var at=ar.gridData.concat(ap)}var ao=(an.color!==null)?an.color:this.series[ax].fillColor;var ay=(an.baseSeries!==null)?an.baseSeries:aw;var am=this.series[ay].renderer.shapeRenderer;var al={fillStyle:ao,fill:true,closePath:true};am.draw(ar.shadowCanvas._ctx,at,al)};this.bindCustomEvents=function(){this.eventCanvas._elem.bind("click",{plot:this},this.onClick);this.eventCanvas._elem.bind("dblclick",{plot:this},this.onDblClick);this.eventCanvas._elem.bind("mousedown",{plot:this},this.onMouseDown);this.eventCanvas._elem.bind("mousemove",{plot:this},this.onMouseMove);this.eventCanvas._elem.bind("mouseenter",{plot:this},this.onMouseEnter);this.eventCanvas._elem.bind("mouseleave",{plot:this},this.onMouseLeave);if(this.captureRightClick){this.eventCanvas._elem.bind("mouseup",{plot:this},this.onRightClick);this.eventCanvas._elem.get(0).oncontextmenu=function(){return false}}else{this.eventCanvas._elem.bind("mouseup",{plot:this},this.onMouseUp)}};function ai(av){var au=av.data.plot;var ap=au.eventCanvas._elem.offset();var at={x:av.pageX-ap.left,y:av.pageY-ap.top};var aq={xaxis:null,yaxis:null,x2axis:null,y2axis:null,y3axis:null,y4axis:null,y5axis:null,y6axis:null,y7axis:null,y8axis:null,y9axis:null,yMidAxis:null};var ar=["xaxis","yaxis","x2axis","y2axis","y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];var al=au.axes;var am,ao;for(am=11;am>0;am--){ao=ar[am-1];if(al[ao].show){aq[ao]=al[ao].series_p2u(at[ao.charAt(0)])}}return{offsets:ap,gridPos:at,dataPos:aq}}function ak(al,am){var aq=am.series;var aW,aU,aT,aO,aP,aJ,aI,aw,au,az,aA,aK;var aS,aX,aQ,ar,aH,aM,aV;var an,aN;for(aT=am.seriesStack.length-1;aT>=0;aT--){aW=am.seriesStack[aT];aO=aq[aW];aV=aO._highlightThreshold;switch(aO.renderer.constructor){case L.jqplot.BarRenderer:aJ=al.x;aI=al.y;for(aU=0;aUaH[0][0]&&aJaH[2][1]&&aIaH[0][0]+aV[0][0]&&aJaH[2][1]&&aI0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aPaO._innerRadius){for(aU=0;aU0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw0&&-aI>=0){aw=2*Math.PI-Math.atan(-aI/aJ)}else{if(aJ>0&&-aI<0){aw=-Math.atan(-aI/aJ)}else{if(aJ<0){aw=Math.PI-Math.atan(-aI/aJ)}else{if(aJ==0&&-aI>0){aw=3*Math.PI/2}else{if(aJ==0&&-aI<0){aw=Math.PI/2}else{if(aJ==0&&aI==0){aw=0}}}}}}if(az){aw-=az;if(aw<0){aw+=2*Math.PI}else{if(aw>2*Math.PI){aw-=2*Math.PI}}}au=aO.sliceMargin/180*Math.PI;if(aP0)?aO.gridData[aU-1][1]+au:au;aK=aO.gridData[aU][1];if(aw>aA&&aw=ay[0][1]&&aI<=ay[3][1]&&aJ>=at[0]&&aJ<=aE[0]){return{seriesIndex:aO.index,pointIndex:aU,gridData:null,data:aO.data[aU]}}}break;case L.jqplot.LineRenderer:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){if((aO.fill||(aO.renderer.bands.show&&aO.renderer.bands.fill))&&(!am.plugins.highlighter||!am.plugins.highlighter.show)){var ax=false;if(aJ>aO._boundingBox[0][0]&&aJaO._boundingBox[1][1]&&aI=aI||aB[1]=aI){if(aC[0]+(aI-aC[1])/(aB[1]-aC[1])*(aB[0]-aC[0])0)?aN:0;for(var aU=0;aU=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{if(aQ[0]!=null&&aQ[1]!=null){aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}}}break;default:aJ=al.x;aI=al.y;aP=aO.renderer;if(aO.show){aN=aO.markerRenderer.size/2+aO.neighborThreshold;an=(aN>0)?aN:0;for(var aU=0;aU=aQ[0]-aP._bodyWidth/2&&aJ<=aQ[0]+aP._bodyWidth/2&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{if(!aP.hlc){var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][2])&&aI<=av(aO.data[aU][3])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}else{var av=aO._yaxis.series_u2p;if(aJ>=aQ[0]-aP._tickLength&&aJ<=aQ[0]+aP._tickLength&&aI>=av(aO.data[aU][1])&&aI<=av(aO.data[aU][2])){return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}else{aX=Math.sqrt((aJ-aQ[0])*(aJ-aQ[0])+(aI-aQ[1])*(aI-aQ[1]));if(aX<=an&&(aX<=aS||aS==null)){aS=aX;return{seriesIndex:aW,pointIndex:aU,gridData:aQ,data:aO.data[aU]}}}}}break}}return null}this.onClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onDblClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotDblClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseDown=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseDown");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseUp=function(an){var am=ai(an);var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,null,an.data.plot])};this.onRightClick=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);if(ap.captureRightClick){if(an.which==3){var al=L.Event("jqplotRightClick");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}else{var al=L.Event("jqplotMouseUp");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])}}};this.onMouseMove=function(an){var am=ai(an);var ap=an.data.plot;var ao=ak(am.gridPos,ap);var al=L.Event("jqplotMouseMove");al.pageX=an.pageX;al.pageY=an.pageY;L(this).trigger(al,[am.gridPos,am.dataPos,ao,ap])};this.onMouseEnter=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseEnter");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.onMouseLeave=function(an){var am=ai(an);var ao=an.data.plot;var al=L.Event("jqplotMouseLeave");al.pageX=an.pageX;al.pageY=an.pageY;al.relatedTarget=an.relatedTarget;L(this).trigger(al,[am.gridPos,am.dataPos,null,ao])};this.drawSeries=function(an,al){var ap,ao,am;al=(typeof(an)==="number"&&al==null)?an:al;an=(typeof(an)==="object")?an:{};if(al!=u){ao=this.series[al];am=ao.shadowCanvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.drawShadow(am,an,this);am=ao.canvas._ctx;am.clearRect(0,0,am.canvas.width,am.canvas.height);ao.draw(am,an,this);if(ao.renderer.constructor==L.jqplot.BezierCurveRenderer){if(al660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak.push("rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")")}}else{var al=L.jqplot.getColorComponents(ai);var ah=[al[0],al[1],al[2]];var an=ah[0]+ah[1]+ah[2];for(var aj=0;aj<3;aj++){ah[aj]=(an>660)?ah[aj]*0.85:0.73*ah[aj]+90;ah[aj]=parseInt(ah[aj],10);(ah[aj]>255)?255:ah[aj]}ah[3]=0.3+0.35*al[3];ak="rgba("+ah[0]+","+ah[1]+","+ah[2]+","+ah[3]+")"}return ak};L.jqplot.ColorGenerator=function(ai){ai=ai||L.jqplot.config.defaultColors;var ah=0;this.next=function(){if(ah0){return ai[ah--]}else{ah=ai.length-1;return ai[ah]}};this.get=function(ak){var aj=ak-ai.length*Math.floor(ak/ai.length);return ai[aj]};this.setColors=function(aj){ai=aj};this.reset=function(){ah=0};this.getIndex=function(){return ah};this.setIndex=function(aj){ah=aj}};L.jqplot.hex2rgb=function(aj,ah){aj=aj.replace("#","");if(aj.length==3){aj=aj.charAt(0)+aj.charAt(0)+aj.charAt(1)+aj.charAt(1)+aj.charAt(2)+aj.charAt(2)}var ai;ai="rgba("+parseInt(aj.slice(0,2),16)+", "+parseInt(aj.slice(2,4),16)+", "+parseInt(aj.slice(4,6),16);if(ah){ai+=", "+ah}ai+=")";return ai};L.jqplot.rgb2hex=function(am){var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/;var ah=am.match(aj);var al="#";for(var ak=1;ak<4;ak++){var ai;if(ah[ak].search(/%/)!=-1){ai=parseInt(255*ah[ak]/100,10).toString(16);if(ai.length==1){ai="0"+ai}}else{ai=parseInt(ah[ak],10).toString(16);if(ai.length==1){ai="0"+ai}}al+=ai}return al};L.jqplot.normalize2rgb=function(ai,ah){if(ai.search(/^ *rgba?\(/)!=-1){return ai}else{if(ai.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/)!=-1){return L.jqplot.hex2rgb(ai,ah)}else{throw new Error("Invalid color spec")}}};L.jqplot.getColorComponents=function(am){am=L.jqplot.colorKeywordMap[am]||am;var ak=L.jqplot.normalize2rgb(am);var aj=/rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/;var ah=ak.match(aj);var ai=[];for(var al=1;al<4;al++){if(ah[al].search(/%/)!=-1){ai[al-1]=parseInt(255*ah[al]/100,10)}else{ai[al-1]=parseInt(ah[al],10)}}ai[3]=parseFloat(ah[4])?parseFloat(ah[4]):1;return ai};L.jqplot.colorKeywordMap={aliceblue:"rgb(240, 248, 255)",antiquewhite:"rgb(250, 235, 215)",aqua:"rgb( 0, 255, 255)",aquamarine:"rgb(127, 255, 212)",azure:"rgb(240, 255, 255)",beige:"rgb(245, 245, 220)",bisque:"rgb(255, 228, 196)",black:"rgb( 0, 0, 0)",blanchedalmond:"rgb(255, 235, 205)",blue:"rgb( 0, 0, 255)",blueviolet:"rgb(138, 43, 226)",brown:"rgb(165, 42, 42)",burlywood:"rgb(222, 184, 135)",cadetblue:"rgb( 95, 158, 160)",chartreuse:"rgb(127, 255, 0)",chocolate:"rgb(210, 105, 30)",coral:"rgb(255, 127, 80)",cornflowerblue:"rgb(100, 149, 237)",cornsilk:"rgb(255, 248, 220)",crimson:"rgb(220, 20, 60)",cyan:"rgb( 0, 255, 255)",darkblue:"rgb( 0, 0, 139)",darkcyan:"rgb( 0, 139, 139)",darkgoldenrod:"rgb(184, 134, 11)",darkgray:"rgb(169, 169, 169)",darkgreen:"rgb( 0, 100, 0)",darkgrey:"rgb(169, 169, 169)",darkkhaki:"rgb(189, 183, 107)",darkmagenta:"rgb(139, 0, 139)",darkolivegreen:"rgb( 85, 107, 47)",darkorange:"rgb(255, 140, 0)",darkorchid:"rgb(153, 50, 204)",darkred:"rgb(139, 0, 0)",darksalmon:"rgb(233, 150, 122)",darkseagreen:"rgb(143, 188, 143)",darkslateblue:"rgb( 72, 61, 139)",darkslategray:"rgb( 47, 79, 79)",darkslategrey:"rgb( 47, 79, 79)",darkturquoise:"rgb( 0, 206, 209)",darkviolet:"rgb(148, 0, 211)",deeppink:"rgb(255, 20, 147)",deepskyblue:"rgb( 0, 191, 255)",dimgray:"rgb(105, 105, 105)",dimgrey:"rgb(105, 105, 105)",dodgerblue:"rgb( 30, 144, 255)",firebrick:"rgb(178, 34, 34)",floralwhite:"rgb(255, 250, 240)",forestgreen:"rgb( 34, 139, 34)",fuchsia:"rgb(255, 0, 255)",gainsboro:"rgb(220, 220, 220)",ghostwhite:"rgb(248, 248, 255)",gold:"rgb(255, 215, 0)",goldenrod:"rgb(218, 165, 32)",gray:"rgb(128, 128, 128)",grey:"rgb(128, 128, 128)",green:"rgb( 0, 128, 0)",greenyellow:"rgb(173, 255, 47)",honeydew:"rgb(240, 255, 240)",hotpink:"rgb(255, 105, 180)",indianred:"rgb(205, 92, 92)",indigo:"rgb( 75, 0, 130)",ivory:"rgb(255, 255, 240)",khaki:"rgb(240, 230, 140)",lavender:"rgb(230, 230, 250)",lavenderblush:"rgb(255, 240, 245)",lawngreen:"rgb(124, 252, 0)",lemonchiffon:"rgb(255, 250, 205)",lightblue:"rgb(173, 216, 230)",lightcoral:"rgb(240, 128, 128)",lightcyan:"rgb(224, 255, 255)",lightgoldenrodyellow:"rgb(250, 250, 210)",lightgray:"rgb(211, 211, 211)",lightgreen:"rgb(144, 238, 144)",lightgrey:"rgb(211, 211, 211)",lightpink:"rgb(255, 182, 193)",lightsalmon:"rgb(255, 160, 122)",lightseagreen:"rgb( 32, 178, 170)",lightskyblue:"rgb(135, 206, 250)",lightslategray:"rgb(119, 136, 153)",lightslategrey:"rgb(119, 136, 153)",lightsteelblue:"rgb(176, 196, 222)",lightyellow:"rgb(255, 255, 224)",lime:"rgb( 0, 255, 0)",limegreen:"rgb( 50, 205, 50)",linen:"rgb(250, 240, 230)",magenta:"rgb(255, 0, 255)",maroon:"rgb(128, 0, 0)",mediumaquamarine:"rgb(102, 205, 170)",mediumblue:"rgb( 0, 0, 205)",mediumorchid:"rgb(186, 85, 211)",mediumpurple:"rgb(147, 112, 219)",mediumseagreen:"rgb( 60, 179, 113)",mediumslateblue:"rgb(123, 104, 238)",mediumspringgreen:"rgb( 0, 250, 154)",mediumturquoise:"rgb( 72, 209, 204)",mediumvioletred:"rgb(199, 21, 133)",midnightblue:"rgb( 25, 25, 112)",mintcream:"rgb(245, 255, 250)",mistyrose:"rgb(255, 228, 225)",moccasin:"rgb(255, 228, 181)",navajowhite:"rgb(255, 222, 173)",navy:"rgb( 0, 0, 128)",oldlace:"rgb(253, 245, 230)",olive:"rgb(128, 128, 0)",olivedrab:"rgb(107, 142, 35)",orange:"rgb(255, 165, 0)",orangered:"rgb(255, 69, 0)",orchid:"rgb(218, 112, 214)",palegoldenrod:"rgb(238, 232, 170)",palegreen:"rgb(152, 251, 152)",paleturquoise:"rgb(175, 238, 238)",palevioletred:"rgb(219, 112, 147)",papayawhip:"rgb(255, 239, 213)",peachpuff:"rgb(255, 218, 185)",peru:"rgb(205, 133, 63)",pink:"rgb(255, 192, 203)",plum:"rgb(221, 160, 221)",powderblue:"rgb(176, 224, 230)",purple:"rgb(128, 0, 128)",red:"rgb(255, 0, 0)",rosybrown:"rgb(188, 143, 143)",royalblue:"rgb( 65, 105, 225)",saddlebrown:"rgb(139, 69, 19)",salmon:"rgb(250, 128, 114)",sandybrown:"rgb(244, 164, 96)",seagreen:"rgb( 46, 139, 87)",seashell:"rgb(255, 245, 238)",sienna:"rgb(160, 82, 45)",silver:"rgb(192, 192, 192)",skyblue:"rgb(135, 206, 235)",slateblue:"rgb(106, 90, 205)",slategray:"rgb(112, 128, 144)",slategrey:"rgb(112, 128, 144)",snow:"rgb(255, 250, 250)",springgreen:"rgb( 0, 255, 127)",steelblue:"rgb( 70, 130, 180)",tan:"rgb(210, 180, 140)",teal:"rgb( 0, 128, 128)",thistle:"rgb(216, 191, 216)",tomato:"rgb(255, 99, 71)",turquoise:"rgb( 64, 224, 208)",violet:"rgb(238, 130, 238)",wheat:"rgb(245, 222, 179)",white:"rgb(255, 255, 255)",whitesmoke:"rgb(245, 245, 245)",yellow:"rgb(255, 255, 0)",yellowgreen:"rgb(154, 205, 50)"};L.jqplot.AxisLabelRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.axis;this.show=true;this.label="";this.fontFamily=null;this.fontSize=null;this.textColor=null;this._elem;this.escapeHTML=false;L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisLabelRenderer.prototype.constructor=L.jqplot.AxisLabelRenderer;L.jqplot.AxisLabelRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisLabelRenderer.prototype.draw=function(ah,ai){if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L('
      ');if(Number(this.label)){this._elem.css("white-space","nowrap")}if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}return this._elem};L.jqplot.AxisLabelRenderer.prototype.pack=function(){};L.jqplot.AxisTickRenderer=function(ah){L.jqplot.ElemContainer.call(this);this.mark="outside";this.axis;this.showMark=true;this.showGridline=true;this.isMinorTick=false;this.size=4;this.markSize=6;this.show=true;this.showLabel=true;this.label=null;this.value=null;this._styles={};this.formatter=L.jqplot.DefaultTickFormatter;this.prefix="";this.suffix="";this.formatString="";this.fontFamily;this.fontSize;this.textColor;this.escapeHTML=false;this._elem;this._breakTick=false;L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.AxisTickRenderer.prototype=new L.jqplot.ElemContainer();L.jqplot.AxisTickRenderer.prototype.constructor=L.jqplot.AxisTickRenderer;L.jqplot.AxisTickRenderer.prototype.setTick=function(ah,aj,ai){this.value=ah;this.axis=aj;if(ai){this.isMinorTick=true}return this};L.jqplot.AxisTickRenderer.prototype.draw=function(){if(this.label===null){this.label=this.prefix+this.formatter(this.formatString,this.value)+this.suffix}var ai={position:"absolute"};if(Number(this.label)){ai.whitSpace="nowrap"}if(this._elem){this._elem.emptyForce();this._elem=null}this._elem=L(document.createElement("div"));this._elem.addClass("jqplot-"+this.axis+"-tick");if(!this.escapeHTML){this._elem.html(this.label)}else{this._elem.text(this.label)}this._elem.css(ai);for(var ah in this._styles){this._elem.css(ah,this._styles[ah])}if(this.fontFamily){this._elem.css("font-family",this.fontFamily)}if(this.fontSize){this._elem.css("font-size",this.fontSize)}if(this.textColor){this._elem.css("color",this.textColor)}if(this._breakTick){this._elem.addClass("jqplot-breakTick")}return this._elem};L.jqplot.DefaultTickFormatter=function(ah,ai){if(typeof ai=="number"){if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.PercentTickFormatter=function(ah,ai){if(typeof ai=="number"){ai=100*ai;if(!ah){ah=L.jqplot.config.defaultTickFormatString}return L.jqplot.sprintf(ah,ai)}else{return String(ai)}};L.jqplot.AxisTickRenderer.prototype.pack=function(){};L.jqplot.CanvasGridRenderer=function(){this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.CanvasGridRenderer.prototype.init=function(ai){this._ctx;L.extend(true,this,ai);var ah={lineJoin:"miter",lineCap:"round",fill:false,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.shadowWidth,closePath:false,strokeStyle:this.shadowColor};this.renderer.shadowRenderer.init(ah)};L.jqplot.CanvasGridRenderer.prototype.createElement=function(ak){var aj;if(this._elem){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){aj=this._elem.get(0);window.G_vmlCanvasManager.uninitElement(aj);aj=null}this._elem.emptyForce();this._elem=null}aj=ak.canvasManager.getCanvas();var ah=this._plotDimensions.width;var ai=this._plotDimensions.height;aj.width=ah;aj.height=ai;this._elem=L(aj);this._elem.addClass("jqplot-grid-canvas");this._elem.css({position:"absolute",left:0,top:0});aj=ak.canvasManager.initCanvas(aj);this._top=this._offsets.top;this._bottom=ai-this._offsets.bottom;this._left=this._offsets.left;this._right=ah-this._offsets.right;this._width=this._right-this._left;this._height=this._bottom-this._top;aj=null;return this._elem};L.jqplot.CanvasGridRenderer.prototype.draw=function(){this._ctx=this._elem.get(0).getContext("2d");var at=this._ctx;var aw=this._axes;at.save();at.clearRect(0,0,this._plotDimensions.width,this._plotDimensions.height);at.fillStyle=this.backgroundColor||this.background;at.fillRect(this._left,this._top,this._width,this._height);at.save();at.lineJoin="miter";at.lineCap="butt";at.lineWidth=this.gridLineWidth;at.strokeStyle=this.gridLineColor;var aA,az,ap,aq;var am=["xaxis","yaxis","x2axis","y2axis"];for(var ay=4;ay>0;ay--){var aD=am[ay-1];var ah=aw[aD];var aB=ah._ticks;var ar=aB.length;if(ah.show){if(ah.drawBaseline){var aC={};if(ah.baselineWidth!==null){aC.lineWidth=ah.baselineWidth}if(ah.baselineColor!==null){aC.strokeStyle=ah.baselineColor}switch(aD){case"xaxis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"yaxis":ao(this._left,this._bottom,this._left,this._top,aC);break;case"x2axis":ao(this._left,this._bottom,this._right,this._bottom,aC);break;case"y2axis":ao(this._right,this._bottom,this._right,this._top,aC);break}}for(var au=ar;au>0;au--){var an=aB[au-1];if(an.show){var ak=Math.round(ah.u2p(an.value))+0.5;switch(aD){case"xaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._top,ak,this._bottom)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._bottom;az=this._bottom+ap;break;case"inside":aA=this._bottom-ap;az=this._bottom;break;case"cross":aA=this._bottom-ap;az=this._bottom+ap;break;default:aA=this._bottom;az=this._bottom+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"yaxis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._right,ak,this._left,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._left-ap;az=this._left;break;case"inside":aA=this._left;az=this._left+ap;break;case"cross":aA=this._left-ap;az=this._left+ap;break;default:aA=this._left-ap;az=this._left;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;case"x2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(ak,this._bottom,ak,this._top)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._top-ap;az=this._top;break;case"inside":aA=this._top;az=this._top+ap;break;case"cross":aA=this._top-ap;az=this._top+ap;break;default:aA=this._top-ap;az=this._top;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[ak,aA],[ak,az]],{lineCap:"butt",lineWidth:this.gridLineWidth,offset:this.gridLineWidth*0.75,depth:2,fill:false,closePath:false})}ao(ak,aA,ak,az)}break;case"y2axis":if(an.showGridline&&this.drawGridlines&&((!an.isMinorTick&&ah.drawMajorGridlines)||(an.isMinorTick&&ah.drawMinorGridlines))){ao(this._left,ak,this._right,ak)}if(an.showMark&&an.mark&&((!an.isMinorTick&&ah.drawMajorTickMarks)||(an.isMinorTick&&ah.drawMinorTickMarks))){ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;switch(aq){case"outside":aA=this._right;az=this._right+ap;break;case"inside":aA=this._right-ap;az=this._right;break;case"cross":aA=this._right-ap;az=this._right+ap;break;default:aA=this._right;az=this._right+ap;break}if(this.shadow){this.renderer.shadowRenderer.draw(at,[[aA,ak],[az,ak]],{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}break;default:break}}}an=null}ah=null;aB=null}am=["y3axis","y4axis","y5axis","y6axis","y7axis","y8axis","y9axis","yMidAxis"];for(var ay=7;ay>0;ay--){var ah=aw[am[ay-1]];var aB=ah._ticks;if(ah.show){var ai=aB[ah.numberTicks-1];var al=aB[0];var aj=ah.getLeft();var av=[[aj,ai.getTop()+ai.getHeight()/2],[aj,al.getTop()+al.getHeight()/2+1]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",fill:false,closePath:false})}ao(av[0][0],av[0][1],av[1][0],av[1][1],{lineCap:"butt",strokeStyle:ah.borderColor,lineWidth:ah.borderWidth});for(var au=aB.length;au>0;au--){var an=aB[au-1];ap=an.markSize;aq=an.mark;var ak=Math.round(ah.u2p(an.value))+0.5;if(an.showMark&&an.mark){switch(aq){case"outside":aA=aj;az=aj+ap;break;case"inside":aA=aj-ap;az=aj;break;case"cross":aA=aj-ap;az=aj+ap;break;default:aA=aj;az=aj+ap;break}av=[[aA,ak],[az,ak]];if(this.shadow){this.renderer.shadowRenderer.draw(at,av,{lineCap:"butt",lineWidth:this.gridLineWidth*1.5,offset:this.gridLineWidth*0.75,fill:false,closePath:false})}ao(aA,ak,az,ak,{strokeStyle:ah.borderColor})}an=null}al=null}ah=null;aB=null}at.restore();function ao(aH,aG,aE,ax,aF){at.save();aF=aF||{};if(aF.lineWidth==null||aF.lineWidth!=0){L.extend(true,at,aF);at.beginPath();at.moveTo(aH,aG);at.lineTo(aE,ax);at.stroke();at.restore()}}if(this.shadow){var av=[[this._left,this._bottom],[this._right,this._bottom],[this._right,this._top]];this.renderer.shadowRenderer.draw(at,av)}if(this.borderWidth!=0&&this.drawBorder){ao(this._left,this._top,this._right,this._top,{lineCap:"round",strokeStyle:aw.x2axis.borderColor,lineWidth:aw.x2axis.borderWidth});ao(this._right,this._top,this._right,this._bottom,{lineCap:"round",strokeStyle:aw.y2axis.borderColor,lineWidth:aw.y2axis.borderWidth});ao(this._right,this._bottom,this._left,this._bottom,{lineCap:"round",strokeStyle:aw.xaxis.borderColor,lineWidth:aw.xaxis.borderWidth});ao(this._left,this._bottom,this._left,this._top,{lineCap:"round",strokeStyle:aw.yaxis.borderColor,lineWidth:aw.yaxis.borderWidth})}at.restore();at=null;aw=null};L.jqplot.DivTitleRenderer=function(){};L.jqplot.DivTitleRenderer.prototype.init=function(ah){L.extend(true,this,ah)};L.jqplot.DivTitleRenderer.prototype.draw=function(){if(this._elem){this._elem.emptyForce();this._elem=null}var ak=this.renderer;var aj=document.createElement("div");this._elem=L(aj);this._elem.addClass("jqplot-title");if(!this.text){this.show=false;this._elem.height(0);this._elem.width(0)}else{if(this.text){var ah;if(this.color){ah=this.color}else{if(this.textColor){ah=this.textColor}}var ai={position:"absolute",top:"0px",left:"0px"};if(this._plotWidth){ai.width=this._plotWidth+"px"}if(this.fontSize){ai.fontSize=this.fontSize}if(typeof this.textAlign==="string"){ai.textAlign=this.textAlign}else{ai.textAlign="center"}if(ah){ai.color=ah}if(this.paddingBottom){ai.paddingBottom=this.paddingBottom}if(this.fontFamily){ai.fontFamily=this.fontFamily}this._elem.css(ai);if(this.escapeHtml){this._elem.text(this.text)}else{this._elem.html(this.text)}}}aj=null;return this._elem};L.jqplot.DivTitleRenderer.prototype.pack=function(){};var r=0.1;L.jqplot.LinePattern=function(aw,aq){var ap={dotted:[r,L.jqplot.config.dotGapLength],dashed:[L.jqplot.config.dashLength,L.jqplot.config.gapLength],solid:null};if(typeof aq==="string"){if(aq[0]==="."||aq[0]==="-"){var ax=aq;aq=[];for(var ao=0,al=ax.length;ao0)&&(aC>0)){aA/=aB;az/=aB;while(true){var aD=aC*ar;if(aD=aq.length){ak=0}ar=aq[ak]}else{au=ay;at=aE;if((ak&1)==0){aw.lineTo(au,at)}else{aw.moveTo(au,at)}ar-=aB/aC;break}}}};var ai=function(){aw.beginPath()};var am=function(){aj(an,ah)};return{moveTo:av,lineTo:aj,beginPath:ai,closePath:am}};L.jqplot.LineRenderer=function(){this.shapeRenderer=new L.jqplot.ShapeRenderer();this.shadowRenderer=new L.jqplot.ShadowRenderer()};L.jqplot.LineRenderer.prototype.init=function(ai,an){ai=ai||{};this._type="line";this.renderer.animation={show:false,direction:"left",speed:2500,_supported:true};this.renderer.smooth=false;this.renderer.tension=null;this.renderer.constrainSmoothing=true;this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];this.renderer.bandData=[];this.renderer.bands={show:false,hiData:[],lowData:[],color:this.color,showLines:false,fill:true,fillColor:null,_min:null,_max:null,interval:"3%"};var al={highlightMouseOver:ai.highlightMouseOver,highlightMouseDown:ai.highlightMouseDown,highlightColor:ai.highlightColor};delete (ai.highlightMouseOver);delete (ai.highlightMouseDown);delete (ai.highlightColor);L.extend(true,this.renderer,ai);this.renderer.options=ai;if(this.renderer.bandData.length>1&&(!ai.bands||ai.bands.show==null)){this.renderer.bands.show=true}else{if(ai.bands&&ai.bands.show==null&&ai.bands.interval!=null){this.renderer.bands.show=true}}if(this.fill){this.renderer.bands.show=false}if(this.renderer.bands.show){this.renderer.initBands.call(this,this.renderer.options,an)}if(this._stack){this.renderer.smooth=false}var am={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,strokeStyle:this.color,fillStyle:this.fillColor,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shapeRenderer.init(am);var aj=ai.shadowOffset;if(aj==null){if(this.lineWidth>2.5){aj=1.25*(1+(Math.atan((this.lineWidth/2.5))/0.785398163-1)*0.6)}else{aj=1.25*Math.atan((this.lineWidth/2.5))/0.785398163}}var ah={lineJoin:this.lineJoin,lineCap:this.lineCap,fill:this.fill,isarc:false,angle:this.shadowAngle,offset:aj,alpha:this.shadowAlpha,depth:this.shadowDepth,lineWidth:this.lineWidth,linePattern:this.linePattern,closePath:this.fill};this.renderer.shadowRenderer.init(ah);this._areaPoints=[];this._boundingBox=[[],[]];if(!this.isTrendline&&this.fill||this.renderer.bands.show){this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColor=null;if(al.highlightMouseDown&&al.highlightMouseOver==null){al.highlightMouseOver=false}L.extend(true,this,{highlightMouseOver:al.highlightMouseOver,highlightMouseDown:al.highlightMouseDown,highlightColor:al.highlightColor});if(!this.highlightColor){var ak=(this.renderer.bands.show)?this.renderer.bands.fillColor:this.fillColor;this.highlightColor=L.jqplot.computeHighlightColors(ak)}if(this.highlighter){this.highlighter.show=false}}if(!this.isTrendline&&an){an.plugins.lineRenderer={};an.postInitHooks.addOnce(z);an.postDrawHooks.addOnce(af);an.eventListenerHooks.addOnce("jqplotMouseMove",h);an.eventListenerHooks.addOnce("jqplotMouseDown",e);an.eventListenerHooks.addOnce("jqplotMouseUp",ad);an.eventListenerHooks.addOnce("jqplotClick",g);an.eventListenerHooks.addOnce("jqplotRightClick",s)}};L.jqplot.LineRenderer.prototype.initBands=function(ak,av){var al=ak.bandData||[];var an=this.renderer.bands;an.hiData=[];an.lowData=[];var aB=this.data;an._max=null;an._min=null;if(al.length==2){if(L.isArray(al[0][0])){var ao;var ah=0,ar=0;for(var aw=0,at=al[0].length;awan._max)||an._max==null){an._max=ao[1]}if((ao[1]!=null&&ao[1]an._max)||an._max==null){an._max=ao[1];ar=1}if((ao[1]!=null&&ao[1]al[1][0])?0:1;var aC=(aj)?0:1;for(var aw=0,at=aB.length;aw2&&!L.isArray(al[0][0])){var aj=(al[0][0]>al[0][1])?0:1;var aC=(aj)?0:1;for(var aw=0,at=al.length;awan._max)||an._max==null){an._max=am[aw][1]}}for(var aw=0,at=ap.length;aw0){aR=Math.abs((ap[aQ][1]-ap[aQ-1][1])/(ap[aQ][0]-ap[aQ-1][0]))}am=aR/aG+aE;aM=aF*A(am)-aF*A(aE)+aS;aT=(aO+aM)/2}else{aT=aU}for(aK=0;aK2){var ao;if(this.renderer.constrainSmoothing){ao=J.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}else{ao=F.call(this,this.gridData);this.renderer._smoothedData=ao[0];this.renderer._smoothedPlotData=ao[1];if(ak.show){ao=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ao[0];ao=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ao[0]}ao=null}}};L.jqplot.LineRenderer.prototype.makeGridData=function(ao,aq){var am=this._xaxis.series_u2p;var ah=this._yaxis.series_u2p;var ar=[];var aj=[];this.renderer._smoothedData=[];this.renderer._smoothedPlotData=[];this.renderer._hiBandGridData=[];this.renderer._lowBandGridData=[];this.renderer._hiBandSmoothedData=[];this.renderer._lowBandSmoothedData=[];var al=this.renderer.bands;var ai=false;for(var an=0;an2){var ap;if(this.renderer.constrainSmoothing){ap=J.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=J.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=J.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}else{ap=F.call(this,ar);this.renderer._smoothedData=ap[0];this.renderer._smoothedPlotData=ap[1];if(al.show){ap=F.call(this,this.renderer._hiBandGridData);this.renderer._hiBandSmoothedData=ap[0];ap=F.call(this,this.renderer._lowBandGridData);this.renderer._lowBandSmoothedData=ap[0]}ap=null}}return ar};L.jqplot.LineRenderer.prototype.draw=function(ax,aI,ai,aB){var aC;var aq=L.extend(true,{},ai);var ak=(aq.shadow!=u)?aq.shadow:this.shadow;var aJ=(aq.showLine!=u)?aq.showLine:this.showLine;var aA=(aq.fill!=u)?aq.fill:this.fill;var ah=(aq.fillAndStroke!=u)?aq.fillAndStroke:this.fillAndStroke;var ar,ay,av,aE;ax.save();if(aI.length){if(aJ){if(aA){if(this.fillToZero){var aF=this.negativeColor;if(!this.useNegativeColors){aF=aq.fillStyle}var ao=false;var ap=aq.fillStyle;if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var aw=[];var aL=(this.renderer.smooth)?this.renderer._smoothedPlotData:this._plotData;this._areaPoints=[];var aG=this._yaxis.series_u2p(this.fillToValue);var aj=this._xaxis.series_u2p(this.fillToValue);aq.closePath=true;if(this.fillAxis=="y"){aw.push([aI[0][0],aG]);this._areaPoints.push([aI[0][0],aG]);for(var aC=0;aC0;aC--){aI.push(au[aC-1])}if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this._areaPoints=aI;this.renderer.shapeRenderer.draw(ax,aI,aq)}}else{if(ah){var aH=aI.slice(0)}if(this.index==0||!this._stack){var al=ax.canvas.height;aI.unshift([aI[0][0],al]);var aD=aI.length;aI.push([aI[aD-1][0],al])}else{var au=this._prevGridData;for(var aC=au.length;aC>0;aC--){aI.push(au[aC-1])}}this._areaPoints=aI;if(ak){this.renderer.shadowRenderer.draw(ax,aI,aq)}this.renderer.shapeRenderer.draw(ax,aI,aq)}if(ah){var az=L.extend(true,{},aq,{fill:false,closePath:false});this.renderer.shapeRenderer.draw(ax,aH,az);if(this.markerRenderer.show){if(this.renderer.smooth){aH=this.gridData}for(aC=0;aCat[0]||ar==null){ar=at[0]}if(aEat[1]||ay==null){ay=at[1]}}if(this.type==="line"&&this.renderer.bands.show){aE=this._yaxis.series_u2p(this.renderer.bands._min);ay=this._yaxis.series_u2p(this.renderer.bands._max)}this._boundingBox=[[ar,aE],[av,ay]];if(this.markerRenderer.show&&!aA){if(this.renderer.smooth){aI=this.gridData}for(aC=0;aCao){ao=aj}}}al=null;am=null;if(ah){ai=this._label._elem.outerWidth(true);an=this._label._elem.outerHeight(true)}if(this.name=="xaxis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",bottom:"0px"})}else{if(this.name=="x2axis"){ao=ao+an;this._elem.css({height:ao+"px",left:"0px",top:"0px"})}else{if(this.name=="yaxis"){ao=ao+ai;this._elem.css({width:ao+"px",left:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}else{ao=ao+ai;this._elem.css({width:ao+"px",right:"0px",top:"0px"});if(ah&&this._label.constructor==L.jqplot.AxisLabelRenderer){this._label._elem.css("width",ai+"px")}}}}}};L.jqplot.LinearAxisRenderer.prototype.createTicks=function(aj){var aT=this._ticks;var aK=this.ticks;var az=this.name;var aB=this._dataBounds;var ah=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;var an;var a6,aI;var ap,ao;var a4,a0;var aH=this.min;var a5=this.max;var aW=this.numberTicks;var ba=this.tickInterval;var am=30;this._scalefact=(Math.max(ah,am+1)-am)/300;if(aK.length){for(a0=0;a0this.breakPoints[0]&&aO[0]<=this.breakPoints[1]){aU.show=false;aU.showGridline=false;aU.label=aO[1]}else{aU.label=aO[1]}}}else{aU.label=aO[1]}aU.setTick(aO[0],this.name);this._ticks.push(aU)}else{if(L.isPlainObject(aO)){L.extend(true,aU,aO);aU.axis=this.name;this._ticks.push(aU)}else{aU.value=aO;if(this.breakPoints){if(aO==this.breakPoints[0]){aU.label=this.breakTickLabel;aU._breakTick=true;aU.showGridline=false;aU.showMark=false}else{if(aO>this.breakPoints[0]&&aO<=this.breakPoints[1]){aU.show=false;aU.showGridline=false}}}aU.setTick(aO,this.name);this._ticks.push(aU)}}}this.numberTicks=aK.length;this.min=this._ticks[0].value;this.max=this._ticks[this.numberTicks-1].value;this.tickInterval=(this.max-this.min)/(this.numberTicks-1)}else{if(az=="xaxis"||az=="x2axis"){ah=this._plotDimensions.width}else{ah=this._plotDimensions.height}var ax=this.numberTicks;if(this.alignTicks){if(this.name==="x2axis"&&aj.axes.xaxis.show){ax=aj.axes.xaxis.numberTicks}else{if(this.name.charAt(0)==="y"&&this.name!=="yaxis"&&this.name!=="yMidAxis"&&aj.axes.yaxis.show){ax=aj.axes.yaxis.numberTicks}}}a6=((this.min!=null)?this.min:aB.min);aI=((this.max!=null)?this.max:aB.max);var av=aI-a6;var aS,ay;var at;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}if(this.min==null||this.max==null&&this.tickInterval==null&&!this.autoscale){if(this.forceTickAt0){if(a6>0){a6=0}if(aI<0){aI=0}}if(this.forceTickAt100){if(a6>100){a6=100}if(aI<100){aI=100}}var aE=false,a1=false;if(this.min!=null){aE=true}else{if(this.max!=null){a1=true}}var aP=L.jqplot.LinearTickGenerator(a6,aI,this._scalefact,ax,aE,a1);var aw=(this.min!=null)?a6:a6+av*(this.padMin-1);var aQ=(this.max!=null)?aI:aI-av*(this.padMax-1);if(a6aQ){aw=(this.min!=null)?a6:a6-av*(this.padMin-1);aQ=(this.max!=null)?aI:aI+av*(this.padMax-1);aP=L.jqplot.LinearTickGenerator(aw,aQ,this._scalefact,ax,aE,a1)}this.min=aP[0];this.max=aP[1];this.numberTicks=aP[2];this._autoFormatString=aP[3];this.tickInterval=aP[4]}else{if(a6==aI){var ai=0.05;if(a6>0){ai=Math.max(Math.log(a6)/Math.LN10,0.05)}a6-=ai;aI+=ai}if(this.autoscale&&this.min==null&&this.max==null){var ak,al,ar;var aC=false;var aN=false;var aA={min:null,max:null,average:null,stddev:null};for(var a0=0;a0a2){a2=aR[aZ]}}}var au=(a2-aG)/a2;if(aV.renderer.constructor==L.jqplot.BarRenderer){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{aC=false;if(aV.fill&&aV.fillToZero&&aG<0&&a2>0){aN=true}else{aN=false}}}else{if(aV.fill){if(aG>=0&&(aV.fillToZero||au>0.1)){aC=true}else{if(aG<0&&a2>0&&aV.fillToZero){aC=false;aN=true}else{aC=false;aN=false}}}else{if(aG<0){aC=false}}}}}if(aC){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);this.min=0;aH=0;al=aI/(this.numberTicks-1);at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));if(al/at==parseInt(al/at,10)){al+=at}this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*(this.numberTicks-1)}else{if(aN){this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing);var aJ=Math.ceil(Math.abs(a6)/av*(this.numberTicks-1));var a9=this.numberTicks-1-aJ;al=Math.max(Math.abs(a6/aJ),Math.abs(aI/a9));at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)));this.tickInterval=Math.ceil(al/at)*at;this.max=this.tickInterval*a9;this.min=-this.tickInterval*aJ}else{if(this.numberTicks==null){if(this.tickInterval){this.numberTicks=3+Math.ceil(av/this.tickInterval)}else{this.numberTicks=2+Math.ceil((ah-(this.tickSpacing-1))/this.tickSpacing)}}if(this.tickInterval==null){al=av/(this.numberTicks-1);if(al<1){at=Math.pow(10,Math.abs(Math.floor(Math.log(al)/Math.LN10)))}else{at=1}this.tickInterval=Math.ceil(al*at*this.pad)/at}else{at=1/this.tickInterval}ak=this.tickInterval*(this.numberTicks-1);ar=(ak-av)/2;if(this.min==null){this.min=Math.floor(at*(a6-ar))/at}if(this.max==null){this.max=this.min+ak}}}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM}else{aS=(this.min!=null)?this.min:a6-av*(this.padMin-1);ay=(this.max!=null)?this.max:aI+av*(this.padMax-1);av=ay-aS;if(this.numberTicks==null){if(this.tickInterval!=null){this.numberTicks=Math.ceil((ay-aS)/this.tickInterval)+1}else{if(ah>100){this.numberTicks=parseInt(3+(ah-100)/75,10)}else{this.numberTicks=2}}}if(this.tickInterval==null){this.tickInterval=av/(this.numberTicks-1)}if(this.max==null){ay=aS+this.tickInterval*(this.numberTicks-1)}if(this.min==null){aS=ay-this.tickInterval*(this.numberTicks-1)}var aF=L.jqplot.getSignificantFigures(this.tickInterval);var aM;if(aF.digitsLeft>=aF.significantDigits){aM="%d"}else{var at=Math.max(0,5-aF.digitsLeft);at=Math.min(at,aF.digitsRight);aM="%."+at+"f"}this._autoFormatString=aM;this.min=aS;this.max=ay}if(this.renderer.constructor==L.jqplot.LinearAxisRenderer&&this._autoFormatString==""){av=this.max-this.min;var a7=new this.tickRenderer(this.tickOptions);var aL=a7.formatString||L.jqplot.config.defaultTickFormatString;var aL=aL.match(L.jqplot.sprintf.regex)[0];var a3=0;if(aL){if(aL.search(/[fFeEgGpP]/)>-1){var aY=aL.match(/\%\.(\d{0,})?[eEfFgGpP]/);if(aY){a3=parseInt(aY[1],10)}else{a3=6}}else{if(aL.search(/[di]/)>-1){a3=0}}var aq=Math.pow(10,-a3);if(this.tickIntervalthis.breakPoints[0]&&aAthis.breakPoints[0]&&aAthis.breakPoints[0]&&aA=this.breakPoints[1]){return(aA-au)*ak/al}else{return(aA+this.breakPoints[1]-this.breakPoints[0]-au)*ak/al}};this.series_p2u=function(aA){return aA*al/ak+au}}}else{this.p2u=function(aA){return(aA-am)*al/ak+at};this.u2p=function(aA){return(aA-at)*ak/al+am};if(this.name=="xaxis"||this.name=="x2axis"){this.series_u2p=function(aA){return(aA-at)*ak/al};this.series_p2u=function(aA){return aA*al/ak+at}}else{this.series_u2p=function(aA){return(aA-au)*ak/al};this.series_p2u=function(aA){return aA*al/ak+au}}}if(this.show){if(this.name=="xaxis"||this.name=="x2axis"){for(var av=0;av0){ah=-ap._textRenderer.height*Math.cos(-ap._textRenderer.angle)/2}else{ah=-ap.getHeight()+ap._textRenderer.height*Math.cos(ap._textRenderer.angle)/2}break;case"middle":ah=-ap.getHeight()/2;break;default:ah=-ap.getHeight()/2;break}}else{ah=-ap.getHeight()/2}var az=this.u2p(ap.value)+ah+"px";ap._elem.css("top",az);ap.pack()}}if(aq){var aw=this._label._elem.outerHeight(true);this._label._elem.css("top",ao-ak/2-aw/2+"px");if(this.name=="yaxis"){this._label._elem.css("left","0px")}else{this._label._elem.css("right","0px")}this._label.pack()}}}ay=null};function i(ai){var ah;ai=Math.abs(ai);if(ai>=10){ah="%d"}else{if(ai>1){if(ai===parseInt(ai,10)){ah="%d"}else{ah="%.1f"}}else{var aj=-Math.floor(Math.log(ai)/Math.LN10);ah="%."+aj+"f"}}return ah}var b=[0.1,0.2,0.3,0.4,0.5,0.8,1,2,3,4,5];var c=function(ai){var ah=b.indexOf(ai);if(ah>0){return b[ah-1]}else{return b[b.length-1]/100}};var k=function(ai){var ah=b.indexOf(ai);if(ah5){ah=10*aj}else{if(am>2){ah=5*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}else{if(am>5){ah=10*aj}else{if(am>4){ah=5*aj}else{if(am>3){ah=4*aj}else{if(am>2){ah=3*aj}else{if(am>1){ah=2*aj}else{ah=aj}}}}}}return ah}function Q(ai,ah){ah=ah||1;var ak=Math.floor(Math.log(ai)/Math.LN10);var am=Math.pow(10,ak);var al=ai/am;var aj;al=al/ah;if(al<=0.38){aj=0.1}else{if(al<=1.6){aj=0.2}else{if(al<=4){aj=0.5}else{if(al<=8){aj=1}else{if(al<=16){aj=2}else{aj=5}}}}}return aj*am}function x(aj,ai){var al=Math.floor(Math.log(aj)/Math.LN10);var an=Math.pow(10,al);var am=aj/an;var ah;var ak;am=am/ai;if(am<=0.38){ak=0.1}else{if(am<=1.6){ak=0.2}else{if(am<=4){ak=0.5}else{if(am<=8){ak=1}else{if(am<=16){ak=2}else{ak=5}}}}}ah=ak*an;return[ah,ak,an]}L.jqplot.LinearTickGenerator=function(an,aq,aj,ak,ao,ar){ao=(ao===null)?false:ao;ar=(ar===null||ao)?false:ar;if(an===aq){aq=(aq)?0:1}aj=aj||1;if(aqat){at=aB}if(ai>aA){aA=ai}})}an.width=at+Number(av);an.height=aA+Number(ax);var ak=an.getContext("2d");ak.save();ak.fillStyle=al;ak.fillRect(0,0,an.width,an.height);ak.restore();ak.translate(au,ar);ak.textAlign="left";ak.textBaseline="top";function aC(aE){var aF=parseInt(L(aE).css("line-height"),10);if(isNaN(aF)){aF=parseInt(L(aE).css("font-size"),10)*1.2}return aF}function aD(aF,aE,aS,aG,aO,aH){var aQ=aC(aF);var aK=L(aF).innerWidth();var aL=L(aF).innerHeight();var aN=aS.split(/\s+/);var aR=aN.length;var aP="";var aM=[];var aU=aO;var aT=aG;for(var aJ=0;aJaK){aM.push(aJ);aP="";aJ--}}if(aM.length===0){if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aS,aT,aO)}else{aP=aN.slice(0,aM[0]).join(" ");if(L(aF).css("textAlign")==="center"){aT=aG+(aH-aE.measureText(aP).width)/2-au}aE.fillText(aP,aT,aU);aU+=aQ;for(var aJ=1,aI=aM.length;aJ0){ak.strokeRect(aI,aL,L(aG).innerWidth(),L(aG).innerHeight())}L(aG).find("div.jqplot-table-legend-swatch-outline").each(function(){var aU=L(this);ak.strokeStyle=aU.css("border-top-color");var aQ=aI+aU.position().left;var aR=aL+aU.position().top;ak.strokeRect(aQ,aR,aU.innerWidth(),aU.innerHeight());aQ+=parseInt(aU.css("padding-left"),10);aR+=parseInt(aU.css("padding-top"),10);var aT=aU.innerHeight()-2*parseInt(aU.css("padding-top"),10);var aP=aU.innerWidth()-2*parseInt(aU.css("padding-left"),10);var aS=aU.children("div.jqplot-table-legend-swatch");ak.fillStyle=aS.css("background-color");ak.fillRect(aQ,aR,aP,aT)});L(aG).find("td.jqplot-table-legend-label").each(function(){var aR=L(this);var aP=aI+aR.position().left;var aQ=aL+aR.position().top+parseInt(aR.css("padding-top"),10);ak.font=aR.jqplotGetComputedFontStyle();ak.fillStyle=aR.css("color");aD(aR,ak,aR.text(),aP,aQ,aM)});var aH=null}else{if(aN=="canvas"){ak.drawImage(aG,aI,aL)}}}}L(this).children().each(function(){aw(this,av,ax)});return an};L.fn.jqplotToImageStr=function(ai){var ah=L(this).jqplotToImageCanvas(ai);if(ah){return ah.toDataURL("image/png")}else{return null}};L.fn.jqplotToImageElem=function(ah){var ai=document.createElement("img");var aj=L(this).jqplotToImageStr(ah);ai.src=aj;return ai};L.fn.jqplotToImageElemStr=function(ah){var ai="";return ai};L.fn.jqplotSaveImage=function(){var ah=L(this).jqplotToImageStr({});if(ah){window.location.href=ah.replace("image/png","image/octet-stream")}};L.fn.jqplotViewImage=function(){var ai=L(this).jqplotToImageElemStr({});var aj=L(this).jqplotToImageStr({});if(ai){var ah=window.open("");ah.document.open("image/png");ah.document.write(ai);ah.document.close();ah=null}};var ag=function(){this.syntax=ag.config.syntax;this._type="jsDate";this.proxy=new Date();this.options={};this.locale=ag.regional.getLocale();this.formatString="";this.defaultCentury=ag.config.defaultCentury;switch(arguments.length){case 0:break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai0?"floor":"ceil"](ak))};ag.prototype.getAbbrDayName=function(){return ag.regional[this.locale]["dayNamesShort"][this.proxy.getDay()]};ag.prototype.getAbbrMonthName=function(){return ag.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()]};ag.prototype.getAMPM=function(){return this.proxy.getHours()>=12?"PM":"AM"};ag.prototype.getAmPm=function(){return this.proxy.getHours()>=12?"pm":"am"};ag.prototype.getCentury=function(){return parseInt(this.proxy.getFullYear()/100,10)};ag.prototype.getDate=function(){return this.proxy.getDate()};ag.prototype.getDay=function(){return this.proxy.getDay()};ag.prototype.getDayOfWeek=function(){var ah=this.proxy.getDay();return ah===0?7:ah};ag.prototype.getDayOfYear=function(){var ai=this.proxy;var ah=ai-new Date(""+ai.getFullYear()+"/1/1 GMT");ah+=ai.getTimezoneOffset()*60000;ai=null;return parseInt(ah/60000/60/24,10)+1};ag.prototype.getDayName=function(){return ag.regional[this.locale]["dayNames"][this.proxy.getDay()]};ag.prototype.getFullWeekOfYear=function(){var ak=this.proxy;var ah=this.getDayOfYear();var aj=6-ak.getDay();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getFullYear=function(){return this.proxy.getFullYear()};ag.prototype.getGmtOffset=function(){var ah=this.proxy.getTimezoneOffset()/60;var ai=ah<0?"+":"-";ah=Math.abs(ah);return ai+N(Math.floor(ah),2)+":"+N((ah%1)*60,2)};ag.prototype.getHours=function(){return this.proxy.getHours()};ag.prototype.getHours12=function(){var ah=this.proxy.getHours();return ah>12?ah-12:(ah==0?12:ah)};ag.prototype.getIsoWeek=function(){var ak=this.proxy;var aj=this.getWeekOfYear();var ah=(new Date(""+ak.getFullYear()+"/1/1")).getDay();var ai=aj+(ah>4||ah<=1?0:1);if(ai==53&&(new Date(""+ak.getFullYear()+"/12/31")).getDay()<4){ai=1}else{if(ai===0){ak=new ag(new Date(""+(ak.getFullYear()-1)+"/12/31"));ai=ak.getIsoWeek()}}ak=null;return ai};ag.prototype.getMilliseconds=function(){return this.proxy.getMilliseconds()};ag.prototype.getMinutes=function(){return this.proxy.getMinutes()};ag.prototype.getMonth=function(){return this.proxy.getMonth()};ag.prototype.getMonthName=function(){return ag.regional[this.locale]["monthNames"][this.proxy.getMonth()]};ag.prototype.getMonthNumber=function(){return this.proxy.getMonth()+1};ag.prototype.getSeconds=function(){return this.proxy.getSeconds()};ag.prototype.getShortYear=function(){return this.proxy.getYear()%100};ag.prototype.getTime=function(){return this.proxy.getTime()};ag.prototype.getTimezoneAbbr=function(){return this.proxy.toString().replace(/^.*\(([^)]+)\)$/,"$1")};ag.prototype.getTimezoneName=function(){var ah=/(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString());return ah[1]||ah[2]||"GMT"+this.getGmtOffset()};ag.prototype.getTimezoneOffset=function(){return this.proxy.getTimezoneOffset()};ag.prototype.getWeekOfYear=function(){var ah=this.getDayOfYear();var aj=7-this.getDayOfWeek();var ai=parseInt((ah+aj)/7,10);return ai};ag.prototype.getUnix=function(){return Math.round(this.proxy.getTime()/1000,0)};ag.prototype.getYear=function(){return this.proxy.getYear()};ag.prototype.next=function(ah){ah=ah||"day";return this.clone().add(1,ah)};ag.prototype.set=function(){switch(arguments.length){case 0:this.proxy=new Date();break;case 1:if(l(arguments[0])=="[object Object]"&&arguments[0]._type!="jsDate"){var aj=this.options=arguments[0];this.syntax=aj.syntax||this.syntax;this.defaultCentury=aj.defaultCentury||this.defaultCentury;this.proxy=ag.createDate(aj.date)}else{this.proxy=ag.createDate(arguments[0])}break;default:var ah=[];for(var ai=0;ai0?"floor":"ceil"](ah/12));var ai=aj.getMonth()+(ah%12);if(ai==12){ai=0;aj.setYear(aj.getFullYear()+1)}else{if(ai==-1){ai=11;aj.setYear(aj.getFullYear()-1)}}aj.setMonth(ai)},diff:function(al,aj){var ah=al.getFullYear()-aj.getFullYear();var ai=al.getMonth()-aj.getMonth()+(ah*12);var ak=al.getDate()-aj.getDate();return ai+(ak/30)}},year:{add:function(ai,ah){ai.setYear(ai.getFullYear()+Math[ah>0?"floor":"ceil"](ah))},diff:function(ai,ah){return E.month.diff(ai,ah)/12}}};for(var Y in E){if(Y.substring(Y.length-1)!="s"){E[Y+"s"]=E[Y]}}var H=function(al,ak,ai){if(ag.formats[ai]["shortcuts"][ak]){return ag.strftime(al,ag.formats[ai]["shortcuts"][ak],ai)}else{var ah=(ag.formats[ai]["codes"][ak]||"").split(".");var aj=al["get"+ah[0]]?al["get"+ah[0]]():"";if(ah[1]){aj=N(aj,ah[1])}return aj}};ag.strftime=function(an,ak,aj,ao){var ai="perl";var am=ag.regional.getLocale();if(aj&&ag.formats.hasOwnProperty(aj)){ai=aj}else{if(aj&&ag.regional.hasOwnProperty(aj)){am=aj}}if(ao&&ag.formats.hasOwnProperty(ao)){ai=ao}else{if(ao&&ag.regional.hasOwnProperty(ao)){am=ao}}if(l(an)!="[object Object]"||an._type!="jsDate"){an=new ag(an);an.locale=am}if(!ak){ak=an.formatString||ag.regional[am]["formatString"]}var ah=ak||"%Y-%m-%d",ap="",al;while(ah.length>0){if(al=ah.match(ag.formats[ai].codes.matcher)){ap+=ah.slice(0,al.index);ap+=(al[1]||"")+H(an,al[2],ai);ah=ah.slice(al.index+al[0].length)}else{ap+=ah;ah=""}}return ap};ag.formats={ISO:"%Y-%m-%dT%H:%M:%S.%N%G",SQL:"%Y-%m-%d %H:%M:%S"};ag.formats.perl={codes:{matcher:/()%(#?(%|[a-z]))/i,Y:"FullYear",y:"ShortYear.2",m:"MonthNumber.2","#m":"MonthNumber",B:"MonthName",b:"AbbrMonthName",d:"Date.2","#d":"Date",e:"Date",A:"DayName",a:"AbbrDayName",w:"Day",H:"Hours.2","#H":"Hours",I:"Hours12.2","#I":"Hours12",p:"AMPM",M:"Minutes.2","#M":"Minutes",S:"Seconds.2","#S":"Seconds",s:"Unix",N:"Milliseconds.3","#N":"Milliseconds",O:"TimezoneOffset",Z:"TimezoneName",G:"GmtOffset"},shortcuts:{F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",D:"%m/%d/%y","#c":"%a %b %e %H:%M:%S %Y",v:"%e-%b-%Y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.formats.php={codes:{matcher:/()%((%|[a-z]))/i,a:"AbbrDayName",A:"DayName",d:"Date.2",e:"Date",j:"DayOfYear.3",u:"DayOfWeek",w:"Day",U:"FullWeekOfYear.2",V:"IsoWeek.2",W:"WeekOfYear.2",b:"AbbrMonthName",B:"MonthName",m:"MonthNumber.2",h:"AbbrMonthName",C:"Century.2",y:"ShortYear.2",Y:"FullYear",H:"Hours.2",I:"Hours12.2",l:"Hours12",p:"AMPM",P:"AmPm",M:"Minutes.2",S:"Seconds.2",s:"Unix",O:"TimezoneOffset",z:"GmtOffset",Z:"TimezoneAbbr"},shortcuts:{D:"%m/%d/%y",F:"%Y-%m-%d",T:"%H:%M:%S",X:"%H:%M:%S",x:"%m/%d/%y",R:"%H:%M",r:"%I:%M:%S %p",t:"\t",n:"\n","%":"%"}};ag.createDate=function(aj){if(aj==null){return new Date()}if(aj instanceof Date){return aj}if(typeof aj=="number"){return new Date(aj)}var ao=String(aj).replace(/^\s*(.+)\s*$/g,"$1");ao=ao.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/,"$1/$2/$3");ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i,"$1 $2 $3");var an=ao.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i);if(an&&an.length>3){var at=parseFloat(an[3]);var am=ag.config.defaultCentury+at;am=String(am);ao=ao.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i,an[1]+" "+an[2]+" "+am)}an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/);function ar(ax,aw){var aC=parseFloat(aw[1]);var aB=parseFloat(aw[2]);var aA=parseFloat(aw[3]);var az=ag.config.defaultCentury;var av,au,aD,ay;if(aC>31){au=aA;aD=aB;av=az+aC}else{au=aB;aD=aC;av=az+aA}ay=aD+"/"+au+"/"+av;return ax.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/,ay)}if(an&&an.length>3){ao=ar(ao,an)}var an=ao.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/);if(an&&an.length>3){ao=ar(ao,an)}var al=0;var ai=ag.matchers.length;var aq,ah,ap=ao,ak;while(al31){ah=an;ai=am+ao}else{ah=ao;ai=am+an}var ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNamesShort"]);if(ap==-1){ap=ab(aj[2],ag.regional[ag.regional.getLocale()]["monthNames"])}ak.setFullYear(ai,ap,ah);ak.setHours(0,0,0,0);return ak}else{return al}}];function ab(aj,ak){if(ak.indexOf){return ak.indexOf(aj)}for(var ah=0,ai=ak.length;ah=ap)?"":Array(1+ap-au.length>>>0).join(aq);return at?au+ar:ar+au}function ak(ar){var aq=new String(ar);for(var ap=10;ap>0;ap--){if(aq==(aq=aq.replace(/^(\d+)(\d{3})/,"$1"+L.jqplot.sprintf.thousandsSeparator+"$2"))){break}}return aq}function aj(av,au,ax,ar,at,aq){var aw=ar-av.length;if(aw>0){var ap=" ";if(aq){ap=" "}if(ax||!at){av=an(av,ar,ap,ax)}else{av=av.slice(0,au.length)+an("",aw,"0",true)+av.slice(au.length)}}return av}function ao(ay,aq,aw,ar,ap,av,ax,au){var at=ay>>>0;aw=aw&&at&&{"2":"0b","8":"0","16":"0x"}[aq]||"";ay=aw+an(at.toString(aq),av||0,"0",false);return aj(ay,aw,ar,ap,ax,au)}function ah(au,av,ar,ap,at,aq){if(ap!=null){au=au.slice(0,ap)}return aj(au,"",av,ar,at,aq)}var ai=arguments,al=0,am=ai[al++];return am.replace(L.jqplot.sprintf.regex,function(aM,ax,ay,aB,aO,aJ,av){if(aM=="%%"){return"%"}var aD=false,az="",aA=false,aL=false,aw=false,au=false;for(var aI=0;ay&&aI-1?6:(av=="d")?0:void (0)}else{if(aJ=="*"){aJ=+ai[al++]}else{if(aJ.charAt(0)=="*"){aJ=+ai[aJ.slice(1,-1)]}else{aJ=+aJ}}}var aF=ax?ai[ax.slice(0,-1)]:ai[al++];switch(av){case"s":if(aF==null){return""}return ah(String(aF),aD,aB,aJ,aA,aw);case"c":return ah(String.fromCharCode(+aF),aD,aB,aJ,aA,aw);case"b":return ao(aF,2,aL,aD,aB,aJ,aA,aw);case"o":return ao(aF,8,aL,aD,aB,aJ,aA,aw);case"x":return ao(aF,16,aL,aD,aB,aJ,aA,aw);case"X":return ao(aF,16,aL,aD,aB,aJ,aA,aw).toUpperCase();case"u":return ao(aF,10,aL,aD,aB,aJ,aA,aw);case"i":var ar=parseInt(+aF,10);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"d":var ar=Math.round(+aF);if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aK=au?ak(String(Math.abs(ar))):String(Math.abs(ar));aF=aH+an(aK,aJ,"0",false);return aj(aF,aH,aD,aB,aA,aw);case"e":case"E":case"f":case"F":case"g":case"G":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var at=["toExponential","toFixed","toPrecision"]["efg".indexOf(av.toLowerCase())];var aN=["toString","toUpperCase"]["eEfFgG".indexOf(av)%2];var aK=Math.abs(ar)[at](aJ);var aE=aK.toString().split(".");aE[0]=au?ak(aE[0]):aE[0];aK=aE.join(L.jqplot.sprintf.decimalMark);aF=aH+aK;var aC=aj(aF,aH,aD,aB,aA,aw)[aN]();return aC;case"p":case"P":var ar=+aF;if(isNaN(ar)){return""}var aH=ar<0?"-":az;var aE=String(Number(Math.abs(ar)).toExponential()).split(/e|E/);var aq=(aE[0].indexOf(".")!=-1)?aE[0].length-1:String(ar).length;var aG=(aE[1]<0)?-aE[1]-1:0;if(Math.abs(ar)<1){if(aq+aG<=aJ){aF=aH+Math.abs(ar).toPrecision(aq)}else{if(aq<=aJ-1){aF=aH+Math.abs(ar).toExponential(aq-1)}else{aF=aH+Math.abs(ar).toExponential(aJ-1)}}}else{var ap=(aq<=aJ)?aq:aJ;aF=aH+Math.abs(ar).toPrecision(ap)}var aN=["toString","toUpperCase"]["pP".indexOf(av)%2];return aj(aF,aH,aD,aB,aA,aw)[aN]();case"n":return"";default:return aM}})};L.jqplot.sprintf.thousandsSeparator=",";L.jqplot.sprintf.decimalMark=".";L.jqplot.sprintf.regex=/%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g;L.jqplot.getSignificantFigures=function(al){var an=String(Number(Math.abs(al)).toExponential()).split(/e|E/);var am=(an[0].indexOf(".")!=-1)?an[0].length-1:an[0].length;var ai=(an[1]<0)?-an[1]-1:0;var ah=parseInt(an[1],10);var aj=(ah+1>0)?ah+1:0;var ak=(am<=aj)?0:am-ah-1;return{significantDigits:am,digitsLeft:aj,digitsRight:ak,zeros:ai,exponent:ah}};L.jqplot.getPrecision=function(ah){return L.jqplot.getSignificantFigures(ah).digitsRight};var X=L.uiBackCompat!==false;L.jqplot.effects={effect:{}};var m="jqplot.storage.";L.extend(L.jqplot.effects,{version:"1.9pre",save:function(ai,aj){for(var ah=0;ah
      ").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),ah={width:ai.width(),height:ai.height()},ak=document.activeElement;ai.wrap(al);if(ai[0]===ak||L.contains(ai[0],ak)){L(ak).focus()}al=ai.parent();if(ai.css("position")==="static"){al.css({position:"relative"});ai.css({position:"relative"})}else{L.extend(aj,{position:ai.css("position"),zIndex:ai.css("z-index")});L.each(["top","left","bottom","right"],function(am,an){aj[an]=ai.css(an);if(isNaN(parseInt(aj[an],10))){aj[an]="auto"}});ai.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}ai.css(ah);return al.css(aj).show()},removeWrapper:function(ah){var ai=document.activeElement;if(ah.parent().is(".ui-effects-wrapper")){ah.parent().replaceWith(ah);if(ah[0]===ai||L.contains(ah[0],ai)){L(ai).focus()}}return ah}});function j(ai,ah,aj,ak){if(L.isPlainObject(ai)){return ai}ai={effect:ai};if(ah===u){ah={}}if(L.isFunction(ah)){ak=ah;aj=null;ah={}}if(L.type(ah)==="number"||L.fx.speeds[ah]){ak=aj;aj=ah;ah={}}if(L.isFunction(aj)){ak=aj;aj=null}if(ah){L.extend(ai,ah)}aj=aj||ah.duration;ai.duration=L.fx.off?0:typeof aj==="number"?aj:aj in L.fx.speeds?L.fx.speeds[aj]:L.fx.speeds._default;ai.complete=ak||ah.complete;return ai}function ae(ah){if(!ah||typeof ah==="number"||L.fx.speeds[ah]){return true}if(typeof ah==="string"&&!L.jqplot.effects.effect[ah]){if(X&&L.jqplot.effects[ah]){return false}return true}return false}L.fn.extend({jqplotEffect:function(ap,aq,ai,ao){var an=j.apply(this,arguments),ak=an.mode,al=an.queue,am=L.jqplot.effects.effect[an.effect],ah=!am&&X&&L.jqplot.effects[an.effect];if(L.fx.off||!(am||ah)){if(ak){return this[ak](an.duration,an.complete)}else{return this.each(function(){if(an.complete){an.complete.call(this)}})}}function aj(au){var av=L(this),at=an.complete,aw=an.mode;function ar(){if(L.isFunction(at)){at.call(av[0])}if(L.isFunction(au)){au()}}if(av.is(":hidden")?aw==="hide":aw==="show"){ar()}else{am.call(av[0],an,ar)}}if(am){return al===false?this.each(aj):this.queue(al||"fx",aj)}else{return ah.call(this,{options:an,duration:an.duration,callback:an.complete,mode:an.mode})}}});var a=/up|down|vertical/,v=/up|left|vertical|horizontal/;L.jqplot.effects.effect.blind=function(aj,ao){var ak=L(this),ar=["position","top","bottom","left","right","height","width"],ap=L.jqplot.effects.setMode(ak,aj.mode||"hide"),au=aj.direction||"up",am=a.test(au),al=am?"height":"width",aq=am?"top":"left",aw=v.test(au),an={},av=ap==="show",ai,ah,at;if(ak.parent().is(".ui-effects-wrapper")){L.jqplot.effects.save(ak.parent(),ar)}else{L.jqplot.effects.save(ak,ar)}ak.show();at=parseInt(ak.css("top"),10);ai=L.jqplot.effects.createWrapper(ak).css({overflow:"hidden"});ah=am?ai[al]()+at:ai[al]();an[al]=av?String(ah):"0";if(!aw){ak.css(am?"bottom":"right",0).css(am?"top":"left","").css({position:"absolute"});an[aq]=av?"0":String(ah)}if(av){ai.css(al,0);if(!aw){ai.css(aq,ah)}}ai.animate(an,{duration:aj.duration,easing:aj.easing,queue:false,complete:function(){if(ap==="hide"){ak.hide()}L.jqplot.effects.restore(ak,ar);L.jqplot.effects.removeWrapper(ak);ao()}})}})(jQuery); + +/** + * jqPlot + * Pure JavaScript plotting plugin using jQuery + * + * Version: 1.0.4r1121 + * + * Copyright (c) 2009-2011 Chris Leonello + * jqPlot is currently available for use in all personal or commercial projects + * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL + * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can + * choose the license that best suits your project and use it accordingly. + * + * Although not required, the author would appreciate an email letting him + * know of any substantial use of jqPlot. You can reach the author at: + * chris at jqplot dot com or see http://www.jqplot.com/info.php . + * + * If you are feeling kind and generous, consider supporting the project by + * making a donation at: http://www.jqplot.com/donate.php . + * + * sprintf functions contained in jqplot.sprintf.js by Ash Searle: + * + * version 2007.04.27 + * author Ash Searle + * http://hexmen.com/blog/2007/03/printf-sprintf/ + * http://hexmen.com/js/sprintf.js + * The author (Ash Searle) has placed this code in the public domain: + * "This code is unrestricted: you are free to use it however you like." + * + * included jsDate library by Chris Leonello: + * + * Copyright (c) 2010-2011 Chris Leonello + * + * jsDate is currently available for use in all personal or commercial projects + * under both the MIT and GPL version 2.0 licenses. This means that you can + * choose the license that best suits your project and use it accordingly. + * + * jsDate borrows many concepts and ideas from the Date Instance + * Methods by Ken Snyder along with some parts of Ken's actual code. + * + * Ken's origianl Date Instance Methods and copyright notice: + * + * Ken Snyder (ken d snyder at gmail dot com) + * 2008-09-10 + * version 2.0.2 (http://kendsnyder.com/sandbox/date/) + * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/) + * + * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js. + * Larry has generously given permission to adapt his code for inclusion + * into jqPlot. + * + * Larry's original code can be found here: + * + * https://github.com/lsiden/export-jqplot-to-png + * + * https://bitbucket.org/cleonello/jqplot/src/e8af8a37f0f14ea1e8c630ecfe6f1b1933794036/src/plugins/jqplot.meterGaugeRenderer.js?at=default + */ +(function(c){c.jqplot.MeterGaugeRenderer=function(){c.jqplot.LineRenderer.call(this)};c.jqplot.MeterGaugeRenderer.prototype=new c.jqplot.LineRenderer();c.jqplot.MeterGaugeRenderer.prototype.constructor=c.jqplot.MeterGaugeRenderer;c.jqplot.MeterGaugeRenderer.prototype.init=function(e){this.diameter=null;this.padding=null;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=4;this.background="#efefef";this.ringColor="#BBC6D0";this.needleColor="#C3D3E5";this.tickColor="989898";this.ringWidth=null;this.min;this.max;this.ticks=[];this.showTicks=true;this.showTickLabels=true;this.label=null;this.labelHeightAdjust=0;this.labelPosition="inside";this.intervals=[];this.intervalColors=["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"];this.intervalInnerRadius=null;this.intervalOuterRadius=null;this.tickRenderer=c.jqplot.MeterGaugeTickRenderer;this.tickPositions=[1,2,2.5,5,10];this.tickSpacing=30;this.numberMinorTicks=null;this.hubRadius=null;this.tickPadding=null;this.needleThickness=null;this.needlePad=6;this.pegNeedle=true;this._type="meterGauge";c.extend(true,this,e);this.type=null;this.numberTicks=null;this.tickInterval=null;this.span=180;if(this.type=="circular"){this.semiCircular=false}else{if(this.type!="circular"){this.semiCircular=true}else{this.semiCircular=(this.span<=180)?true:false}}this._tickPoints=[];this._labelElem=null;this.startAngle=(90+(360-this.span)/2)*Math.PI/180;this.endAngle=(90-(360-this.span)/2)*Math.PI/180;this.setmin=!!(this.min==null);this.setmax=!!(this.max==null);if(this.intervals.length){if(this.intervals[0].length==null||this.intervals.length==1){for(var f=0;f=this.data[0][1]){this.max=this.intervals[this.intervals.length-1][0];this.setmax=false}}else{this.setmax=false}}else{this.min=(this.min==null)?0:this.min;this.setmin=false;if(this.max==null){this.max=this.data[0][1]*1.25;this.setmax=true}else{this.setmax=false}}}};c.jqplot.MeterGaugeRenderer.prototype.setGridData=function(j){var f=[];var k=[];var e=this.startAngle;for(var h=0;h0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h0){f[h]+=f[h-1]}}var g=Math.PI*2/f[f.length-1];for(var h=0;h=0;h--){e=f/(j[h]*Math.pow(10,g));if(e==4||e==5){return e-1}}return null}c.jqplot.MeterGaugeRenderer.prototype.draw=function(X,aC,ap){var aa;var aM=(ap!=undefined)?ap:{};var ai=0;var ah=0;var at=1;if(ap.legendInfo&&ap.legendInfo.placement=="inside"){var aI=ap.legendInfo;switch(aI.location){case"nw":ai=aI.width+aI.xoffset;break;case"w":ai=aI.width+aI.xoffset;break;case"sw":ai=aI.width+aI.xoffset;break;case"ne":ai=aI.width+aI.xoffset;at=-1;break;case"e":ai=aI.width+aI.xoffset;at=-1;break;case"se":ai=aI.width+aI.xoffset;at=-1;break;case"n":ah=aI.height+aI.yoffset;break;case"s":ah=aI.height+aI.yoffset;at=-1;break;default:break}}if(this.label){this._labelElem=c('
      '+this.label+"
      ");this.canvas._elem.after(this._labelElem)}var m=(aM.shadow!=undefined)?aM.shadow:this.shadow;var N=(aM.showLine!=undefined)?aM.showLine:this.showLine;var I=(aM.fill!=undefined)?aM.fill:this.fill;var K=X.canvas.width;var S=X.canvas.height;if(this.padding==null){this.padding=Math.round(Math.min(K,S)/30)}var Q=K-ai-2*this.padding;var ab=S-ah-2*this.padding;if(this.labelPosition=="bottom"&&this.label){ab-=this._labelElem.outerHeight(true)}var L=Math.min(Q,ab);var ad=L;if(!this.diameter){if(this.semiCircular){if(Q>=2*ab){if(!this.ringWidth){this.ringWidth=2*ab/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=2*(ab-2*this.innerPad)}else{if(!this.ringWidth){this.ringWidth=Q/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=this.ringWidth/2+this.needleThickness/2+this.needlePad;this.diameter=Q-2*this.innerPad-this.ringWidth-this.padding}this._center=[(K-at*ai)/2+at*ai,(S+at*ah-this.padding-this.ringWidth-this.innerPad)]}else{if(!this.ringWidth){this.ringWidth=ad/35}this.needleThickness=this.needleThickness||2+Math.pow(this.ringWidth,0.8);this.innerPad=0;this.diameter=ad-this.ringWidth;this._center=[(K-at*ai)/2+at*ai,(S-at*ah)/2+at*ah]}}if(this._labelElem&&this.labelPosition=="bottom"){this._center[1]-=this._labelElem.outerHeight(true)}this._radius=this.diameter/2;this.tickSpacing=6000/this.diameter;if(!this.hubRadius){this.hubRadius=this.diameter/18}this.shadowOffset=0.5+this.ringWidth/9;this.shadowWidth=this.ringWidth*1;this.tickPadding=3+Math.pow(this.diameter/20,0.7);this.tickOuterRadius=this._radius-this.ringWidth/2-this.tickPadding;this.tickLength=(this.showTicks)?this._radius/13:0;if(this.ticks.length==0){var A=this.max,aL=this.min,q=this.setmax,aG=this.setmin,au=(A-aL)*this.tickSpacing/this.span;var aw=Math.floor(parseFloat((Math.log(au)/Math.log(10)).toFixed(11)));var an=(au/Math.pow(10,aw));(an>2&&an<=2.5)?an=2.5:an=Math.ceil(an);var T=this.tickPositions;var aA,ak;for(aa=0;aa0)?aL-aL%au:aL-aL%au-au;if(!this.forceZero){var D=Math.min(aL-aP,0.8*au);var o=Math.floor(D/T[aA]);if(o>1){aP=aP+T[aA]*(o-1);if(parseInt(aP,10)!=aP&&parseInt(aP-T[aA],10)==aP-T[aA]){aP=aP-T[aA]}}}if(aL==aP){aL-=au}else{if(aL-aP>0.23*au){aL=aP}else{aL=aP-au;ak+=1}}ak+=1;var E=aL+(ak-1)*au;if(A>=E){E+=au;ak+=1}if(E-A<0.23*au){E+=au;ak+=1}this.max=A=E;this.min=aL;this.tickInterval=au;this.numberTicks=ak;var O;for(aa=0;aa=E){A=E+au;ak+=1}else{A=E}this.tickInterval=this.tickInterval||au;this.numberTicks=this.numberTicks||ak;var O;for(aa=0;aa1){var aJ=String(P);if(aJ.search(/\./)==-1){var aF=aJ.search(/0+$/);av=(aF>0)?aJ.length-aF-1:0}}M=P/Math.pow(10,av);for(aa=0;aa'+this.ticks[aa][1]+"
    ");this.canvas._elem.after(J);aO=J.outerWidth(true);g=J.outerHeight(true);W=this._tickPoints[aa][0]-aO*(this._tickPoints[aa][2]-Math.PI)/Math.PI-an*Math.cos(this._tickPoints[aa][2]);T=this._tickPoints[aa][1]-g/2+g/2*Math.pow(Math.abs((Math.sin(this._tickPoints[aa][2]))),0.5)+an/3*Math.pow(Math.abs((Math.sin(this._tickPoints[aa][2]))),0.5);J.css({left:W,top:T});G=aO*Math.cos(this._tickPoints[aa][2])+g*Math.sin(Math.PI/2+this._tickPoints[aa][2]/2);n=(G>n)?G:n}}if(this.label&&this.labelPosition=="inside"){var W=this._center[0]+this.canvas._offsets.left;var an=this.tickPadding*(1-1/(this.diameter/80+1));var T=0.5*(this._center[1]+this.canvas._offsets.top-this.hubRadius)+0.5*(this._center[1]+this.canvas._offsets.top-this.tickOuterRadius+this.tickLength+an)+this.labelHeightAdjust;W-=this._labelElem.outerWidth(true)/2;T-=this._labelElem.outerHeight(true)/2;this._labelElem.css({left:W,top:T})}else{if(this.label&&this.labelPosition=="bottom"){var W=this._center[0]+this.canvas._offsets.left-this._labelElem.outerWidth(true)/2;var T=this._center[1]+this.canvas._offsets.top+this.innerPad+ +this.ringWidth+this.padding+this.labelHeightAdjust;this._labelElem.css({left:W,top:T})}}X.save();var ax=this.intervalInnerRadius||this.hubRadius*1.5;if(this.intervalOuterRadius==null){if(this.showTickLabels){var ag=(this.tickOuterRadius-this.tickLength-this.tickPadding-this.diameter/8)}else{var ag=(this.tickOuterRadius-this.tickLength-this.diameter/16)}}else{var ag=this.intervalOuterRadius}var P=this.max-this.min;var aD=this.intervals[this.intervals.length-1]-this.min;var y,Z,u=this.span*Math.PI/180;for(aa=0;aathis.max+R*3/this.span){ay=this.max+R*3/this.span}if(this.data[0][1]');var f=false,q=false,u,o;var w=p[0];if(w.show){var t=w.data;if(this.numberRows){u=this.numberRows;if(!this.numberColumns){o=Math.ceil(t.length/u)}else{o=this.numberColumns}}else{if(this.numberColumns){o=this.numberColumns;u=Math.ceil(t.length/this.numberColumns)}else{u=t.length;o=1}}var n,m,r,g,e,l,k,h;var v=0;for(n=0;n').prependTo(this._elem)}else{r=c('').appendTo(this._elem)}for(m=0;m0){f=true}else{f=false}}else{if(n==u-1){f=false}else{f=true}}k=(f)?this.rowSpacing:"0";g=c('
    ');e=c('');if(this.escapeHtml){e.text(l)}else{e.html(l)}if(q){e.prependTo(r);g.prependTo(r)}else{g.appendTo(r);e.appendTo(r)}f=true}v++}}}}return this._elem};function a(j,h,f){f=f||{};f.axesDefaults=f.axesDefaults||{};f.legend=f.legend||{};f.seriesDefaults=f.seriesDefaults||{};f.grid=f.grid||{};var e=false;if(f.seriesDefaults.renderer==c.jqplot.MeterGaugeRenderer){e=true}else{if(f.series){for(var g=0;g + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/widgets/jqui/doc.html b/www/widgets/jqui/doc.html new file mode 100644 index 0000000..082d2c0 --- /dev/null +++ b/www/widgets/jqui/doc.html @@ -0,0 +1,313 @@ + + + + Dokumentation Widget-Set jqui + + + +

    static - Button Link

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    static - Button Link _blank

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    static - Icon link

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    static - HTML - Dialog

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    static - Icon - Dialog

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    container - HTML - view in jqui Dialog

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    container - Icon - view in jqui Dialog

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    container - Button - view in jqui Dialog

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    naviation - Button

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    navigation - Icon

    + +

    Attribute

    +
    + +
    +
    + + +
    + + +

    hm_ctrl - Input

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Icon Bool

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Input Datetime

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Input + Set-Button

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Button .State()

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Button .ProgramExecute()

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Radiobuttons on/off

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Radiobuttons ValueList

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Select ValueList

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Radiobuttons 25%

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Slider vertical

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + +

    hm_ctrl - Slider horizontal

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + + +

    hm_ctrl - Slider vertical

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + + +

    hm_ctrl - Icon .State()

    + +

    Attribute

    +
    + +
    +
    + + +
    + + + + + \ No newline at end of file diff --git a/www/widgets/jqui/img/Prev_ContainerButtonDialog.png b/www/widgets/jqui/img/Prev_ContainerButtonDialog.png new file mode 100644 index 0000000..ec56987 Binary files /dev/null and b/www/widgets/jqui/img/Prev_ContainerButtonDialog.png differ diff --git a/www/widgets/jqui/img/Prev_ContainerDialog.png b/www/widgets/jqui/img/Prev_ContainerDialog.png new file mode 100644 index 0000000..8212af9 Binary files /dev/null and b/www/widgets/jqui/img/Prev_ContainerDialog.png differ diff --git a/www/widgets/jqui/img/Prev_ContainerDialogExternal.png b/www/widgets/jqui/img/Prev_ContainerDialogExternal.png new file mode 100644 index 0000000..fcf796a Binary files /dev/null and b/www/widgets/jqui/img/Prev_ContainerDialogExternal.png differ diff --git a/www/widgets/jqui/img/Prev_ContainerIconDialog.png b/www/widgets/jqui/img/Prev_ContainerIconDialog.png new file mode 100644 index 0000000..bfa3c44 Binary files /dev/null and b/www/widgets/jqui/img/Prev_ContainerIconDialog.png differ diff --git a/www/widgets/jqui/img/Prev_JquiDialog.png b/www/widgets/jqui/img/Prev_JquiDialog.png new file mode 100644 index 0000000..5050ba1 Binary files /dev/null and b/www/widgets/jqui/img/Prev_JquiDialog.png differ diff --git a/www/widgets/jqui/img/Prev_JquiIconDialog.png b/www/widgets/jqui/img/Prev_JquiIconDialog.png new file mode 100644 index 0000000..72b8bbd Binary files /dev/null and b/www/widgets/jqui/img/Prev_JquiIconDialog.png differ diff --git a/www/widgets/jqui/img/ct.png b/www/widgets/jqui/img/ct.png new file mode 100644 index 0000000..00b8706 Binary files /dev/null and b/www/widgets/jqui/img/ct.png differ diff --git a/www/widgets/jqui/img/hue.png b/www/widgets/jqui/img/hue.png new file mode 100644 index 0000000..f258a0f Binary files /dev/null and b/www/widgets/jqui/img/hue.png differ diff --git a/www/widgets/jqui/img/internet-web-browser-2.png b/www/widgets/jqui/img/internet-web-browser-2.png new file mode 100644 index 0000000..b0c18e8 Binary files /dev/null and b/www/widgets/jqui/img/internet-web-browser-2.png differ diff --git a/www/widgets/swipe.html b/www/widgets/swipe.html new file mode 100644 index 0000000..87b4229 --- /dev/null +++ b/www/widgets/swipe.html @@ -0,0 +1,278 @@ + + + + + + + + \ No newline at end of file diff --git a/www/widgets/swipe/doc.html b/www/widgets/swipe/doc.html new file mode 100644 index 0000000..9a019ab --- /dev/null +++ b/www/widgets/swipe/doc.html @@ -0,0 +1,47 @@ + + + + Dokumentation Widget-Set swipe + + + +

    swipe Navigation

    + +Dieses Widget ermöglicht Navigation durch Wisch-Gesten + +

    Attribute

    +
    + +
    Left-nav_view
    +
    Name der View beim Wischen nach Links
    + +
    Right-nav_view
    +
    Name der View beim Wischen nach Rechts
    + +
    ???-out effect
    +
    Effect der auszublendenen View
    + +
    ???-in effect
    +
    Effect der einzublendenen View
    + +
    ???-???-opt
    +
    ggf. Optionen für den Effect
    + +
    duration
    +
    Dauer der Animation in ms
    + +
    +
    + +
    Hinweis:
    +
    Wenn auf der View zb. Slider vorhanden sind, kann man diese mit dem Eintrag "noSwipe" bei "CSS Klasse:" von der Swipe erkennung ausschliesen
    + + + + +
    + + + + + \ No newline at end of file diff --git a/www/widgets/swipe/img/Prev_Carousel.png b/www/widgets/swipe/img/Prev_Carousel.png new file mode 100644 index 0000000..caa5f25 Binary files /dev/null and b/www/widgets/swipe/img/Prev_Carousel.png differ diff --git a/www/widgets/swipe/img/Prev_Swipe.png b/www/widgets/swipe/img/Prev_Swipe.png new file mode 100644 index 0000000..756c326 Binary files /dev/null and b/www/widgets/swipe/img/Prev_Swipe.png differ diff --git a/www/widgets/swipe/img/noSwipe.jpg b/www/widgets/swipe/img/noSwipe.jpg new file mode 100644 index 0000000..ed15638 Binary files /dev/null and b/www/widgets/swipe/img/noSwipe.jpg differ diff --git a/www/widgets/swipe/js/jquery.roundabout-shapes.js b/www/widgets/swipe/js/jquery.roundabout-shapes.js new file mode 100644 index 0000000..04cffbc --- /dev/null +++ b/www/widgets/swipe/js/jquery.roundabout-shapes.js @@ -0,0 +1,182 @@ +/** + * jQuery Roundabout Shapes v2 + * http://fredhq.com/projects/roundabout-shapes/ + * + * Provides additional paths along which items can move for the + * jQuery Roundabout plugin (v1.0+). + * + * Terms of Use // jQuery Roundabout Shapes + * + * Open source under the BSD license + * + * Copyright (c) 2009-2011, Fred LeBlanc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +jQuery.extend(jQuery.roundaboutShapes, +{ + theJuggler: function(r, a, t) { + return { + x: Math.sin(r + a), + y: Math.tan(Math.exp(Math.log(r)) + a) / (t - 1), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + figure8: function(r, a, t) { + return { + x: Math.sin(r * 2 + a), + y: (Math.sin(r + Math.PI/2 + a) / 8) * t, + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + waterWheel: function(r, a, t) { + return { + x: (Math.sin(r + Math.PI/2 + a) / 8) * t, + y: Math.sin(r + a) / (Math.PI/2), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + square: function(r, a, t) { + var sq_x, sq_y, sq_z; + + if (r <= Math.PI/2) { + sq_x = (2/Math.PI) * r; + sq_y = -(2/Math.PI) * r + 1; + sq_z = -(1/Math.PI) * r + 1; + } else if (r > Math.PI/2 && r <= Math.PI) { + sq_x = -(2/Math.PI) * r + 2; + sq_y = -(2/Math.PI) * r + 1; + sq_z = -(1/Math.PI) * r + 1; + } else if (r > Math.PI && r <= (3 * Math.PI) / 2) { + sq_x = -(2/Math.PI) * r + 2; + sq_y = (2/Math.PI) * r - 3; + sq_z = (1/Math.PI) * r - 1; + } else { + sq_x = (2/Math.PI) * r - 4; + sq_y = (2/Math.PI) * r - 3; + sq_z = (1/Math.PI) * r - 1; + } + + return { + x: sq_x, + y: sq_y * t, + z: sq_z, + scale: sq_z + }; + }, + conveyorBeltLeft: function(r, a, t) { + return { + x: -Math.cos(r + a), + y: (Math.cos(r + 3*Math.PI/2 + a) / 8) * t, + z: (Math.sin(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + conveyorBeltRight: function(r, a, t) { + return { + x: Math.cos(r + a), + y: (Math.cos(r + 3*Math.PI/2 + a) / 8) * t, + z: (Math.sin(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + goodbyeCruelWorld: function(r, a, t) { + return { + x: Math.sin(r + a), + y: (Math.tan(r + 3*Math.PI/2 + a) / 8) * (t + 0.5), + z: (Math.sin(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + diagonalRingLeft: function(r, a, t) { + return { + x: Math.sin(r + a), + y: -Math.cos(r + Math.tan(Math.cos(a))) / (t + 1.5), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + diagonalRingRight: function(r, a, t) { + return { + x: Math.sin(r + a), + y: Math.cos(r + Math.tan(Math.cos(a))) / (t + 1.5), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + rollerCoaster: function(r, a, t) { + return { + x: Math.sin(r + a), + y: Math.sin((2 + t) * r), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + tearDrop: function(r, a, t) { + return { + x: Math.sin(r + a), + y: -Math.sin(r/2 + t) + 0.35, + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + tickingClock: function(r, a, t) { + return { + x: Math.cos(r + a - Math.PI/2), + y: Math.sin(r + a - Math.PI/2), + z: Math.cos(r), + scale: Math.cos(r) + 0.5 + } + }, + flurry: function(r, a, t) { + return { + x: Math.sin(r * 3 + a), + y: (Math.cos(r + Math.PI/2 + a) / 2) * t, + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + nowSlide: function(r, a, t) { + return { + x: Math.tan(r * 2 + a) * 0.5, + y: Math.cos(r*2 + t) / 6, + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + }, + risingEssence: function(r, a, t) { + return { + x: Math.sin(r + a), + y: Math.tan((2 + t) * r), + z: (Math.cos(r + a) + 1) / 2, + scale: (Math.sin(r + Math.PI/2 + a) / 2) + 0.5 + }; + } +}); \ No newline at end of file diff --git a/www/widgets/swipe/js/jquery.roundabout.min.js b/www/widgets/swipe/js/jquery.roundabout.min.js new file mode 100644 index 0000000..b6f4935 --- /dev/null +++ b/www/widgets/swipe/js/jquery.roundabout.min.js @@ -0,0 +1,41 @@ +/** + * jQuery Roundabout - v2.4.2 + * http://fredhq.com/projects/roundabout + * + * Moves list-items of enabled ordered and unordered lists long + * a chosen path. Includes the default "lazySusan" path, that + * moves items long a spinning turntable. + * + * Terms of Use // jQuery Roundabout + * + * Open source under the BSD license + * + * Copyright (c) 2011-2012, Fred LeBlanc + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * - Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +(function(a){"use strict";var b,c,d;a.extend({roundaboutShapes:{def:"lazySusan",lazySusan:function(a,b,c){return{x:Math.sin(a+b),y:Math.sin(a+3*Math.PI/2+b)/8*c,z:(Math.cos(a+b)+1)/2,scale:Math.sin(a+Math.PI/2+b)/2+.5}}}});b={bearing:0,tilt:0,minZ:100,maxZ:280,minOpacity:.4,maxOpacity:1,minScale:.4,maxScale:1,duration:600,btnNext:null,btnNextCallback:function(){},btnPrev:null,btnPrevCallback:function(){},btnToggleAutoplay:null,btnStartAutoplay:null,btnStopAutoplay:null,easing:"swing",clickToFocus:true,clickToFocusCallback:function(){},focusBearing:0,shape:"lazySusan",debug:false,childSelector:"li",startingChild:null,reflect:false,floatComparisonThreshold:.001,autoplay:false,autoplayDuration:1e3,autoplayPauseOnHover:false,autoplayCallback:function(){},autoplayInitialDelay:0,enableDrag:false,dropDuration:600,dropEasing:"swing",dropAnimateTo:"nearest",dropCallback:function(){},dragAxis:"x",dragFactor:4,triggerFocusEvents:true,triggerBlurEvents:true,responsive:false};c={autoplayInterval:null,autoplayIsRunning:false,autoplayStartTimeout:null,animating:false,childInFocus:-1,touchMoveStartPosition:null,stopAnimation:false,lastAnimationStep:false};d={init:function(e,f,g){var h,i=(new Date).getTime();e=typeof e==="object"?e:{};f=a.isFunction(f)?f:function(){};f=a.isFunction(e)?e:f;h=a.extend({},b,e,c);return this.each(function(){var b=a(this),c=b.children(h.childSelector).length,e=360/c,i=h.startingChild&&h.startingChild>c-1?c-1:h.startingChild,j=h.startingChild===null?h.bearing:360-i*e,k=b.css("position")!=="static"?b.css("position"):"relative";b.css({padding:0,position:k}).addClass("roundabout-holder").data("roundabout",a.extend({},h,{startingChild:i,bearing:j,oppositeOfFocusBearing:d.normalize.apply(null,[h.focusBearing-180]),dragBearing:j,period:e}));if(g){b.unbind(".roundabout").children(h.childSelector).unbind(".roundabout")}else{if(h.responsive){a(window).bind("resize",function(){d.stopAutoplay.apply(b);d.relayoutChildren.apply(b)})}}if(h.clickToFocus){b.children(h.childSelector).each(function(c){a(this).bind("click.roundabout",function(){var e=d.getPlacement.apply(b,[c]);if(!d.isInFocus.apply(b,[e])){d.stopAnimation.apply(a(this));if(!b.data("roundabout").animating){d.animateBearingToFocus.apply(b,[e,b.data("roundabout").clickToFocusCallback])}return false}})})}if(h.btnNext){a(h.btnNext).bind("click.roundabout",function(){if(!b.data("roundabout").animating){d.animateToNextChild.apply(b,[b.data("roundabout").btnNextCallback])}return false})}if(h.btnPrev){a(h.btnPrev).bind("click.roundabout",function(){d.animateToPreviousChild.apply(b,[b.data("roundabout").btnPrevCallback]);return false})}if(h.btnToggleAutoplay){a(h.btnToggleAutoplay).bind("click.roundabout",function(){d.toggleAutoplay.apply(b);return false})}if(h.btnStartAutoplay){a(h.btnStartAutoplay).bind("click.roundabout",function(){d.startAutoplay.apply(b);return false})}if(h.btnStopAutoplay){a(h.btnStopAutoplay).bind("click.roundabout",function(){d.stopAutoplay.apply(b);return false})}if(h.autoplayPauseOnHover){b.bind("mouseenter.roundabout.autoplay",function(){d.stopAutoplay.apply(b,[true])}).bind("mouseleave.roundabout.autoplay",function(){d.startAutoplay.apply(b)})}if(h.enableDrag){if(!a.isFunction(b.drag)){if(h.debug){alert("You do not have the drag plugin loaded.")}}else if(!a.isFunction(b.drop)){if(h.debug){alert("You do not have the drop plugin loaded.")}}else{b.drag(function(a,c){var e=b.data("roundabout"),f=e.dragAxis.toLowerCase()==="x"?"deltaX":"deltaY";d.stopAnimation.apply(b);d.setBearing.apply(b,[e.dragBearing+c[f]/e.dragFactor])}).drop(function(a){var c=b.data("roundabout"),e=d.getAnimateToMethod(c.dropAnimateTo);d.allowAnimation.apply(b);d[e].apply(b,[c.dropDuration,c.dropEasing,c.dropCallback]);c.dragBearing=c.period*d.getNearestChild.apply(b)})}b.each(function(){var b=a(this).get(0),c=a(this).data("roundabout"),e=c.dragAxis.toLowerCase()==="x"?"pageX":"pageY",f=d.getAnimateToMethod(c.dropAnimateTo);if(b.addEventListener){b.addEventListener("touchstart",function(a){c.touchMoveStartPosition=a.touches[0][e]},false);b.addEventListener("touchmove",function(b){var f=(b.touches[0][e]-c.touchMoveStartPosition)/c.dragFactor;b.preventDefault();d.stopAnimation.apply(a(this));d.setBearing.apply(a(this),[c.dragBearing+f])},false);b.addEventListener("touchend",function(b){b.preventDefault();d.allowAnimation.apply(a(this));f=d.getAnimateToMethod(c.dropAnimateTo);d[f].apply(a(this),[c.dropDuration,c.dropEasing,c.dropCallback]);c.dragBearing=c.period*d.getNearestChild.apply(a(this))},false)}})}d.initChildren.apply(b,[f,g])})},initChildren:function(b,c){var e=a(this),f=e.data("roundabout");b=b||function(){};e.children(f.childSelector).each(function(b){var f,g,h,i=d.getPlacement.apply(e,[b]);if(c&&a(this).data("roundabout")){f=a(this).data("roundabout").startWidth;g=a(this).data("roundabout").startHeight;h=a(this).data("roundabout").startFontSize}a(this).addClass("roundabout-moveable-item").css("position","absolute");a(this).data("roundabout",{startWidth:f||a(this).width(),startHeight:g||a(this).height(),startFontSize:h||parseInt(a(this).css("font-size"),10),degrees:i,backDegrees:d.normalize.apply(null,[i-180]),childNumber:b,currentScale:1,parent:e})});d.updateChildren.apply(e);if(f.autoplay){f.autoplayStartTimeout=setTimeout(function(){d.startAutoplay.apply(e)},f.autoplayInitialDelay)}e.trigger("ready");b.apply(e);return e},updateChildren:function(){return this.each(function(){var b=a(this),c=b.data("roundabout"),e=-1,f={bearing:c.bearing,tilt:c.tilt,stage:{width:Math.floor(a(this).width()*.9),height:Math.floor(a(this).height()*.9)},animating:c.animating,inFocus:c.childInFocus,focusBearingRadian:d.degToRad.apply(null,[c.focusBearing]),shape:a.roundaboutShapes[c.shape]||a.roundaboutShapes[a.roundaboutShapes.def]};f.midStage={width:f.stage.width/2,height:f.stage.height/2};f.nudge={width:f.midStage.width+f.stage.width*.05,height:f.midStage.height+f.stage.height*.05};f.zValues={min:c.minZ,max:c.maxZ,diff:c.maxZ-c.minZ};f.opacity={min:c.minOpacity,max:c.maxOpacity,diff:c.maxOpacity-c.minOpacity};f.scale={min:c.minScale,max:c.maxScale,diff:c.maxScale-c.minScale};b.children(c.childSelector).each(function(g){if(d.updateChild.apply(b,[a(this),f,g,function(){a(this).trigger("ready")}])&&(!f.animating||c.lastAnimationStep)){e=g;a(this).addClass("roundabout-in-focus")}else{a(this).removeClass("roundabout-in-focus")}});if(e!==f.inFocus){if(c.triggerBlurEvents){b.children(c.childSelector).eq(f.inFocus).trigger("blur")}c.childInFocus=e;if(c.triggerFocusEvents&&e!==-1){b.children(c.childSelector).eq(e).trigger("focus")}}b.trigger("childrenUpdated")})},updateChild:function(b,c,e,f){var g,h=this,i=a(b),j=i.data("roundabout"),k=[],l=d.degToRad.apply(null,[360-j.degrees+c.bearing]);f=f||function(){};l=d.normalizeRad.apply(null,[l]);g=c.shape(l,c.focusBearingRadian,c.tilt);g.scale=g.scale>1?1:g.scale;g.adjustedScale=(c.scale.min+c.scale.diff*g.scale).toFixed(4);g.width=(g.adjustedScale*j.startWidth).toFixed(4);g.height=(g.adjustedScale*j.startHeight).toFixed(4);i.css({left:(g.x*c.midStage.width+c.nudge.width-g.width/2).toFixed(0)+"px",top:(g.y*c.midStage.height+c.nudge.height-g.height/2).toFixed(0)+"px",width:g.width+"px",height:g.height+"px",opacity:(c.opacity.min+c.opacity.diff*g.scale).toFixed(2),zIndex:Math.round(c.zValues.min+c.zValues.diff*g.z),fontSize:(g.adjustedScale*j.startFontSize).toFixed(1)+"px"});j.currentScale=g.adjustedScale;if(h.data("roundabout").debug){k.push('
    ');k.push('Child '+e+"
    ");k.push("left: "+i.css("left")+"
    ");k.push("top: "+i.css("top")+"
    ");k.push("width: "+i.css("width")+"
    ");k.push("opacity: "+i.css("opacity")+"
    ");k.push("height: "+i.css("height")+"
    ");k.push("z-index: "+i.css("z-index")+"
    ");k.push("font-size: "+i.css("font-size")+"
    ");k.push("scale: "+i.data("roundabout").currentScale);k.push("
    ");i.html(k.join(""))}i.trigger("reposition");f.apply(h);return d.isInFocus.apply(h,[j.degrees])},setBearing:function(b,c){c=c||function(){};b=d.normalize.apply(null,[b]);this.each(function(){var c,e,f,g=a(this),h=g.data("roundabout"),i=h.bearing;h.bearing=b;g.trigger("bearingSet");d.updateChildren.apply(g);c=Math.abs(i-b);if(!h.animating||c>180){return}c=Math.abs(i-b);g.children(h.childSelector).each(function(c){var e;if(d.isChildBackDegreesBetween.apply(a(this),[b,i])){e=i>b?"Clockwise":"Counterclockwise";a(this).trigger("move"+e+"ThroughBack")}})});c.apply(this);return this},adjustBearing:function(b,c){c=c||function(){};if(b===0){return this}this.each(function(){d.setBearing.apply(a(this),[a(this).data("roundabout").bearing+b])});c.apply(this);return this},setTilt:function(b,c){c=c||function(){};this.each(function(){a(this).data("roundabout").tilt=b;d.updateChildren.apply(a(this))});c.apply(this);return this},adjustTilt:function(b,c){c=c||function(){};this.each(function(){d.setTilt.apply(a(this),[a(this).data("roundabout").tilt+b])});c.apply(this);return this},animateToBearing:function(b,c,e,f,g){var h=(new Date).getTime();g=g||function(){};if(a.isFunction(f)){g=f;f=null}else if(a.isFunction(e)){g=e;e=null}else if(a.isFunction(c)){g=c;c=null}this.each(function(){var i,j,k,l=a(this),m=l.data("roundabout"),n=!c?m.duration:c,o=e?e:m.easing||"swing";if(!f){f={timerStart:h,start:m.bearing,totalTime:n}}i=h-f.timerStart;if(m.stopAnimation){d.allowAnimation.apply(l);m.animating=false;return}if(i=0&&!a.easing["easeOutBack"]){k=f.start+(b-f.start)*k}k=d.normalize.apply(null,[k]);m.dragBearing=k;d.setBearing.apply(l,[k,function(){setTimeout(function(){d.animateToBearing.apply(l,[b,n,o,f,g])},0)}])}else{m.lastAnimationStep=true;b=d.normalize.apply(null,[b]);d.setBearing.apply(l,[b,function(){l.trigger("animationEnd")}]);m.animating=false;m.lastAnimationStep=false;m.dragBearing=b;g.apply(l)}});return this},animateToNearbyChild:function(b,c){var e=b[0],f=b[1],g=b[2]||function(){};if(a.isFunction(f)){g=f;f=null}else if(a.isFunction(e)){g=e;e=null}return this.each(function(){var b,h,i=a(this),j=i.data("roundabout"),k=!j.reflect?j.bearing%360:j.bearing,l=i.children(j.childSelector).length;if(!j.animating){if(j.reflect&&c==="previous"||!j.reflect&&c==="next"){k=Math.abs(k)=Math.floor(h.lower)){if(l===2&&k===360){d.animateToDelta.apply(i,[-180,e,f,g])}else{d.animateBearingToFocus.apply(i,[h.lower,e,f,g])}break}}}else{k=Math.abs(k)=0;b-=1){h={lower:j.period*b,upper:j.period*(b+1)};h.upper=b===l-1?360:h.upper;if(k>=Math.floor(h.lower)&&k180?-(360-g):g;if(g!==0){d.animateToDelta.apply(a(this),[g,c,e,f])}})},stopAnimation:function(){return this.each(function(){a(this).data("roundabout").stopAnimation=true})},allowAnimation:function(){return this.each(function(){a(this).data("roundabout").stopAnimation=false})},startAutoplay:function(b){return this.each(function(){var c=a(this),e=c.data("roundabout");b=b||e.autoplayCallback||function(){};clearInterval(e.autoplayInterval);e.autoplayInterval=setInterval(function(){d.animateToNextChild.apply(c,[b])},e.autoplayDuration);e.autoplayIsRunning=true;c.trigger("autoplayStart")})},stopAutoplay:function(b){return this.each(function(){clearInterval(a(this).data("roundabout").autoplayInterval);a(this).data("roundabout").autoplayInterval=null;a(this).data("roundabout").autoplayIsRunning=false;if(!b){a(this).unbind(".autoplay")}a(this).trigger("autoplayStop")})},toggleAutoplay:function(b){return this.each(function(){var c=a(this),e=c.data("roundabout");b=b||e.autoplayCallback||function(){};if(!d.isAutoplaying.apply(a(this))){d.startAutoplay.apply(a(this),[b])}else{d.stopAutoplay.apply(a(this),[b])}})},isAutoplaying:function(){return this.data("roundabout").autoplayIsRunning},changeAutoplayDuration:function(b){return this.each(function(){var c=a(this),e=c.data("roundabout");e.autoplayDuration=b;if(d.isAutoplaying.apply(c)){d.stopAutoplay.apply(c);setTimeout(function(){d.startAutoplay.apply(c)},10)}})},normalize:function(a){var b=a%360;return b<0?360+b:b},normalizeRad:function(a){while(a<0){a+=Math.PI*2}while(a>Math.PI*2){a-=Math.PI*2}return a},isChildBackDegreesBetween:function(b,c){var d=a(this).data("roundabout").backDegrees;if(b>c){return d>=c&&d=b}},getAnimateToMethod:function(a){a=a.toLowerCase();if(a==="next"){return"animateToNextChild"}else if(a==="previous"){return"animateToPreviousChild"}return"animateToNearestChild"},relayoutChildren:function(){return this.each(function(){var b=a(this),c=a.extend({},b.data("roundabout"));c.startingChild=b.data("roundabout").childInFocus;d.init.apply(b,[c,null,true])})},getNearestChild:function(){var b=a(this),c=b.data("roundabout"),d=b.children(c.childSelector).length;if(!c.reflect){return(d-Math.round(c.bearing/c.period)%d)%d}else{return Math.round(c.bearing/c.period)%d}},degToRad:function(a){return d.normalize.apply(null,[a])*Math.PI/180},getPlacement:function(a){var b=this.data("roundabout");return!b.reflect?360-b.period*a:b.period*a},isInFocus:function(a){var b,c=this,e=c.data("roundabout"),f=d.normalize.apply(null,[e.bearing]);a=d.normalize.apply(null,[a]);b=Math.abs(f-a);return b<=e.floatComparisonThreshold||b>=360-e.floatComparisonThreshold},getChildInFocus:function(){var b=a(this).data("roundabout");return b.childInFocus>-1?b.childInFocus:false},compareVersions:function(a,b){var c,d=a.split(/\./i),e=b.split(/\./i),f=d.length>e.length?d.length:e.length;for(c=0;c<=f;c++){if(d[c]&&!e[c]&&parseInt(d[c],10)!==0){return 1}else if(e[c]&&!d[c]&&parseInt(e[c],10)!==0){return-1}else if(d[c]===e[c]){continue}if(d[c]&&e[c]){if(parseInt(d[c],10)>parseInt(e[c],10)){return 1}else{return-1}}}return 0}};a.fn.roundabout=function(b){if(d[b]){return d[b].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof b==="object"||a.isFunction(b)||!b){return d.init.apply(this,arguments)}else{a.error("Method "+b+" does not exist for jQuery.roundabout.")}}})(jQuery) \ No newline at end of file diff --git a/www/widgets/swipe/js/jquery.touchSwipe.min.js b/www/widgets/swipe/js/jquery.touchSwipe.min.js new file mode 100644 index 0000000..5054f33 --- /dev/null +++ b/www/widgets/swipe/js/jquery.touchSwipe.min.js @@ -0,0 +1 @@ +(function(e){var o="left",n="right",d="up",v="down",c="in",w="out",l="none",r="auto",k="swipe",s="pinch",x="tap",i="doubletap",b="longtap",A="horizontal",t="vertical",h="all",q=10,f="start",j="move",g="end",p="cancel",a="ontouchstart" in window,y="TouchSwipe";var m={fingers:1,threshold:75,cancelThreshold:null,pinchThreshold:20,maxTimeThreshold:null,fingerReleaseThreshold:250,longTapThreshold:500,doubleTapThreshold:200,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,pinchIn:null,pinchOut:null,pinchStatus:null,click:null,tap:null,doubleTap:null,longTap:null,triggerOnTouchEnd:true,triggerOnTouchLeave:false,allowPageScroll:"auto",fallbackToMouseEvents:true,excludedElements:"button, input, select, textarea, a, .noSwipe"};e.fn.swipe=function(D){var C=e(this),B=C.data(y);if(B&&typeof D==="string"){if(B[D]){return B[D].apply(this,Array.prototype.slice.call(arguments,1))}else{e.error("Method "+D+" does not exist on jQuery.swipe")}}else{if(!B&&(typeof D==="object"||!D)){return u.apply(this,arguments)}}return C};e.fn.swipe.defaults=m;e.fn.swipe.phases={PHASE_START:f,PHASE_MOVE:j,PHASE_END:g,PHASE_CANCEL:p};e.fn.swipe.directions={LEFT:o,RIGHT:n,UP:d,DOWN:v,IN:c,OUT:w};e.fn.swipe.pageScroll={NONE:l,HORIZONTAL:A,VERTICAL:t,AUTO:r};e.fn.swipe.fingers={ONE:1,TWO:2,THREE:3,ALL:h};function u(B){if(B&&(B.allowPageScroll===undefined&&(B.swipe!==undefined||B.swipeStatus!==undefined))){B.allowPageScroll=l}if(B.click!==undefined&&B.tap===undefined){B.tap=B.click}if(!B){B={}}B=e.extend({},e.fn.swipe.defaults,B);return this.each(function(){var D=e(this);var C=D.data(y);if(!C){C=new z(this,B);D.data(y,C)}})}function z(a0,aq){var av=(a||!aq.fallbackToMouseEvents),G=av?"touchstart":"mousedown",au=av?"touchmove":"mousemove",R=av?"touchend":"mouseup",P=av?null:"mouseleave",az="touchcancel";var ac=0,aL=null,Y=0,aX=0,aV=0,D=1,am=0,aF=0,J=null;var aN=e(a0);var W="start";var T=0;var aM=null;var Q=0,aY=0,a1=0,aa=0,K=0;var aS=null;try{aN.bind(G,aJ);aN.bind(az,a5)}catch(ag){e.error("events not supported "+G+","+az+" on jQuery.swipe")}this.enable=function(){aN.bind(G,aJ);aN.bind(az,a5);return aN};this.disable=function(){aG();return aN};this.destroy=function(){aG();aN.data(y,null);return aN};this.option=function(a8,a7){if(aq[a8]!==undefined){if(a7===undefined){return aq[a8]}else{aq[a8]=a7}}else{e.error("Option "+a8+" does not exist on jQuery.swipe.options")}};function aJ(a9){if(ax()){return}if(e(a9.target).closest(aq.excludedElements,aN).length>0){return}var ba=a9.originalEvent?a9.originalEvent:a9;var a8,a7=a?ba.touches[0]:ba;W=f;if(a){T=ba.touches.length}else{a9.preventDefault()}ac=0;aL=null;aF=null;Y=0;aX=0;aV=0;D=1;am=0;aM=af();J=X();O();if(!a||(T===aq.fingers||aq.fingers===h)||aT()){ae(0,a7);Q=ao();if(T==2){ae(1,ba.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}if(aq.swipeStatus||aq.pinchStatus){a8=L(ba,W)}}else{a8=false}if(a8===false){W=p;L(ba,W);return a8}else{ak(true)}}function aZ(ba){var bd=ba.originalEvent?ba.originalEvent:ba;if(W===g||W===p||ai()){return}var a9,a8=a?bd.touches[0]:bd;var bb=aD(a8);aY=ao();if(a){T=bd.touches.length}W=j;if(T==2){if(aX==0){ae(1,bd.touches[1]);aX=aV=ap(aM[0].start,aM[1].start)}else{aD(bd.touches[1]);aV=ap(aM[0].end,aM[1].end);aF=an(aM[0].end,aM[1].end)}D=a3(aX,aV);am=Math.abs(aX-aV)}if((T===aq.fingers||aq.fingers===h)||!a||aT()){aL=aH(bb.start,bb.end);ah(ba,aL);ac=aO(bb.start,bb.end);Y=aI();aE(aL,ac);if(aq.swipeStatus||aq.pinchStatus){a9=L(bd,W)}if(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave){var a7=true;if(aq.triggerOnTouchLeave){var bc=aU(this);a7=B(bb.end,bc)}if(!aq.triggerOnTouchEnd&&a7){W=ay(j)}else{if(aq.triggerOnTouchLeave&&!a7){W=ay(g)}}if(W==p||W==g){L(bd,W)}}}else{W=p;L(bd,W)}if(a9===false){W=p;L(bd,W)}}function I(a7){var a8=a7.originalEvent;if(a){if(a8.touches.length>0){C();return true}}if(ai()){T=aa}a7.preventDefault();aY=ao();Y=aI();if(a6()){W=p;L(a8,W)}else{if(aq.triggerOnTouchEnd||(aq.triggerOnTouchEnd==false&&W===j)){W=g;L(a8,W)}else{if(!aq.triggerOnTouchEnd&&a2()){W=g;aB(a8,W,x)}else{if(W===j){W=p;L(a8,W)}}}}ak(false)}function a5(){T=0;aY=0;Q=0;aX=0;aV=0;D=1;O();ak(false)}function H(a7){var a8=a7.originalEvent;if(aq.triggerOnTouchLeave){W=ay(g);L(a8,W)}}function aG(){aN.unbind(G,aJ);aN.unbind(az,a5);aN.unbind(au,aZ);aN.unbind(R,I);if(P){aN.unbind(P,H)}ak(false)}function ay(bb){var ba=bb;var a9=aw();var a8=aj();var a7=a6();if(!a9||a7){ba=p}else{if(a8&&bb==j&&(!aq.triggerOnTouchEnd||aq.triggerOnTouchLeave)){ba=g}else{if(!a8&&bb==g&&aq.triggerOnTouchLeave){ba=p}}}return ba}function L(a9,a7){var a8=undefined;if(F()||S()){a8=aB(a9,a7,k)}else{if((M()||aT())&&a8!==false){a8=aB(a9,a7,s)}}if(aC()&&a8!==false){a8=aB(a9,a7,i)}else{if(al()&&a8!==false){a8=aB(a9,a7,b)}else{if(ad()&&a8!==false){a8=aB(a9,a7,x)}}}if(a7===p){a5(a9)}if(a7===g){if(a){if(a9.touches.length==0){a5(a9)}}else{a5(a9)}}return a8}function aB(ba,a7,a9){var a8=undefined;if(a9==k){aN.trigger("swipeStatus",[a7,aL||null,ac||0,Y||0,T]);if(aq.swipeStatus){a8=aq.swipeStatus.call(aN,ba,a7,aL||null,ac||0,Y||0,T);if(a8===false){return false}}if(a7==g&&aR()){aN.trigger("swipe",[aL,ac,Y,T]);if(aq.swipe){a8=aq.swipe.call(aN,ba,aL,ac,Y,T);if(a8===false){return false}}switch(aL){case o:aN.trigger("swipeLeft",[aL,ac,Y,T]);if(aq.swipeLeft){a8=aq.swipeLeft.call(aN,ba,aL,ac,Y,T)}break;case n:aN.trigger("swipeRight",[aL,ac,Y,T]);if(aq.swipeRight){a8=aq.swipeRight.call(aN,ba,aL,ac,Y,T)}break;case d:aN.trigger("swipeUp",[aL,ac,Y,T]);if(aq.swipeUp){a8=aq.swipeUp.call(aN,ba,aL,ac,Y,T)}break;case v:aN.trigger("swipeDown",[aL,ac,Y,T]);if(aq.swipeDown){a8=aq.swipeDown.call(aN,ba,aL,ac,Y,T)}break}}}if(a9==s){aN.trigger("pinchStatus",[a7,aF||null,am||0,Y||0,T,D]);if(aq.pinchStatus){a8=aq.pinchStatus.call(aN,ba,a7,aF||null,am||0,Y||0,T,D);if(a8===false){return false}}if(a7==g&&a4()){switch(aF){case c:aN.trigger("pinchIn",[aF||null,am||0,Y||0,T,D]);if(aq.pinchIn){a8=aq.pinchIn.call(aN,ba,aF||null,am||0,Y||0,T,D)}break;case w:aN.trigger("pinchOut",[aF||null,am||0,Y||0,T,D]);if(aq.pinchOut){a8=aq.pinchOut.call(aN,ba,aF||null,am||0,Y||0,T,D)}break}}}if(a9==x){if(a7===p||a7===g){clearTimeout(aS);if(V()&&!E()){K=ao();aS=setTimeout(e.proxy(function(){K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}},this),aq.doubleTapThreshold)}else{K=null;aN.trigger("tap",[ba.target]);if(aq.tap){a8=aq.tap.call(aN,ba,ba.target)}}}}else{if(a9==i){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("doubletap",[ba.target]);if(aq.doubleTap){a8=aq.doubleTap.call(aN,ba,ba.target)}}}else{if(a9==b){if(a7===p||a7===g){clearTimeout(aS);K=null;aN.trigger("longtap",[ba.target]);if(aq.longTap){a8=aq.longTap.call(aN,ba,ba.target)}}}}}return a8}function aj(){var a7=true;if(aq.threshold!==null){a7=ac>=aq.threshold}return a7}function a6(){var a7=false;if(aq.cancelThreshold!==null&&aL!==null){a7=(aP(aL)-ac)>=aq.cancelThreshold}return a7}function ab(){if(aq.pinchThreshold!==null){return am>=aq.pinchThreshold}return true}function aw(){var a7;if(aq.maxTimeThreshold){if(Y>=aq.maxTimeThreshold){a7=false}else{a7=true}}else{a7=true}return a7}function ah(a7,a8){if(aq.allowPageScroll===l||aT()){a7.preventDefault()}else{var a9=aq.allowPageScroll===r;switch(a8){case o:if((aq.swipeLeft&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case n:if((aq.swipeRight&&a9)||(!a9&&aq.allowPageScroll!=A)){a7.preventDefault()}break;case d:if((aq.swipeUp&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break;case v:if((aq.swipeDown&&a9)||(!a9&&aq.allowPageScroll!=t)){a7.preventDefault()}break}}}function a4(){var a8=aK();var a7=U();var a9=ab();return a8&&a7&&a9}function aT(){return !!(aq.pinchStatus||aq.pinchIn||aq.pinchOut)}function M(){return !!(a4()&&aT())}function aR(){var ba=aw();var bc=aj();var a9=aK();var a7=U();var a8=a6();var bb=!a8&&a7&&a9&&bc&&ba;return bb}function S(){return !!(aq.swipe||aq.swipeStatus||aq.swipeLeft||aq.swipeRight||aq.swipeUp||aq.swipeDown)}function F(){return !!(aR()&&S())}function aK(){return((T===aq.fingers||aq.fingers===h)||!a)}function U(){return aM[0].end.x!==0}function a2(){return !!(aq.tap)}function V(){return !!(aq.doubleTap)}function aQ(){return !!(aq.longTap)}function N(){if(K==null){return false}var a7=ao();return(V()&&((a7-K)<=aq.doubleTapThreshold))}function E(){return N()}function at(){return((T===1||!a)&&(isNaN(ac)||ac===0))}function aW(){return((Y>aq.longTapThreshold)&&(ac=0)){return o}else{if((a9<=360)&&(a9>=315)){return o}else{if((a9>=135)&&(a9<=225)){return n}else{if((a9>45)&&(a9<135)){return v}else{return d}}}}}function ao(){var a7=new Date();return a7.getTime()}function aU(a7){a7=e(a7);var a9=a7.offset();var a8={left:a9.left,right:a9.left+a7.outerWidth(),top:a9.top,bottom:a9.top+a7.outerHeight()};return a8}function B(a7,a8){return(a7.x>a8.left&&a7.xa8.top&&a7.y + + + + diff --git a/www/widgets/tabs/jquery.sliderTabs.js b/www/widgets/tabs/jquery.sliderTabs.js new file mode 100644 index 0000000..4573bf7 --- /dev/null +++ b/www/widgets/tabs/jquery.sliderTabs.js @@ -0,0 +1,813 @@ +/* + * jQuery SliderTabs v1.1 + * http://lopatin.github.com/sliderTabs + * + * Copyright 2012, Alex Lopatin + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php + * + */ + + +(function( $ ){ + /* + * The sliderTabs tabs class + */ + $.sliderTabs = function(container, options){ + var plugin = this; + + var defaults = { + autoplay: false, + tabArrowWidth: 35, + classes: { + leftTabArrow: '', + panel: '', + panelActive: '', + panelsContainer: '', + rightTabArrow: '', + tab: '', + tabActive: '', + tabsList: '' + }, + defaultTab: 1, + height: null, + indicators: false, + mousewheel: true, + position: "top", + panelArrows: false, + panelArrowsShowOnHover: false, + tabs: true, + tabHeight: 30, + tabArrows: true, + tabSlideLength: 100, + tabSlideSpeed: 200, + transition: 'slide', + transitionEasing: 'easeOutCubic', + transitionSpeed: 500, + width: null + }; + + // jQuery objects of important elements + var $container = $(container), + $indicators, + $tabsList, + $contentDivs, + $tabsListContainer, + $tabsListWrapper, + $contentDivsContainer, + $leftTabArrow, + $rightTabArrow, + $leftPanelArrow, + $rightPanelArrow; + + // Locks to stop out of sync behavior + var selectLock = false, + heightLock = true; + + var settings, minMargin; + + // Index of currently selected tab + plugin.selectedTab = defaults.defaultTab; + + plugin.init = function(){ + settings = plugin.settings = $.extend({}, defaults, options); + $container.addClass('ui-slider-tabs'); + + /* + * Rebuild structure of container + */ + $contentDivs = $container.children("div").addClass('ui-slider-tab-content').remove(); + + // Tabs + $tabsList = $container.children("ul").addClass('ui-slider-tabs-list').remove(); + $tabsList.children("li").remove().appendTo($tabsList); + plugin.count = $tabsList.children('li').length; + $tabsListWrapper = $("
    "); + $tabsListContainer = $("
    ").append($tabsList).appendTo($tabsListWrapper); + $tabsListContainer.find('li').css('height', settings.tabHeight+2); + $tabsListContainer.find('li a').css('height', settings.tabHeight+2); + + // Tab arrows + $leftTabArrow = $("
    ").css({ + 'width': settings.tabArrowWidth, + 'height': settings.tabHeight+2 + }).appendTo($tabsListContainer).click(function(e){ + plugin.slideTabs('right', settings.tabSlideLength); + return false; + }); + $rightTabArrow = $("
    ").css({ + 'width': settings.tabArrowWidth, + 'height': settings.tabHeight+2 + }).appendTo($tabsListContainer).click(function(e){ + plugin.slideTabs('left', settings.tabSlideLength); + return false; + }); + + // Content container + $contentDivsContainer = $("
    ").append($contentDivs); + + // Position the tabs on top or bottom + if(settings.position == 'bottom') + $container.append($contentDivsContainer).append($tabsListWrapper.addClass('bottom')); + else + $container.append($tabsListWrapper).append($contentDivsContainer); + + + if(settings.width) + $container.width(parseInt(settings.width)); + if(settings.height) + $contentDivsContainer.height(parseInt(settings.height)- settings.tabHeight); + + // Create and show indicators + if(settings.indicators) + plugin.showIndicators(); + + + // Select default tab + plugin.selectTab(settings.defaultTab); + plugin.slideTabs('left', 0); + + reorderPanels(); + + resizePanels(); + + // When tab is clicked + $container.delegate('.ui-slider-tabs-list li a', 'click', function(){ + if(!$(this).parent().hasClass('selected') && !selectLock){ + plugin.selectTab($(this).parent()); + } + return false; + }); + + // When indicator is clicked + if($indicators) + $indicators.delegate('.ui-slider-tabs-indicator', 'click', function(){ + if(!$(this).hasClass('selected') && !selectLock) + plugin.selectTab($(this).index()+1); + }); + + // Set classes + $.each(settings.classes, function(i, c){ + switch(i){ + case 'leftTabArrow': + $leftTabArrow.addClass(c); + break; + case 'rightTabArrow': + $rightTabArrow.addClass(c); + break; + case 'panel': + $contentDivs.addClass(c); + break; + case 'panelsContainer': + $contentDivsContainer.addClass(c); + break; + case 'tab': + $tabsList.find('li').addClass(c); + break; + case 'tabsList': + $tabsList.addClass(c); + break; + default: + break; + } + }); + + // Panel arrows + // Creates them if they don't exist + if(settings.panelArrows) + positionPanelArrows(); + + if(settings.panelArrowsShowOnHover){ + if($leftPanelArrow) + $leftPanelArrow.addClass('showOnHover'); + if($rightPanelArrow) + $rightPanelArrow.addClass('showOnHover'); + } + + $contentDivsContainer.resize(positionPanelArrows); + + // Make responsive to changes in dimensions + $tabsListWrapper.resize(function(){ + resizeTabsList(); + resizePanels(); + }); + + // Resize content container height if inner panels change + setInterval(function(){ + var $panel = $contentDivsContainer.children('.selected'); + if($panel.outerHeight() > $contentDivsContainer.outerHeight() && heightLock) + resizeContentContainer($panel); + }, 100); + + resizeTabsList(); + + // Hide tabs wrapper if option if false + if(!settings.tabs) + $tabsListWrapper.hide(); + + // Auto play + if(settings.autoplay) + setInterval(plugin.next, settings.autoplay); + + // Panel arrows + + // Mousehweel + $container.bind('mousewheel', function(event, delta, deltaX, deltaY) { + if(delta > 0) + plugin.next(); + else if(delta < 0) + plugin.prev(); + return false; + }); + } + + /* + * Public methods + */ + + // Select tab + // param: tab is a tab index (1 ... n) or jQuery object of tab li element + plugin.selectTab = function(tab){ + heightLock = false; + + // Find $targetPanel, the panel to show + var $clicked = (typeof tab === 'number') ? $tabsList.children("li:nth-child("+tab+")") : tab; + var targetId = ($clicked.find('a').attr('href')).substr(1); + var $targetPanel = $contentDivsContainer.children("#"+targetId); + + // Update selected tab + plugin.selectedTab = (typeof tab === 'number') ? tab : tab.index()+1; + + // Resize the main contant container to the size of $targetPanel + resizeContentContainer($targetPanel); + + // Lock selections until transitions finished + selectLock = true; + + // Direction to slide panel on hide + var direction = ($tabsList.find('.selected').index() < $clicked.index()) ? 'left' : 'right'; + + // Update selected classes + $clicked.siblings().removeClass('selected'); + if(settings.classes.tabActive != '') $clicked.siblings().removeClass(settings.classes.tabActive); + $clicked.addClass('selected').addClass(settings.classes.tabActive); + + // Hide and show appropriate panels + hidePanel($contentDivsContainer.children(".ui-slider-tab-content:visible"), direction); + showPanel($targetPanel); + + // Slide tabs so that they fit in $tabsListContainer + fitTabInContainer($clicked); + + // Select the proper indicator + selectIndicator(); + }; + + // Select the next (right) panel + plugin.next = function(){ + if(!selectLock){ + if(plugin.count === plugin.selectedTab) + plugin.selectTab(1); + else plugin.selectTab(plugin.selectedTab+1); + } + }; + + // Select the previous panel + plugin.prev = function(){ + if(!selectLock){ + if(plugin.selectedTab === 1) + plugin.selectTab(plugin.count); + else plugin.selectTab(plugin.selectedTab-1); + } + }; + + // Slide tabs left/right within $tabsListContainer + plugin.slideTabs = function(direction, length){ + var margin = parseInt($tabsList.css('margin-left')); + var newMargin = margin; + + // Reset 'edge' classes on tab arrows + $leftTabArrow.removeClass('edge'); + $rightTabArrow.removeClass('edge'); + + // Calculate delta to slide by + if(direction=='right') newMargin += length; + else if(direction=='left') newMargin -= length; + if(newMargin >= 0) { + newMargin = 0; + $leftTabArrow.addClass('edge'); + } + else if(newMargin <= minMargin){ + newMargin = minMargin; + $rightTabArrow.addClass('edge'); + } + + // Animate + $tabsList.animate({'margin-left': newMargin}, settings.tabSlideSpeed); + }; + + // Show panel indicators + // Create indicators if they don't exist yet + plugin.showIndicators = function(){ + if(!$indicators){ + $indicators = $("
    "); + for(var i = 0; i < $contentDivs.length; i++){ + $indicators.append("
    "); + } + $contentDivsContainer.append($indicators); + } + else + $indicators.show(); + }; + + // Hide panel indicators + plugin.hideIndicators = function(){ + if($indicators) + $indicators.hide(); + }; + + // Show arrows that slide tabs left and right + plugin.showTabArrows = function(){ + if(!settings.tabArrows) + return; + $leftTabArrow.show(); + $rightTabArrow.show(); + $tabsListContainer.css('margin', '0 '+settings.tabArrowWidth+'px'); + }; + + // Hide arrows that slide tabs left and right + plugin.hideTabArrows = function(){ + $leftTabArrow.hide(); + $rightTabArrow.hide(); + $tabsListContainer.css('margin', '0'); + }; + + // Show panel arrows + plugin.showPanelArrows = function(){ + if($leftPanelArrow) $leftPanelArrow.show(); + if($rightPanelArrow) $rightPanelArrow.show(); + }; + + // Hide panel arrows + plugin.hidePanelArrows = function(){ + if($leftPanelArrow) $leftPanelArrow.hide(); + if($rightPanelArrow) $rightPanelArrow.hide(); + }; + + /* + * Private methods + */ + + // Add the selected class to the plugin.selectedTab tab. Remove from all others. + var selectIndicator = function(){ + if(settings.indicators && $indicators){ + var $indicator = $indicators.children("div:nth-child("+plugin.selectedTab+")"); + $indicator.siblings().removeClass('selected'); + $indicator.addClass('selected'); + } + }; + + // Slide tabs inside of $tabsListContainer so that the selected one fits inside + var fitTabInContainer = function(tab){ + var tabOffset = tab.offset(), + containerOffset = $tabsListContainer.offset(), + leftOffset = tabOffset.left - containerOffset.left, + rightOffset = (containerOffset.left + $tabsListContainer.outerWidth()) - (tabOffset.left + tab.outerWidth() ); + + if(leftOffset < 0) + plugin.slideTabs('right', -leftOffset); + else if(rightOffset < 0) + plugin.slideTabs('left', -rightOffset); + }; + + // Reposition content panels so that they are ready to be transitioned in and out. + // This depends on whether the transition is set to slide or fade + var reorderPanels = function(){ + // Position content divs + if(settings.transition == 'slide') + // Move panels left/right basedon their index relative to the selected panel + $tabsList.children('li').each(function(index, el){ + var selectedIndex = $tabsList.children('.selected').index(), + thisIndex = $(el).index(); + var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1)); + if(selectedIndex < thisIndex) + panel.css({left: $contentDivsContainer.width()+'px'}); + else if(selectedIndex > thisIndex) + panel.css({left: '-'+$contentDivsContainer.width()+'px'}); + else + panel.addClass(settings.classes.panelActive); + }); + + if(settings.transition == 'fade') + // Set opacity to correct value for non selected panels. + $tabsList.children('li').each(function(index, el){ + var selectedIndex = $tabsList.children('.selected').index(), + thisIndex = $(el).index(); + var panel = $contentDivsContainer.children('#'+$(el).find('a').attr('href').substr(1)); + if(selectedIndex != thisIndex) + panel.css({opacity: 0}); + else + panel.addClass(settings.classes.panelActive); + }); + }; + + // Object determining css properties to be animated to based on various actions, transitions, and directions + var panelAnimationCSS = function(width){ + return { + hide: { + slideleft: { + left: '-'+width+'px' + }, + slideright: { + left: width+'px' + }, + fade: { + opacity: 0 + } + }, + show: { + slide: { + left: 0 + }, + fade: { + opacity: 1 + } + } + } + }; + + // Transition out the passed in panel. + // param: panel is the jQuery object of the panel to be hidden + // direction is either 'left' or 'right' for sliding transitions + var hidePanel = function(panel, direction){ + // Calculate correct key in panelAnimationCSS + if(settings.transition == 'slide') + var trans = 'slide'+direction; + else var trans = settings.transition; + + // Animate the panel out + panel.animate(panelAnimationCSS($contentDivsContainer.width())['hide'][trans], settings.transitionSpeed, settings.transitionEasing, function(){ + panel.hide(); + panel.removeClass('selected'); + //if(settings.classes.panelActive != '') panel.removeClass(settings.classes.panelActive); + selectLock = false; + reorderPanels(); + }); + }; + + // Transition in the parameter panel + // param: panel is the jQuery object of the panel to be shown + var showPanel = function(panel){ + // Show first + panel.show(); + panel.addClass(settings.classes.panelActive).addClass('selected'); + + // Then animate css properties + panel.animate(panelAnimationCSS($contentDivsContainer.width())['show'][settings.transition], settings.transitionSpeed, settings.transitionEasing, function(){ + selectLock = false; + heightLock = true; + reorderPanels(); + }); + }; + + // Animate the height of the content container to height target + // params: target (int) is the new height + var resizeContentContainer = function(target){ + if(!settings.height) + $contentDivsContainer.animate({ + height: actualHeight(target) + }, 200); + }; + + // Position the panel arrows + var positionPanelArrows = function(){ + if(settings.panelArrows){ + // Initialize them if you need to + if(!$leftPanelArrow && !$rightPanelArrow){ + $leftPanelArrow = $("
    ").click(function(){ + plugin.prev(); + }); + $rightPanelArrow = $("
    ").click(function(){ + plugin.next(); + }); + + $leftPanelArrow.appendTo($contentDivsContainer); + $rightPanelArrow.appendTo($contentDivsContainer); + } + + // Set correct CSS 'top' attribute of each panel arrow + $rightPanelArrow.css({ + "top": $contentDivsContainer.height()/2 - $rightPanelArrow.outerHeight()/2 + }); + $leftPanelArrow.css({ + "top": $contentDivsContainer.height()/2 - $leftPanelArrow.outerHeight()/2 + }); + } + }; + + // Change the width of $tabsList to the sum of the outer widths of all tabs + var resizeTabsList = function(){ + // Calculate total width + var width = 0; + $tabsList.children().each(function(index, element){ + width += $(element).outerWidth(true); + }); + // Set new width of $tabsList + $tabsList.width(width); + + // Update minMargin. Hide tab arrows if no overflow + if($tabsListContainer.width() < width && settings.tabArrows){ + plugin.showTabArrows(); + minMargin = $tabsListContainer.width() - width; + } + else plugin.hideTabArrows(); + } + + // Resize indiviual panels to the width of the new container + var resizePanels = function(){ + $contentDivs.width($contentDivsContainer.width() - ($contentDivs.outerWidth() - $contentDivs.width())); + }; + + // Get height of a hidden element + var actualHeight = function(element){ + var prevCSS = { + 'display': element.css('display'), + 'left': element.css('left'), + 'position': element.css('position') + }; + element.css({ + 'display': 'normal', + 'left': -5000, + 'position': 'absolute' + }); + var height = element.outerHeight(); + element.css(prevCSS); + return height; + }; + + + // Initialize the plugin + plugin.init(); + }; + + /* + * Handle input. Call public functions and initializers + */ + $.fn.sliderTabs = function( data ) { + return this.each(function(){ + var _this = $(this), + plugin = _this.data('sliderTabs'); + + // Method calling logic + if (!plugin) { + // If no plugin, initialize it + plugin = new $.sliderTabs(this, data); + _this.data('sliderTabs', plugin); + return plugin; + } + if (plugin.methods[data]){ + // If plugin exists, call a public method + return plugin.methods[ data ].apply( this, Array.prototype.slice.call( arguments, 1 )); + } + }); + }; +})( jQuery ); + + + + + +/* + * Additional easing functions + * Taken from jQuery UI source code + * + * https://github.com/jquery/jquery-ui + */ + +$.extend($.easing, + { + def: 'easeOutQuad', + swing: function (x, t, b, c, d) { + //alert($.easing.default); + return $.easing[$.easing.def](x, t, b, c, d); + }, + easeInQuad: function (x, t, b, c, d) { + return c*(t/=d)*t + b; + }, + easeOutQuad: function (x, t, b, c, d) { + return -c *(t/=d)*(t-2) + b; + }, + easeInOutQuad: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t + b; + return -c/2 * ((--t)*(t-2) - 1) + b; + }, + easeInCubic: function (x, t, b, c, d) { + return c*(t/=d)*t*t + b; + }, + easeOutCubic: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t + 1) + b; + }, + easeInOutCubic: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t + b; + return c/2*((t-=2)*t*t + 2) + b; + }, + easeInQuart: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t + b; + }, + easeOutQuart: function (x, t, b, c, d) { + return -c * ((t=t/d-1)*t*t*t - 1) + b; + }, + easeInOutQuart: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t + b; + return -c/2 * ((t-=2)*t*t*t - 2) + b; + }, + easeInQuint: function (x, t, b, c, d) { + return c*(t/=d)*t*t*t*t + b; + }, + easeOutQuint: function (x, t, b, c, d) { + return c*((t=t/d-1)*t*t*t*t + 1) + b; + }, + easeInOutQuint: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b; + return c/2*((t-=2)*t*t*t*t + 2) + b; + }, + easeInSine: function (x, t, b, c, d) { + return -c * Math.cos(t/d * (Math.PI/2)) + c + b; + }, + easeOutSine: function (x, t, b, c, d) { + return c * Math.sin(t/d * (Math.PI/2)) + b; + }, + easeInOutSine: function (x, t, b, c, d) { + return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; + }, + easeInExpo: function (x, t, b, c, d) { + return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b; + }, + easeOutExpo: function (x, t, b, c, d) { + return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b; + }, + easeInOutExpo: function (x, t, b, c, d) { + if (t==0) return b; + if (t==d) return b+c; + if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b; + return c/2 * (-Math.pow(2, -10 * --t) + 2) + b; + }, + easeInCirc: function (x, t, b, c, d) { + return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b; + }, + easeOutCirc: function (x, t, b, c, d) { + return c * Math.sqrt(1 - (t=t/d-1)*t) + b; + }, + easeInOutCirc: function (x, t, b, c, d) { + if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b; + return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b; + }, + easeInElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + }, + easeOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3; + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b; + }, + easeInOutElastic: function (x, t, b, c, d) { + var s=1.70158;var p=0;var a=c; + if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5); + if (a < Math.abs(c)) { a=c; var s=p/4; } + else var s = p/(2*Math.PI) * Math.asin (c/a); + if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b; + return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b; + }, + easeInBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*(t/=d)*t*((s+1)*t - s) + b; + }, + easeOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b; + }, + easeInOutBack: function (x, t, b, c, d, s) { + if (s == undefined) s = 1.70158; + if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b; + return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b; + }, + easeInBounce: function (x, t, b, c, d) { + return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b; + }, + easeOutBounce: function (x, t, b, c, d) { + if ((t/=d) < (1/2.75)) { + return c*(7.5625*t*t) + b; + } else if (t < (2/2.75)) { + return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b; + } else if (t < (2.5/2.75)) { + return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b; + } else { + return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b; + } + }, + easeInOutBounce: function (x, t, b, c, d) { + if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b; + return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b; + } + }); + + + + + +/* + * The following is the jQuery Mousewheel plugin. Full credit goes to + * Brandon Aaron. (https://github.com/brandonaaron/jquery-mousewheel) + * / + + + /*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net) + * Licensed under the MIT License (LICENSE.txt). + * + * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. + * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. + * Thanks to: Seamus Leahy for adding deltaX and deltaY + * + * Version: 3.0.6 + * + * Requires: 1.2.2+ + */ + +(function($) { + + var types = ['DOMMouseScroll', 'mousewheel']; + + if ($.event.fixHooks) { + for ( var i=types.length; i; ) { + $.event.fixHooks[ types[--i] ] = $.event.mouseHooks; + } + } + + $.event.special.mousewheel = { + setup: function() { + if ( this.addEventListener ) { + for ( var i=types.length; i; ) { + this.addEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = handler; + } + }, + + teardown: function() { + if ( this.removeEventListener ) { + for ( var i=types.length; i; ) { + this.removeEventListener( types[--i], handler, false ); + } + } else { + this.onmousewheel = null; + } + } + }; + + $.fn.extend({ + mousewheel: function(fn) { + return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel"); + }, + + unmousewheel: function(fn) { + return this.unbind("mousewheel", fn); + } + }); + + + function handler(event) { + var orgEvent = event || window.event, args = [].slice.call( arguments, 1 ), delta = 0, returnValue = true, deltaX = 0, deltaY = 0; + event = $.event.fix(orgEvent); + event.type = "mousewheel"; + + // Old school scrollwheel delta + if ( orgEvent.wheelDelta ) { delta = orgEvent.wheelDelta/120; } + if ( orgEvent.detail ) { delta = -orgEvent.detail/3; } + + // New school multidimensional scroll (touchpads) deltas + deltaY = delta; + + // Gecko + if ( orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { + deltaY = 0; + deltaX = -1*delta; + } + + // Webkit + if ( orgEvent.wheelDeltaY !== undefined ) { deltaY = orgEvent.wheelDeltaY/120; } + if ( orgEvent.wheelDeltaX !== undefined ) { deltaX = -1*orgEvent.wheelDeltaX/120; } + + // Add event and delta to the front of the arguments + args.unshift(event, delta, deltaX, deltaY); + + return ($.event.dispatch || $.event.handle).apply(this, args); + } + +})(jQuery); \ No newline at end of file diff --git a/www/widgets/tabs/styles/images/indicator.png b/www/widgets/tabs/styles/images/indicator.png new file mode 100644 index 0000000..6a7d586 Binary files /dev/null and b/www/widgets/tabs/styles/images/indicator.png differ diff --git a/www/widgets/tabs/styles/images/indicatorActive.png b/www/widgets/tabs/styles/images/indicatorActive.png new file mode 100644 index 0000000..246b95e Binary files /dev/null and b/www/widgets/tabs/styles/images/indicatorActive.png differ diff --git a/www/widgets/tabs/styles/images/leftArrow.png b/www/widgets/tabs/styles/images/leftArrow.png new file mode 100644 index 0000000..1338b79 Binary files /dev/null and b/www/widgets/tabs/styles/images/leftArrow.png differ diff --git a/www/widgets/tabs/styles/images/leftPanelArrow.png b/www/widgets/tabs/styles/images/leftPanelArrow.png new file mode 100644 index 0000000..612ef62 Binary files /dev/null and b/www/widgets/tabs/styles/images/leftPanelArrow.png differ diff --git a/www/widgets/tabs/styles/images/rightArrow.png b/www/widgets/tabs/styles/images/rightArrow.png new file mode 100644 index 0000000..e511a9e Binary files /dev/null and b/www/widgets/tabs/styles/images/rightArrow.png differ diff --git a/www/widgets/tabs/styles/images/rightPanelArrow.png b/www/widgets/tabs/styles/images/rightPanelArrow.png new file mode 100644 index 0000000..0bd3a96 Binary files /dev/null and b/www/widgets/tabs/styles/images/rightPanelArrow.png differ diff --git a/www/widgets/tabs/styles/jquery.sliderTabs.css b/www/widgets/tabs/styles/jquery.sliderTabs.css new file mode 100644 index 0000000..96baf5a --- /dev/null +++ b/www/widgets/tabs/styles/jquery.sliderTabs.css @@ -0,0 +1,225 @@ +.ui-slider-tabs{ + +} +.ui-slider-tabs-list-wrapper{ + position: relative; + width: 100%; + font-family: Arial, sans-serif; + margin: 0 0 -1px 0; + z-index: 50; +} +.ui-slider-tabs-list-wrapper.bottom{ + margin: -1px 0 0 0; +} +.ui-slider-tabs-list-container{ + overflow: hidden; +} +.ui-slider-tabs-list{ + padding: 0; + margin: 0 0 0 0; + list-style: none; +} +.ui-slider-tabs-list li{ + display: inline-block; + border-bottom: 1px solid #cfcfcf; + border-right: 1px solid #cfcfcf; + border-top: 1px solid #cfcfcf; + margin: 0; + font-size: 13px; + font-weight: bold; + + background: #000000; /* Old browsers */ + background: -moz-linear-gradient(top, #000000 0%, #000000 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000000), color-stop(100%,#000000)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #000000 0%,#000000 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #000000 0%,#000000 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #000000 0%,#000000 100%); /* IE10+ */ + background: linear-gradient(top, #000000 0%,#000000 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-tabs-list li a{ + display: block; + padding: 8px 15px; + text-decoration: none; + color: #BABABA; + /* text-shadow: 0px 1px 0px #fff;*/ + margin: 0; +} +.ui-slider-tabs-list li a:hover{ + color: #BABABA; +} +.ui-slider-tabs-list li.selected{ + border-bottom-color: #000; + border-top-color: #cfcfcf; + background: #3B3B3B; /* Old browsers */ + background: -moz-linear-gradient(top, #3B3B3B 0%, #3B3B3B 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#3B3B3B), color-stop(100%,#3B3B3B)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #3B3B3B 0%,#3B3B3B 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #3B3B3B 0%,#3B3B3B 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #3B3B3B 0%,#3B3B3B 100%); /* IE10+ */ + background: linear-gradient(top, #3B3B3B 0%,#3B3B3B 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#3B3B3B', endColorstr='#3B3B3B',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-tabs-list li.selected{ + border-top-color: #000; + border-bottom-color: #cfcfcf; +} +.ui-slider-tabs-list li.selected a{ + cursor: default; + color: #BABABA; +} +.ui-slider-tabs-list li:first-of-type{ + border-left: 1px solid #cfcfcf; +} + +.ui-slider-tabs-content-container{ + position: relative; + border: 1px solid #cfcfcf; + z-index: 1; + overflow: hidden; + background-color: #000; +} + +.ui-slider-tab-content{ + position: absolute; + display: none; + top: 0; + left: 0; + padding: 10px; +} + +.ui-slider-left-arrow, .ui-slider-right-arrow, .ui-slider-left-arrow.edge:hover, .ui-slider-right-arrow.edge:hover{ + display: block; + position: absolute; + border: 1px solid #cfcfcf; + + background: #000000; /* Old browsers */ + background: -moz-linear-gradient(top, #000000 0%, #000000 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#000000), color-stop(100%,#000000)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #000000 0%,#000000 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #000000 0%,#000000 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #000000 0%,#000000 100%); /* IE10+ */ + background: linear-gradient(top, #000000 0%,#000000 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#000000', endColorstr='#000000',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-left-arrow:hover, .ui-slider-right-arrow:hover{ + background: #BABABA; /* Old browsers */ + background: -moz-linear-gradient(top, #BABABA 0%, #BABABA 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#BABABA), color-stop(100%,#BABABA)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #BABABA 0%,#BABABA 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #BABABA 0%,#BABABA 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #BABABA 0%,#BABABA 100%); /* IE10+ */ + background: linear-gradient(top, #BABABA 0%,#BABABA 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#BABABA', endColorstr='#BABABA',GradientType=0 ); /* IE6-9 */ +} + +.ui-slider-left-arrow{ + left: 0; + top: 0; + box-shadow: 2px 0px 1px rgba(0,0,0,.06); + border-top-left-radius: 4px; +} +.ui-slider-left-arrow div{ + background-image: url('images/leftArrow.png'); + background-repeat: no-repeat; + background-position: center center; + height: inherit; +} +.ui-slider-left-arrow.edge div{ + opacity: .25; +} +.ui-slider-left-arrow.edge{ + box-shadow: none; + cursor: default; +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-left-arrow{ + border-top-left-radius: 0; + border-bottom-left-radius: 4px; +} + +.ui-slider-right-arrow{ + top: 0; + right: 0; + box-shadow: -2px 0px 1px rgba(0,0,0,.06); + border-top-right-radius: 4px; +} +.ui-slider-right-arrow div{ + background-image: url('images/rightArrow.png'); + background-repeat: no-repeat; + background-position: center center; + height: inherit; +} +.ui-slider-right-arrow.edge div{ + opacity: .25; +} +.ui-slider-right-arrow.edge{ + box-shadow: none; + cursor: default; +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-right-arrow{ + border-top-right-radius: 0; + border-bottom-right-radius: 4px; +} + +.ui-slider-tabs-indicator-container{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + text-align: center; +} + +.ui-slider-tabs-indicator{ + width: 10px; + height: 10px; + background-image: url('images/indicator.png'); + background-repeat: no-repeat; + display: inline-block; + margin-right: 3px; + cursor: pointer; +} +.ui-slider-tabs-indicator.selected{ + background-image: url('images/indicatorActive.png'); +} + +.ui-slider-tabs-leftPanelArrow{ + position: absolute; + left: 0px; + width: 30px; + height: 35px; + background-image: url('images/leftPanelArrow.png'); + background-repeat: no-repeat; + background-position: center center; + cursor: pointer; + opacity: 0.5; + -moz-opacity: 0.5; + filter:alpha(opacity=5); +} + +.ui-slider-tabs-rightPanelArrow{ + position: absolute; + right: 0px; + width: 30px; + height: 35px; + background-image: url('images/rightPanelArrow.png'); + background-repeat: no-repeat; + background-position: center center; + cursor: pointer; + opacity: 0.5; + -moz-opacity: 0.5; + filter:alpha(opacity=5); +} + +.ui-slider-tabs-rightPanelArrow.showOnHover, .ui-slider-tabs-leftPanelArrow.showOnHover{ + opacity: 0; + display: none; +} + +.ui-slider-tabs-content-container:hover .ui-slider-tabs-rightPanelArrow.showOnHover,.ui-slider-tabs-content-container:hover .ui-slider-tabs-leftPanelArrow.showOnHover{ + opacity: .5; + display: inline-block; +} + +.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow.showOnHover:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow.showOnHover:hover{ + opacity: 1; +} \ No newline at end of file diff --git a/www/widgets/tabs/styles/jquery.sliderTabs.css.orig b/www/widgets/tabs/styles/jquery.sliderTabs.css.orig new file mode 100644 index 0000000..e2cfcf1 --- /dev/null +++ b/www/widgets/tabs/styles/jquery.sliderTabs.css.orig @@ -0,0 +1,225 @@ +.ui-slider-tabs{ + +} +.ui-slider-tabs-list-wrapper{ + position: relative; + width: 100%; + font-family: Arial, sans-serif; + margin: 0 0 -1px 0; + z-index: 50; +} +.ui-slider-tabs-list-wrapper.bottom{ + margin: -1px 0 0 0; +} +.ui-slider-tabs-list-container{ + overflow: hidden; +} +.ui-slider-tabs-list{ + padding: 0; + margin: 0 0 0 0; + list-style: none; +} +.ui-slider-tabs-list li{ + display: inline-block; + border-bottom: 1px solid #cfcfcf; + border-right: 1px solid #cfcfcf; + border-top: 1px solid #cfcfcf; + margin: 0; + font-size: 13px; + font-weight: bold; + + background: #fcfcfc; /* Old browsers */ + background: -moz-linear-gradient(top, #fcfcfc 0%, #f5f5f5 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfcfc), color-stop(100%,#f5f5f5)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* IE10+ */ + background: linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#f5f5f5',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-tabs-list li a{ + display: block; + padding: 8px 15px; + text-decoration: none; + color: #555; + text-shadow: 0px 1px 0px #fff; + margin: 0; +} +.ui-slider-tabs-list li a:hover{ + color: #000; +} +.ui-slider-tabs-list li.selected{ + border-bottom-color: #fff; + border-top-color: #cfcfcf; + background: #ffffff; /* Old browsers */ + background: -moz-linear-gradient(top, #ffffff 0%, #ffffff 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* IE10+ */ + background: linear-gradient(top, #ffffff 0%,#ffffff 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-tabs-list li.selected{ + border-top-color: #fff; + border-bottom-color: #cfcfcf; +} +.ui-slider-tabs-list li.selected a{ + cursor: default; + color: #000; +} +.ui-slider-tabs-list li:first-of-type{ + border-left: 1px solid #cfcfcf; +} + +.ui-slider-tabs-content-container{ + position: relative; + border: 1px solid #cfcfcf; + z-index: 1; + overflow: hidden; + background-color: #fff; +} + +.ui-slider-tab-content{ + position: absolute; + display: none; + top: 0; + left: 0; + padding: 10px; +} + +.ui-slider-left-arrow, .ui-slider-right-arrow, .ui-slider-left-arrow.edge:hover, .ui-slider-right-arrow.edge:hover{ + display: block; + position: absolute; + border: 1px solid #cfcfcf; + + background: #fcfcfc; /* Old browsers */ + background: -moz-linear-gradient(top, #fcfcfc 0%, #f5f5f5 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#fcfcfc), color-stop(100%,#f5f5f5)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* IE10+ */ + background: linear-gradient(top, #fcfcfc 0%,#f5f5f5 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc', endColorstr='#f5f5f5',GradientType=0 ); /* IE6-9 */ +} +.ui-slider-left-arrow:hover, .ui-slider-right-arrow:hover{ + background: #ffffff; /* Old browsers */ + background: -moz-linear-gradient(top, #ffffff 0%, #ffffff 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#ffffff)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #ffffff 0%,#ffffff 100%); /* IE10+ */ + background: linear-gradient(top, #ffffff 0%,#ffffff 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#ffffff',GradientType=0 ); /* IE6-9 */ +} + +.ui-slider-left-arrow{ + left: 0; + top: 0; + box-shadow: 2px 0px 1px rgba(0,0,0,.06); + border-top-left-radius: 4px; +} +.ui-slider-left-arrow div{ + background-image: url('images/leftArrow.png'); + background-repeat: no-repeat; + background-position: center center; + height: inherit; +} +.ui-slider-left-arrow.edge div{ + opacity: .25; +} +.ui-slider-left-arrow.edge{ + box-shadow: none; + cursor: default; +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-left-arrow{ + border-top-left-radius: 0; + border-bottom-left-radius: 4px; +} + +.ui-slider-right-arrow{ + top: 0; + right: 0; + box-shadow: -2px 0px 1px rgba(0,0,0,.06); + border-top-right-radius: 4px; +} +.ui-slider-right-arrow div{ + background-image: url('images/rightArrow.png'); + background-repeat: no-repeat; + background-position: center center; + height: inherit; +} +.ui-slider-right-arrow.edge div{ + opacity: .25; +} +.ui-slider-right-arrow.edge{ + box-shadow: none; + cursor: default; +} +.ui-slider-tabs-list-wrapper.bottom .ui-slider-right-arrow{ + border-top-right-radius: 0; + border-bottom-right-radius: 4px; +} + +.ui-slider-tabs-indicator-container{ + position: absolute; + bottom: 0; + left: 0; + width: 100%; + text-align: center; +} + +.ui-slider-tabs-indicator{ + width: 10px; + height: 10px; + background-image: url('images/indicator.png'); + background-repeat: no-repeat; + display: inline-block; + margin-right: 3px; + cursor: pointer; +} +.ui-slider-tabs-indicator.selected{ + background-image: url('images/indicatorActive.png'); +} + +.ui-slider-tabs-leftPanelArrow{ + position: absolute; + left: 0px; + width: 30px; + height: 35px; + background-image: url('images/leftPanelArrow.png'); + background-repeat: no-repeat; + background-position: center center; + cursor: pointer; + opacity: 0.5; + -moz-opacity: 0.5; + filter:alpha(opacity=5); +} + +.ui-slider-tabs-rightPanelArrow{ + position: absolute; + right: 0px; + width: 30px; + height: 35px; + background-image: url('images/rightPanelArrow.png'); + background-repeat: no-repeat; + background-position: center center; + cursor: pointer; + opacity: 0.5; + -moz-opacity: 0.5; + filter:alpha(opacity=5); +} + +.ui-slider-tabs-rightPanelArrow.showOnHover, .ui-slider-tabs-leftPanelArrow.showOnHover{ + opacity: 0; + display: none; +} + +.ui-slider-tabs-content-container:hover .ui-slider-tabs-rightPanelArrow.showOnHover,.ui-slider-tabs-content-container:hover .ui-slider-tabs-leftPanelArrow.showOnHover{ + opacity: .5; + display: inline-block; +} + +.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow.showOnHover:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow.showOnHover:hover{ + opacity: 1; +} \ No newline at end of file diff --git a/www/widgets/tabs/styles/jquery.sliderTabs.min.css b/www/widgets/tabs/styles/jquery.sliderTabs.min.css new file mode 100644 index 0000000..67aede9 --- /dev/null +++ b/www/widgets/tabs/styles/jquery.sliderTabs.min.css @@ -0,0 +1 @@ +.ui-slider-tabs{}.ui-slider-tabs-list-wrapper{ position: relative;width:100%;font-family:Arial,sans-serif;margin:0 0 -1px 0;z-index:50;}.ui-slider-tabs-list-wrapper.bottom{ margin: -1px 0 0 0;}.ui-slider-tabs-list-container{ overflow: hidden;}.ui-slider-tabs-list{ padding:0;margin:0 0 0 0;list-style: none;}.ui-slider-tabs-list li{ display: inline-block;border-bottom:1px solid #cfcfcf;border-right:1px solid #cfcfcf;border-top:1px solid #cfcfcf;margin:0;font-size:13px;font-weight:bold;background:#fcfcfc;background: -moz-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#fcfcfc),color-stop(100%,#f5f5f5));background: -webkit-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -o-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -ms-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc',endColorstr='#f5f5f5',GradientType=0 );}.ui-slider-tabs-list li a{ display:block;padding:8px 15px;text-decoration: none;color:#555;text-shadow:0px 1px 0px #fff;margin:0;}.ui-slider-tabs-list li a:hover{ color:#000;}.ui-slider-tabs-list li.selected{ border-bottom-color:#fff;border-top-color:#cfcfcf;background:#ffffff;background: -moz-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#ffffff),color-stop(100%,#ffffff));background: -webkit-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -o-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -ms-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: linear-gradient(top,#ffffff 0%,#ffffff 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff',endColorstr='#ffffff',GradientType=0 );}.ui-slider-tabs-list-wrapper.bottom .ui-slider-tabs-list li.selected{ border-top-color:#fff;border-bottom-color:#cfcfcf;}.ui-slider-tabs-list li.selected a{ cursor:default;color:#000;}.ui-slider-tabs-list li:first-of-type{ border-left:1px solid #cfcfcf;}.ui-slider-tabs-content-container{ position: relative;border:1px solid #cfcfcf;z-index:1;overflow: hidden;background-color:#fff;}.ui-slider-tab-content{ position:absolute;display: none;top:0;left:0;padding:10px;}.ui-slider-left-arrow,.ui-slider-right-arrow,.ui-slider-left-arrow.edge:hover,.ui-slider-right-arrow.edge:hover{ display:block;position:absolute;border:1px solid #cfcfcf;background:#fcfcfc;background: -moz-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#fcfcfc),color-stop(100%,#f5f5f5));background: -webkit-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -o-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: -ms-linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);background: linear-gradient(top,#fcfcfc 0%,#f5f5f5 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fcfcfc',endColorstr='#f5f5f5',GradientType=0 );}.ui-slider-left-arrow:hover,.ui-slider-right-arrow:hover{ background:#ffffff;background: -moz-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#ffffff),color-stop(100%,#ffffff));background: -webkit-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -o-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: -ms-linear-gradient(top,#ffffff 0%,#ffffff 100%);background: linear-gradient(top,#ffffff 0%,#ffffff 100%);filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff',endColorstr='#ffffff',GradientType=0 );}.ui-slider-left-arrow{ left:0;top:0;box-shadow:2px 0px 1px rgba(0,0,0,.06);border-top-left-radius:4px;}.ui-slider-left-arrow div{ background-image: url('images/leftArrow.png');background-repeat: no-repeat;background-position:center center;height: inherit;}.ui-slider-left-arrow.edge div{ opacity: .25;}.ui-slider-left-arrow.edge{ box-shadow: none;cursor:default;}.ui-slider-tabs-list-wrapper.bottom .ui-slider-left-arrow{ border-top-left-radius:0;border-bottom-left-radius:4px;}.ui-slider-right-arrow{ top:0;right:0;box-shadow: -2px 0px 1px rgba(0,0,0,.06);border-top-right-radius:4px;}.ui-slider-right-arrow div{ background-image: url('images/rightArrow.png');background-repeat: no-repeat;background-position:center center;height: inherit;}.ui-slider-right-arrow.edge div{ opacity: .25;}.ui-slider-right-arrow.edge{ box-shadow: none;cursor:default;}.ui-slider-tabs-list-wrapper.bottom .ui-slider-right-arrow{ border-top-right-radius:0;border-bottom-right-radius:4px;}.ui-slider-tabs-indicator-container{ position:absolute;bottom:0;left:0;width:100%;text-align:center;}.ui-slider-tabs-indicator{ width:10px;height:10px;background-image: url('images/indicator.png');background-repeat: no-repeat;display: inline-block;margin-right:3px;cursor: pointer;}.ui-slider-tabs-indicator.selected{ background-image: url('images/indicatorActive.png');}.ui-slider-tabs-leftPanelArrow{ position:absolute;left:0px;width:30px;height:35px;background-image: url('images/leftPanelArrow.png');background-repeat: no-repeat;background-position:center center;cursor: pointer;opacity:0.5;-moz-opacity:0.5;filter:alpha(opacity=5);}.ui-slider-tabs-rightPanelArrow{ position:absolute;right:0px;width:30px;height:35px;background-image: url('images/rightPanelArrow.png');background-repeat: no-repeat;background-position:center center;cursor: pointer;opacity:0.5;-moz-opacity:0.5;filter:alpha(opacity=5);}.ui-slider-tabs-rightPanelArrow.showOnHover,.ui-slider-tabs-leftPanelArrow.showOnHover{ opacity:0;display: none;}.ui-slider-tabs-content-container:hover .ui-slider-tabs-rightPanelArrow.showOnHover,.ui-slider-tabs-content-container:hover .ui-slider-tabs-leftPanelArrow.showOnHover{ opacity: .5;display: inline-block;}.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow:hover,.ui-slider-tabs-content-container .ui-slider-tabs-rightPanelArrow.showOnHover:hover,.ui-slider-tabs-content-container .ui-slider-tabs-leftPanelArrow.showOnHover:hover{ opacity:1;} \ No newline at end of file diff --git a/www/widgets/todo/dev.html b/www/widgets/todo/dev.html new file mode 100644 index 0000000..aa16448 --- /dev/null +++ b/www/widgets/todo/dev.html @@ -0,0 +1,72 @@ + + + + + + + + + + \ No newline at end of file diff --git a/www/widgets/todo/homematic.html b/www/widgets/todo/homematic.html new file mode 100644 index 0000000..1f1daf2 --- /dev/null +++ b/www/widgets/todo/homematic.html @@ -0,0 +1,89 @@ + + + + diff --git a/www/widgets/todo/special.html b/www/widgets/todo/special.html new file mode 100644 index 0000000..f4f9d18 --- /dev/null +++ b/www/widgets/todo/special.html @@ -0,0 +1,138 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/www/widgets/todo/weather.html b/www/widgets/todo/weather.html new file mode 100644 index 0000000..3549c2d --- /dev/null +++ b/www/widgets/todo/weather.html @@ -0,0 +1,19 @@ + + + \ No newline at end of file