diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..af72445 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,16 @@ +{ + "extends": "pebble", + "env" : { + "node": true, + "browser": true + }, + "globals": { + "Pebble": true, + "$": true, + "t": true + }, + "rules" : { + "new-cap": [0], + "max-params": [1] + } +} diff --git a/README.md b/README.md index be7d4dd..ed62350 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # pebble-clay Pebble Config Framework + +config html + - contains diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..a51a25d --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,37 @@ +'use strict'; + +var gulp = require('gulp'); +var browserify = require('browserify'); +var source = require('vinyl-source-stream'); +var stringify = require('stringify'); +var del = require('del'); +var inline = require('gulp-inline'); +var minifyInline = require('gulp-minify-inline'); +var minifyHTML = require('gulp-minify-html'); + +gulp.task('clean', function(done) { + del(['dist', 'tmp']).then(function() { + done(); + }); +}); + +gulp.task('browserify', ['clean'], function(done) { + return browserify('src/scripts/config-page.js', { debug: true }) + .transform(stringify(['.html', '.mustache'])) + .bundle() + .pipe(source('config-page.js')) + .pipe(gulp.dest('./tmp/')); +}); + +gulp.task('inlineHtml', ['clean', 'browserify'], function() { + return gulp.src('src/config-page.html') + .pipe(inline()) + .pipe(minifyInline({ + js: {}, + jsSelector: 'script[uglify]' + })) + .pipe(minifyHTML()) + .pipe(gulp.dest('dist/')); +}); + +gulp.task('default', ['inlineHtml']); diff --git a/index.js b/index.js new file mode 100644 index 0000000..7c7a202 --- /dev/null +++ b/index.js @@ -0,0 +1,95 @@ +'use strict'; + +var configPageHtml = require('./dist/config-page.html'); + +function encodeDataUri(input) { + if (window.btoa) { + return 'data:text/html;base64,' + encodeURIComponent(window.btoa(input)); + } + + // iOS doesn't have a window so we need to polyfil window.btoa + // extracted from https://github.com/inexorabletash/polyfill + var B64_ALPHABET = + 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + input = String(input); + var position = 0; + var out = []; + var o1; + var o2; + var o3; + var e1; + var e2; + var e3; + var e4; + + if (/[^\x00-\xFF]/.test(input)) { throw Error('InvalidCharacterError'); } + + while (position < input.length) { + o1 = input.charCodeAt(position++); + o2 = input.charCodeAt(position++); + o3 = input.charCodeAt(position++); + + // 111111 112222 222233 333333 + e1 = o1 >> 2; + e2 = ((o1 & 0x3) << 4) | (o2 >> 4); + e3 = ((o2 & 0xf) << 2) | (o3 >> 6); + e4 = o3 & 0x3f; + + if (position === input.length + 2) { + e3 = 64; + e4 = 64; + } else if (position === input.length + 1) { + e4 = 64; + } + + out.push(B64_ALPHABET.charAt(e1), + B64_ALPHABET.charAt(e2), + B64_ALPHABET.charAt(e3), + B64_ALPHABET.charAt(e4)); + } + + return 'data:text/html;base64,' + encodeURIComponent(out.join('')); +} + +function Clay(config) { + this.config = config; + /** + * @type {{}} + * @private + */ + this._defaults = {}; +} + +/** + * Generate the Data URI used by the config Page with settings injected + * @param {string} clayData - the entire HTML page as a data URI + */ +Clay.prototype.generateUrl = function() { + var settings; + try { + settings = JSON.parse(localStorage.getItem('clay-settings')) || {}; + } catch (e) { + console.error(e); + settings = {}; + } + // Show config page + return encodeDataUri(configPageHtml + .replace('$$CONFIG$$', JSON.stringify(this.config)) + .replace('$$SETTINGS$$', JSON.stringify(settings)) + ); +}; + +Clay.prototype.getSettings = function(response) { + // Decode and parse config data as JSON + var settings = JSON.parse(decodeURIComponent(response)); + // @todo get defaults in here + if (!settings) return {}; + + localStorage.setItem('clay-settings', JSON.stringify(settings)); +}; + +Clay.prototype.getDefaults = function() { + return this._defaults; +}; + +module.exports = Clay; diff --git a/mold.js b/mold.js new file mode 100644 index 0000000..c5ae6ed --- /dev/null +++ b/mold.js @@ -0,0 +1,34 @@ +'use strict'; + +var browserify = require('browserify'); +var source = require('vinyl-source-stream'); +var gulp = require('gulp'); +var path = require('path'); +var template = require('gulp-template'); +var stringify = require('stringify'); +var del = require('del'); + +var projectPath = process.argv[2] || process.cwd(); +var pebbleJsPath = path.resolve(projectPath, 'src/js/pebble-js-app.js'); +var clayJsPath = path.resolve(projectPath, 'src/js/pebble-clay-js-app.js'); + +var warningMessage = + '/* Do not edit this file! Use "pebble-clay-js-app.js" instead. */'; + +gulp.task('clean', function() { + return del([pebbleJsPath]); +}); + +gulp.task('build', ['clean', 'pebble-js-app'], function() { + +}); + +gulp.task('pebble-js-app', function() { + browserify(clayJsPath, { debug: false }) + .transform(stringify(['.html', '.mustache'])) + .bundle() + .pipe(source('pebble-js-app.js')) + .pipe(gulp.dest('./src/js/')); +}); + +gulp.start('build'); diff --git a/src/config-page.html b/src/config-page.html new file mode 100644 index 0000000..79804ad --- /dev/null +++ b/src/config-page.html @@ -0,0 +1,18 @@ + + + + + + + + + + +
+ + + + diff --git a/src/scripts/config-page.js b/src/scripts/config-page.js new file mode 100644 index 0000000..fc9f372 --- /dev/null +++ b/src/scripts/config-page.js @@ -0,0 +1,158 @@ +'use strict'; + +/** + * A Clay config Item + * @typedef {object} Clay~Item + * @property {string} type + * @property {string} app_key + * @property {string} id + * @property {string} content + * @property {string|boolean} default + * @property {string} label + * @property {object} attributes + * @property {array} options + * @property {array} items + */ + +var mustache = require('mustache'); +var itemTypes = require('./lib/item-types'); +var $ = require('zepto-browserify').$; + +var config = $.extend(true, [], window.clayConfig || []); +var settings = $.extend(true, {}, window.claySettings || {}); + +// Get query variables +function getQueryParam(variable, defaultValue) { + var query = location.search.substring(1); + var vars = query.split('&'); + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split('='); + + if (pair[0] === variable) { + return decodeURIComponent(pair[1]); + } + } + return defaultValue || false; +} + +function submit() { + // Set the return URL depending on the runtime environment + var return_to = getQueryParam('return_to', 'pebblejs://close#'); + document.location = return_to + encodeURIComponent(JSON.stringify(settings)); +} + +/** + * + * @param {string} key + * @param {string|boolean} _default + * @return {string|boolean} + */ +function getSetting(key, _default) { + return typeof settings[key] !== 'undefined' ? settings[key] : (_default || ''); +} + +function setSetting(key, value) { + settings[key] = value; +} + +/** + * @param {Clay~Item} item + * @param {$} $parent + */ +function processConfigItem(item, $parent) { + // @todo add validation on the Item + + if (Array.isArray(item)) { + item.forEach(function(item) { + processConfigItem(item, $parent); + }); + } else if (item.type === 'section') { + processConfigItem( + item.items, + $('
').appendTo($parent) + ); + } else if (item.type === 'block') { + processConfigItem( + item.items, + $('
').appendTo($parent) + ); + } else { + var apiItem = {}; + var itemType = itemTypes[item.type]; + var templateData = $.extend({}, item, { + attributes: $.map(item.attributes || [], function(item, key) { + return { + key: key, + // .replace('"', '"'), + value: item.toString() + // .replace('"', '"') + }; + }), + value: typeof itemType.valueTransformer === 'function' ? + itemType.valueTransformer(getSetting(item.app_key, item.default), item) : + getSetting(item.app_key, item.default) + }); + + apiItem.$element = $(mustache.render(itemType.template, templateData)); + apiItem.$manipulatorTarget = apiItem.$element.find('[data-manipulator-target]'); + apiItem.on = function(events, handler) { + return apiItem.$manipulatorTarget.on(events, $.proxy(handler, apiItem)); + }; + apiItem.one = function(events, handler) { + return apiItem.$manipulatorTarget.one(events, $.proxy(handler, apiItem)); + }; + apiItem.off = apiItem.$manipulatorTarget.off.bind(apiItem.$manipulatorTarget); + apiItem.triggerHandler = + apiItem.$manipulatorTarget.triggerHandler.bind(apiItem.$manipulatorTarget); + + // attach the manipulator methods the the apiItem + $.each(itemType.manipulator, function(methodName, method) { + apiItem[methodName] = method.bind(apiItem); + }); + + apiItem.config = item; + + if (item.id) { + _interface.itemsById[item.id] = apiItem; + } + + if (item.app_key) { + _interface.itemsByAppKey[item.app_key] = apiItem; + } + + _interface.items.push(apiItem); + + $parent.append(apiItem.$element); + } +} + +var _interface = { + items: [], + itemsById: {}, + itemsByAppKey: {} +}; + +var $mainForm = $('#main-form'); + +_interface.getItemByAppKey = function(key) { + return _interface.itemsByAppKey[key]; +}; + +_interface.getItemById = function(key) { + return _interface.itemsById[key]; +}; + +_interface.getItemsByType = function(type) { + return _interface.items.filter(function(item) { + return item.config.type === type; + }); +}; + +processConfigItem(config, $mainForm, 0); + +$mainForm.submit(submit); + +module.exports = _interface; +window._interface = _interface; + +console.log(_interface); diff --git a/src/scripts/lib/item-types.js b/src/scripts/lib/item-types.js new file mode 100644 index 0000000..4bea1fb --- /dev/null +++ b/src/scripts/lib/item-types.js @@ -0,0 +1,49 @@ +'use strict'; + +var manipulators = require('./manipulators'); + +module.exports = { + heading: { + template: require('../../templates/components/heading.mustache'), + manipulator: manipulators.html + }, + subheading: { + template: require('../../templates/components/subheading.mustache'), + manipulator: manipulators.html + }, + footer: { + template: require('../../templates/components/footer.mustache'), + manipulator: manipulators.html + }, + input: { + template: require('../../templates/components/input.mustache'), + manipulator: manipulators.val + }, + color: { + template: require('../../templates/components/color.mustache'), + manipulator: manipulators.val + }, + select: { + template: require('../../templates/components/select.mustache'), + manipulator: manipulators.val, + valueTransformer: function(rawValue, item) { + item.options.forEach(function(option, index) { + if (option.value === rawValue) { + item.options[index].selected = 'selected'; + } + }); + return rawValue; + } + }, + toggle: { + template: require('../../templates/components/toggle.mustache'), + manipulator: manipulators.checked, + valueTransformer: function(rawValue) { + return rawValue ? 'checked' : ''; + } + }, + submit: { + template: require('../../templates/components/submit.mustache'), + manipulator: manipulators.val + } +}; diff --git a/src/scripts/lib/manipulators.js b/src/scripts/lib/manipulators.js new file mode 100644 index 0000000..e405e96 --- /dev/null +++ b/src/scripts/lib/manipulators.js @@ -0,0 +1,47 @@ +'use strict'; + +module.exports = { + html: { + get: function() { + return this.$manipulatorTarget.html(); + }, + set: function(value) { + return this.$manipulatorTarget.html(value) + .triggerHandler('change'); + } + }, + val: { + get: function() { + return this.$manipulatorTarget.val(); + }, + set: function(value) { + return this.$manipulatorTarget.val(value) + .triggerHandler('change'); + }, + disable: function() { + return this.$manipulatorTarget.prop('disabled', true) + .triggerHandler('change'); + }, + enable: function() { + return this.$manipulatorTarget.prop('disabled', false) + .triggerHandler('change'); + } + }, + checked: { + get: function() { + return this.$manipulatorTarget.prop('checked'); + }, + set: function(value) { + return this.$manipulatorTarget.prop('checked', value) + .triggerHandler('change'); + }, + disable: function() { + return this.$manipulatorTarget.prop('disabled', true) + .triggerHandler('change'); + }, + enable: function() { + return this.$manipulatorTarget.prop('disabled', false) + .triggerHandler('change'); + } + } +}; diff --git a/src/styles/config-page.css b/src/styles/config-page.css new file mode 100644 index 0000000..ed0a217 --- /dev/null +++ b/src/styles/config-page.css @@ -0,0 +1,59 @@ + +html, body { + height: 100%; + margin: 0; +} + +.hide { + display:none; +} +.item-styled-color .value { + box-sizing: border-box; + height: 26px; +} + +.item-container { + margin-top: 0; + padding-top: 15px; +} + +input[type="button"]:disabled { + background-color: #ccc; +} + +#cancel-btn { + background-color: #444; +} + +#cancel-btn, +#save-btn { + width: 45%; +} + +#main-form { + min-height: 100%; + /* equal to footer height */ + margin-bottom: -1.5rem; +} + +#main-form:after { + content: ""; + display: block; + padding-top: 2rem; +} + +footer, #main-form:after { + height: 1.5rem; +} + +footer { + display: block; + text-align: center; + width: 100%; +} + +.item { + display: table; + width:100%; + box-sizing: border-box; +} diff --git a/src/templates/components/color.mustache b/src/templates/components/color.mustache new file mode 100644 index 0000000..3eafa32 --- /dev/null +++ b/src/templates/components/color.mustache @@ -0,0 +1,4 @@ + diff --git a/src/templates/components/footer.mustache b/src/templates/components/footer.mustache new file mode 100644 index 0000000..a536c55 --- /dev/null +++ b/src/templates/components/footer.mustache @@ -0,0 +1,3 @@ + diff --git a/src/templates/components/heading.mustache b/src/templates/components/heading.mustache new file mode 100644 index 0000000..fb87890 --- /dev/null +++ b/src/templates/components/heading.mustache @@ -0,0 +1,3 @@ +
+

{{&content}}

+
diff --git a/src/templates/components/input.mustache b/src/templates/components/input.mustache new file mode 100644 index 0000000..e7e441e --- /dev/null +++ b/src/templates/components/input.mustache @@ -0,0 +1,11 @@ + diff --git a/src/templates/components/select.mustache b/src/templates/components/select.mustache new file mode 100644 index 0000000..ef26f2c --- /dev/null +++ b/src/templates/components/select.mustache @@ -0,0 +1,8 @@ + diff --git a/src/templates/components/subheading.mustache b/src/templates/components/subheading.mustache new file mode 100644 index 0000000..573dff0 --- /dev/null +++ b/src/templates/components/subheading.mustache @@ -0,0 +1,3 @@ +
+

{{&content}}

+
diff --git a/src/templates/components/submit.mustache b/src/templates/components/submit.mustache new file mode 100644 index 0000000..27eb81d --- /dev/null +++ b/src/templates/components/submit.mustache @@ -0,0 +1,3 @@ +
+ +
diff --git a/src/templates/components/toggle.mustache b/src/templates/components/toggle.mustache new file mode 100644 index 0000000..b59bd83 --- /dev/null +++ b/src/templates/components/toggle.mustache @@ -0,0 +1,4 @@ + diff --git a/vendor/pebble-slate/.bower.json b/vendor/pebble-slate/.bower.json new file mode 100644 index 0000000..1bc632e --- /dev/null +++ b/vendor/pebble-slate/.bower.json @@ -0,0 +1,21 @@ +{ + "name": "Slate", + "homepage": "https://github.com/pebble/slate", + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "_release": "81d6db0ccd", + "_resolution": { + "type": "branch", + "branch": "master", + "commit": "81d6db0ccd64e455985c01683fed4fd287970637" + }, + "_source": "git@github.com:keegan-lillo/slate.git", + "_target": "master", + "_originalSource": "git@github.com:keegan-lillo/slate.git" +} \ No newline at end of file diff --git a/vendor/pebble-slate/History.md b/vendor/pebble-slate/History.md new file mode 100644 index 0000000..6404c07 --- /dev/null +++ b/vendor/pebble-slate/History.md @@ -0,0 +1,16 @@ + +0.0.3 / 2015-07-29 +================== + + * Change PFDinDisplayPro-Regular to PFDinDisplayPro-Light. + * Use the web fonts as a fallback for when system font is unavailable. + +0.0.2 / 2015-07-29 +================== + + * Fix font imports. + +0.0.1 / 2015-07-07 +================== + + * Initial release diff --git a/vendor/pebble-slate/LICENSE b/vendor/pebble-slate/LICENSE new file mode 100644 index 0000000..bee51b7 --- /dev/null +++ b/vendor/pebble-slate/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2015 Pebble Technology + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/pebble-slate/README.md b/vendor/pebble-slate/README.md new file mode 100644 index 0000000..17d2829 --- /dev/null +++ b/vendor/pebble-slate/README.md @@ -0,0 +1,312 @@ +Slate +===== + +![Bower](https://img.shields.io/bower/v/pebble-slate.svg) + +Slate is a front-end framework for developing Pebble mobile configuration pages. +It's the fastest way to make a clean UI for a Pebble app's mobile configuration +page. + +![screenshot](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/screenshot.png) + +Getting Started +--------------- + +### Getting Slate + +There are only four files that makeup the Slate framework, a CSS file and a +JavaScript file, and two fonts. + +There are two quick ways to getting started with Slate. + +#### Via Download + +The CSS and JS files and fonts are also available via download. + +[Download Slate 0.0.3 >](https://github.com/pebble/slate/archive/v0.0.3.zip) + +#### Via Bower + +The CSS and JS files and fonts are also avaliable via Bower. + +```bash +bower install pebble-slate +``` + +### Zepto.js + +Slate is also bundled with [Zepto.js](https://github.com/madrobby/zepto), which +is "a minimalist JavaScript library for modern browsers with a largely +jQuery-compatible API." + +Video Tutorial +-------------- + +A detailed live demo tutorial was given at the Pebble SF Meetup, and can be +watched in full below. + +[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/TtP7z6wceqI/0.jpg)](http://www.youtube.com/watch?v=TtP7z6wceqI) + +Additionally, the example app used in the video +[can be found here](https://github.com/pebble-hacks/slate-watchface-template), +while a second example implementation +[can be found here](https://github.com/pebble-examples/slate-config-example). + +Documentation +------------- + +Here is a list of the different components you can create with Slate. + +### Paragraphs + +![paragraph](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-paragraph.png) + +```html +
+
+
+ Abilities or he perfectly pretended so strangers be exquisite. Oh to + another chamber pleased imagine do in. Went me rank at last loud shot an + draw. Excellent so to no sincerity smallness. Removal request delight if + on he we. Unaffected in we by apartments astonished to decisively + themselves. Offended ten old consider speaking. +
+
+
+``` + +### Headers, Footers, and Items + +![header, footer, and item](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-header-content-footer.png) + +```html +
+
Single Item
+
+ +
+ +
+``` + +### Toggles and Selects + +![toggles and select](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-toggle.png) + +```html +
+
Multiple Items
+
+ + + +
+
+``` + +### Checkboxes + +![checkboxes](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-checkbox.png) + +```html +
+
Checkboxes
+
+ + +
+
+``` + +### Radio Buttons + +![radio buttons](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-radio.png) + +```html +
+
Radio Buttons
+
+ + + +
+
+``` + +### Date, Time, and Colorpickers + +![date, time, and colorpickers](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-date-time-colorpickers.png) + +```html +
+
Date, Time, Colorpickers
+
+ + + + +
+
+``` + +### Input Fields + +![input field](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-input.png) + +```html +
+
Input Field
+
+ +
+
+``` + +### Input Fields with Buttons + +![input field with button](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-input-button.png) + +```html +
+
Input Field + Send Button
+
+ +
+
+``` + +### Tab Buttons + +![tab buttons](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-tab-button.png) + +```html +
+
Tab Buttons
+
+ +
+
+``` + +### Sliders + +![slider](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-slider.png) + +```html +
+
Slider
+
+ +
+
+``` + +### Draggable Lists + +![draggable list](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-draggable.png) + +```html +
+
draggable Items
+
+
+ + + + +
+
+``` + +### Lists + +![list](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-list.png) + +```html +
+
Item List
+
+
+ + +
+
+
+``` + +### Buttons + +![button](https://raw.githubusercontent.com/pebble/slate/master/docs/assets/slate-button.png) + +```html +
+
+ +
+
+``` diff --git a/vendor/pebble-slate/bower.json b/vendor/pebble-slate/bower.json new file mode 100644 index 0000000..e67f9d8 --- /dev/null +++ b/vendor/pebble-slate/bower.json @@ -0,0 +1,13 @@ +{ + "name": "Slate", + "version": "0.0.3", + "homepage": "https://github.com/pebble/slate", + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} diff --git a/vendor/pebble-slate/dist/css/slate.css b/vendor/pebble-slate/dist/css/slate.css new file mode 100644 index 0000000..cad659d --- /dev/null +++ b/vendor/pebble-slate/dist/css/slate.css @@ -0,0 +1,485 @@ +@font-face { + font-family: 'PFDinDisplayProLightWebfont'; + src: url("../fonts/PFDinDisplayPro-Light.woff") format("woff"); + font-weight: normal; + font-style: normal; + font-variant: normal; } +@font-face { + font-family: 'PTSansRegularWebfont'; + src: url("../fonts/PTSans-regular.woff") format("woff"); + font-weight: normal; + font-style: normal; + font-variant: normal; } +* { + margin: 0; + padding: 0; } + +*:focus { + outline-width: 0; } + +a { + color: #FF4700; + text-decoration: none; } + +body { + background-color: #EAEAEA; + margin-bottom: 15px; + font-size: 1.2em; + line-height: 1.4em; + -webkit-user-select: none !important; + -moz-user-select: none !important; + -ms-user-select: none !important; + user-select: none !important; } + +body, select, input[type=text], input[type=time], input[type=date] { + font-family: 'PFDinDisplayPro-Light', PFDinDisplayProLightWebfont, sans-serif; + font-weight: normal; } + +select, input[type=time], input[type=date] { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + border: none; + position: absolute; + top: 13px; + color: #A8A8A8; + font-size: 1em; + line-height: 1em; + background-color: #F7F7F7; } + +input[type=date] { + direction: rtl; } + +select { + right: 30px; + top: 14px; } + +input[type=time] { + right: 10px !important; } + +input[type=date] { + right: 10px !important; } + +.select-triangle { + position: absolute; + right: 10px; + top: 20px; + width: 0; + height: 0; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid #FF4700; } + +.item-container { + color: #333333; + margin-top: 15px; } + +.item-container-header { + padding: 3px 10px; + text-transform: uppercase; + font-family: 'PT Sans', PTSansRegularWebfont, sans-serif; + font-size: .8em; + font-weight: normal; + color: #A8A8A8; } + +.item-container-content { + background-color: #F7F7F7; + border-top: 1px solid #DEDEDE; + border-bottom: 1px solid #DEDEDE; } + +.item-container-footer { + padding: 3px 10px; + font-size: .7em; + line-height: 1.4em; + color: #A8A8A8; } + +.item { + position: relative; + padding: 10px; + display: block; + overflow: hidden; } + +.item:not(:first-child) { + border-top: 1px solid #DEDEDE; } + +.item-subtitle-wrapper { + font-size: 1em; } + +.item-subtitle-wrapper .item-styled-toggle-wrapper { + top: 16px; } + +.item-subtitle-wrapper .item-styled-checkbox { + top: 18px; } + +.item-subtitle-wrapper .item-styled-radio { + top: 16px; } + +.item-subtitle-wrapper .item-draggable-handle { + top: 18px; } + +.item-subtitle { + font-size: .7em; + line-height: .7em; + padding: .3em 0; } + +.item-styled-toggle-wrapper { + position: absolute; + right: 10px; + top: 8px; + width: 56px; + height: 30px; + border-radius: 5px; + transition-timing-function: ease-in-out; + transition-duration: 0.3s; + transition-property: background-color; } + +.item-styled-toggle { + position: relative; + background-color: #FFFFFF; + width: 28px; + height: 28px; + border-radius: 5px; + top: 1px; + transition-timing-function: ease-in-out; + transition-duration: 0.3s; + transition-property: left; } + +.item-toggle { + display: none; } + +.item-toggle + .item-styled-toggle-wrapper { + background-color: #A8A8A8; } + +.item-toggle:checked + .item-styled-toggle-wrapper { + background-color: #FF4700; } + +.item-toggle + .item-styled-toggle-wrapper .item-styled-toggle { + left: 1px; } + +.item-toggle:checked + .item-styled-toggle-wrapper .item-styled-toggle { + left: 27px; } + +.item-styled-toggle-bar { + width: 3px; + height: 15px; + margin-left: 3px; + background-color: #EAEAEA; + float: left; + position: relative; + left: 4px; + top: 7px; } + +.item-styled-checkbox { + position: absolute; + right: 10px; + top: 10px; + width: 21px; + height: 21px; + border-radius: 5px; + border-width: 2px; + border-style: solid; } + +.item-checkbox { + display: none; } + +.item-checkbox + .item-styled-checkbox { + border-color: #DEDEDE; } + +.item-checkbox:checked + .item-styled-checkbox { + border-color: #FF4700; + background-color: #FF4700; } + +.item-checkbox:checked + .item-styled-checkbox:before { + content: ""; + display: block; + position: relative; + left: 7px; + width: 6px; + height: 14px; + border-color: #F7F7F7; + border-width: 0 2px 2px 0; + border-style: solid; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); } + +.item-styled-radio { + position: absolute; + right: 10px; + top: 10px; + width: 21px; + height: 21px; + border-radius: 12px; + border-width: 2px; + border-style: solid; } + +.item-radio { + display: none; } + +.item-radio + .item-styled-radio { + border-color: #DEDEDE; } + +.item-radio:checked + .item-styled-radio { + border-color: #FF4700; + background-color: #FF4700; } + +.item-radio:checked + .item-styled-radio:before { + content: ""; + display: block; + position: relative; + top: 1px; + left: 6px; + width: 6px; + height: 14px; + border-color: #F7F7F7; + border-width: 0 2px 2px 0; + border-style: solid; + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); } + +.item-color { + display: none; } + +.item-styled-color { + background: #F7F7F7; } + .item-styled-color .value { + position: absolute; + right: 10px; + top: 10px; + width: 56px; + height: 30px; + border-radius: 5px; + border-color: #A8A8A8; + border-width: 1px; + border-style: solid; } + .item-styled-color .color-box-wrap { + display: none; + box-sizing: border-box; + position: relative; + height: 0; + width: 100%; + padding: 0 0 100% 0; + margin: 0.6em 0 0em; } + .item-styled-color .color-box-wrap.show { + display: block; } + .item-styled-color .color-box-wrap .color-box-container { + position: absolute; + height: 99.97%; + width: 100%; + left: 0; + top: 0; } + .item-styled-color .color-box-wrap .color-box-container .color-box { + float: left; + cursor: pointer; } + .item-styled-color .color-box-wrap .color-box-container .color-box.rounded-tl { + border-top-left-radius: 5px; } + .item-styled-color .color-box-wrap .color-box-container .color-box.rounded-tr { + border-top-right-radius: 5px; } + .item-styled-color .color-box-wrap .color-box-container .color-box.rounded-bl { + border-bottom-left-radius: 5px; } + .item-styled-color .color-box-wrap .color-box-container .color-box.rounded-br { + border-bottom-right-radius: 5px; } + +.item-date, .item-time { + position: absolute; + color: #F7F7F7 !important; } + +.item-styled-date, .item-styled-time { + position: absolute; + top: 13px; + right: 10px; + color: #A8A8A8; + font-size: 1em; + line-height: 1em; + background-color: #F7F7F7; } + +.item-input-wrapper { + border-radius: 5px; + border: 2px solid #DEDEDE; } + +.item-input-wrapper-button { + box-sizing: border-box; + width: 77%; } + +.item-input { + border: 0; + background-color: transparent; + padding: 0 10px 7px 10px; + font-size: 13px; + width: 100%; + box-sizing: border-box; } + +.button-container { + text-align: center; } + +.item-button { + width: 60%; + height: 35px; + background-color: #FF4700; + border-radius: 5px; + color: white; + font-size: 0.8em; + border: none; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; } + +.item-input-button { + position: absolute; + right: 10px; + top: 9px; + width: 20%; } + +.tab-buttons { + display: table; + width: 100%; + box-sizing: border-box; + table-layout: fixed; } + +.tab-button { + display: table-cell; + position: relative; + color: #FF4700; + border: 1px solid #FF4700; + border-right-width: 0; + font-size: 14px; + padding: 5px 0; + text-align: center; + right: -1px; } + +.tab-button:first-child { + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; + border-right-width: 0; } + +.tab-button:last-child { + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; + border-right-width: 1px; } + +.tab-button.active { + background-color: #FF4700; + color: #F7F7F7; } + +.item-slider { + position: relative; + top: 8px; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + height: 30px; + width: 79%; + overflow: hidden; + background-color: transparent; + margin-top: -10px; } + +.item-slider::-webkit-slider-thumb:before { + content: ""; + position: absolute; + top: 11px; + left: -1001px; + height: 2px; + width: 1000px; + background: #FF4700; } + +.item-slider::-webkit-slider-thumb { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + appearance: none; + position: relative; + top: -13px; + height: 28px; + width: 28px; + background-color: #FFFFFF; + border-radius: 5px; + border: 2px solid #EAEAEA; } + +.item-slider::-webkit-slider-runnable-track { + height: 2px; + background-color: #DEDEDE; } + +.item-slider::-webkit-slider-thumb:after { + content: "lll"; + position: absolute; + left: 4px; + top: 3px; + height: 12px; + width: 10px; + font-weight: normal; + text-align: center; + color: #DEDEDE; + font-size: 16px; + letter-spacing: 1px; } + +.item-slider-text { + position: absolute; + top: 6px; + right: 10px; + width: 16%; } + +.item-slider-text .item-input { + text-align: center; } + +.delete-item { + width: 30px; + height: 30px; + right: 5px; + top: 5px; + position: absolute; + border-radius: 6px; } + +.delete-item:before, .delete-item:after { + content: ''; + position: absolute; + width: 24px; + height: 2px; + background-color: #A8A8A8; + border-radius: 2px; + top: 16px; } + +.delete-item:before { + -webkit-transform: rotate(45deg); + -moz-transform: rotate(45deg); + -ms-transform: rotate(45deg); + -o-transform: rotate(45deg); + transform: rotate(45deg); + left: 3px; } + +.delete-item:after { + -webkit-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + transform: rotate(-45deg); + right: 3px; } + +.add-item { + color: #FF4700; } + +.item-draggable-handle { + position: absolute; + right: 5px; + top: 10px; + height: 28px; + width: 28px; } + +.item-draggable-handle-bar { + margin-top: 5px; + height: 2px; + width: 20px; + background-color: #A8A8A8; + text-align: center; } + +[draggable=true] { + background-color: #F7F7F7; + border: 2px solid #EAEAEA; + border-radius: 2px; } diff --git a/vendor/pebble-slate/dist/css/slate.min.css b/vendor/pebble-slate/dist/css/slate.min.css new file mode 100644 index 0000000..0a9dcfe --- /dev/null +++ b/vendor/pebble-slate/dist/css/slate.min.css @@ -0,0 +1 @@ +@font-face{font-family:'PFDinDisplayProLightWebfont';src:url("../fonts/PFDinDisplayPro-Light.woff") format("woff");font-weight:normal;font-style:normal;font-variant:normal}@font-face{font-family:'PTSansRegularWebfont';src:url("../fonts/PTSans-regular.woff") format("woff");font-weight:normal;font-style:normal;font-variant:normal}*{margin:0;padding:0}*:focus{outline-width:0}a{color:#ff4700;text-decoration:none}body{background-color:#eaeaea;margin-bottom:15px;font-size:1.2em;line-height:1.4em;-webkit-user-select:none !important;-moz-user-select:none !important;-ms-user-select:none !important;user-select:none !important}body,select,input[type=text],input[type=time],input[type=date]{font-family:'PFDinDisplayPro-Light',PFDinDisplayProLightWebfont,sans-serif;font-weight:normal}select,input[type=time],input[type=date]{-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;border:0;position:absolute;top:13px;color:#a8a8a8;font-size:1em;line-height:1em;background-color:#f7f7f7}input[type=date]{direction:rtl}select{right:30px;top:14px}input[type=time]{right:10px !important}input[type=date]{right:10px !important}.select-triangle{position:absolute;right:10px;top:20px;width:0;height:0;border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #ff4700}.item-container{color:#333;margin-top:15px}.item-container-header{padding:3px 10px;text-transform:uppercase;font-family:'PT Sans',PTSansRegularWebfont,sans-serif;font-size:.8em;font-weight:normal;color:#a8a8a8}.item-container-content{background-color:#f7f7f7;border-top:1px solid #dedede;border-bottom:1px solid #dedede}.item-container-footer{padding:3px 10px;font-size:.7em;line-height:1.4em;color:#a8a8a8}.item{position:relative;padding:10px;display:block;overflow:hidden}.item:not(:first-child){border-top:1px solid #dedede}.item-subtitle-wrapper{font-size:1em}.item-subtitle-wrapper .item-styled-toggle-wrapper{top:16px}.item-subtitle-wrapper .item-styled-checkbox{top:18px}.item-subtitle-wrapper .item-styled-radio{top:16px}.item-subtitle-wrapper .item-draggable-handle{top:18px}.item-subtitle{font-size:.7em;line-height:.7em;padding:.3em 0}.item-styled-toggle-wrapper{position:absolute;right:10px;top:8px;width:56px;height:30px;border-radius:5px;transition-timing-function:ease-in-out;transition-duration:.3s;transition-property:background-color}.item-styled-toggle{position:relative;background-color:#fff;width:28px;height:28px;border-radius:5px;top:1px;transition-timing-function:ease-in-out;transition-duration:.3s;transition-property:left}.item-toggle{display:none}.item-toggle+.item-styled-toggle-wrapper{background-color:#a8a8a8}.item-toggle:checked+.item-styled-toggle-wrapper{background-color:#ff4700}.item-toggle+.item-styled-toggle-wrapper .item-styled-toggle{left:1px}.item-toggle:checked+.item-styled-toggle-wrapper .item-styled-toggle{left:27px}.item-styled-toggle-bar{width:3px;height:15px;margin-left:3px;background-color:#eaeaea;float:left;position:relative;left:4px;top:7px}.item-styled-checkbox{position:absolute;right:10px;top:10px;width:21px;height:21px;border-radius:5px;border-width:2px;border-style:solid}.item-checkbox{display:none}.item-checkbox+.item-styled-checkbox{border-color:#dedede}.item-checkbox:checked+.item-styled-checkbox{border-color:#ff4700;background-color:#ff4700}.item-checkbox:checked+.item-styled-checkbox:before{content:"";display:block;position:relative;left:7px;width:6px;height:14px;border-color:#f7f7f7;border-width:0 2px 2px 0;border-style:solid;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.item-styled-radio{position:absolute;right:10px;top:10px;width:21px;height:21px;border-radius:12px;border-width:2px;border-style:solid}.item-radio{display:none}.item-radio+.item-styled-radio{border-color:#dedede}.item-radio:checked+.item-styled-radio{border-color:#ff4700;background-color:#ff4700}.item-radio:checked+.item-styled-radio:before{content:"";display:block;position:relative;top:1px;left:6px;width:6px;height:14px;border-color:#f7f7f7;border-width:0 2px 2px 0;border-style:solid;-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.item-color{display:none}.item-styled-color{background:#f7f7f7}.item-styled-color .value{position:absolute;right:10px;top:10px;width:56px;height:30px;border-radius:5px;border-color:#a8a8a8;border-width:1px;border-style:solid}.item-styled-color .color-box-wrap{display:none;box-sizing:border-box;position:relative;height:0;width:100%;padding:0 0 100% 0;margin:.6em 0 0}.item-styled-color .color-box-wrap.show{display:block}.item-styled-color .color-box-wrap .color-box-container{position:absolute;height:99.97%;width:100%;left:0;top:0}.item-styled-color .color-box-wrap .color-box-container .color-box{float:left;cursor:pointer}.item-styled-color .color-box-wrap .color-box-container .color-box.rounded-tl{border-top-left-radius:5px}.item-styled-color .color-box-wrap .color-box-container .color-box.rounded-tr{border-top-right-radius:5px}.item-styled-color .color-box-wrap .color-box-container .color-box.rounded-bl{border-bottom-left-radius:5px}.item-styled-color .color-box-wrap .color-box-container .color-box.rounded-br{border-bottom-right-radius:5px}.item-date,.item-time{position:absolute;color:#f7f7f7 !important}.item-styled-date,.item-styled-time{position:absolute;top:13px;right:10px;color:#a8a8a8;font-size:1em;line-height:1em;background-color:#f7f7f7}.item-input-wrapper{border-radius:5px;border:2px solid #dedede}.item-input-wrapper-button{box-sizing:border-box;width:77%}.item-input{border:0;background-color:transparent;padding:0 10px 7px 10px;font-size:13px;width:100%;box-sizing:border-box}.button-container{text-align:center}.item-button{width:60%;height:35px;background-color:#ff4700;border-radius:5px;color:white;font-size:.8em;border:0;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none}.item-input-button{position:absolute;right:10px;top:9px;width:20%}.tab-buttons{display:table;width:100%;box-sizing:border-box;table-layout:fixed}.tab-button{display:table-cell;position:relative;color:#ff4700;border:1px solid #ff4700;border-right-width:0;font-size:14px;padding:5px 0;text-align:center;right:-1px}.tab-button:first-child{border-top-left-radius:5px;border-bottom-left-radius:5px;border-right-width:0}.tab-button:last-child{border-top-right-radius:5px;border-bottom-right-radius:5px;border-right-width:1px}.tab-button.active{background-color:#ff4700;color:#f7f7f7}.item-slider{position:relative;top:8px;-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;height:30px;width:79%;overflow:hidden;background-color:transparent;margin-top:-10px}.item-slider::-webkit-slider-thumb:before{content:"";position:absolute;top:11px;left:-1001px;height:2px;width:1000px;background:#ff4700}.item-slider::-webkit-slider-thumb{-webkit-appearance:none;-moz-appearance:none;-ms-appearance:none;appearance:none;position:relative;top:-13px;height:28px;width:28px;background-color:#fff;border-radius:5px;border:2px solid #eaeaea}.item-slider::-webkit-slider-runnable-track{height:2px;background-color:#dedede}.item-slider::-webkit-slider-thumb:after{content:"lll";position:absolute;left:4px;top:3px;height:12px;width:10px;font-weight:normal;text-align:center;color:#dedede;font-size:16px;letter-spacing:1px}.item-slider-text{position:absolute;top:6px;right:10px;width:16%}.item-slider-text .item-input{text-align:center}.delete-item{width:30px;height:30px;right:5px;top:5px;position:absolute;border-radius:6px}.delete-item:before,.delete-item:after{content:'';position:absolute;width:24px;height:2px;background-color:#a8a8a8;border-radius:2px;top:16px}.delete-item:before{-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg);left:3px}.delete-item:after{-webkit-transform:rotate(-45deg);-moz-transform:rotate(-45deg);-ms-transform:rotate(-45deg);-o-transform:rotate(-45deg);transform:rotate(-45deg);right:3px}.add-item{color:#ff4700}.item-draggable-handle{position:absolute;right:5px;top:10px;height:28px;width:28px}.item-draggable-handle-bar{margin-top:5px;height:2px;width:20px;background-color:#a8a8a8;text-align:center}[draggable=true]{background-color:#f7f7f7;border:2px solid #eaeaea;border-radius:2px} \ No newline at end of file diff --git a/vendor/pebble-slate/dist/fonts/PFDinDisplayPro-Light.woff b/vendor/pebble-slate/dist/fonts/PFDinDisplayPro-Light.woff new file mode 100644 index 0000000..1a206ff Binary files /dev/null and b/vendor/pebble-slate/dist/fonts/PFDinDisplayPro-Light.woff differ diff --git a/vendor/pebble-slate/dist/fonts/ptsans-regular.woff b/vendor/pebble-slate/dist/fonts/ptsans-regular.woff new file mode 100644 index 0000000..48d9d3f Binary files /dev/null and b/vendor/pebble-slate/dist/fonts/ptsans-regular.woff differ diff --git a/vendor/pebble-slate/dist/js/slate.js b/vendor/pebble-slate/dist/js/slate.js new file mode 100644 index 0000000..dd9b051 --- /dev/null +++ b/vendor/pebble-slate/dist/js/slate.js @@ -0,0 +1,381 @@ +/*! Sortable 1.2.0 - MIT | git://github.com/rubaxa/Sortable.git */ +!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){this.el=a,this.options=b=q({},b),a[H]=this;var d={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0};for(var e in d)!(e in b)&&(b[e]=d[e]);var g=b.group;g&&"object"==typeof g||(g=b.group={name:g}),["pull","put"].forEach(function(a){a in g||(g[a]=!0)}),b.groups=" "+g.name+(g.put.join?" "+g.put.join(" "):"")+" ";for(var h in this)"_"===h.charAt(0)&&(this[h]=c(this,this[h]));f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"dragover",this),f(a,"dragenter",this),Q.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){t&&t.state!==a&&(i(t,"display",a?"none":""),!a&&t.state&&u.insertBefore(t,r),t.state=a)}function c(a,b){var c=P.call(arguments,2);return b.bind?b.bind.apply(b,[a].concat(c)):function(){return b.apply(a,c.concat(P.call(arguments)))}}function d(a,b,c){if(a){c=c||J,b=b.split(".");var d=b.shift().toUpperCase(),e=new RegExp("\\s("+b.join("|")+")\\s","g");do if(">*"===d&&a.parentNode===c||(""===d||a.nodeName.toUpperCase()==d)&&(!b.length||((" "+a.className+" ").match(e)||[]).length==b.length))return a;while(a!==c&&(a=a.parentNode))}return null}function e(a){a.dataTransfer.dropEffect="move",a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,!1)}function g(a,b,c){a.removeEventListener(b,c,!1)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(G," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(G," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return J.defaultView&&J.defaultView.getComputedStyle?c=J.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function k(a){a.draggable=!1}function l(){M=!1}function m(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5&&c}function n(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function o(a){for(var b=0;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&b++;return b}function p(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function q(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var r,s,t,u,v,w,x,y,z,A,B,C,D,E,F={},G=/\s+/g,H="Sortable"+(new Date).getTime(),I=window,J=I.document,K=I.parseInt,L=!!("draggable"in J.createElement("div")),M=!1,N=function(a,b,c,d,e,f,g){var h=J.createEvent("Event"),i=(a||b[H]).options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.item=d||b,h.from=e||b,h.clone=t,h.oldIndex=f,h.newIndex=g,i[j]&&i[j].call(a,h),b.dispatchEvent(h)},O=Math.abs,P=[].slice,Q=[],R=p(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(x!==c&&(w=b.scroll,x=c,w===!0)){w=c;do if(w.offsetWidth=l-j)-(h>=j),g=(h>=m-k)-(h>=k),(f||g)&&(d=I)),(F.vx!==f||F.vy!==g||F.el!==d)&&(F.el=d,F.vx=f,F.vy=g,clearInterval(F.pid),d&&(F.pid=setInterval(function(){d===I?I.scrollTo(I.pageXOffset+f*i,I.pageYOffset+g*i):(g&&(d.scrollTop+=g*i),f&&(d.scrollLeft+=f*i))},24)))}},30);return a.prototype={constructor:a,_onTapStart:function(a){var b=this,c=this.el,e=this.options,f=a.type,g=a.touches&&a.touches[0],h=(g||a).target,i=h,j=e.filter;if(!("mousedown"===f&&0!==a.button||e.disabled)&&(h=d(h,e.draggable,c))){if(A=o(h),"function"==typeof j){if(j.call(this,a,h,this))return N(b,i,"filter",h,c,A),void a.preventDefault()}else if(j&&(j=j.split(",").some(function(a){return a=d(i,a.trim(),c),a?(N(b,a,"filter",h,c,A),!0):void 0})))return void a.preventDefault();(!e.handle||d(i,e.handle,c))&&this._prepareDragStart(a,g,h)}},_prepareDragStart:function(a,b,c){var d,e=this,g=e.el,h=e.options,i=g.ownerDocument;c&&!r&&c.parentNode===g&&(D=a,u=g,r=c,v=r.nextSibling,C=h.group,d=function(){e._disableDelayedDrag(),r.draggable=!0,h.ignore.split(",").forEach(function(a){j(r,a.trim(),k)}),e._triggerDragStart(b)},f(i,"mouseup",e._onDrop),f(i,"touchend",e._onDrop),f(i,"touchcancel",e._onDrop),h.delay?(f(i,"mousemove",e._disableDelayedDrag),f(i,"touchmove",e._disableDelayedDrag),e._dragStartTimer=setTimeout(d,h.delay)):d())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(D={target:r,clientX:a.clientX,clientY:a.clientY},this._onDragStart(D,"touch")):L?(f(r,"dragend",this),f(u,"dragstart",this._onDragStart)):this._onDragStart(D,!0);try{J.selection?J.selection.empty():window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){u&&r&&(h(r,this.options.ghostClass,!0),a.active=this,N(this,u,"start",r,u,A))},_emulateDragOver:function(){if(E){i(s,"display","none");var a=J.elementFromPoint(E.clientX,E.clientY),b=a,c=" "+this.options.group.name,d=Q.length;if(b)do{if(b[H]&&b[H].options.groups.indexOf(c)>-1){for(;d--;)Q[d]({clientX:E.clientX,clientY:E.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);i(s,"display","")}},_onTouchMove:function(a){if(D){var b=a.touches?a.touches[0]:a,c=b.clientX-D.clientX,d=b.clientY-D.clientY,e=a.touches?"translate3d("+c+"px,"+d+"px,0)":"translate("+c+"px,"+d+"px)";E=b,i(s,"webkitTransform",e),i(s,"mozTransform",e),i(s,"msTransform",e),i(s,"transform",e),a.preventDefault()}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;if(this._offUpEvents(),"clone"==C.pull&&(t=r.cloneNode(!0),i(t,"display","none"),u.insertBefore(t,r)),b){var e,g=r.getBoundingClientRect(),h=i(r);s=r.cloneNode(!0),i(s,"top",g.top-K(h.marginTop,10)),i(s,"left",g.left-K(h.marginLeft,10)),i(s,"width",g.width),i(s,"height",g.height),i(s,"opacity","0.8"),i(s,"position","fixed"),i(s,"zIndex","100000"),u.appendChild(s),e=s.getBoundingClientRect(),i(s,"width",2*g.width-e.width),i(s,"height",2*g.height-e.height),"touch"===b?(f(J,"touchmove",this._onTouchMove),f(J,"touchend",this._onDrop),f(J,"touchcancel",this._onDrop)):(f(J,"mousemove",this._onTouchMove),f(J,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,150)}else c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,r)),f(J,"drop",this);setTimeout(this._dragStarted,0)},_onDragOver:function(a){var c,e,f,g=this.el,h=this.options,j=h.group,k=j.put,n=C===j,o=h.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!h.dragoverBubble&&a.stopPropagation()),C&&!h.disabled&&(n?o||(f=!u.contains(r)):C.pull&&k&&(C.name===j.name||k.indexOf&&~k.indexOf(C.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(R(a,h,this.el),M)return;if(c=d(a.target,h.draggable,g),e=r.getBoundingClientRect(),f)return b(!0),void(t||v?u.insertBefore(r,t||v):o||u.appendChild(r));if(0===g.children.length||g.children[0]===s||g===a.target&&(c=m(g,a))){if(c){if(c.animated)return;q=c.getBoundingClientRect()}b(n),g.appendChild(r),this._animate(e,r),c&&this._animate(q,c)}else if(c&&!c.animated&&c!==r&&void 0!==c.parentNode[H]){y!==c&&(y=c,z=i(c));var p,q=c.getBoundingClientRect(),w=q.right-q.left,x=q.bottom-q.top,A=/left|right|inline/.test(z.cssFloat+z.display),B=c.offsetWidth>r.offsetWidth,D=c.offsetHeight>r.offsetHeight,E=(A?(a.clientX-q.left)/w:(a.clientY-q.top)/x)>.5,F=c.nextElementSibling;M=!0,setTimeout(l,30),b(n),p=A?c.previousElementSibling===r&&!B||E&&B:F!==r&&!D||E&&D,p&&!F?g.appendChild(r):c.parentNode.insertBefore(r,p?F:c),this._animate(e,r),this._animate(q,c)}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(J,"touchmove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(F.pid),clearTimeout(this.dragStartTimer),g(J,"drop",this),g(J,"mousemove",this._onTouchMove),g(c,"dragstart",this._onDragStart),this._offUpEvents(),b&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation(),s&&s.parentNode.removeChild(s),r&&(g(r,"dragend",this),k(r),h(r,this.options.ghostClass,!1),u!==r.parentNode?(B=o(r),N(null,r.parentNode,"sort",r,u,A,B),N(this,u,"sort",r,u,A,B),N(null,r.parentNode,"add",r,u,A,B),N(this,u,"remove",r,u,A,B)):(t&&t.parentNode.removeChild(t),r.nextSibling!==v&&(B=o(r),N(this,u,"update",r,u,A,B),N(this,u,"sort",r,u,A,B))),a.active&&N(this,u,"end",r,u,A,B)),u=r=s=v=t=w=x=D=E=y=z=C=a.active=null,this.save())},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?r&&(this._onDragOver(a),e(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],c=this.el.children,e=0,f=c.length,g=this.options;f>e;e++)a=c[e],d(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||n(a));return b},sort:function(a){var b={},c=this.el;this.toArray().forEach(function(a,e){var f=c.children[e];d(f,this.options.draggable,c)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(c.removeChild(b[a]),c.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return d(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:void(c[a]=b)},destroy:function(){var a=this.el;a[H]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"dragover",this),g(a,"dragenter",this),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),Q.splice(Q.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:f,off:g,css:i,find:j,bind:c,is:function(a,b){return!!d(a,b,a)},extend:q,throttle:p,closest:d,toggleClass:h,index:o},a.version="1.2.0",a.create=function(b,c){return new a(b,c)},a}); +/* Zepto v1.1.6 - zepto event ajax form ie - zeptojs.com/license */ +var Zepto=function(){function L(t){return null==t?String(t):j[S.call(t)]||"object"}function Z(t){return"function"==L(t)}function _(t){return null!=t&&t==t.window}function $(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function M(t){return D(t)&&!_(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function B(n,i,r){for(e in i)r&&(M(i[e])||A(i[e]))?(M(i[e])&&!M(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),B(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function U(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function G(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},S=j.toString,T={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return T.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~T.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},T.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),M(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},T.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},T.isZ=function(t){return t instanceof T.Z},T.init=function(e,i){var r;if(!e)return T.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=T.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=T.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(T.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=T.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=T.qsa(a,e)}}return T.Z(r,e)},n=function(t,e){return T.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){B(t,n,e)}),t},T.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return $(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=a.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=L,n.isFunction=Z,n.isWindow=_,n.isArray=A,n.isPlainObject=M,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(R(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return T.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&T.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(T.qsa(this[0],t)):this.map(function(){return T.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:T.matches(i,t));)i=i!==e&&!$(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!$(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return U(e,t)},parent:function(t){return U(N(this.pluck("parentNode")),t)},children:function(t){return U(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return U(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=J(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){X(this,t)},this)})},prop:function(t,e){return t=P[t]||t,1 in arguments?this.each(function(n){this[t]=J(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(m,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?Y(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=J(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[C(t)]||r.getPropertyValue(t);if(A(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[C(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return W(this,"");i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),W(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?_(s)?s["inner"+i]:$(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:T.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,u){o=i?u:u.parentNode,u=0==e?u.nextSibling:1==e?u.firstChild:2==e?u:null;var f=n.contains(a.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,u),f&&G(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),T.Z.prototype=n.fn,T.uniq=N,T.deserializeValue=Y,n.zepto=T,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function S(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(S(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=S(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),x(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),x(e,n,i)}function x(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function b(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function j(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function S(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/,l=n.createElement("a");l.href=window.location.href,t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):y(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),g(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:b,success:b,error:b,complete:b,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,html:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var a,o=t.extend({},e||{}),s=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===o[i]&&(o[i]=t.ajaxSettings[i]);d(o),o.crossDomain||(a=n.createElement("a"),a.href=o.url,a.href=a.href,o.crossDomain=l.protocol+"//"+l.host!=a.protocol+"//"+a.host),o.url||(o.url=window.location.toString()),j(o);var u=o.dataType,f=/\?.+=\?/.test(o.url);if(f&&(u="jsonp"),o.cache!==!1&&(e&&e.cache===!0||"script"!=u&&"jsonp"!=u)||(o.url=E(o.url,"_="+Date.now())),"jsonp"==u)return f||(o.url=E(o.url,o.jsonp?o.jsonp+"=?":o.jsonp===!1?"":"callback=?")),t.ajaxJSONP(o,s);var C,h=o.accepts[u],p={},m=function(t,e){p[t.toLowerCase()]=[t,e]},x=/^([\w-]+:)\/\//.test(o.url)?RegExp.$1:window.location.protocol,S=o.xhr(),T=S.setRequestHeader;if(s&&s.promise(S),o.crossDomain||m("X-Requested-With","XMLHttpRequest"),m("Accept",h||"*/*"),(h=o.mimeType||h)&&(h.indexOf(",")>-1&&(h=h.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(h)),(o.contentType||o.contentType!==!1&&o.data&&"GET"!=o.type.toUpperCase())&&m("Content-Type",o.contentType||"application/x-www-form-urlencoded"),o.headers)for(r in o.headers)m(r,o.headers[r]);if(S.setRequestHeader=m,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=b,clearTimeout(C);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==x){u=u||w(o.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==u?(1,eval)(e):"xml"==u?e=S.responseXML:"json"==u&&(e=c.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?y(n,"parsererror",S,o,s):v(e,S,o,s)}else y(S.statusText||null,S.status?"error":"abort",S,o,s)}},g(S,o)===!1)return S.abort(),y(null,"abort",S,o,s),S;if(o.xhrFields)for(r in o.xhrFields)S[r]=o.xhrFields[r];var N="async"in o?o.async:!0;S.open(o.type,o.url,N,o.username,o.password);for(r in p)T.apply(S,p[r]);return o.timeout>0&&(C=setTimeout(function(){S.onreadystatechange=b,S.abort(),y(null,"timeout",S,o,s)},o.timeout)),S.send(o.data?o.data:null),S},t.get=function(){return t.ajax(S.apply(null,arguments))},t.post=function(){var e=S.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=S.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=S(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(T(e)+"="+T(n))},C(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n,i=[],r=function(t){return t.forEach?t.forEach(r):void i.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(i,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&r(t(o).val())}),i},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto); +'use strict'; + +(function($, Sortable) { + + var ENUMS = { + COLOR : { + EMPTY: 'transparent' + } + } + + $.extend($.fn, { + itemToggle: function() { + this.each(function() { + var $checkbox = $(this); + var item = $checkbox.parent(); + + var $injectedCheckbox = $('
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'); + + item.append($injectedCheckbox); + }); + }, + + itemCheckbox: function() { + this.each(function() { + var $checkbox = $(this); + var item = $checkbox.parent(); + + var $injectedCheckbox = $('
'); + + item.append($injectedCheckbox); + }); + }, + + itemSelect: function() { + this.each(function() { + var $select = $(this); + var $item = $select.parent(); + + $item.append('
'); + }); + }, + + itemDate: function() { + this.each(function() { + var $date = $(this); + var $item = $date.parent(); + + var $injectedDate = $('
'); + updateDate(); + + $item.append($injectedDate); + + $date.change(function() { + updateDate(); + }); + + function updateDate() { + $injectedDate.html($date.val()); + } + }); + }, + + itemTime: function() { + this.each(function() { + var $time = $(this); + var $item = $time.parent(); + + var $injectedTime = $('
'); + updateTime(); + + $item.append($injectedTime); + + $time.change(function() { + updateTime(); + }); + + function updateTime() { + $injectedTime.html($time.val()); + } + }); + }, + + itemRadio: function() { + this.each(function() { + var $radio = $(this); + var $item = $radio.parent(); + + var $injectedRadio = $('
'); + + $item.append($injectedRadio); + }); + }, + + itemColor: function(options){ + + var options = $.extend({}, { + sunny: false + }, options || {}); + + var layout = [ + [false , false , '#55FF00', '#AAFF55', false , '#FFFF55', '#FFFFAA', false , false ], + [false , '#AAFFAA', '#55FF55', '#00FF00', '#AAFF00', '#FFFF00', '#FFAA55', '#FFAAAA', false ], + ['#55FFAA', '#00FF55', '#00AA00', '#55AA00', '#AAAA55', '#AAAA00', '#FFAA00', '#FF5500', '#FF5555'], + ['#AAFFFF', '#00FFAA', '#00AA55', '#55AA55', '#005500', '#555500', '#AA5500', '#FF0000', '#FF0055'], + [false , '#55AAAA', '#00AAAA', '#005555', '#FFFFFF', '#000000', '#AA5555', '#AA0000', false ], + ['#55FFFF', '#00FFFF', '#00AAFF', '#0055AA', '#AAAAAA', '#555555', '#550000', '#AA0055', '#FF55AA'], + ['#55AAFF', '#0055FF', '#0000FF', '#0000AA', '#000055', '#550055', '#AA00AA', '#FF00AA', '#FFAAFF'], + [false , '#5555AA', '#5555FF', '#5500FF', '#5500AA', '#AA00FF', '#FF00FF', '#FF55FF', false ], + [false , false , false , '#AAAAFF', '#AA55FF', '#AA55AA', false , false , false ], + ]; + + var mappingSunny = {'000000': '000000','000055': '001e41','0000aa': '004387', + '0000ff': '0068ca','005500': '2b4a2c','005555': '27514f', + '0055aa': '16638d','0055ff': '007dce','00aa00': '5e9860', + '00aa55': '5c9b72','00aaaa': '57a5a2','00aaff': '4cb4db', + '00ff00': '8ee391','00ff55': '8ee69e','00ffaa': '8aebc0', + '00ffff': '84f5f1','550000': '4a161b','550055': '482748', + '5500aa': '40488a','5500ff': '2f6bcc','555500': '564e36', + '555555': '545454','5555aa': '4f6790','5555ff': '4180d0', + '55aa00': '759a64','55aa55': '759d76','55aaaa': '71a6a4', + '55aaff': '69b5dd','55ff00': '9ee594','55ff55': '9de7a0', + '55ffaa': '9becc2','55ffff': '95f6f2','aa0000': '99353f', + 'aa0055': '983e5a','aa00aa': '955694','aa00ff': '8f74d2', + 'aa5500': '9d5b4d','aa5555': '9d6064','aa55aa': '9a7099', + 'aa55ff': '9587d5','aaaa00': 'afa072','aaaa55': 'aea382', + 'aaaaaa': 'ababab','ffffff': 'ffffff','aaaaff': 'a7bae2', + 'aaff00': 'c9e89d','aaff55': 'c9eaa7','aaffaa': 'c7f0c8', + 'aaffff': 'c3f9f7','ff0000': 'e35462','ff0055': 'e25874', + 'ff00aa': 'e16aa3','ff00ff': 'de83dc','ff5500': 'e66e6b', + 'ff5555': 'e6727c','ff55aa': 'e37fa7','ff55ff': 'e194df', + 'ffaa00': 'f1aa86','ffaa55': 'f1ad93','ffaaaa': 'efb5b8', + 'ffaaff': 'ecc3eb','ffff00': 'ffeeab','ffff55': 'fff1b5', + 'ffffaa': 'fff6d3'}; + + var mappingNormal = {'000000': '000000','001e41': '000055','004387': '0000aa', + '0068ca': '0000ff','2b4a2c': '005500','27514f': '005555', + '16638d': '0055aa','007dce': '0055ff','5e9860': '00aa00', + '5c9b72': '00aa55','57a5a2': '00aaaa','4cb4db': '00aaff', + '8ee391': '00ff00','8ee69e': '00ff55','8aebc0': '00ffaa', + '84f5f1': '00ffff','4a161b': '550000','482748': '550055', + '40488a': '5500aa','2f6bcc': '5500ff','564e36': '555500', + '545454': '555555','4f6790': '5555aa','4180d0': '5555ff', + '759a64': '55aa00','759d76': '55aa55','71a6a4': '55aaaa', + '69b5dd': '55aaff','9ee594': '55ff00','9de7a0': '55ff55', + '9becc2': '55ffaa','95f6f2': '55ffff','99353f': 'aa0000', + '983e5a': 'aa0055','955694': 'aa00aa','8f74d2': 'aa00ff', + '9d5b4d': 'aa5500','9d6064': 'aa5555','9a7099': 'aa55aa', + '9587d5': 'aa55ff','afa072': 'aaaa00','aea382': 'aaaa55', + 'ababab': 'aaaaaa','ffffff': 'ffffff','a7bae2': 'aaaaff', + 'c9e89d': 'aaff00','c9eaa7': 'aaff55','c7f0c8': 'aaffaa', + 'c3f9f7': 'aaffff','e35462': 'ff0000','e25874': 'ff0055', + 'e16aa3': 'ff00aa','de83dc': 'ff00ff','e66e6b': 'ff5500', + 'e6727c': 'ff5555','e37fa7': 'ff55aa','e194df': 'ff55ff', + 'f1aa86': 'ffaa00','f1ad93': 'ffaa55','efb5b8': 'ffaaaa', + 'ecc3eb': 'ffaaff','ffeeab': 'ffff00','fff1b5': 'ffff55', + 'fff6d3': 'ffffaa'}; + + this.each(function() { + var $color = $(this); + var $item = $color.parent(); + var grid = ''; + var itemWidth = 100 / layout[0].length; + var itemHeight = 100 / layout.length; + var boxHeight = itemWidth * layout.length; + + for(var i = 0; i < layout.length; i++) { + for(var j = 0; j < layout[i].length; j++) { + + var color = layout[i][j] || ENUMS.COLOR.EMPTY; + var selectable = (color !== ENUMS.COLOR.EMPTY ? ' selectable' : ''); + + var roundedTL = (i === 0 && j === 0) + || i === 0 && !layout[i][j - 1] + || !layout[i][j - 1] && !layout[i -1][j] + ? ' rounded-tl' : ''; + + var roundedTR = i === 0 && !layout[i][j + 1] + || !layout[i][j + 1] && !layout[i -1][j] + ? ' rounded-tr ' : ''; + + var roundedBL = (i === layout.length - 1 && j === 0) + || i === layout.length - 1 && !layout[i][j - 1] + || !layout[i][j - 1] && !layout[i + 1][j] + ? ' rounded-bl' : ''; + + var roundedBR = i === layout.length - 1 && !layout[i][j + 1] + || !layout[i][j + 1] && !layout[i + 1][j] + ? ' rounded-br' : ''; + + if(options.sunny && color !== ENUMS.COLOR.EMPTY) { + color = '#' + mappingSunny[color.replace('#', '').toLowerCase()]; + } + + grid += '' + + ''; + } + } + + var $injectedColor = $('
' + + '' + + '
' + + '
' + + grid + + '
' + + '
' + + '
'); + $item.append($injectedColor); + + var $valueDisplay = $injectedColor.find('.value'); + + $color.on('click', function(ev) { + $item.find('.color-box-wrap').toggleClass('show'); + }); + + $color.on('change', function(ev) { + var value = $(this).val().replace(/^0x/, '').toLowerCase(); + if(options.sunny) { + value = mappingSunny[value]; + } + $valueDisplay.css('background-color', '#' + value); + }); + + $item.find('.color-box.selectable').on('click', function(ev) { + ev.preventDefault(); + + var value = $(this).data('value').toLowerCase(); + if(options.sunny) { + $color.val('0x' + mappingNormal[value.replace(/^0x/, '')]).trigger('change'); + } else { + $color.val(value).trigger('change'); + } + $valueDisplay.css('background-color', value.replace(/^0x/, '#')); + $item.find('.color-box-wrap').removeClass('show'); + }) + + }); + }, + + tab: function() { + this.each(function() { + var $tab = $(this); + + $tab.click(function() { + var $current = $(this); + var name = $current.attr('name'); + + $('a[name=' + name + ']').each(function(){ + $(this).removeClass('active'); + }); + + $current.addClass('active'); + }); + }); + }, + + itemSlider: function() { + this.each(function() { + var $slider = $(this); + var name = $slider.attr('name'); + var $input = $('input[name=' + name + '][class=item-input]'); + + $slider.on('input', function() { + var $current = $(this); + $input.val($current.val()); + }); + + $input.change(function() { + var $current = $(this); + $slider.val($current.val()); + }); + }); + }, + + itemDraggableList: function() { + this.each(function() { + var $handlebar = '
' + + '
' + + '
' + + '
' + + '
'; + + $(this).children('label').append($handlebar); + + Sortable.create(this, { + handle: '.item-draggable-handle' + }); + }); + }, + + itemDynamicList: function() { + this.each(function() { + var $list = $(this); + + $list.children('label').each(function() { + var $deleteButton = $('
'); + + $deleteButton.click(function() { + $(this).parent().remove(); + }); + + $(this).append($deleteButton); + }); + + var $addButton = $('
Add one more...
'); + + $list.append($addButton); + + $addButton.click(function() { + var $inbox = $('
' + + '
' + + '' + + '
' + + '
'); + + $inbox.insertBefore($list.children().last()); + + var $input = $inbox.find('input'); + $input.focus(); + + $input.keypress(function(e) { + var key = e.which; + if (key === 13) { + stopEditing($input, $inbox); + } + }); + + $input.focusout(function() { + stopEditing($input, $inbox); + }); + + function stopEditing(input, inbox) { + var text = input.val(); + inbox.html(text); + + var deletebutton = $('
'); + + deletebutton.click(function(){ + $(this).parent().remove(); + }); + + inbox.append(deletebutton); + } + }); + }); + } + }); + + $(function() { + $('.item-toggle').itemToggle(); + $('.item-checkbox').itemCheckbox(); + $('.item-select').itemSelect(); + $('.item-date').itemDate(); + $('.item-time').itemTime(); + $('.item-radio').itemRadio(); + $('.item-color-normal').itemColor({sunny: false}); + $('.item-color-sunny').itemColor({sunny: true}); + $('.tab-button').tab(); + $('.item-slider').itemSlider(); + $('.item-draggable-list').itemDraggableList(); + $('.item-dynamic-list').itemDynamicList(); + }); +}(Zepto, Sortable)); diff --git a/vendor/pebble-slate/dist/js/slate.min.js b/vendor/pebble-slate/dist/js/slate.min.js new file mode 100644 index 0000000..5ccd17e --- /dev/null +++ b/vendor/pebble-slate/dist/js/slate.min.js @@ -0,0 +1,2 @@ +!function(t){"use strict";"function"==typeof define&&define.amd?define(t):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=t():"undefined"!=typeof Package?Sortable=t():window.Sortable=t()}(function(){"use strict";function t(t,e){this.el=t,this.options=e=v({},e),t[P]=this;var i={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(t.nodeName)?"li":">*",ghostClass:"sortable-ghost",ignore:"a, img",filter:null,animation:0,setData:function(t,e){t.setData("Text",e.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0};for(var a in i)!(a in e)&&(e[a]=i[a]);var o=e.group;o&&"object"==typeof o||(o=e.group={name:o}),["pull","put"].forEach(function(t){t in o||(o[t]=!0)}),e.groups=" "+o.name+(o.put.join?" "+o.put.join(" "):"")+" ";for(var s in this)"_"===s.charAt(0)&&(this[s]=n(this,this[s]));r(t,"mousedown",this._onTapStart),r(t,"touchstart",this._onTapStart),r(t,"dragover",this),r(t,"dragenter",this),z.push(this._onDragOver),e.store&&this.sort(e.store.get(this))}function e(t){b&&b.state!==t&&(c(b,"display",t?"none":""),!t&&b.state&&x.insertBefore(b,g),b.state=t)}function n(t,e){var n=$.call(arguments,2);return e.bind?e.bind.apply(e,[t].concat(n)):function(){return e.apply(t,n.concat($.call(arguments)))}}function i(t,e,n){if(t){n=n||k,e=e.split(".");var i=e.shift().toUpperCase(),a=new RegExp("\\s("+e.join("|")+")\\s","g");do if(">*"===i&&t.parentNode===n||(""===i||t.nodeName.toUpperCase()==i)&&(!e.length||((" "+t.className+" ").match(a)||[]).length==e.length))return t;while(t!==n&&(t=t.parentNode))}return null}function a(t){t.dataTransfer.dropEffect="move",t.preventDefault()}function r(t,e,n){t.addEventListener(e,n,!1)}function o(t,e,n){t.removeEventListener(e,n,!1)}function s(t,e,n){if(t)if(t.classList)t.classList[n?"add":"remove"](e);else{var i=(" "+t.className+" ").replace(O," ").replace(" "+e+" "," ");t.className=(i+(n?" "+e:"")).replace(O," ")}}function c(t,e,n){var i=t&&t.style;if(i){if(void 0===n)return k.defaultView&&k.defaultView.getComputedStyle?n=k.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),void 0===e?n:n[e];e in i||(e="-webkit-"+e),i[e]=n+("string"==typeof n?"":"px")}}function f(t,e,n){if(t){var i=t.getElementsByTagName(e),a=0,r=i.length;if(n)for(;r>a;a++)n(i[a],a);return i}return[]}function l(t){t.draggable=!1}function u(){B=!1}function h(t,e){var n=t.lastElementChild,i=n.getBoundingClientRect();return e.clientY-(i.top+i.height)>5&&n}function d(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,i=0;n--;)i+=e.charCodeAt(n);return i.toString(36)}function p(t){for(var e=0;t&&(t=t.previousElementSibling);)"TEMPLATE"!==t.nodeName.toUpperCase()&&e++;return e}function m(t,e){var n,i;return function(){void 0===n&&(n=arguments,i=this,setTimeout(function(){1===n.length?t.call(i,n[0]):t.apply(i,n),n=void 0},e))}}function v(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var g,y,b,x,A,w,F,E,C,S,T,D,_,N,j={},O=/\s+/g,P="Sortable"+(new Date).getTime(),L=window,k=L.document,R=L.parseInt,M=!!("draggable"in k.createElement("div")),B=!1,Z=function(t,e,n,i,a,r,o){var s=k.createEvent("Event"),c=(t||e[P]).options,f="on"+n.charAt(0).toUpperCase()+n.substr(1);s.initEvent(n,!0,!0),s.item=i||e,s.from=a||e,s.clone=b,s.oldIndex=r,s.newIndex=o,c[f]&&c[f].call(t,s),e.dispatchEvent(s)},I=Math.abs,$=[].slice,z=[],Y=m(function(t,e,n){if(n&&e.scroll){var i,a,r,o,s=e.scrollSensitivity,c=e.scrollSpeed,f=t.clientX,l=t.clientY,u=window.innerWidth,h=window.innerHeight;if(F!==n&&(w=e.scroll,F=n,w===!0)){w=n;do if(w.offsetWidth=u-f)-(s>=f),o=(s>=h-l)-(s>=l),(r||o)&&(i=L)),(j.vx!==r||j.vy!==o||j.el!==i)&&(j.el=i,j.vx=r,j.vy=o,clearInterval(j.pid),i&&(j.pid=setInterval(function(){i===L?L.scrollTo(L.pageXOffset+r*c,L.pageYOffset+o*c):(o&&(i.scrollTop+=o*c),r&&(i.scrollLeft+=r*c))},24)))}},30);return t.prototype={constructor:t,_onTapStart:function(t){var e=this,n=this.el,a=this.options,r=t.type,o=t.touches&&t.touches[0],s=(o||t).target,c=s,f=a.filter;if(!("mousedown"===r&&0!==t.button||a.disabled)&&(s=i(s,a.draggable,n))){if(S=p(s),"function"==typeof f){if(f.call(this,t,s,this))return Z(e,c,"filter",s,n,S),void t.preventDefault()}else if(f&&(f=f.split(",").some(function(t){return t=i(c,t.trim(),n),t?(Z(e,t,"filter",s,n,S),!0):void 0})))return void t.preventDefault();(!a.handle||i(c,a.handle,n))&&this._prepareDragStart(t,o,s)}},_prepareDragStart:function(t,e,n){var i,a=this,o=a.el,s=a.options,c=o.ownerDocument;n&&!g&&n.parentNode===o&&(_=t,x=o,g=n,A=g.nextSibling,D=s.group,i=function(){a._disableDelayedDrag(),g.draggable=!0,s.ignore.split(",").forEach(function(t){f(g,t.trim(),l)}),a._triggerDragStart(e)},r(c,"mouseup",a._onDrop),r(c,"touchend",a._onDrop),r(c,"touchcancel",a._onDrop),s.delay?(r(c,"mousemove",a._disableDelayedDrag),r(c,"touchmove",a._disableDelayedDrag),a._dragStartTimer=setTimeout(i,s.delay)):i())},_disableDelayedDrag:function(){var t=this.el.ownerDocument;clearTimeout(this._dragStartTimer),o(t,"mousemove",this._disableDelayedDrag),o(t,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(t){t?(_={target:g,clientX:t.clientX,clientY:t.clientY},this._onDragStart(_,"touch")):M?(r(g,"dragend",this),r(x,"dragstart",this._onDragStart)):this._onDragStart(_,!0);try{k.selection?k.selection.empty():window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(){x&&g&&(s(g,this.options.ghostClass,!0),t.active=this,Z(this,x,"start",g,x,S))},_emulateDragOver:function(){if(N){c(y,"display","none");var t=k.elementFromPoint(N.clientX,N.clientY),e=t,n=" "+this.options.group.name,i=z.length;if(e)do{if(e[P]&&e[P].options.groups.indexOf(n)>-1){for(;i--;)z[i]({clientX:N.clientX,clientY:N.clientY,target:t,rootEl:e});break}t=e}while(e=e.parentNode);c(y,"display","")}},_onTouchMove:function(t){if(_){var e=t.touches?t.touches[0]:t,n=e.clientX-_.clientX,i=e.clientY-_.clientY,a=t.touches?"translate3d("+n+"px,"+i+"px,0)":"translate("+n+"px,"+i+"px)";N=e,c(y,"webkitTransform",a),c(y,"mozTransform",a),c(y,"msTransform",a),c(y,"transform",a),t.preventDefault()}},_onDragStart:function(t,e){var n=t.dataTransfer,i=this.options;if(this._offUpEvents(),"clone"==D.pull&&(b=g.cloneNode(!0),c(b,"display","none"),x.insertBefore(b,g)),e){var a,o=g.getBoundingClientRect(),s=c(g);y=g.cloneNode(!0),c(y,"top",o.top-R(s.marginTop,10)),c(y,"left",o.left-R(s.marginLeft,10)),c(y,"width",o.width),c(y,"height",o.height),c(y,"opacity","0.8"),c(y,"position","fixed"),c(y,"zIndex","100000"),x.appendChild(y),a=y.getBoundingClientRect(),c(y,"width",2*o.width-a.width),c(y,"height",2*o.height-a.height),"touch"===e?(r(k,"touchmove",this._onTouchMove),r(k,"touchend",this._onDrop),r(k,"touchcancel",this._onDrop)):(r(k,"mousemove",this._onTouchMove),r(k,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,150)}else n&&(n.effectAllowed="move",i.setData&&i.setData.call(this,n,g)),r(k,"drop",this);setTimeout(this._dragStarted,0)},_onDragOver:function(t){var n,a,r,o=this.el,s=this.options,f=s.group,l=f.put,d=D===f,p=s.sort;if(void 0!==t.preventDefault&&(t.preventDefault(),!s.dragoverBubble&&t.stopPropagation()),D&&!s.disabled&&(d?p||(r=!x.contains(g)):D.pull&&l&&(D.name===f.name||l.indexOf&&~l.indexOf(D.name)))&&(void 0===t.rootEl||t.rootEl===this.el)){if(Y(t,s,this.el),B)return;if(n=i(t.target,s.draggable,o),a=g.getBoundingClientRect(),r)return e(!0),void(b||A?x.insertBefore(g,b||A):p||x.appendChild(g));if(0===o.children.length||o.children[0]===y||o===t.target&&(n=h(o,t))){if(n){if(n.animated)return;v=n.getBoundingClientRect()}e(d),o.appendChild(g),this._animate(a,g),n&&this._animate(v,n)}else if(n&&!n.animated&&n!==g&&void 0!==n.parentNode[P]){E!==n&&(E=n,C=c(n));var m,v=n.getBoundingClientRect(),w=v.right-v.left,F=v.bottom-v.top,S=/left|right|inline/.test(C.cssFloat+C.display),T=n.offsetWidth>g.offsetWidth,_=n.offsetHeight>g.offsetHeight,N=(S?(t.clientX-v.left)/w:(t.clientY-v.top)/F)>.5,j=n.nextElementSibling;B=!0,setTimeout(u,30),e(d),m=S?n.previousElementSibling===g&&!T||N&&T:j!==g&&!_||N&&_,m&&!j?o.appendChild(g):n.parentNode.insertBefore(g,m?j:n),this._animate(a,g),this._animate(v,n)}}},_animate:function(t,e){var n=this.options.animation;if(n){var i=e.getBoundingClientRect();c(e,"transition","none"),c(e,"transform","translate3d("+(t.left-i.left)+"px,"+(t.top-i.top)+"px,0)"),e.offsetWidth,c(e,"transition","all "+n+"ms"),c(e,"transform","translate3d(0,0,0)"),clearTimeout(e.animated),e.animated=setTimeout(function(){c(e,"transition",""),c(e,"transform",""),e.animated=!1},n)}},_offUpEvents:function(){var t=this.el.ownerDocument;o(k,"touchmove",this._onTouchMove),o(t,"mouseup",this._onDrop),o(t,"touchend",this._onDrop),o(t,"touchcancel",this._onDrop)},_onDrop:function(e){var n=this.el,i=this.options;clearInterval(this._loopId),clearInterval(j.pid),clearTimeout(this.dragStartTimer),o(k,"drop",this),o(k,"mousemove",this._onTouchMove),o(n,"dragstart",this._onDragStart),this._offUpEvents(),e&&(e.preventDefault(),!i.dropBubble&&e.stopPropagation(),y&&y.parentNode.removeChild(y),g&&(o(g,"dragend",this),l(g),s(g,this.options.ghostClass,!1),x!==g.parentNode?(T=p(g),Z(null,g.parentNode,"sort",g,x,S,T),Z(this,x,"sort",g,x,S,T),Z(null,g.parentNode,"add",g,x,S,T),Z(this,x,"remove",g,x,S,T)):(b&&b.parentNode.removeChild(b),g.nextSibling!==A&&(T=p(g),Z(this,x,"update",g,x,S,T),Z(this,x,"sort",g,x,S,T))),t.active&&Z(this,x,"end",g,x,S,T)),x=g=y=A=b=w=F=_=N=E=C=D=t.active=null,this.save())},handleEvent:function(t){var e=t.type;"dragover"===e||"dragenter"===e?g&&(this._onDragOver(t),a(t)):("drop"===e||"dragend"===e)&&this._onDrop(t)},toArray:function(){for(var t,e=[],n=this.el.children,a=0,r=n.length,o=this.options;r>a;a++)t=n[a],i(t,o.draggable,this.el)&&e.push(t.getAttribute(o.dataIdAttr)||d(t));return e},sort:function(t){var e={},n=this.el;this.toArray().forEach(function(t,a){var r=n.children[a];i(r,this.options.draggable,n)&&(e[t]=r)},this),t.forEach(function(t){e[t]&&(n.removeChild(e[t]),n.appendChild(e[t]))})},save:function(){var t=this.options.store;t&&t.set(this)},closest:function(t,e){return i(t,e||this.options.draggable,this.el)},option:function(t,e){var n=this.options;return void 0===e?n[t]:void(n[t]=e)},destroy:function(){var t=this.el;t[P]=null,o(t,"mousedown",this._onTapStart),o(t,"touchstart",this._onTapStart),o(t,"dragover",this),o(t,"dragenter",this),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(t){t.removeAttribute("draggable")}),z.splice(z.indexOf(this._onDragOver),1),this._onDrop(),this.el=t=null}},t.utils={on:r,off:o,css:c,find:f,bind:n,is:function(t,e){return!!i(t,e,t)},extend:v,throttle:m,closest:i,toggleClass:s,index:p},t.version="1.2.0",t.create=function(e,n){return new t(e,n)},t});var Zepto=function(){function t(t){return null==t?String(t):q[U.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function i(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function a(e){return"object"==t(e)}function r(t){return a(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function o(t){return"number"==typeof t.length}function s(t){return _.call(t,function(t){return null!=t})}function c(t){return t.length>0?F.fn.concat.apply([],t):t}function f(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function l(t){return t in O?O[t]:O[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function u(t,e){return"number"!=typeof e||P[f(t)]?e:e+"px"}function h(t){var e,n;return j[t]||(e=N.createElement(t),N.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),j[t]=n),j[t]}function d(t){return"children"in t?D.call(t.children):F.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function p(t,e,n){for(w in e)n&&(r(e[w])||G(e[w]))?(r(e[w])&&!r(t[w])&&(t[w]={}),G(e[w])&&!G(t[w])&&(t[w]=[]),p(t[w],e[w],n)):e[w]!==A&&(t[w]=e[w])}function m(t,e){return null==e?F(t):F(t).filter(e)}function v(t,n,i,a){return e(n)?n.call(t,i,a):n}function g(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function y(t,e){var n=t.className||"",i=n&&n.baseVal!==A;return e===A?i?n.baseVal:n:void(i?n.baseVal=e:t.className=e)}function b(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?F.parseJSON(t):t):t}catch(e){return t}}function x(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)x(t.childNodes[n],e)}var A,w,F,E,C,S,T=[],D=T.slice,_=T.filter,N=window.document,j={},O={},P={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},L=/^\s*<(\w+|!)[^>]*>/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,M=/^(?:body|html)$/i,B=/([A-Z])/g,Z=["val","css","html","text","data","width","height","offset"],I=["after","prepend","before","append"],$=N.createElement("table"),z=N.createElement("tr"),Y={tr:N.createElement("tbody"),tbody:$,thead:$,tfoot:$,td:z,th:z,"*":N.createElement("div")},H=/complete|loaded|interactive/,X=/^[\w-]*$/,q={},U=q.toString,V={},W=N.createElement("div"),J={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},G=Array.isArray||function(t){return t instanceof Array};return V.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,a=t.parentNode,r=!a;return r&&(a=W).appendChild(t),i=~V.qsa(a,e).indexOf(t),r&&W.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},S=function(t){return _.call(t,function(e,n){return t.indexOf(e)==n})},V.fragment=function(t,e,n){var i,a,o;return k.test(t)&&(i=F(N.createElement(RegExp.$1))),i||(t.replace&&(t=t.replace(R,"<$1>")),e===A&&(e=L.test(t)&&RegExp.$1),e in Y||(e="*"),o=Y[e],o.innerHTML=""+t,i=F.each(D.call(o.childNodes),function(){o.removeChild(this)})),r(n)&&(a=F(i),F.each(n,function(t,e){Z.indexOf(t)>-1?a[t](e):a.attr(t,e)})),i},V.Z=function(t,e){return t=t||[],t.__proto__=F.fn,t.selector=e||"",t},V.isZ=function(t){return t instanceof V.Z},V.init=function(t,n){var i;if(!t)return V.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&L.test(t))i=V.fragment(t,RegExp.$1,n),t=null;else{if(n!==A)return F(n).find(t);i=V.qsa(N,t)}else{if(e(t))return F(N).ready(t);if(V.isZ(t))return t;if(G(t))i=s(t);else if(a(t))i=[t],t=null;else if(L.test(t))i=V.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==A)return F(n).find(t);i=V.qsa(N,t)}}return V.Z(i,t)},F=function(t,e){return V.init(t,e)},F.extend=function(t){var e,n=D.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){p(t,n,e)}),t},V.qsa=function(t,e){var n,a="#"==e[0],r=!a&&"."==e[0],o=a||r?e.slice(1):e,s=X.test(o);return i(t)&&s&&a?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:D.call(s&&!a?r?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},F.contains=N.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},F.type=t,F.isFunction=e,F.isWindow=n,F.isArray=G,F.isPlainObject=r,F.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},F.inArray=function(t,e,n){return T.indexOf.call(e,t,n)},F.camelCase=C,F.trim=function(t){return null==t?"":String.prototype.trim.call(t)},F.uuid=0,F.support={},F.expr={},F.map=function(t,e){var n,i,a,r=[];if(o(t))for(i=0;i=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return T.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):F(_.call(this,function(e){return V.matches(e,t)}))},add:function(t,e){return F(S(this.concat(F(t,e))))},is:function(t){return this.length>0&&V.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==A)this.each(function(e){t.call(this,e)||n.push(this)});else{var i="string"==typeof t?this.filter(t):o(t)&&e(t.item)?D.call(t):F(t);this.forEach(function(t){i.indexOf(t)<0&&n.push(t)})}return F(n)},has:function(t){return this.filter(function(){return a(t)?F.contains(this,t):F(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!a(t)?t:F(t)},last:function(){var t=this[this.length-1];return t&&!a(t)?t:F(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?F(t).filter(function(){var t=this;return T.some.call(n,function(e){return F.contains(e,t)})}):1==this.length?F(V.qsa(this[0],t)):this.map(function(){return V.qsa(this,t)}):F()},closest:function(t,e){var n=this[0],a=!1;for("object"==typeof t&&(a=F(t));n&&!(a?a.indexOf(n)>=0:V.matches(n,t));)n=n!==e&&!i(n)&&n.parentNode;return F(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=F.map(n,function(t){return(t=t.parentNode)&&!i(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return m(e,t)},parent:function(t){return m(S(this.pluck("parentNode")),t)},children:function(t){return m(this.map(function(){return d(this)}),t)},contents:function(){return this.map(function(){return D.call(this.childNodes)})},siblings:function(t){return m(this.map(function(t,e){return _.call(d(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return F.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=h(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var i=F(t).get(0),a=i.parentNode||this.length>1;return this.each(function(e){F(this).wrapAll(n?t.call(this,e):a?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){F(this[0]).before(t=F(t));for(var e;(e=t.children()).length;)t=e.first();F(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var i=F(this),a=i.contents(),r=n?t.call(this,e):t;a.length?a.wrapAll(r):i.append(r)})},unwrap:function(){return this.parent().each(function(){F(this).replaceWith(F(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=F(this);(t===A?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return F(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return F(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;F(this).empty().append(v(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=v(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(a(t))for(w in t)g(this,w,t[w]);else g(this,t,v(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:A},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){g(this,t)},this)})},prop:function(t,e){return t=J[t]||t,1 in arguments?this.each(function(n){this[t]=v(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(B,"-$1").toLowerCase(),i=1 in arguments?this.attr(n,e):this.attr(n);return null!==i?b(i):A},val:function(t){return 0 in arguments?this.each(function(e){this.value=v(this,t,e,this.value)}):this[0]&&(this[0].multiple?F(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=F(this),i=v(this,t,e,n.offset()),a=n.offsetParent().offset(),r={top:i.top-a.top,left:i.left-a.left};"static"==n.css("position")&&(r.position="relative"),n.css(r)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var i,a=this[0];if(!a)return;if(i=getComputedStyle(a,""),"string"==typeof e)return a.style[C(e)]||i.getPropertyValue(e);if(G(e)){var r={};return F.each(e,function(t,e){r[e]=a.style[C(e)]||i.getPropertyValue(e)}),r}}var o="";if("string"==t(e))n||0===n?o=f(e)+":"+u(e,n):this.each(function(){this.style.removeProperty(f(e))});else for(w in e)e[w]||0===e[w]?o+=f(w)+":"+u(w,e[w])+";":this.each(function(){this.style.removeProperty(f(w))});return this.each(function(){this.style.cssText+=";"+o})},index:function(t){return t?this.indexOf(F(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?T.some.call(this,function(t){return this.test(y(t))},l(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){E=[];var n=y(this),i=v(this,t,e,n);i.split(/\s+/g).forEach(function(t){F(this).hasClass(t)||E.push(t)},this),E.length&&y(this,n+(n?" ":"")+E.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===A)return y(this,"");E=y(this),v(this,t,e,E).split(/\s+/g).forEach(function(t){E=E.replace(l(t)," ")}),y(this,E.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var i=F(this),a=v(this,t,n,y(this));a.split(/\s+/g).forEach(function(t){(e===A?!i.hasClass(t):e)?i.addClass(t):i.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===A?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===A?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),i=M.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(F(t).css("margin-top"))||0,n.left-=parseFloat(F(t).css("margin-left"))||0,i.top+=parseFloat(F(e[0]).css("border-top-width"))||0,i.left+=parseFloat(F(e[0]).css("border-left-width"))||0,{top:n.top-i.top,left:n.left-i.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||N.body;t&&!M.test(t.nodeName)&&"static"==F(t).css("position");)t=t.offsetParent;return t})}},F.fn.detach=F.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});F.fn[t]=function(a){var r,o=this[0];return a===A?n(o)?o["inner"+e]:i(o)?o.documentElement["scroll"+e]:(r=this.offset())&&r[t]:this.each(function(e){o=F(this),o.css(t,v(this,a,e,o[t]()))})}}),I.forEach(function(e,n){var i=n%2;F.fn[e]=function(){var e,a,r=F.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:V.fragment(n)}),o=this.length>1;return r.length<1?this:this.each(function(t,e){a=i?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=F.contains(N.documentElement,a);r.forEach(function(t){if(o)t=t.cloneNode(!0);else if(!a)return F(t).remove();a.insertBefore(t,e),s&&x(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},F.fn[i?e+"To":"insert"+(n?"Before":"After")]=function(t){return F(t)[e](this),this}}),V.Z.prototype=F.fn,V.uniq=S,V.deserializeValue=b,F.zepto=V,F}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function e(t){return t._zid||(t._zid=h++)}function n(t,n,r,o){if(n=i(n),n.ns)var s=a(n.ns);return(v[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!s.test(t.ns)||r&&e(t.fn)!==e(r)||o&&t.sel!=o)})}function i(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function a(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function r(t,e){return t.del&&!y&&t.e in b||!!e}function o(t){return x[t]||y&&b[t]||t}function s(n,a,s,c,l,h,d){var p=e(n),m=v[p]||(v[p]=[]);a.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var a=i(e);a.fn=s,a.sel=l,a.e in x&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?a.fn.apply(this,arguments):void 0}),a.del=h;var p=h||s;a.proxy=function(t){if(t=f(t),!t.isImmediatePropagationStopped()){t.data=c;var e=p.apply(n,t._args==u?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},a.i=m.length,m.push(a),"addEventListener"in n&&n.addEventListener(o(a.e),a.proxy,r(a,d))})}function c(t,i,a,s,c){var f=e(t);(i||"").split(/\s/).forEach(function(e){n(t,e,a,s).forEach(function(e){delete v[f][e.i],"removeEventListener"in t&&t.removeEventListener(o(e.e),e.proxy,r(e,c))})})}function f(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(E,function(t,i){var a=n[t];e[t]=function(){return this[i]=A,a&&a.apply(n,arguments)},e[i]=w}),(n.defaultPrevented!==u?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=A)),e}function l(t){var e,n={originalEvent:t};for(e in t)F.test(e)||t[e]===u||(n[e]=t[e]);return f(n,t)}var u,h=1,d=Array.prototype.slice,p=t.isFunction,m=function(t){return"string"==typeof t},v={},g={},y="onfocusin"in window,b={focus:"focusin",blur:"focusout"},x={mouseenter:"mouseover",mouseleave:"mouseout"};g.click=g.mousedown=g.mouseup=g.mousemove="MouseEvents",t.event={add:s,remove:c},t.proxy=function(n,i){var a=2 in arguments&&d.call(arguments,2);if(p(n)){var r=function(){return n.apply(i,a?a.concat(d.call(arguments)):arguments)};return r._zid=e(n),r}if(m(i))return a?(a.unshift(n[i],n),t.proxy.apply(null,a)):t.proxy(n[i],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var A=function(){return!0},w=function(){return!1},F=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,i,a,r){var o,f,h=this;return e&&!m(e)?(t.each(e,function(t,e){h.on(t,n,i,e,r)}),h):(m(n)||p(a)||a===!1||(a=i,i=n,n=u),(p(i)||i===!1)&&(a=i,i=u),a===!1&&(a=w),h.each(function(u,h){r&&(o=function(t){return c(h,t.type,a),a.apply(this,arguments)}),n&&(f=function(e){var i,r=t(e.target).closest(n,h).get(0);return r&&r!==h?(i=t.extend(l(e),{currentTarget:r,liveFired:h}),(o||a).apply(r,[i].concat(d.call(arguments,1)))):void 0}),s(h,e,a,i,n,f||o)}))},t.fn.off=function(e,n,i){var a=this;return e&&!m(e)?(t.each(e,function(t,e){a.off(t,n,e)}),a):(m(n)||p(i)||i===!1||(i=n,n=u),i===!1&&(i=w),a.each(function(){c(this,e,i,n)}))},t.fn.trigger=function(e,n){return e=m(e)||t.isPlainObject(e)?t.Event(e):f(e),e._args=n,this.each(function(){e.type in b&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,i){var a,r;return this.each(function(o,s){a=l(m(e)?t.Event(e):e),a._args=i,a.target=s,t.each(n(s,e.type||e),function(t,e){return r=e.proxy(a),a.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){m(t)||(e=t,t=e.type);var n=document.createEvent(g[t]||"Events"),i=!0;if(e)for(var a in e)"bubbles"==a?i=!!e[a]:n[a]=e[a];return n.initEvent(t,i,!0),f(n)}}(Zepto),function(t){function e(e,n,i){var a=t.Event(n);return t(e).trigger(a,i),!a.isDefaultPrevented()}function n(t,n,i,a){return t.global?e(n||y,i,a):void 0}function i(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function a(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function r(t,e){var i=e.context;return e.beforeSend.call(i,t,e)===!1||n(e,i,"ajaxBeforeSend",[t,e])===!1?!1:void n(e,i,"ajaxSend",[t,e])}function o(t,e,i,a){var r=i.context,o="success";i.success.call(r,t,o,e),a&&a.resolveWith(r,[t,o,e]),n(i,r,"ajaxSuccess",[e,i,t]),c(o,e,i)}function s(t,e,i,a,r){var o=a.context;a.error.call(o,i,e,t),r&&r.rejectWith(o,[i,e,t]),n(a,o,"ajaxError",[i,a,t||e]),c(e,i,a)}function c(t,e,i){var r=i.context;i.complete.call(r,e,t),n(i,r,"ajaxComplete",[e,i]),a(i)}function f(){}function l(t){return t&&(t=t.split(";",2)[0]),t&&(t==F?"html":t==w?"json":x.test(t)?"script":A.test(t)&&"xml")||"text"}function u(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function h(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=u(e.url,e.data),e.data=void 0)}function d(e,n,i,a){return t.isFunction(n)&&(a=i,i=n,n=void 0),t.isFunction(i)||(a=i,i=void 0),{url:e,data:n,success:i,dataType:a}}function p(e,n,i,a){var r,o=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,c){r=t.type(c),a&&(n=i?a:a+"["+(s||"object"==r||"array"==r?n:"")+"]"),!a&&o?e.add(c.name,c.value):"array"==r||!i&&"object"==r?p(e,c,i,n):e.add(n,c)})}var m,v,g=0,y=window.document,b=/)<[^<]*)*<\/script>/gi,x=/^(?:text|application)\/javascript/i,A=/^(?:text|application)\/xml/i,w="application/json",F="text/html",E=/^\s*$/,C=y.createElement("a");C.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var i,a,c=e.jsonpCallback,f=(t.isFunction(c)?c():c)||"jsonp"+ ++g,l=y.createElement("script"),u=window[f],h=function(e){t(l).triggerHandler("error",e||"abort")},d={abort:h};return n&&n.promise(d),t(l).on("load error",function(r,c){clearTimeout(a),t(l).off().remove(),"error"!=r.type&&i?o(i[0],d,e,n):s(null,c||"error",d,e,n),window[f]=u,i&&t.isFunction(u)&&u(i[0]),u=i=void 0}),r(d,e)===!1?(h("abort"),d):(window[f]=function(){i=arguments},l.src=e.url.replace(/\?(.+)=\?/,"?$1="+f),y.head.appendChild(l),e.timeout>0&&(a=setTimeout(function(){h("timeout")},e.timeout)),d)},t.ajaxSettings={ +type:"GET",beforeSend:f,success:f,error:f,complete:f,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:w,xml:"application/xml, text/xml",html:F,html:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,a=t.extend({},e||{}),c=t.Deferred&&t.Deferred();for(m in t.ajaxSettings)void 0===a[m]&&(a[m]=t.ajaxSettings[m]);i(a),a.crossDomain||(n=y.createElement("a"),n.href=a.url,n.href=n.href,a.crossDomain=C.protocol+"//"+C.host!=n.protocol+"//"+n.host),a.url||(a.url=window.location.toString()),h(a);var d=a.dataType,p=/\?.+=\?/.test(a.url);if(p&&(d="jsonp"),a.cache!==!1&&(e&&e.cache===!0||"script"!=d&&"jsonp"!=d)||(a.url=u(a.url,"_="+Date.now())),"jsonp"==d)return p||(a.url=u(a.url,a.jsonp?a.jsonp+"=?":a.jsonp===!1?"":"callback=?")),t.ajaxJSONP(a,c);var g,b=a.accepts[d],x={},A=function(t,e){x[t.toLowerCase()]=[t,e]},w=/^([\w-]+:)\/\//.test(a.url)?RegExp.$1:window.location.protocol,F=a.xhr(),S=F.setRequestHeader;if(c&&c.promise(F),a.crossDomain||A("X-Requested-With","XMLHttpRequest"),A("Accept",b||"*/*"),(b=a.mimeType||b)&&(b.indexOf(",")>-1&&(b=b.split(",",2)[0]),F.overrideMimeType&&F.overrideMimeType(b)),(a.contentType||a.contentType!==!1&&a.data&&"GET"!=a.type.toUpperCase())&&A("Content-Type",a.contentType||"application/x-www-form-urlencoded"),a.headers)for(v in a.headers)A(v,a.headers[v]);if(F.setRequestHeader=A,F.onreadystatechange=function(){if(4==F.readyState){F.onreadystatechange=f,clearTimeout(g);var e,n=!1;if(F.status>=200&&F.status<300||304==F.status||0==F.status&&"file:"==w){d=d||l(a.mimeType||F.getResponseHeader("content-type")),e=F.responseText;try{"script"==d?(1,eval)(e):"xml"==d?e=F.responseXML:"json"==d&&(e=E.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?s(n,"parsererror",F,a,c):o(e,F,a,c)}else s(F.statusText||null,F.status?"error":"abort",F,a,c)}},r(F,a)===!1)return F.abort(),s(null,"abort",F,a,c),F;if(a.xhrFields)for(v in a.xhrFields)F[v]=a.xhrFields[v];var T="async"in a?a.async:!0;F.open(a.type,a.url,T,a.username,a.password);for(v in x)S.apply(F,x[v]);return a.timeout>0&&(g=setTimeout(function(){F.onreadystatechange=f,F.abort(),s(null,"timeout",F,a,c)},a.timeout)),F.send(a.data?a.data:null),F},t.get=function(){return t.ajax(d.apply(null,arguments))},t.post=function(){var e=d.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=d.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,o=e.split(/\s/),s=d(e,n,i),c=s.success;return o.length>1&&(s.url=o[0],a=o[1]),s.success=function(e){r.html(a?t("
").html(e.replace(b,"")).find(a):e),c&&c.apply(r,arguments)},t.ajax(s),this};var S=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(S(e)+"="+S(n))},p(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n,i=[],a=function(t){return t.forEach?t.forEach(a):void i.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(i,r){n=r.type,e=r.name,e&&"fieldset"!=r.nodeName.toLowerCase()&&!r.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||r.checked)&&a(t(r).val())}),i},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto),function(t,e){var n={COLOR:{EMPTY:"transparent"}};t.extend(t.fn,{itemToggle:function(){this.each(function(){var e=t(this),n=e.parent(),i=t('
');n.append(i)})},itemCheckbox:function(){this.each(function(){var e=t(this),n=e.parent(),i=t('
');n.append(i)})},itemSelect:function(){this.each(function(){var e=t(this),n=e.parent();n.append('
')})},itemDate:function(){this.each(function(){function e(){a.html(n.val())}var n=t(this),i=n.parent(),a=t('
');e(),i.append(a),n.change(function(){e()})})},itemTime:function(){this.each(function(){function e(){a.html(n.val())}var n=t(this),i=n.parent(),a=t('
');e(),i.append(a),n.change(function(){e()})})},itemRadio:function(){this.each(function(){var e=t(this),n=e.parent(),i=t('
');n.append(i)})},itemColor:function(e){var e=t.extend({},{sunny:!1},e||{}),i=[[!1,!1,"#55FF00","#AAFF55",!1,"#FFFF55","#FFFFAA",!1,!1],[!1,"#AAFFAA","#55FF55","#00FF00","#AAFF00","#FFFF00","#FFAA55","#FFAAAA",!1],["#55FFAA","#00FF55","#00AA00","#55AA00","#AAAA55","#AAAA00","#FFAA00","#FF5500","#FF5555"],["#AAFFFF","#00FFAA","#00AA55","#55AA55","#005500","#555500","#AA5500","#FF0000","#FF0055"],[!1,"#55AAAA","#00AAAA","#005555","#FFFFFF","#000000","#AA5555","#AA0000",!1],["#55FFFF","#00FFFF","#00AAFF","#0055AA","#AAAAAA","#555555","#550000","#AA0055","#FF55AA"],["#55AAFF","#0055FF","#0000FF","#0000AA","#000055","#550055","#AA00AA","#FF00AA","#FFAAFF"],[!1,"#5555AA","#5555FF","#5500FF","#5500AA","#AA00FF","#FF00FF","#FF55FF",!1],[!1,!1,!1,"#AAAAFF","#AA55FF","#AA55AA",!1,!1,!1]],a={"000000":"000000","000055":"001e41","0000aa":"004387","0000ff":"0068ca","005500":"2b4a2c","005555":"27514f","0055aa":"16638d","0055ff":"007dce","00aa00":"5e9860","00aa55":"5c9b72","00aaaa":"57a5a2","00aaff":"4cb4db","00ff00":"8ee391","00ff55":"8ee69e","00ffaa":"8aebc0","00ffff":"84f5f1",550000:"4a161b",550055:"482748","5500aa":"40488a","5500ff":"2f6bcc",555500:"564e36",555555:"545454","5555aa":"4f6790","5555ff":"4180d0","55aa00":"759a64","55aa55":"759d76","55aaaa":"71a6a4","55aaff":"69b5dd","55ff00":"9ee594","55ff55":"9de7a0","55ffaa":"9becc2","55ffff":"95f6f2",aa0000:"99353f",aa0055:"983e5a",aa00aa:"955694",aa00ff:"8f74d2",aa5500:"9d5b4d",aa5555:"9d6064",aa55aa:"9a7099",aa55ff:"9587d5",aaaa00:"afa072",aaaa55:"aea382",aaaaaa:"ababab",ffffff:"ffffff",aaaaff:"a7bae2",aaff00:"c9e89d",aaff55:"c9eaa7",aaffaa:"c7f0c8",aaffff:"c3f9f7",ff0000:"e35462",ff0055:"e25874",ff00aa:"e16aa3",ff00ff:"de83dc",ff5500:"e66e6b",ff5555:"e6727c",ff55aa:"e37fa7",ff55ff:"e194df",ffaa00:"f1aa86",ffaa55:"f1ad93",ffaaaa:"efb5b8",ffaaff:"ecc3eb",ffff00:"ffeeab",ffff55:"fff1b5",ffffaa:"fff6d3"},r={"000000":"000000","001e41":"000055","004387":"0000aa","0068ca":"0000ff","2b4a2c":"005500","27514f":"005555","16638d":"0055aa","007dce":"0055ff","5e9860":"00aa00","5c9b72":"00aa55","57a5a2":"00aaaa","4cb4db":"00aaff","8ee391":"00ff00","8ee69e":"00ff55","8aebc0":"00ffaa","84f5f1":"00ffff","4a161b":"550000",482748:"550055","40488a":"5500aa","2f6bcc":"5500ff","564e36":"555500",545454:"555555","4f6790":"5555aa","4180d0":"5555ff","759a64":"55aa00","759d76":"55aa55","71a6a4":"55aaaa","69b5dd":"55aaff","9ee594":"55ff00","9de7a0":"55ff55","9becc2":"55ffaa","95f6f2":"55ffff","99353f":"aa0000","983e5a":"aa0055",955694:"aa00aa","8f74d2":"aa00ff","9d5b4d":"aa5500","9d6064":"aa5555","9a7099":"aa55aa","9587d5":"aa55ff",afa072:"aaaa00",aea382:"aaaa55",ababab:"aaaaaa",ffffff:"ffffff",a7bae2:"aaaaff",c9e89d:"aaff00",c9eaa7:"aaff55",c7f0c8:"aaffaa",c3f9f7:"aaffff",e35462:"ff0000",e25874:"ff0055",e16aa3:"ff00aa",de83dc:"ff00ff",e66e6b:"ff5500",e6727c:"ff5555",e37fa7:"ff55aa",e194df:"ff55ff",f1aa86:"ffaa00",f1ad93:"ffaa55",efb5b8:"ffaaaa",ecc3eb:"ffaaff",ffeeab:"ffff00",fff1b5:"ffff55",fff6d3:"ffffaa"};this.each(function(){for(var o=t(this),s=o.parent(),c="",f=100/i[0].length,l=100/i.length,u=f*i.length,h=0;h'}var x=t('
'+c+"
");s.append(x);var A=x.find(".value");o.on("click",function(t){s.find(".color-box-wrap").toggleClass("show")}),o.on("change",function(n){var i=t(this).val().replace(/^0x/,"").toLowerCase();e.sunny&&(i=a[i]),A.css("background-color","#"+i)}),s.find(".color-box.selectable").on("click",function(n){n.preventDefault();var i=t(this).data("value").toLowerCase();e.sunny?o.val("0x"+r[i.replace(/^0x/,"")]).trigger("change"):o.val(i).trigger("change"),A.css("background-color",i.replace(/^0x/,"#")),s.find(".color-box-wrap").removeClass("show")})})},tab:function(){this.each(function(){var e=t(this);e.click(function(){var e=t(this),n=e.attr("name");t("a[name="+n+"]").each(function(){t(this).removeClass("active")}),e.addClass("active")})})},itemSlider:function(){this.each(function(){var e=t(this),n=e.attr("name"),i=t("input[name="+n+"][class=item-input]");e.on("input",function(){var e=t(this);i.val(e.val())}),i.change(function(){var n=t(this);e.val(n.val())})})},itemDraggableList:function(){this.each(function(){var n='
';t(this).children("label").append(n),e.create(this,{handle:".item-draggable-handle"})})},itemDynamicList:function(){this.each(function(){var e=t(this);e.children("label").each(function(){var e=t('
');e.click(function(){t(this).parent().remove()}),t(this).append(e)});var n=t('
Add one more...
');e.append(n),n.click(function(){function n(e,n){var i=e.val();n.html(i);var a=t('
');a.click(function(){t(this).parent().remove()}),n.append(a)}var i=t('
');i.insertBefore(e.children().last());var a=i.find("input");a.focus(),a.keypress(function(t){var e=t.which;13===e&&n(a,i)}),a.focusout(function(){n(a,i)})})})}}),t(function(){t(".item-toggle").itemToggle(),t(".item-checkbox").itemCheckbox(),t(".item-select").itemSelect(),t(".item-date").itemDate(),t(".item-time").itemTime(),t(".item-radio").itemRadio(),t(".item-color-normal").itemColor({sunny:!1}),t(".item-color-sunny").itemColor({sunny:!0}),t(".tab-button").tab(),t(".item-slider").itemSlider(),t(".item-draggable-list").itemDraggableList(),t(".item-dynamic-list").itemDynamicList()})}(Zepto,Sortable); diff --git a/vendor/pebble-slate/docs/assets/screenshot.png b/vendor/pebble-slate/docs/assets/screenshot.png new file mode 100644 index 0000000..4dcaccf Binary files /dev/null and b/vendor/pebble-slate/docs/assets/screenshot.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-button.png b/vendor/pebble-slate/docs/assets/slate-button.png new file mode 100644 index 0000000..87fb6ad Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-button.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-checkbox.png b/vendor/pebble-slate/docs/assets/slate-checkbox.png new file mode 100644 index 0000000..538d5d7 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-checkbox.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-date-time-colorpickers.png b/vendor/pebble-slate/docs/assets/slate-date-time-colorpickers.png new file mode 100644 index 0000000..6b7de48 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-date-time-colorpickers.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-draggable.png b/vendor/pebble-slate/docs/assets/slate-draggable.png new file mode 100644 index 0000000..8c47864 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-draggable.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-header-content-footer.png b/vendor/pebble-slate/docs/assets/slate-header-content-footer.png new file mode 100644 index 0000000..6a0075d Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-header-content-footer.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-input-button.png b/vendor/pebble-slate/docs/assets/slate-input-button.png new file mode 100644 index 0000000..8d95a29 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-input-button.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-input.png b/vendor/pebble-slate/docs/assets/slate-input.png new file mode 100644 index 0000000..3042caa Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-input.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-list.png b/vendor/pebble-slate/docs/assets/slate-list.png new file mode 100644 index 0000000..507f59b Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-list.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-paragraph.png b/vendor/pebble-slate/docs/assets/slate-paragraph.png new file mode 100644 index 0000000..d3e29ea Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-paragraph.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-radio.png b/vendor/pebble-slate/docs/assets/slate-radio.png new file mode 100644 index 0000000..eaeb5c4 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-radio.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-slider.png b/vendor/pebble-slate/docs/assets/slate-slider.png new file mode 100644 index 0000000..68c541b Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-slider.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-tab-button.png b/vendor/pebble-slate/docs/assets/slate-tab-button.png new file mode 100644 index 0000000..23aacd2 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-tab-button.png differ diff --git a/vendor/pebble-slate/docs/assets/slate-toggle.png b/vendor/pebble-slate/docs/assets/slate-toggle.png new file mode 100644 index 0000000..4beef31 Binary files /dev/null and b/vendor/pebble-slate/docs/assets/slate-toggle.png differ diff --git a/vendor/pebble-slate/docs/index.html b/vendor/pebble-slate/docs/index.html new file mode 100644 index 0000000..f0e7823 --- /dev/null +++ b/vendor/pebble-slate/docs/index.html @@ -0,0 +1,54 @@ + + + + + + + + Your Project + + + + + + + + + + + + + + + + + + + +
+
+

Your Project

+ +
+
+ + +
+
+ +
+ +
+
+ + + diff --git a/vendor/pebble-slate/docs/template.html b/vendor/pebble-slate/docs/template.html new file mode 100644 index 0000000..27241de --- /dev/null +++ b/vendor/pebble-slate/docs/template.html @@ -0,0 +1,210 @@ + + + + + + + + + +
+
+
+
+ Abilities or he perfectly pretended so strangers be exquisite. Oh to + another chamber pleased imagine do in. Went me rank at last loud shot an + draw. Excellent so to no sincerity smallness. Removal request delight if + on he we. Unaffected in we by apartments astonished to decisively + themselves. Offended ten old consider speaking. +
+
+
+ +
+
Single Item
+
+ +
+ +
+ +
+
Multiple Items
+
+ + + +
+
+ +
+
Date, Time, Colorpickers
+
+ + + + +
+
+ +
+
Checkboxes
+
+ + +
+
+ +
+
Radio Buttons
+
+ + + +
+
+ +
+
Subtitles
+
+ + + +
+
+ +
+
Input Field
+
+ +
+
+ +
+
Tab Buttons
+
+ +
+
+ +
+
Slider
+
+ +
+
+ +
+
Input Field + Send Button
+
+ +
+
+ +
+
draggable Items
+
+
+ + + +
+
+
+ +
+
Item List
+
+
+ + +
+
+
+ +
+
+ +
+
+
+ + + diff --git a/vendor/pebble-slate/external/Sortable/LICENSE.md b/vendor/pebble-slate/external/Sortable/LICENSE.md new file mode 100644 index 0000000..7270203 --- /dev/null +++ b/vendor/pebble-slate/external/Sortable/LICENSE.md @@ -0,0 +1,22 @@ +## MIT LICENSE +Copyright 2013-2015 Lebedev Konstantin +http://rubaxa.github.io/Sortable/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/pebble-slate/external/Sortable/Sortable.min.js b/vendor/pebble-slate/external/Sortable/Sortable.min.js new file mode 100644 index 0000000..6b3c942 --- /dev/null +++ b/vendor/pebble-slate/external/Sortable/Sortable.min.js @@ -0,0 +1,2 @@ +/*! Sortable 1.2.0 - MIT | git://github.com/rubaxa/Sortable.git */ +!function(a){"use strict";"function"==typeof define&&define.amd?define(a):"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=a():"undefined"!=typeof Package?Sortable=a():window.Sortable=a()}(function(){"use strict";function a(a,b){this.el=a,this.options=b=q({},b),a[H]=this;var d={group:Math.random(),sort:!0,disabled:!1,store:null,handle:null,scroll:!0,scrollSensitivity:30,scrollSpeed:10,draggable:/[uo]l/i.test(a.nodeName)?"li":">*",ghostClass:"sortable-ghost",ignore:"a, img",filter:null,animation:0,setData:function(a,b){a.setData("Text",b.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0};for(var e in d)!(e in b)&&(b[e]=d[e]);var g=b.group;g&&"object"==typeof g||(g=b.group={name:g}),["pull","put"].forEach(function(a){a in g||(g[a]=!0)}),b.groups=" "+g.name+(g.put.join?" "+g.put.join(" "):"")+" ";for(var h in this)"_"===h.charAt(0)&&(this[h]=c(this,this[h]));f(a,"mousedown",this._onTapStart),f(a,"touchstart",this._onTapStart),f(a,"dragover",this),f(a,"dragenter",this),Q.push(this._onDragOver),b.store&&this.sort(b.store.get(this))}function b(a){t&&t.state!==a&&(i(t,"display",a?"none":""),!a&&t.state&&u.insertBefore(t,r),t.state=a)}function c(a,b){var c=P.call(arguments,2);return b.bind?b.bind.apply(b,[a].concat(c)):function(){return b.apply(a,c.concat(P.call(arguments)))}}function d(a,b,c){if(a){c=c||J,b=b.split(".");var d=b.shift().toUpperCase(),e=new RegExp("\\s("+b.join("|")+")\\s","g");do if(">*"===d&&a.parentNode===c||(""===d||a.nodeName.toUpperCase()==d)&&(!b.length||((" "+a.className+" ").match(e)||[]).length==b.length))return a;while(a!==c&&(a=a.parentNode))}return null}function e(a){a.dataTransfer.dropEffect="move",a.preventDefault()}function f(a,b,c){a.addEventListener(b,c,!1)}function g(a,b,c){a.removeEventListener(b,c,!1)}function h(a,b,c){if(a)if(a.classList)a.classList[c?"add":"remove"](b);else{var d=(" "+a.className+" ").replace(G," ").replace(" "+b+" "," ");a.className=(d+(c?" "+b:"")).replace(G," ")}}function i(a,b,c){var d=a&&a.style;if(d){if(void 0===c)return J.defaultView&&J.defaultView.getComputedStyle?c=J.defaultView.getComputedStyle(a,""):a.currentStyle&&(c=a.currentStyle),void 0===b?c:c[b];b in d||(b="-webkit-"+b),d[b]=c+("string"==typeof c?"":"px")}}function j(a,b,c){if(a){var d=a.getElementsByTagName(b),e=0,f=d.length;if(c)for(;f>e;e++)c(d[e],e);return d}return[]}function k(a){a.draggable=!1}function l(){M=!1}function m(a,b){var c=a.lastElementChild,d=c.getBoundingClientRect();return b.clientY-(d.top+d.height)>5&&c}function n(a){for(var b=a.tagName+a.className+a.src+a.href+a.textContent,c=b.length,d=0;c--;)d+=b.charCodeAt(c);return d.toString(36)}function o(a){for(var b=0;a&&(a=a.previousElementSibling);)"TEMPLATE"!==a.nodeName.toUpperCase()&&b++;return b}function p(a,b){var c,d;return function(){void 0===c&&(c=arguments,d=this,setTimeout(function(){1===c.length?a.call(d,c[0]):a.apply(d,c),c=void 0},b))}}function q(a,b){if(a&&b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}var r,s,t,u,v,w,x,y,z,A,B,C,D,E,F={},G=/\s+/g,H="Sortable"+(new Date).getTime(),I=window,J=I.document,K=I.parseInt,L=!!("draggable"in J.createElement("div")),M=!1,N=function(a,b,c,d,e,f,g){var h=J.createEvent("Event"),i=(a||b[H]).options,j="on"+c.charAt(0).toUpperCase()+c.substr(1);h.initEvent(c,!0,!0),h.item=d||b,h.from=e||b,h.clone=t,h.oldIndex=f,h.newIndex=g,i[j]&&i[j].call(a,h),b.dispatchEvent(h)},O=Math.abs,P=[].slice,Q=[],R=p(function(a,b,c){if(c&&b.scroll){var d,e,f,g,h=b.scrollSensitivity,i=b.scrollSpeed,j=a.clientX,k=a.clientY,l=window.innerWidth,m=window.innerHeight;if(x!==c&&(w=b.scroll,x=c,w===!0)){w=c;do if(w.offsetWidth=l-j)-(h>=j),g=(h>=m-k)-(h>=k),(f||g)&&(d=I)),(F.vx!==f||F.vy!==g||F.el!==d)&&(F.el=d,F.vx=f,F.vy=g,clearInterval(F.pid),d&&(F.pid=setInterval(function(){d===I?I.scrollTo(I.pageXOffset+f*i,I.pageYOffset+g*i):(g&&(d.scrollTop+=g*i),f&&(d.scrollLeft+=f*i))},24)))}},30);return a.prototype={constructor:a,_onTapStart:function(a){var b=this,c=this.el,e=this.options,f=a.type,g=a.touches&&a.touches[0],h=(g||a).target,i=h,j=e.filter;if(!("mousedown"===f&&0!==a.button||e.disabled)&&(h=d(h,e.draggable,c))){if(A=o(h),"function"==typeof j){if(j.call(this,a,h,this))return N(b,i,"filter",h,c,A),void a.preventDefault()}else if(j&&(j=j.split(",").some(function(a){return a=d(i,a.trim(),c),a?(N(b,a,"filter",h,c,A),!0):void 0})))return void a.preventDefault();(!e.handle||d(i,e.handle,c))&&this._prepareDragStart(a,g,h)}},_prepareDragStart:function(a,b,c){var d,e=this,g=e.el,h=e.options,i=g.ownerDocument;c&&!r&&c.parentNode===g&&(D=a,u=g,r=c,v=r.nextSibling,C=h.group,d=function(){e._disableDelayedDrag(),r.draggable=!0,h.ignore.split(",").forEach(function(a){j(r,a.trim(),k)}),e._triggerDragStart(b)},f(i,"mouseup",e._onDrop),f(i,"touchend",e._onDrop),f(i,"touchcancel",e._onDrop),h.delay?(f(i,"mousemove",e._disableDelayedDrag),f(i,"touchmove",e._disableDelayedDrag),e._dragStartTimer=setTimeout(d,h.delay)):d())},_disableDelayedDrag:function(){var a=this.el.ownerDocument;clearTimeout(this._dragStartTimer),g(a,"mousemove",this._disableDelayedDrag),g(a,"touchmove",this._disableDelayedDrag)},_triggerDragStart:function(a){a?(D={target:r,clientX:a.clientX,clientY:a.clientY},this._onDragStart(D,"touch")):L?(f(r,"dragend",this),f(u,"dragstart",this._onDragStart)):this._onDragStart(D,!0);try{J.selection?J.selection.empty():window.getSelection().removeAllRanges()}catch(b){}},_dragStarted:function(){u&&r&&(h(r,this.options.ghostClass,!0),a.active=this,N(this,u,"start",r,u,A))},_emulateDragOver:function(){if(E){i(s,"display","none");var a=J.elementFromPoint(E.clientX,E.clientY),b=a,c=" "+this.options.group.name,d=Q.length;if(b)do{if(b[H]&&b[H].options.groups.indexOf(c)>-1){for(;d--;)Q[d]({clientX:E.clientX,clientY:E.clientY,target:a,rootEl:b});break}a=b}while(b=b.parentNode);i(s,"display","")}},_onTouchMove:function(a){if(D){var b=a.touches?a.touches[0]:a,c=b.clientX-D.clientX,d=b.clientY-D.clientY,e=a.touches?"translate3d("+c+"px,"+d+"px,0)":"translate("+c+"px,"+d+"px)";E=b,i(s,"webkitTransform",e),i(s,"mozTransform",e),i(s,"msTransform",e),i(s,"transform",e),a.preventDefault()}},_onDragStart:function(a,b){var c=a.dataTransfer,d=this.options;if(this._offUpEvents(),"clone"==C.pull&&(t=r.cloneNode(!0),i(t,"display","none"),u.insertBefore(t,r)),b){var e,g=r.getBoundingClientRect(),h=i(r);s=r.cloneNode(!0),i(s,"top",g.top-K(h.marginTop,10)),i(s,"left",g.left-K(h.marginLeft,10)),i(s,"width",g.width),i(s,"height",g.height),i(s,"opacity","0.8"),i(s,"position","fixed"),i(s,"zIndex","100000"),u.appendChild(s),e=s.getBoundingClientRect(),i(s,"width",2*g.width-e.width),i(s,"height",2*g.height-e.height),"touch"===b?(f(J,"touchmove",this._onTouchMove),f(J,"touchend",this._onDrop),f(J,"touchcancel",this._onDrop)):(f(J,"mousemove",this._onTouchMove),f(J,"mouseup",this._onDrop)),this._loopId=setInterval(this._emulateDragOver,150)}else c&&(c.effectAllowed="move",d.setData&&d.setData.call(this,c,r)),f(J,"drop",this);setTimeout(this._dragStarted,0)},_onDragOver:function(a){var c,e,f,g=this.el,h=this.options,j=h.group,k=j.put,n=C===j,o=h.sort;if(void 0!==a.preventDefault&&(a.preventDefault(),!h.dragoverBubble&&a.stopPropagation()),C&&!h.disabled&&(n?o||(f=!u.contains(r)):C.pull&&k&&(C.name===j.name||k.indexOf&&~k.indexOf(C.name)))&&(void 0===a.rootEl||a.rootEl===this.el)){if(R(a,h,this.el),M)return;if(c=d(a.target,h.draggable,g),e=r.getBoundingClientRect(),f)return b(!0),void(t||v?u.insertBefore(r,t||v):o||u.appendChild(r));if(0===g.children.length||g.children[0]===s||g===a.target&&(c=m(g,a))){if(c){if(c.animated)return;q=c.getBoundingClientRect()}b(n),g.appendChild(r),this._animate(e,r),c&&this._animate(q,c)}else if(c&&!c.animated&&c!==r&&void 0!==c.parentNode[H]){y!==c&&(y=c,z=i(c));var p,q=c.getBoundingClientRect(),w=q.right-q.left,x=q.bottom-q.top,A=/left|right|inline/.test(z.cssFloat+z.display),B=c.offsetWidth>r.offsetWidth,D=c.offsetHeight>r.offsetHeight,E=(A?(a.clientX-q.left)/w:(a.clientY-q.top)/x)>.5,F=c.nextElementSibling;M=!0,setTimeout(l,30),b(n),p=A?c.previousElementSibling===r&&!B||E&&B:F!==r&&!D||E&&D,p&&!F?g.appendChild(r):c.parentNode.insertBefore(r,p?F:c),this._animate(e,r),this._animate(q,c)}}},_animate:function(a,b){var c=this.options.animation;if(c){var d=b.getBoundingClientRect();i(b,"transition","none"),i(b,"transform","translate3d("+(a.left-d.left)+"px,"+(a.top-d.top)+"px,0)"),b.offsetWidth,i(b,"transition","all "+c+"ms"),i(b,"transform","translate3d(0,0,0)"),clearTimeout(b.animated),b.animated=setTimeout(function(){i(b,"transition",""),i(b,"transform",""),b.animated=!1},c)}},_offUpEvents:function(){var a=this.el.ownerDocument;g(J,"touchmove",this._onTouchMove),g(a,"mouseup",this._onDrop),g(a,"touchend",this._onDrop),g(a,"touchcancel",this._onDrop)},_onDrop:function(b){var c=this.el,d=this.options;clearInterval(this._loopId),clearInterval(F.pid),clearTimeout(this.dragStartTimer),g(J,"drop",this),g(J,"mousemove",this._onTouchMove),g(c,"dragstart",this._onDragStart),this._offUpEvents(),b&&(b.preventDefault(),!d.dropBubble&&b.stopPropagation(),s&&s.parentNode.removeChild(s),r&&(g(r,"dragend",this),k(r),h(r,this.options.ghostClass,!1),u!==r.parentNode?(B=o(r),N(null,r.parentNode,"sort",r,u,A,B),N(this,u,"sort",r,u,A,B),N(null,r.parentNode,"add",r,u,A,B),N(this,u,"remove",r,u,A,B)):(t&&t.parentNode.removeChild(t),r.nextSibling!==v&&(B=o(r),N(this,u,"update",r,u,A,B),N(this,u,"sort",r,u,A,B))),a.active&&N(this,u,"end",r,u,A,B)),u=r=s=v=t=w=x=D=E=y=z=C=a.active=null,this.save())},handleEvent:function(a){var b=a.type;"dragover"===b||"dragenter"===b?r&&(this._onDragOver(a),e(a)):("drop"===b||"dragend"===b)&&this._onDrop(a)},toArray:function(){for(var a,b=[],c=this.el.children,e=0,f=c.length,g=this.options;f>e;e++)a=c[e],d(a,g.draggable,this.el)&&b.push(a.getAttribute(g.dataIdAttr)||n(a));return b},sort:function(a){var b={},c=this.el;this.toArray().forEach(function(a,e){var f=c.children[e];d(f,this.options.draggable,c)&&(b[a]=f)},this),a.forEach(function(a){b[a]&&(c.removeChild(b[a]),c.appendChild(b[a]))})},save:function(){var a=this.options.store;a&&a.set(this)},closest:function(a,b){return d(a,b||this.options.draggable,this.el)},option:function(a,b){var c=this.options;return void 0===b?c[a]:void(c[a]=b)},destroy:function(){var a=this.el;a[H]=null,g(a,"mousedown",this._onTapStart),g(a,"touchstart",this._onTapStart),g(a,"dragover",this),g(a,"dragenter",this),Array.prototype.forEach.call(a.querySelectorAll("[draggable]"),function(a){a.removeAttribute("draggable")}),Q.splice(Q.indexOf(this._onDragOver),1),this._onDrop(),this.el=a=null}},a.utils={on:f,off:g,css:i,find:j,bind:c,is:function(a,b){return!!d(a,b,a)},extend:q,throttle:p,closest:d,toggleClass:h,index:o},a.version="1.2.0",a.create=function(b,c){return new a(b,c)},a}); \ No newline at end of file diff --git a/vendor/pebble-slate/external/zepto/zepto.min.js b/vendor/pebble-slate/external/zepto/zepto.min.js new file mode 100644 index 0000000..f45479a --- /dev/null +++ b/vendor/pebble-slate/external/zepto/zepto.min.js @@ -0,0 +1,2 @@ +/* Zepto v1.1.6 - zepto event ajax form ie - zeptojs.com/license */ +var Zepto=function(){function L(t){return null==t?String(t):j[S.call(t)]||"object"}function Z(t){return"function"==L(t)}function _(t){return null!=t&&t==t.window}function $(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function M(t){return D(t)&&!_(t)&&Object.getPrototypeOf(t)==Object.prototype}function R(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function B(n,i,r){for(e in i)r&&(M(i[e])||A(i[e]))?(M(i[e])&&!M(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),B(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function U(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className||"",r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){try{return t?"true"==t||("false"==t?!1:"null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?n.parseJSON(t):t):t}catch(e){return t}}function G(t,e){e(t);for(var n=0,i=t.childNodes.length;i>n;n++)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},S=j.toString,T={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return T.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~T.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},T.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),M(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},T.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},T.isZ=function(t){return t instanceof T.Z},T.init=function(e,i){var r;if(!e)return T.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=T.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=T.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(T.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=T.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=T.qsa(a,e)}}return T.Z(r,e)},n=function(t,e){return T.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){B(t,n,e)}),t},T.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return $(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=a.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},n.type=L,n.isFunction=Z,n.isWindow=_,n.isArray=A,n.isPlainObject=M,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(R(t))for(r=0;r=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return T.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&T.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):R(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e=t?"object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(T.qsa(this[0],t)):this.map(function(){return T.qsa(this,t)}):n()},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:T.matches(i,t));)i=i!==e&&!$(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!$(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return U(e,t)},parent:function(t){return U(N(this.pluck("parentNode")),t)},children:function(t){return U(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return U(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=J(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(n,i){var r;return"string"!=typeof n||1 in arguments?this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))}):this.length&&1===this[0].nodeType?!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:t},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){X(this,t)},this)})},prop:function(t,e){return t=P[t]||t,1 in arguments?this.each(function(n){this[t]=J(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(e,n){var i="data-"+e.replace(m,"-$1").toLowerCase(),r=1 in arguments?this.attr(i,n):this.attr(i);return null!==r?Y(r):t},val:function(t){return 0 in arguments?this.each(function(e){this.value=J(this,t,e,this.value)}):this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(!this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r,o=this[0];if(!o)return;if(r=getComputedStyle(o,""),"string"==typeof t)return o.style[C(t)]||r.getPropertyValue(t);if(A(t)){var s={};return n.each(t,function(t,e){s[e]=o.style[C(e)]||r.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){if("className"in this){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}}):this},removeClass:function(e){return this.each(function(n){if("className"in this){if(e===t)return W(this,"");i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),W(this,i.trim())}})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?_(s)?s["inner"+i]:$(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:T.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,u){o=i?u:u.parentNode,u=0==e?u.nextSibling:1==e?u.firstChild:2==e?u:null;var f=n.contains(a.documentElement,o);r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();o.insertBefore(t,u),f&&G(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),T.Z.prototype=n.fn,T.uniq=N,T.deserializeValue=Y,n.zepto=T,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function S(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){var s=2 in arguments&&i.call(arguments,2);if(r(e)){var a=function(){return e.apply(n,s?s.concat(i.call(arguments)):arguments)};return a._zid=l(e),a}if(o(n))return s?(s.unshift(e[n],e),t.proxy.apply(null,s)):t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(S(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){e.type in f&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=S(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function h(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function p(t,e,i,r){return t.global?h(e||n,i,r):void 0}function d(e){e.global&&0===t.active++&&p(e,null,"ajaxStart")}function m(e){e.global&&!--t.active&&p(e,null,"ajaxStop")}function g(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||p(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void p(e,n,"ajaxSend",[t,e])}function v(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),p(n,r,"ajaxSuccess",[e,n,t]),x(o,e,n)}function y(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),p(i,o,"ajaxError",[n,i,t||e]),x(e,n,i)}function x(t,e,n){var i=n.context;n.complete.call(i,e,t),p(n,i,"ajaxComplete",[e,n]),m(n)}function b(){}function w(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function E(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function j(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=E(e.url,e.data),e.data=void 0)}function S(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function C(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?C(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/,l=n.createElement("a");l.href=window.location.href,t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?v(f[0],l,i,r):y(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),g(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:b,success:b,error:b,complete:b,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,html:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var a,o=t.extend({},e||{}),s=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===o[i]&&(o[i]=t.ajaxSettings[i]);d(o),o.crossDomain||(a=n.createElement("a"),a.href=o.url,a.href=a.href,o.crossDomain=l.protocol+"//"+l.host!=a.protocol+"//"+a.host),o.url||(o.url=window.location.toString()),j(o);var u=o.dataType,f=/\?.+=\?/.test(o.url);if(f&&(u="jsonp"),o.cache!==!1&&(e&&e.cache===!0||"script"!=u&&"jsonp"!=u)||(o.url=E(o.url,"_="+Date.now())),"jsonp"==u)return f||(o.url=E(o.url,o.jsonp?o.jsonp+"=?":o.jsonp===!1?"":"callback=?")),t.ajaxJSONP(o,s);var C,h=o.accepts[u],p={},m=function(t,e){p[t.toLowerCase()]=[t,e]},x=/^([\w-]+:)\/\//.test(o.url)?RegExp.$1:window.location.protocol,S=o.xhr(),T=S.setRequestHeader;if(s&&s.promise(S),o.crossDomain||m("X-Requested-With","XMLHttpRequest"),m("Accept",h||"*/*"),(h=o.mimeType||h)&&(h.indexOf(",")>-1&&(h=h.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(h)),(o.contentType||o.contentType!==!1&&o.data&&"GET"!=o.type.toUpperCase())&&m("Content-Type",o.contentType||"application/x-www-form-urlencoded"),o.headers)for(r in o.headers)m(r,o.headers[r]);if(S.setRequestHeader=m,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=b,clearTimeout(C);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==x){u=u||w(o.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==u?(1,eval)(e):"xml"==u?e=S.responseXML:"json"==u&&(e=c.test(e)?null:t.parseJSON(e))}catch(i){n=i}n?y(n,"parsererror",S,o,s):v(e,S,o,s)}else y(S.statusText||null,S.status?"error":"abort",S,o,s)}},g(S,o)===!1)return S.abort(),y(null,"abort",S,o,s),S;if(o.xhrFields)for(r in o.xhrFields)S[r]=o.xhrFields[r];var N="async"in o?o.async:!0;S.open(o.type,o.url,N,o.username,o.password);for(r in p)T.apply(S,p[r]);return o.timeout>0&&(C=setTimeout(function(){S.onreadystatechange=b,S.abort(),y(null,"timeout",S,o,s)},o.timeout)),S.send(o.data?o.data:null),S},t.get=function(){return t.ajax(S.apply(null,arguments))},t.post=function(){var e=S.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=S.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=S(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("
").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(e,n){var i=[];return i.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(T(e)+"="+T(n))},C(i,e,n),i.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var e,n,i=[],r=function(t){return t.forEach?t.forEach(r):void i.push({name:e,value:t})};return this[0]&&t.each(this[0].elements,function(i,o){n=o.type,e=o.name,e&&"fieldset"!=o.nodeName.toLowerCase()&&!o.disabled&&"submit"!=n&&"reset"!=n&&"button"!=n&&"file"!=n&&("radio"!=n&&"checkbox"!=n||o.checked)&&r(t(o).val())}),i},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(0 in arguments)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto); diff --git a/vendor/pebble-slate/gulpfile.js b/vendor/pebble-slate/gulpfile.js new file mode 100644 index 0000000..e7d289d --- /dev/null +++ b/vendor/pebble-slate/gulpfile.js @@ -0,0 +1,51 @@ +// jshint ignore: start +var gulp = require('gulp'), + rimraf = require('rimraf'), + concat = require('gulp-concat'), + sass = require('gulp-ruby-sass'), + notify = require('gulp-notify'), + uglifycss = require('gulp-uglifycss'), + uglify = require('gulp-uglify'); + +var config = { + srcName: 'main', + libName: 'slate', + fontPath: './lib/fonts', + sassPath: './lib/sass', + extPath: './external', + jsPath: './lib/js', + distPath: './dist' +}; + +gulp.task('clean', function(cb) { + rimraf(config.distPath, cb); +}); + +gulp.task('css', function() { + return sass(config.sassPath + '/' + config.srcName + '.scss') + .on("error", notify.onError(function (error) { + return "Error: " + error.message; + })) + .pipe(concat(config.libName + '.css')) + .pipe(gulp.dest(config.distPath + '/css')) + .pipe(concat(config.libName + '.min.css')) + .pipe(uglifycss()) + .pipe(gulp.dest(config.distPath + '/css')); +}); + +gulp.task('js', function() { + return gulp.src([config.extPath + '/*/*.js', config.jsPath + '/*.js']) + .pipe(concat(config.libName + '.js')) + .pipe(gulp.dest(config.distPath + '/js')) + .pipe(uglify()) + .pipe(concat(config.libName + '.min.js')) + .pipe(gulp.dest(config.distPath + '/js')); +}); + +gulp.task('fonts', function() { + return gulp.src(config.fontPath + '/*') + .pipe(gulp.dest(config.distPath + '/fonts')); +}); + +gulp.task('build', ['css', 'js', 'fonts']); +gulp.task('default', ['build']); diff --git a/vendor/pebble-slate/lib/fonts/PFDinDisplayPro-Light.woff b/vendor/pebble-slate/lib/fonts/PFDinDisplayPro-Light.woff new file mode 100644 index 0000000..1a206ff Binary files /dev/null and b/vendor/pebble-slate/lib/fonts/PFDinDisplayPro-Light.woff differ diff --git a/vendor/pebble-slate/lib/fonts/ptsans-regular.woff b/vendor/pebble-slate/lib/fonts/ptsans-regular.woff new file mode 100644 index 0000000..48d9d3f Binary files /dev/null and b/vendor/pebble-slate/lib/fonts/ptsans-regular.woff differ diff --git a/vendor/pebble-slate/lib/js/main.js b/vendor/pebble-slate/lib/js/main.js new file mode 100644 index 0000000..09f7684 --- /dev/null +++ b/vendor/pebble-slate/lib/js/main.js @@ -0,0 +1,377 @@ +'use strict'; + +(function($, Sortable) { + + var ENUMS = { + COLOR : { + EMPTY: 'transparent' + } + } + + $.extend($.fn, { + itemToggle: function() { + this.each(function() { + var $checkbox = $(this); + var item = $checkbox.parent(); + + var $injectedCheckbox = $('
' + + '
' + + '
' + + '
' + + '
' + + '
' + + '
'); + + item.append($injectedCheckbox); + }); + }, + + itemCheckbox: function() { + this.each(function() { + var $checkbox = $(this); + var item = $checkbox.parent(); + + var $injectedCheckbox = $('
'); + + item.append($injectedCheckbox); + }); + }, + + itemSelect: function() { + this.each(function() { + var $select = $(this); + var $item = $select.parent(); + + $item.append('
'); + }); + }, + + itemDate: function() { + this.each(function() { + var $date = $(this); + var $item = $date.parent(); + + var $injectedDate = $('
'); + updateDate(); + + $item.append($injectedDate); + + $date.change(function() { + updateDate(); + }); + + function updateDate() { + $injectedDate.html($date.val()); + } + }); + }, + + itemTime: function() { + this.each(function() { + var $time = $(this); + var $item = $time.parent(); + + var $injectedTime = $('
'); + updateTime(); + + $item.append($injectedTime); + + $time.change(function() { + updateTime(); + }); + + function updateTime() { + $injectedTime.html($time.val()); + } + }); + }, + + itemRadio: function() { + this.each(function() { + var $radio = $(this); + var $item = $radio.parent(); + + var $injectedRadio = $('
'); + + $item.append($injectedRadio); + }); + }, + + itemColor: function(options){ + + var options = $.extend({}, { + sunny: false + }, options || {}); + + var layout = [ + [false , false , '#55FF00', '#AAFF55', false , '#FFFF55', '#FFFFAA', false , false ], + [false , '#AAFFAA', '#55FF55', '#00FF00', '#AAFF00', '#FFFF00', '#FFAA55', '#FFAAAA', false ], + ['#55FFAA', '#00FF55', '#00AA00', '#55AA00', '#AAAA55', '#AAAA00', '#FFAA00', '#FF5500', '#FF5555'], + ['#AAFFFF', '#00FFAA', '#00AA55', '#55AA55', '#005500', '#555500', '#AA5500', '#FF0000', '#FF0055'], + [false , '#55AAAA', '#00AAAA', '#005555', '#FFFFFF', '#000000', '#AA5555', '#AA0000', false ], + ['#55FFFF', '#00FFFF', '#00AAFF', '#0055AA', '#AAAAAA', '#555555', '#550000', '#AA0055', '#FF55AA'], + ['#55AAFF', '#0055FF', '#0000FF', '#0000AA', '#000055', '#550055', '#AA00AA', '#FF00AA', '#FFAAFF'], + [false , '#5555AA', '#5555FF', '#5500FF', '#5500AA', '#AA00FF', '#FF00FF', '#FF55FF', false ], + [false , false , false , '#AAAAFF', '#AA55FF', '#AA55AA', false , false , false ], + ]; + + var mappingSunny = {'000000': '000000','000055': '001e41','0000aa': '004387', + '0000ff': '0068ca','005500': '2b4a2c','005555': '27514f', + '0055aa': '16638d','0055ff': '007dce','00aa00': '5e9860', + '00aa55': '5c9b72','00aaaa': '57a5a2','00aaff': '4cb4db', + '00ff00': '8ee391','00ff55': '8ee69e','00ffaa': '8aebc0', + '00ffff': '84f5f1','550000': '4a161b','550055': '482748', + '5500aa': '40488a','5500ff': '2f6bcc','555500': '564e36', + '555555': '545454','5555aa': '4f6790','5555ff': '4180d0', + '55aa00': '759a64','55aa55': '759d76','55aaaa': '71a6a4', + '55aaff': '69b5dd','55ff00': '9ee594','55ff55': '9de7a0', + '55ffaa': '9becc2','55ffff': '95f6f2','aa0000': '99353f', + 'aa0055': '983e5a','aa00aa': '955694','aa00ff': '8f74d2', + 'aa5500': '9d5b4d','aa5555': '9d6064','aa55aa': '9a7099', + 'aa55ff': '9587d5','aaaa00': 'afa072','aaaa55': 'aea382', + 'aaaaaa': 'ababab','ffffff': 'ffffff','aaaaff': 'a7bae2', + 'aaff00': 'c9e89d','aaff55': 'c9eaa7','aaffaa': 'c7f0c8', + 'aaffff': 'c3f9f7','ff0000': 'e35462','ff0055': 'e25874', + 'ff00aa': 'e16aa3','ff00ff': 'de83dc','ff5500': 'e66e6b', + 'ff5555': 'e6727c','ff55aa': 'e37fa7','ff55ff': 'e194df', + 'ffaa00': 'f1aa86','ffaa55': 'f1ad93','ffaaaa': 'efb5b8', + 'ffaaff': 'ecc3eb','ffff00': 'ffeeab','ffff55': 'fff1b5', + 'ffffaa': 'fff6d3'}; + + var mappingNormal = {'000000': '000000','001e41': '000055','004387': '0000aa', + '0068ca': '0000ff','2b4a2c': '005500','27514f': '005555', + '16638d': '0055aa','007dce': '0055ff','5e9860': '00aa00', + '5c9b72': '00aa55','57a5a2': '00aaaa','4cb4db': '00aaff', + '8ee391': '00ff00','8ee69e': '00ff55','8aebc0': '00ffaa', + '84f5f1': '00ffff','4a161b': '550000','482748': '550055', + '40488a': '5500aa','2f6bcc': '5500ff','564e36': '555500', + '545454': '555555','4f6790': '5555aa','4180d0': '5555ff', + '759a64': '55aa00','759d76': '55aa55','71a6a4': '55aaaa', + '69b5dd': '55aaff','9ee594': '55ff00','9de7a0': '55ff55', + '9becc2': '55ffaa','95f6f2': '55ffff','99353f': 'aa0000', + '983e5a': 'aa0055','955694': 'aa00aa','8f74d2': 'aa00ff', + '9d5b4d': 'aa5500','9d6064': 'aa5555','9a7099': 'aa55aa', + '9587d5': 'aa55ff','afa072': 'aaaa00','aea382': 'aaaa55', + 'ababab': 'aaaaaa','ffffff': 'ffffff','a7bae2': 'aaaaff', + 'c9e89d': 'aaff00','c9eaa7': 'aaff55','c7f0c8': 'aaffaa', + 'c3f9f7': 'aaffff','e35462': 'ff0000','e25874': 'ff0055', + 'e16aa3': 'ff00aa','de83dc': 'ff00ff','e66e6b': 'ff5500', + 'e6727c': 'ff5555','e37fa7': 'ff55aa','e194df': 'ff55ff', + 'f1aa86': 'ffaa00','f1ad93': 'ffaa55','efb5b8': 'ffaaaa', + 'ecc3eb': 'ffaaff','ffeeab': 'ffff00','fff1b5': 'ffff55', + 'fff6d3': 'ffffaa'}; + + this.each(function() { + var $color = $(this); + var $item = $color.parent(); + var grid = ''; + var itemWidth = 100 / layout[0].length; + var itemHeight = 100 / layout.length; + var boxHeight = itemWidth * layout.length; + + for(var i = 0; i < layout.length; i++) { + for(var j = 0; j < layout[i].length; j++) { + + var color = layout[i][j] || ENUMS.COLOR.EMPTY; + var selectable = (color !== ENUMS.COLOR.EMPTY ? ' selectable' : ''); + + var roundedTL = (i === 0 && j === 0) + || i === 0 && !layout[i][j - 1] + || !layout[i][j - 1] && !layout[i -1][j] + ? ' rounded-tl' : ''; + + var roundedTR = i === 0 && !layout[i][j + 1] + || !layout[i][j + 1] && !layout[i -1][j] + ? ' rounded-tr ' : ''; + + var roundedBL = (i === layout.length - 1 && j === 0) + || i === layout.length - 1 && !layout[i][j - 1] + || !layout[i][j - 1] && !layout[i + 1][j] + ? ' rounded-bl' : ''; + + var roundedBR = i === layout.length - 1 && !layout[i][j + 1] + || !layout[i][j + 1] && !layout[i + 1][j] + ? ' rounded-br' : ''; + + if(options.sunny && color !== ENUMS.COLOR.EMPTY) { + color = '#' + mappingSunny[color.replace('#', '').toLowerCase()]; + } + + grid += '' + + ''; + } + } + + var $injectedColor = $('
' + + '' + + '
' + + '
' + + grid + + '
' + + '
' + + '
'); + $item.append($injectedColor); + + var $valueDisplay = $injectedColor.find('.value'); + + $color.on('click', function(ev) { + $item.find('.color-box-wrap').toggleClass('show'); + }); + + $color.on('change', function(ev) { + var value = $(this).val().replace(/^0x/, '').toLowerCase(); + if(options.sunny) { + value = mappingSunny[value]; + } + $valueDisplay.css('background-color', '#' + value); + }); + + $item.find('.color-box.selectable').on('click', function(ev) { + ev.preventDefault(); + + var value = $(this).data('value').toLowerCase(); + if(options.sunny) { + $color.val('0x' + mappingNormal[value.replace(/^0x/, '')]).trigger('change'); + } else { + $color.val(value).trigger('change'); + } + $valueDisplay.css('background-color', value.replace(/^0x/, '#')); + $item.find('.color-box-wrap').removeClass('show'); + }) + + }); + }, + + tab: function() { + this.each(function() { + var $tab = $(this); + + $tab.click(function() { + var $current = $(this); + var name = $current.attr('name'); + + $('a[name=' + name + ']').each(function(){ + $(this).removeClass('active'); + }); + + $current.addClass('active'); + }); + }); + }, + + itemSlider: function() { + this.each(function() { + var $slider = $(this); + var name = $slider.attr('name'); + var $input = $('input[name=' + name + '][class=item-input]'); + + $slider.on('input', function() { + var $current = $(this); + $input.val($current.val()); + }); + + $input.change(function() { + var $current = $(this); + $slider.val($current.val()); + }); + }); + }, + + itemDraggableList: function() { + this.each(function() { + var $handlebar = '
' + + '
' + + '
' + + '
' + + '
'; + + $(this).children('label').append($handlebar); + + Sortable.create(this, { + handle: '.item-draggable-handle' + }); + }); + }, + + itemDynamicList: function() { + this.each(function() { + var $list = $(this); + + $list.children('label').each(function() { + var $deleteButton = $('
'); + + $deleteButton.click(function() { + $(this).parent().remove(); + }); + + $(this).append($deleteButton); + }); + + var $addButton = $('
Add one more...
'); + + $list.append($addButton); + + $addButton.click(function() { + var $inbox = $('
' + + '
' + + '' + + '
' + + '
'); + + $inbox.insertBefore($list.children().last()); + + var $input = $inbox.find('input'); + $input.focus(); + + $input.keypress(function(e) { + var key = e.which; + if (key === 13) { + stopEditing($input, $inbox); + } + }); + + $input.focusout(function() { + stopEditing($input, $inbox); + }); + + function stopEditing(input, inbox) { + var text = input.val(); + inbox.html(text); + + var deletebutton = $('
'); + + deletebutton.click(function(){ + $(this).parent().remove(); + }); + + inbox.append(deletebutton); + } + }); + }); + } + }); + + $(function() { + $('.item-toggle').itemToggle(); + $('.item-checkbox').itemCheckbox(); + $('.item-select').itemSelect(); + $('.item-date').itemDate(); + $('.item-time').itemTime(); + $('.item-radio').itemRadio(); + $('.item-color-normal').itemColor({sunny: false}); + $('.item-color-sunny').itemColor({sunny: true}); + $('.tab-button').tab(); + $('.item-slider').itemSlider(); + $('.item-draggable-list').itemDraggableList(); + $('.item-dynamic-list').itemDynamicList(); + }); +}(Zepto, Sortable)); diff --git a/vendor/pebble-slate/lib/sass/main.scss b/vendor/pebble-slate/lib/sass/main.scss new file mode 100644 index 0000000..d3384da --- /dev/null +++ b/vendor/pebble-slate/lib/sass/main.scss @@ -0,0 +1,581 @@ +@font-face { + font-family: 'PFDinDisplayProLightWebfont'; + src: url('../fonts/PFDinDisplayPro-Light.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-variant:normal; +} + +@font-face { + font-family: 'PTSansRegularWebfont'; + src: url('../fonts/PTSans-regular.woff') format('woff'); + font-weight: normal; + font-style: normal; + font-variant:normal; +} + +$orange: #FF4700; +$dark-gray: #333333; +$gray: #A8A8A8; +$light-gray: #EAEAEA; +$medium-light-gray: #DEDEDE; +$lighter-gray: #F7F7F7; +$white: #FFFFFF; +$border-radius: 5px; + +@mixin transform($deg) { + -webkit-transform: rotate($deg); + -moz-transform: rotate($deg); + -ms-transform: rotate($deg); + -o-transform: rotate($deg); + transform: rotate($deg); +} + +@mixin user-select($type) { + -webkit-user-select: $type; + -moz-user-select: $type; + -ms-user-select: $type; + user-select: $type; +} + +@mixin appearance($type) { + -webkit-appearance: $type; + -moz-appearance: $type; + -ms-appearance: $type; + appearance: $type; +} + +* { + margin: 0; + padding: 0; +} + +*:focus { + outline-width: 0; +} + +a { + color: $orange; + text-decoration: none; +} + +body { + background-color: $light-gray; + margin-bottom: 15px; + font-size: 1.2em; + line-height: 1.4em; + @include user-select(none !important); +} + +body, select, input[type=text], input[type=time], input[type=date] { + font-family: 'PFDinDisplayPro-Light', PFDinDisplayProLightWebfont, sans-serif; + font-weight: normal; +} + +select, input[type=time], input[type=date] { + @include appearance(none); + border: none; + position: absolute; + top: 13px; + color: $gray; + font-size: 1em; + line-height: 1em; + background-color: $lighter-gray; +} + +input[type=date] { + direction: rtl; +} + +select { + right: 30px; + top: 14px; +} + +input[type=time] { + right: 10px !important; +} + +input[type=date] { + right: 10px !important; +} + +.select-triangle { + position: absolute; + right: 10px; + top: 20px; + width: 0; + height: 0; + border-left: 7px solid transparent; + border-right: 7px solid transparent; + border-top: 7px solid $orange; +} + +.item-container { + color: $dark-gray; + margin-top: 15px; +} + +.item-container-header { + padding: 3px 10px; + text-transform: uppercase; + font-family: 'PT Sans', PTSansRegularWebfont, sans-serif; + font-size: .8em; + font-weight: normal; + color: $gray; +} + +.item-container-content { + background-color: $lighter-gray; + border-top: 1px solid $medium-light-gray; + border-bottom: 1px solid $medium-light-gray; +} + +.item-container-footer { + padding: 3px 10px; + font-size: .7em; + line-height: 1.4em; + color: $gray; +} + +.item { + position: relative; + padding: 10px; + display: block; + overflow: hidden; +} + +.item:not(:first-child) { + border-top: 1px solid $medium-light-gray; +} + +.item-subtitle-wrapper { + font-size: 1em; +} + +.item-subtitle-wrapper .item-styled-toggle-wrapper { + top: 16px; +} + +.item-subtitle-wrapper .item-styled-checkbox { + top: 18px; +} + +.item-subtitle-wrapper .item-styled-radio { + top: 16px; +} + +.item-subtitle-wrapper .item-draggable-handle { + top: 18px; +} + +.item-subtitle { + font-size: .7em; + line-height: .7em; + padding: .3em 0; +} + +.item-styled-toggle-wrapper { + position: absolute; + right: 10px; + top: 8px; + width: 56px; + height: 30px; + border-radius: $border-radius; + transition-timing-function: ease-in-out; + transition-duration: 0.3s; + transition-property: background-color; +} + +.item-styled-toggle { + position: relative; + background-color: $white; + width: 28px; + height: 28px; + border-radius: $border-radius; + top: 1px; + transition-timing-function: ease-in-out; + transition-duration: 0.3s; + transition-property: left; +} + +.item-toggle { + display: none; +} + +.item-toggle + .item-styled-toggle-wrapper { + background-color: $gray; +} + +.item-toggle:checked + .item-styled-toggle-wrapper { + background-color: $orange; +} + +.item-toggle + .item-styled-toggle-wrapper .item-styled-toggle { + left: 1px; +} + +.item-toggle:checked + .item-styled-toggle-wrapper .item-styled-toggle { + left: 27px; +} + +.item-styled-toggle-bar { + width: 3px; + height: 15px; + margin-left: 3px; + background-color: $light-gray; + float: left; + position: relative; + left: 4px; + top: 7px; +} + +.item-styled-checkbox { + position: absolute; + right: 10px; + top: 10px; + width: 21px; + height: 21px; + border-radius: $border-radius; + border-width: 2px; + border-style: solid; +} + +.item-checkbox { + display: none; +} + +.item-checkbox + .item-styled-checkbox { + border-color: $medium-light-gray; +} + +.item-checkbox:checked + .item-styled-checkbox { + border-color: $orange; + background-color: $orange; +} + +.item-checkbox:checked + .item-styled-checkbox:before { + content: ""; + display: block; + position: relative; + left: 7px; + width: 6px; + height: 14px; + border-color: $lighter-gray; + border-width: 0 2px 2px 0; + border-style: solid; + @include transform(45deg); +} + +.item-styled-radio { + position: absolute; + right: 10px; + top: 10px; + width: 21px; + height: 21px; + border-radius: 12px; + border-width: 2px; + border-style: solid; +} + +.item-radio { + display: none; +} + +.item-radio + .item-styled-radio { + border-color: $medium-light-gray; +} + +.item-radio:checked + .item-styled-radio { + border-color: $orange; + background-color: $orange; +} + +.item-radio:checked + .item-styled-radio:before { + content: ""; + display: block; + position: relative; + top: 1px; + left: 6px; + width: 6px; + height: 14px; + border-color: $lighter-gray; + border-width: 0 2px 2px 0; + border-style: solid; + @include transform(45deg); +} + +.item-color { + display:none; +} + +.item-styled-color { + + background: $lighter-gray; + + .value { + position: absolute; + right: 10px; + top: 10px; + width: 56px; + height: 30px; + border-radius: $border-radius; + border-color: $gray; + border-width: 1px; + border-style: solid; + } + + .color-box-wrap { + display:none; + box-sizing: border-box; + position: relative; + height: 0; + width: 100%; + padding: 0 0 100% 0; // overridden with inline style + margin: 0.6em 0 0em; + + &.show { + display: block; + } + + .color-box-container { + position: absolute; + height: 99.97%; + width: 100%; + left: 0; + top: 0; + + .color-box { + float:left; + cursor: pointer; + + &.rounded-tl { + border-top-left-radius: $border-radius; + } + + &.rounded-tr { + border-top-right-radius: $border-radius; + } + + &.rounded-bl { + border-bottom-left-radius: $border-radius; + } + + &.rounded-br { + border-bottom-right-radius: $border-radius; + } + } + + } + } +} + +.item-date, .item-time { + position: absolute; + color: $lighter-gray !important; +} + +.item-styled-date, .item-styled-time { + position: absolute; + top: 13px; + right: 10px; + color: $gray; + font-size: 1em; + line-height: 1em; + background-color: $lighter-gray; +} + +.item-input-wrapper { + border-radius: $border-radius; + border: 2px solid $medium-light-gray; +} + +.item-input-wrapper-button { + box-sizing: border-box; + width: 77%; +} + +.item-input { + border: 0; + background-color: transparent; + padding: 0 10px 7px 10px; + font-size: 13px; + width: 100%; + box-sizing: border-box; +} + +.button-container { + text-align: center; +} + +.item-button { + width: 60%; + height: 35px; + background-color: $orange; + border-radius: $border-radius; + color: white; + font-size: 0.8em; + border: none; + @include appearance(none); +} + +.item-input-button { + position: absolute; + right: 10px; + top: 9px; + width: 20%; +} + +.tab-buttons { + display: table; + width: 100%; + box-sizing: border-box; + table-layout: fixed; +} + +.tab-button { + display: table-cell; + position: relative; + color: $orange; + border: 1px solid $orange; + border-right-width: 0; + font-size: 14px; + padding: 5px 0; + text-align: center; + right: -1px; +} + +.tab-button:first-child { + border-top-left-radius: 5px; + border-bottom-left-radius: 5px; + border-right-width: 0; +} + +.tab-button:last-child { + border-top-right-radius: 5px; + border-bottom-right-radius: 5px; + border-right-width: 1px; +} + +.tab-button.active { + background-color: $orange; + color: $lighter-gray; +} + +.item-slider { + position: relative; + top: 8px; + @include appearance(none); + height: 30px; + width: 79%; + overflow: hidden; + background-color: transparent; + margin-top: -10px; +} + +.item-slider::-webkit-slider-thumb:before { + content: ""; + position: absolute; + top: 11px; + left: -1001px; + height: 2px; + width: 1000px; + background: $orange; +} + +.item-slider::-webkit-slider-thumb { + @include appearance(none); + position: relative; + top: -13px; + height: 28px; + width: 28px; + background-color: $white; + border-radius: $border-radius; + border: 2px solid $light-gray; +} + +.item-slider::-webkit-slider-runnable-track { + height: 2px; + background-color: $medium-light-gray; +} + +.item-slider::-webkit-slider-thumb:after { + content: "lll"; + position: absolute; + left: 4px; + top: 3px; + height: 12px; + width: 10px; + font-weight: normal; + text-align: center; + color: $medium-light-gray; + font-size: 16px; + letter-spacing: 1px; +} + +.item-slider-text { + position: absolute; + top: 6px; + right: 10px; + width: 16%; +} + +.item-slider-text .item-input { + text-align: center; +} + +.delete-item{ + width: 30px; + height: 30px; + right: 5px; + top: 5px; + position: absolute; + border-radius: 6px; +} + +.delete-item:before,.delete-item:after{ + content: ''; + position: absolute; + width: 24px; + height: 2px; + background-color: $gray; + border-radius: 2px; + top: 16px; +} + +.delete-item:before{ + @include transform(45deg); + left: 3px; +} + +.delete-item:after{ + @include transform(-45deg); + right: 3px; +} + +.add-item{ + color: $orange; +} + +.item-draggable-handle { + position: absolute; + right: 5px; + top: 10px; + height: 28px; + width: 28px; +} + +.item-draggable-handle-bar { + margin-top: 5px; + height: 2px; + width: 20px; + background-color: $gray; + text-align: center; +} + +[draggable=true] { + background-color: $lighter-gray; + border: 2px solid $light-gray; + border-radius: 2px; +} + diff --git a/vendor/pebble-slate/package.json b/vendor/pebble-slate/package.json new file mode 100644 index 0000000..ebbf5b2 --- /dev/null +++ b/vendor/pebble-slate/package.json @@ -0,0 +1,29 @@ +{ + "name": "Slate", + "version": "0.0.3", + "description": "Front-end framework for developing Pebble mobile configuration pages.", + "scripts": { + "build": "gulp build" + }, + "repository": { + "type": "git", + "url": "https://github.com/pebble/slate.git" + }, + "keywords": [ + "Pebble" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/pebble/slate/issues" + }, + "homepage": "https://github.com/pebble/slate", + "devDependencies": { + "gulp": "^3.9.0", + "gulp-concat": "^2.5.2", + "gulp-notify": "^2.2.0", + "gulp-ruby-sass": "^1.0.5", + "gulp-uglify": "^1.2.0", + "gulp-uglifycss": "^1.0.4", + "rimraf": "^2.4.0" + } +}