-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
@@ -69,11 +68,13 @@
-
+
diff --git a/js/piskel-packaged-2014-07-12-12-20.js b/js/piskel-packaged-2014-07-12-06-35.js
similarity index 97%
rename from js/piskel-packaged-2014-07-12-12-20.js
rename to js/piskel-packaged-2014-07-12-06-35.js
index c440979d..3b3c7a7c 100644
--- a/js/piskel-packaged-2014-07-12-12-20.js
+++ b/js/piskel-packaged-2014-07-12-06-35.js
@@ -11836,8 +11836,8 @@ var Constants = {
SAVE : 'save'
}
},
- IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-a.appspot.com/__/upload',
- IMAGE_SERVICE_GET_URL : 'http://piskel-imgstore-a.appspot.com/img/',
+ IMAGE_SERVICE_UPLOAD_URL : 'http://piskel-imgstore-b.appspot.com/__/upload',
+ IMAGE_SERVICE_GET_URL : 'http://piskel-imgstore-b.appspot.com/img/',
ZOOMED_OUT_BACKGROUND_COLOR : '#A0A0A0',
@@ -12036,6 +12036,48 @@ if (typeof Function.prototype.bind !== "function") {
return buffer.buffer;
}
};
+})();;(function () {
+ var ns = $.namespace('pskl.utils');
+
+ var BASE64_REGEX = /\s*;\s*base64\s*(?:;|$)/i;
+
+ ns.BlobUtils = {
+ dataToBlob : function(dataURI, type, callback) {
+ var header_end = dataURI.indexOf(","),
+ data = dataURI.substring(header_end + 1),
+ isBase64 = BASE64_REGEX.test(dataURI.substring(0, header_end)),
+ blob;
+
+ if (Blob.fake) {
+ // no reason to decode a data: URI that's just going to become a data URI again
+ blob = new Blob();
+ blob.encoding = isBase64 ? "base64" : "URI";
+ blob.data = data;
+ blob.size = data.length;
+ } else if (Uint8Array) {
+ var blobData = isBase64 ? pskl.utils.Base64.decode(data) : decodeURIComponent(data);
+ blob = new Blob([blobData], {type: type});
+ }
+ callback(blob);
+ },
+
+ canvasToBlob : function(canvas, callback, type /*, ...args*/) {
+ type = type || "image/png";
+
+ if (canvas.mozGetAsFile) {
+ callback(canvas.mozGetAsFile("canvas", type));
+ } else {
+ var args = Array.prototype.slice.call(arguments, 2);
+ var dataURI = canvas.toDataURL.apply(canvas, args);
+ pskl.utils.BlobUtils.dataToBlob(dataURI, type, callback);
+ }
+ },
+
+ stringToBlob : function (string, callback, type) {
+ type = type || "text/plain";
+ pskl.utils.BlobUtils.dataToBlob('data:'+type+',' + string, type, callback);
+ }
+ };
})();;(function () {
var ns = $.namespace("pskl");
@@ -12110,6 +12152,30 @@ if (typeof Function.prototype.bind !== "function") {
})();;(function () {
var ns = $.namespace('pskl.utils');
+ var pad = function (num) {
+ if (num < 10) {
+ return "0" + num;
+ } else {
+ return "" + num;
+ }
+ };
+
+ ns.DateUtils = {
+ format : function (date, format) {
+ date = new Date(date);
+ return pskl.utils.Template.replace(format, {
+ Y : date.getFullYear(),
+ M : pad(date.getMonth() + 1),
+ D : pad(date.getDate()),
+ H : pad(date.getHours()),
+ m : pad(date.getMinutes()),
+ s : pad(date.getSeconds())
+ });
+ }
+ };
+})();;(function () {
+ var ns = $.namespace('pskl.utils');
+
ns.Dom = {
/**
* Check if a given HTML element is nested inside another
@@ -12165,7 +12231,7 @@ if (typeof Function.prototype.bind !== "function") {
reader.readAsDataURL(file);
},
- downloadAsFile : function (filename, content) {
+ downloadAsFile : function (content, filename) {
var saveAs = window.saveAs || (navigator.msSaveBlob && navigator.msSaveBlob.bind(navigator));
if (saveAs) {
saveAs(content, filename);
@@ -12384,43 +12450,6 @@ if (typeof Function.prototype.bind !== "function") {
})();;(function () {
var ns = $.namespace('pskl.utils');
- var BASE64_REGEX = /\s*;\s*base64\s*(?:;|$)/i;
-
- ns.ImageToBlob = {
- imageDataToBlob : function(dataURI, type, callback) {
- var header_end = dataURI.indexOf(","),
- data = dataURI.substring(header_end + 1),
- isBase64 = BASE64_REGEX.test(dataURI.substring(0, header_end)),
- blob;
-
- if (Blob.fake) {
- // no reason to decode a data: URI that's just going to become a data URI again
- blob = new Blob();
- blob.encoding = isBase64 ? "base64" : "URI";
- blob.data = data;
- blob.size = data.length;
- } else if (Uint8Array) {
- var blobData = isBase64 ? pskl.utils.Base64.decode(data) : decodeURIComponent(data);
- blob = new Blob([blobData], {type: type});
- }
- callback(blob);
- },
-
- canvasToBlob : function(canvas, callback, type /*, ...args*/) {
- type = type || "image/png";
-
- if (this.mozGetAsFile) {
- callback(this.mozGetAsFile("canvas", type));
- } else {
- var args = Array.prototype.slice.call(arguments, 2);
- var dataURI = canvas.toDataURL.apply(canvas, args);
- pskl.utils.ImageToBlob.imageDataToBlob(dataURI, type, callback);
- }
- }
- };
-})();;(function () {
- var ns = $.namespace('pskl.utils');
-
ns.ImageResizer = {
resize : function (image, targetWidth, targetHeight, smoothingEnabled) {
var canvas = pskl.CanvasUtils.createCanvas(targetWidth, targetHeight);
@@ -12660,6 +12689,22 @@ if (typeof Function.prototype.bind !== "function") {
return this.calculateZoom(container.height(), container.width(), pictureHeight, pictureWidth);
}
};
+})();;(function () {
+ var ns = $.namespace('pskl.utils');
+
+ ns.PiskelFileUtils = {
+ loadFromFile : function (file, onSuccess, onError) {
+ pskl.utils.FileUtils.readFile(file, function (content) {
+ var rawPiskel = window.atob(content.replace('data:;base64,',''));
+ var serializedPiskel = JSON.parse(rawPiskel);
+ var fps = serializedPiskel.piskel.fps;
+ var descriptor = new pskl.model.piskel.Descriptor(serializedPiskel.piskel.name, serializedPiskel.piskel.description, true);
+ pskl.utils.serialization.Deserializer.deserialize(serializedPiskel, function (piskel) {
+ onSuccess(piskel, descriptor, fps);
+ });
+ });
+ }
+ };
})();;(function () {
var ns = $.namespace("pskl.utils");
var templates = {};
@@ -12683,6 +12728,15 @@ if (typeof Function.prototype.bind !== "function") {
return dummyEl.children[0];
},
+ getAndReplace : function (templateId, dict) {
+ var result = "";
+ var tpl = pskl.utils.Template.get(templateId);
+ if (tpl) {
+ result = pskl.utils.Template.replace(tpl, dict);
+ }
+ return result;
+ },
+
replace : function (template, dict) {
for (var key in dict) {
if (dict.hasOwnProperty(key)) {
@@ -12800,6 +12854,9 @@ if (typeof Function.prototype.bind !== "function") {
return JSON.stringify({
modelVersion : Constants.MODEL_VERSION,
piskel : {
+ name : piskel.getDescriptor().name,
+ description : piskel.getDescriptor().description,
+ fps : pskl.app.piskelController.getFPS(),
height : piskel.getHeight(),
width : piskel.getWidth(),
layers : serializedLayers,
@@ -19047,7 +19104,7 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
})();;(function () {
var ns = $.namespace("pskl.controller.settings");
- var URL_MAX_LENGTH = 60;
+ var URL_MAX_LENGTH = 30;
var MAX_GIF_COLORS = 256;
ns.GifExportController = function (piskelController) {
@@ -19073,12 +19130,12 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
];
ns.GifExportController.prototype.init = function () {
- this.radioTemplate_ = pskl.utils.Template.get("gif-export-radio-template");
+ this.optionTemplate_ = pskl.utils.Template.get("gif-export-option-template");
this.uploadStatusContainerEl = document.querySelector(".gif-upload-status");
this.previewContainerEl = document.querySelector(".gif-export-preview");
- this.radioGroupEl = document.querySelector(".gif-export-radio-group");
+ this.selectResolutionEl = document.querySelector(".gif-export-select-resolution");
this.uploadButton = $(".gif-upload-button");
this.uploadButton.click(this.onUploadButtonClick_.bind(this));
@@ -19091,7 +19148,7 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.exportProgressStatusEl = document.querySelector('.gif-export-progress-status');
this.exportProgressBarEl = document.querySelector('.gif-export-progress-bar');
- this.createRadioElements_();
+ this.createOptionElements_();
};
ns.GifExportController.prototype.onUploadButtonClick_ = function (evt) {
@@ -19109,8 +19166,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.renderAsImageDataAnimatedGIF(zoom, fps, function (imageData) {
pskl.app.imageUploadService.upload(imageData, this.onImageUploadCompleted_.bind(this));
- pskl.utils.ImageToBlob.imageDataToBlob(imageData, "image/gif", function(blob) {
- pskl.utils.FileUtils.downloadAsFile(fileName, blob);
+ pskl.utils.BlobUtils.dataToBlob(imageData, "image/gif", function(blob) {
+ pskl.utils.FileUtils.downloadAsFile(blob, fileName);
});
}.bind(this));
};
@@ -19128,43 +19185,30 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
};
ns.GifExportController.prototype.updatePreview_ = function (src) {
- this.previewContainerEl.innerHTML = "
";
+ this.previewContainerEl.innerHTML = "
";
};
ns.GifExportController.prototype.getSelectedZoom_ = function () {
- var radiosColl = this.exportForm.get(0).querySelectorAll("[name=gif-zoom-level]"),
- radios = Array.prototype.slice.call(radiosColl,0);
- var selectedRadios = radios.filter(function(radio) {return !!radio.checked;});
-
- if (selectedRadios.length == 1) {
- return selectedRadios[0].value;
- } else {
- throw "Unexpected error when retrieving selected zoom";
- }
+ return this.selectResolutionEl.value;
};
- ns.GifExportController.prototype.createRadioElements_ = function () {
+ ns.GifExportController.prototype.createOptionElements_ = function () {
var resolutions = ns.GifExportController.RESOLUTIONS;
for (var i = 0 ; i < resolutions.length ; i++) {
- var radio = this.createRadioForResolution_(resolutions[i]);
- this.radioGroupEl.appendChild(radio);
+ var option = this.createOptionForResolution_(resolutions[i]);
+ this.selectResolutionEl.appendChild(option);
}
};
- ns.GifExportController.prototype.createRadioForResolution_ = function (resolution) {
+ ns.GifExportController.prototype.createOptionForResolution_ = function (resolution) {
var zoom = resolution.zoom;
var label = zoom*this.piskelController.getWidth() + "x" + zoom*this.piskelController.getHeight();
var value = zoom;
- var radioHTML = pskl.utils.Template.replace(this.radioTemplate_, {value : value, label : label});
- var radioEl = pskl.utils.Template.createFromHTML(radioHTML);
+ var optionHTML = pskl.utils.Template.replace(this.optionTemplate_, {value : value, label : label});
+ var optionEl = pskl.utils.Template.createFromHTML(optionHTML);
- if (resolution['default']) {
- var input = radioEl.getElementsByTagName("input")[0];
- input.setAttribute("checked", "checked");
- }
-
- return radioEl;
+ return optionEl;
};
ns.GifExportController.prototype.renderAsImageDataAnimatedGIF = function(zoom, fps, cb) {
@@ -19227,8 +19271,10 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
ns.GifExportController.prototype.shorten_ = function (url, maxLength, suffix) {
if (url.length > maxLength) {
- url = url.substring(0, maxLength);
- url += suffix;
+ var index = Math.round((maxLength-suffix.length) / 2);
+ var part1 = url.substring(0, index);
+ var part2 = url.substring(url.length - index, url.length);
+ url = part1 + suffix + part2;
}
return url;
};
@@ -19243,28 +19289,23 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
ns.PngExportController.prototype.init = function () {
this.previewContainerEl = document.querySelectorAll(".png-export-preview")[0];
- this.uploadStatusContainerEl = document.querySelectorAll(".png-upload-status")[0];
- document.querySelector(".png-upload-button").addEventListener('click', this.onPngUploadButtonClick_.bind(this));
document.querySelector(".png-download-button").addEventListener('click', this.onPngDownloadButtonClick_.bind(this));
document.querySelector(".zip-generate-button").addEventListener('click', this.onZipButtonClick_.bind(this));
this.updatePreview_(this.getFramesheetAsCanvas().toDataURL("image/png"));
+
+ (new ns.GifExportController(this.piskelController)).init();
};
ns.PngExportController.prototype.onPngDownloadButtonClick_ = function (evt) {
var fileName = this.getPiskelName_() + '.png';
- pskl.utils.ImageToBlob.canvasToBlob(this.getFramesheetAsCanvas(), function(blob) {
- pskl.utils.FileUtils.downloadAsFile(fileName, blob);
+ pskl.utils.BlobUtils.canvasToBlob(this.getFramesheetAsCanvas(), function(blob) {
+ pskl.utils.FileUtils.downloadAsFile(blob, fileName);
});
};
- ns.PngExportController.prototype.onPngUploadButtonClick_ = function (evt) {
- this.previewContainerEl.classList.add("preview-upload-ongoing");
- pskl.app.imageUploadService.upload(this.getFramesheetAsCanvas().toDataURL("image/png"), this.onImageUploadCompleted_.bind(this));
- };
-
ns.PngExportController.prototype.onZipButtonClick_ = function () {
var zip = new window.JSZip();
@@ -19277,8 +19318,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
var fileName = this.getPiskelName_() + '.zip';
- var fileContent = zip.generate({type:"blob"});
- pskl.utils.FileUtils.downloadAsFile(fileName, fileContent);
+ var blob = zip.generate({type:"blob"});
+ pskl.utils.FileUtils.downloadAsFile(blob, fileName);
};
ns.PngExportController.prototype.getFrameAsCanvas_ = function (frame) {
@@ -19441,13 +19482,17 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.nameInput = $('#save-name');
this.descriptionInput = $('#save-description');
this.isPublicCheckbox = $('input[name=save-public-checkbox]');
- this.saveCloudButton = $('#save-cloud-button');
- this.saveLocalButton = $('#save-local-button');
+ this.saveOnlineButton = $('#save-online-button');
+ this.saveLocalButton = $('#save-browser-button');
+ this.saveFileButton = $('#save-file-button');
// Only available in app-engine mode ...
this.piskelName = $('.piskel-name').get(0);
- this.status = $('#save-status');
+ this.saveOnlineStatus = $('#save-online-status');
+
+ this.saveFileStatus = $('#save-file-status');
+ this.timestamp = new Date();
var descriptor = this.piskelController.getPiskel().getDescriptor();
this.nameInput.val(descriptor.name);
@@ -19455,20 +19500,48 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.isPublicCheckbox.prop('checked', descriptor.isPublic);
+ this.saveFileButton.click(this.saveFile_.bind(this));
+ this.saveLocalButton.click(this.saveLocal_.bind(this));
+ this.saveOnlineButton.click(this.saveOnline_.bind(this));
+ this.saveForm.submit(this.onSaveFormSubmit_.bind(this));
+
+ this.nameInput.keyup(this.updateLocalStatusFilename_.bind(this));
+
if (!pskl.app.isLoggedIn()) {
- this.saveCloudButton.attr('disabled', 'disabled');
- this.status.html('You are not logged in. Only Local Save is available.');
- } else {
- this.saveForm.submit(this.onSaveFormSubmit_.bind(this));
+ this.saveOnlineButton.hide();
+ $('.save-public-section').hide();
+ this.saveOnlineStatus.html(pskl.utils.Template.get('save-please-login-partial'));
+ this.saveFileButton.get(0).classList.add('button-primary');
}
- this.saveLocalButton.click(this.onSaveLocalClick_.bind(this));
+ this.updateLocalStatusFilename_();
+ };
+
+ ns.SaveController.prototype.updateLocalStatusFilename_ = function () {
+ this.saveFileStatus.html(pskl.utils.Template.getAndReplace('save-file-status-template', {
+ name : this.getLocalFilename_()
+ }));
+ };
+
+ ns.SaveController.prototype.getLocalFilename_ = function () {
+ var piskelName = this.getName();
+ var timestamp = pskl.utils.DateUtils.format(this.timestamp, "{{Y}}{{M}}{{D}}-{{H}}{{m}}{{s}}");
+ return piskelName + "-" + timestamp + ".piskel";
};
ns.SaveController.prototype.onSaveFormSubmit_ = function (evt) {
evt.preventDefault();
evt.stopPropagation();
+ if (pskl.app.isLoggedIn()) {
+ this.saveOnline_();
+ } else {
+ this.saveLocal_();
+ }
+
+ };
+
+ ns.SaveController.prototype.saveOnline_ = function () {
var name = this.getName();
if (!name) {
@@ -19491,7 +19564,7 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
}
};
- ns.SaveController.prototype.onSaveLocalClick_ = function (evt) {
+ ns.SaveController.prototype.saveLocal_ = function () {
var localStorageService = pskl.app.localStorageService;
var isOk = true;
var name = this.getName();
@@ -19506,10 +19579,20 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
window.setTimeout(function () {
this.onSaveSuccess_();
this.afterSaving_();
- }.bind(this), 1000);
+ }.bind(this), 500);
}
};
+ ns.SaveController.prototype.saveFile_ = function () {
+ this.beforeSaving_();
+ this.saveToFile_();
+ pskl.utils.BlobUtils.stringToBlob(pskl.app.piskelController.serialize(), function(blob) {
+ pskl.utils.FileUtils.downloadAsFile(blob, this.getLocalFilename_());
+ this.onSaveSuccess_();
+ this.afterSaving_();
+ }.bind(this), "application/piskel+json");
+ };
+
ns.SaveController.prototype.getName = function () {
return this.nameInput.val();
};
@@ -19519,14 +19602,25 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
};
ns.SaveController.prototype.beforeSaving_ = function () {
- this.saveCloudButton.attr('disabled', true);
- this.status.html('Saving ...');
+ this.updatePiskelDescriptor_();
+
+ this.saveOnlineButton.attr('disabled', true);
+ this.saveOnlineStatus.html('Saving ...');
if (this.piskelName) {
this.piskelName.classList.add('piskel-name-saving');
}
};
+ ns.SaveController.prototype.updatePiskelDescriptor_ = function () {
+ var name = this.getName();
+ var description = this.getDescription();
+ var isPublic = !!this.isPublicCheckbox.prop('checked');
+
+ var descriptor = new pskl.model.piskel.Descriptor(name, description, isPublic);
+ this.piskelController.getPiskel().setDescriptor(descriptor);
+ };
+
ns.SaveController.prototype.onSaveSuccess_ = function () {
$.publish(Events.CLOSE_SETTINGS_DRAWER);
$.publish(Events.SHOW_NOTIFICATION, [{"content": "Successfully saved !"}]);
@@ -19538,8 +19632,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
};
ns.SaveController.prototype.afterSaving_ = function () {
- this.saveCloudButton.attr('disabled', false);
- this.status.html('');
+ this.saveOnlineButton.attr('disabled', false);
+ this.saveOnlineStatus.html('');
if (this.piskelName) {
this.piskelName.classList.remove('piskel-name-saving');
@@ -19549,8 +19643,6 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
};
})();;(function () {
var ns = $.namespace('pskl.controller.settings');
- var DEFAULT_FILE_STATUS = 'No file selected ...';
- var PREVIEW_HEIGHT = 60;
ns.ImportController = function (piskelController) {
this.piskelController = piskelController;
@@ -19558,197 +19650,119 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
};
ns.ImportController.prototype.init = function () {
- this.importForm = $('[name=import-form]');
+ this.hiddenOpenPiskelInput = $('[name=open-piskel-input]');
+ this.openPiskelInputButton = $('.open-piskel-button');
+
this.hiddenFileInput = $('[name=file-upload-input]');
this.fileInputButton = $('.file-input-button');
- this.fileInputStatus = $('.file-input-status');
- this.fileInputStatus.html(DEFAULT_FILE_STATUS);
- this.importPreview = $('.import-section-preview');
+ this.browseLocalButton = document.querySelector('.browse-local-button');
+ this.browseLocalButton.addEventListener('click', this.onBrowseLocalClick_.bind(this));
- this.resizeWidth = $('[name=resize-width]');
- this.resizeHeight = $('[name=resize-height]');
- this.smoothResize = $('[name=smooth-resize-checkbox]');
- this.submitButton = $('[name=import-submit]');
-
- this.importForm.submit(this.onImportFormSubmit_.bind(this));
this.hiddenFileInput.change(this.onFileUploadChange_.bind(this));
this.fileInputButton.click(this.onFileInputClick_.bind(this));
- this.resizeWidth.keyup(this.onResizeInputKeyUp_.bind(this, 'width'));
- this.resizeHeight.keyup(this.onResizeInputKeyUp_.bind(this, 'height'));
+ this.hiddenOpenPiskelInput.change(this.onOpenPiskelChange_.bind(this));
+ this.openPiskelInputButton.click(this.onOpenPiskelClick_.bind(this));
+
+ this.prevSessionContainer = $('.previous-session');
+ this.previousSessionTemplate_ = pskl.utils.Template.get("previous-session-info-template");
+ this.fillRestoreSession_();
};
- ns.ImportController.prototype.reset_ = function () {
- this.importForm.get(0).reset();
- this.fileInputStatus.html(DEFAULT_FILE_STATUS);
+ ns.ImportController.prototype.closeDrawer_ = function () {
$.publish(Events.CLOSE_SETTINGS_DRAWER);
};
-
- ns.ImportController.prototype.onResizeInputKeyUp_ = function (from, evt) {
- if (this.importedImage_) {
- this.synchronizeResizeFields_(evt.target.value, from);
- }
- };
-
- ns.ImportController.prototype.synchronizeResizeFields_ = function (value, from) {
- value = parseInt(value, 10);
- if (isNaN(value)) {
- value = 0;
- }
- var height = this.importedImage_.height, width = this.importedImage_.width;
- if (from === 'width') {
- this.resizeHeight.val(Math.round(value * height / width));
- } else {
- this.resizeWidth.val(Math.round(value * width / height));
- }
- };
-
- ns.ImportController.prototype.onImportFormSubmit_ = function (evt) {
- evt.originalEvent.preventDefault();
- this.importImageToPiskel_();
- };
-
ns.ImportController.prototype.onFileUploadChange_ = function (evt) {
- this.importFromFile_();
+ this.importPictureFromFile_();
};
ns.ImportController.prototype.onFileInputClick_ = function (evt) {
this.hiddenFileInput.click();
};
- ns.ImportController.prototype.importFromFile_ = function () {
+ ns.ImportController.prototype.onOpenPiskelChange_ = function (evt) {
+ this.openPiskelFile_();
+ };
+
+ ns.ImportController.prototype.onOpenPiskelClick_ = function (evt) {
+ this.hiddenOpenPiskelInput.click();
+ };
+
+ ns.ImportController.prototype.onBrowseLocalClick_ = function (evt) {
+ $.publish(Events.DIALOG_DISPLAY, 'browse-local');
+ this.closeDrawer_();
+ };
+
+ ns.ImportController.prototype.openPiskelFile_ = function () {
+ var files = this.hiddenOpenPiskelInput.get(0).files;
+ if (files.length == 1) {
+
+ var file = files[0];
+ if (this.isPiskel_(file)){
+ pskl.utils.PiskelFileUtils.loadFromFile(file, function (piskel, descriptor, fps) {
+ piskel.setDescriptor(descriptor);
+ pskl.app.piskelController.setPiskel(piskel);
+ pskl.app.animationController.setFPS(fps);
+ });
+ this.closeDrawer_();
+ }
+ }
+ };
+
+ ns.ImportController.prototype.importPictureFromFile_ = function () {
var files = this.hiddenFileInput.get(0).files;
if (files.length == 1) {
var file = files[0];
if (this.isImage_(file)) {
- this.readImageFile_(file);
- this.enableDisabledSections_();
+ $.publish(Events.DIALOG_DISPLAY, {
+ dialogId : 'import-image',
+ initArgs : file
+ });
+ this.closeDrawer_();
} else {
- this.reset_();
+ this.closeDrawer_();
throw 'File is not an image : ' + file.type;
}
}
};
ns.ImportController.prototype.enableDisabledSections_ = function () {
- this.resizeWidth.removeAttr('disabled');
- this.resizeHeight.removeAttr('disabled');
- this.smoothResize.removeAttr('disabled');
- this.submitButton.removeAttr('disabled');
-
this.fileInputButton.removeClass('button-primary');
this.fileInputButton.blur();
-
- $('.import-section-disabled').removeClass('import-section-disabled');
- };
-
- ns.ImportController.prototype.readImageFile_ = function (imageFile) {
- pskl.utils.FileUtils.readFile(imageFile, this.processImageSource_.bind(this));
- };
-
- /**
- * Create an image from the given source (url or data-url), and onload forward to onImageLoaded
- * TODO : should be a generic utility method, should take a callback
- * @param {String} imageSource url or data-url, will be used as src for the image
- */
- ns.ImportController.prototype.processImageSource_ = function (imageSource) {
- this.importedImage_ = new Image();
- this.importedImage_.onload = this.onImageLoaded_.bind(this);
- this.importedImage_.src = imageSource;
- };
-
- ns.ImportController.prototype.onImageLoaded_ = function (evt) {
- var w = this.importedImage_.width,
- h = this.importedImage_.height;
-
- // FIXME : We remove the onload callback here because JsGif will insert
- // the image again and we want to avoid retriggering the image onload
- this.importedImage_.onload = function () {};
-
- var filePath = this.hiddenFileInput.val();
- var fileName = this.extractFileNameFromPath_(filePath);
- this.fileInputStatus.html(fileName);
-
- this.resizeWidth.val(w);
- this.resizeHeight.val(h);
-
- this.importPreview.width('auto');
- this.importPreview.html('');
- this.importPreview.append(this.createImagePreview_());
- };
-
- ns.ImportController.prototype.createImagePreview_ = function () {
- var image = document.createElement('IMG');
- image.src = this.importedImage_.src;
- image.setAttribute('height', PREVIEW_HEIGHT);
- return image;
- };
-
- ns.ImportController.prototype.extractFileNameFromPath_ = function (path) {
- var parts = [];
- if (path.indexOf('/') !== -1) {
- parts = path.split('/');
- } else if (path.indexOf('\\') !== -1) {
- parts = path.split('\\');
- } else {
- parts = [path];
- }
- return parts[parts.length-1];
- };
-
- ns.ImportController.prototype.importImageToPiskel_ = function () {
- var image = this.importedImage_;
- if (image) {
- if (window.confirm('You are about to create a new Piskel, unsaved changes will be lost.')) {
- var gifLoader = new window.SuperGif({
- gif : image
- });
-
- gifLoader.load({
- success : function(){
- var images = gifLoader.getFrames().map(function (frame) {
- return pskl.CanvasUtils.createFromImageData(frame.data);
- });
- this.createPiskelFromImages_(images);
- }.bind(this),
- error : function () {
- this.createPiskelFromImages_([image]);
- }.bind(this)
- });
-
- }
- }
- };
-
- ns.ImportController.prototype.createFramesFromImages_ = function (images) {
- var w = this.resizeWidth.val();
- var h = this.resizeHeight.val();
- var smoothing = !!this.smoothResize.prop('checked');
-
- var frames = images.map(function (image) {
- var resizedImage = pskl.utils.ImageResizer.resize(image, w, h, smoothing);
- return pskl.utils.FrameUtils.createFromImage(resizedImage);
- });
- return frames;
- };
-
- ns.ImportController.prototype.createPiskelFromImages_ = function (images) {
- var frames = this.createFramesFromImages_(images);
- var layer = pskl.model.Layer.fromFrames('Layer 1', frames);
- var descriptor = new pskl.model.piskel.Descriptor('Imported piskel', '');
- var piskel = pskl.model.Piskel.fromLayers([layer], descriptor);
-
- pskl.app.piskelController.setPiskel(piskel);
- pskl.app.animationController.setFPS(Constants.DEFAULT.FPS);
-
- this.reset_();
+ $('.import-options').show();
};
ns.ImportController.prototype.isImage_ = function (file) {
return file.type.indexOf('image') === 0;
};
+ ns.ImportController.prototype.isPiskel_ = function (file) {
+ return (/\.piskel$/).test(file.name);
+ };
+
+ ns.ImportController.prototype.fillRestoreSession_ = function () {
+ var previousInfo = pskl.app.backupService.getPreviousPiskelInfo();
+ if (previousInfo) {
+ var info = {
+ name : previousInfo.name,
+ date : pskl.utils.DateUtils.format(previousInfo.date, "{{H}}:{{m}} - {{Y}}/{{M}}/{{D}}")
+ };
+
+ this.prevSessionContainer.html(pskl.utils.Template.replace(this.previousSessionTemplate_, info));
+ $(".restore-session-button").click(this.onRestorePreviousSessionClick_.bind(this));
+ } else {
+ this.prevSessionContainer.html("No piskel backup was found on this browser.");
+ }
+ };
+
+ ns.ImportController.prototype.onRestorePreviousSessionClick_ = function () {
+ if (window.confirm('This will erase your current workspace. Continue ?')) {
+ pskl.app.backupService.load();
+ $.publish(Events.CLOSE_SETTINGS_DRAWER);
+ }
+ };
+
})();;(function () {
var ns = $.namespace('pskl.controller.settings');
@@ -19761,12 +19775,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
template : 'templates/settings/resize.html',
controller : ns.ResizeController
},
- 'gif' : {
- template : 'templates/settings/export-gif.html',
- controller : ns.GifExportController
- },
'png' : {
- template : 'templates/settings/export-png.html',
+ template : 'templates/settings/export.html',
controller : ns.PngExportController
},
'import' : {
@@ -19850,6 +19860,23 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
document.activeElement.blur();
};
+})();;(function () {
+ var ns = $.namespace('pskl.controller.dialogs');
+
+ ns.AbstractDialogController = function () {};
+
+
+ ns.AbstractDialogController.prototype.init = function () {
+ this.closeButton = document.querySelector('.dialog-close');
+ this.closeButton.addEventListener('click', this.closeDialog.bind(this));
+ };
+
+ ns.AbstractDialogController.prototype.destroy = function () {};
+
+ ns.AbstractDialogController.prototype.closeDialog = function () {
+ $.publish(Events.DIALOG_HIDE);
+ };
+
})();;(function () {
var ns = $.namespace('pskl.controller.dialogs');
@@ -19870,13 +19897,16 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.spectrumContainers = [];
};
+ pskl.utils.inherit(ns.PaletteManagerController, ns.AbstractDialogController);
+
ns.PaletteManagerController.prototype.init = function () {
+ this.superclass.init.call(this);
+
this.palettesList = document.querySelector('.palette-manager-list');
this.paletteBody = document.querySelector('.palette-manager-details-body');
this.paletteHead = document.querySelector('.palette-manager-details-head');
this.createButton = document.querySelector('.palette-manager-actions-button[data-action="create"]');
this.saveAllButton = document.querySelector('.palette-manager-actions-button[data-action="save-all"]');
- this.closeButton = document.querySelector('.palette-manager-close');
this.colorCardTemplate = pskl.utils.Template.get('palette-color-card-template');
this.newColorTemplate = pskl.utils.Template.get('palette-new-color-template');
@@ -19889,7 +19919,6 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.paletteHead.addEventListener('click', this.delegatedPaletteHeadClick.bind(this));
this.createButton.addEventListener('click', this.onCreateClick_.bind(this));
this.saveAllButton.addEventListener('click', this.saveAll.bind(this));
- this.closeButton.addEventListener('click', this.closeDialog.bind(this));
// Init markup
this.createPaletteListMarkup();
@@ -19904,10 +19933,6 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.destroySpectrumPickers();
};
- ns.PaletteManagerController.prototype.closeDialog = function () {
- $.publish(Events.DIALOG_HIDE);
- };
-
ns.PaletteManagerController.prototype.onCreateClick_ = function (evt) {
this.createPalette();
};
@@ -20233,6 +20258,215 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
return JSON.parse(palettesString) || [];
};
+})();;(function () {
+ var ns = $.namespace('pskl.controller.dialogs');
+ var PREVIEW_HEIGHT = 60;
+
+ ns.ImportImageController = function (piskelController) {
+ this.importedImage_ = null;
+ this.file_ = null;
+ };
+
+ pskl.utils.inherit(ns.ImportImageController, ns.AbstractDialogController);
+
+ ns.ImportImageController.prototype.init = function (file) {
+ this.superclass.init.call(this);
+
+ this.file_ = file;
+
+ this.importPreview = $('.import-section-preview');
+
+ this.fileNameContainer = $('.import-image-file-name');
+
+ this.resizeWidth = $('[name=resize-width]');
+ this.resizeHeight = $('[name=resize-height]');
+ this.smoothResize = $('[name=smooth-resize-checkbox]');
+
+ this.resizeWidth.keyup(this.onResizeInputKeyUp_.bind(this, 'width'));
+ this.resizeHeight.keyup(this.onResizeInputKeyUp_.bind(this, 'height'));
+
+ this.importImageForm = $('[name=import-image-form]');
+ this.importImageForm.submit(this.onImportFormSubmit_.bind(this));
+
+ pskl.utils.FileUtils.readFile(this.file_, this.processImageSource_.bind(this));
+ };
+
+ ns.ImportImageController.prototype.onImportFormSubmit_ = function (evt) {
+ evt.originalEvent.preventDefault();
+ this.importImageToPiskel_();
+ };
+
+ ns.ImportImageController.prototype.onResizeInputKeyUp_ = function (from, evt) {
+ if (this.importedImage_) {
+ this.synchronizeResizeFields_(evt.target.value, from);
+ }
+ };
+
+ ns.ImportImageController.prototype.synchronizeResizeFields_ = function (value, from) {
+ value = parseInt(value, 10);
+ if (isNaN(value)) {
+ value = 0;
+ }
+ var height = this.importedImage_.height, width = this.importedImage_.width;
+ if (from === 'width') {
+ this.resizeHeight.val(Math.round(value * height / width));
+ } else {
+ this.resizeWidth.val(Math.round(value * width / height));
+ }
+ };
+
+ /**
+ * Create an image from the given source (url or data-url), and onload forward to onImageLoaded
+ * TODO : should be a generic utility method, should take a callback
+ * @param {String} imageSource url or data-url, will be used as src for the image
+ */
+ ns.ImportImageController.prototype.processImageSource_ = function (imageSource) {
+ this.importedImage_ = new Image();
+ this.importedImage_.onload = this.onImageLoaded_.bind(this);
+ this.importedImage_.src = imageSource;
+ };
+
+ ns.ImportImageController.prototype.onImageLoaded_ = function (evt) {
+ var w = this.importedImage_.width,
+ h = this.importedImage_.height;
+
+ // FIXME : We remove the onload callback here because JsGif will insert
+ // the image again and we want to avoid retriggering the image onload
+ this.importedImage_.onload = function () {};
+
+ var fileName = this.extractFileNameFromPath_(this.file_.name);
+ this.fileNameContainer.html(fileName);
+
+ this.resizeWidth.val(w);
+ this.resizeHeight.val(h);
+
+ this.importPreview.width('auto');
+ this.importPreview.html('');
+ this.importPreview.append(this.createImagePreview_());
+ };
+
+ ns.ImportImageController.prototype.createImagePreview_ = function () {
+ var image = document.createElement('IMG');
+ image.src = this.importedImage_.src;
+ image.setAttribute('height', PREVIEW_HEIGHT);
+ return image;
+ };
+
+ ns.ImportImageController.prototype.extractFileNameFromPath_ = function (path) {
+ var parts = [];
+ if (path.indexOf('/') !== -1) {
+ parts = path.split('/');
+ } else if (path.indexOf('\\') !== -1) {
+ parts = path.split('\\');
+ } else {
+ parts = [path];
+ }
+ return parts[parts.length-1];
+ };
+
+ ns.ImportImageController.prototype.importImageToPiskel_ = function () {
+ var image = this.importedImage_;
+ if (image) {
+ if (window.confirm('You are about to create a new Piskel, unsaved changes will be lost.')) {
+ var gifLoader = new window.SuperGif({
+ gif : image
+ });
+
+ gifLoader.load({
+ success : function(){
+ var images = gifLoader.getFrames().map(function (frame) {
+ return pskl.CanvasUtils.createFromImageData(frame.data);
+ });
+ this.createPiskelFromImages_(images);
+ this.closeDialog();
+ }.bind(this),
+ error : function () {
+ this.createPiskelFromImages_([image]);
+ this.closeDialog();
+ }.bind(this)
+ });
+
+ }
+ }
+ };
+
+ ns.ImportImageController.prototype.createFramesFromImages_ = function (images) {
+ var w = this.resizeWidth.val();
+ var h = this.resizeHeight.val();
+ var smoothing = !!this.smoothResize.prop('checked');
+
+ var frames = images.map(function (image) {
+ var resizedImage = pskl.utils.ImageResizer.resize(image, w, h, smoothing);
+ return pskl.utils.FrameUtils.createFromImage(resizedImage);
+ });
+ return frames;
+ };
+
+ ns.ImportImageController.prototype.createPiskelFromImages_ = function (images) {
+ var frames = this.createFramesFromImages_(images);
+ var layer = pskl.model.Layer.fromFrames('Layer 1', frames);
+ var descriptor = new pskl.model.piskel.Descriptor('Imported piskel', '');
+ var piskel = pskl.model.Piskel.fromLayers([layer], descriptor);
+
+ pskl.app.piskelController.setPiskel(piskel);
+ pskl.app.animationController.setFPS(Constants.DEFAULT.FPS);
+ };
+})();;(function () {
+ var ns = $.namespace('pskl.controller.dialogs');
+
+ ns.BrowseLocalController = function (piskelController) {
+ };
+
+ pskl.utils.inherit(ns.BrowseLocalController, ns.AbstractDialogController);
+
+ ns.BrowseLocalController.prototype.init = function () {
+ this.superclass.init.call(this);
+
+ this.localStorageItemTemplate_ = pskl.utils.Template.get("local-storage-item-template");
+
+ this.service_ = pskl.app.localStorageService;
+ this.piskelsList = $('.local-piskels-list');
+ this.prevSessionContainer = $('.previous-session');
+
+ this.fillLocalPiskelsList_();
+
+ this.piskelsList.click(this.onPiskelsListClick_.bind(this));
+ };
+
+ ns.BrowseLocalController.prototype.onPiskelsListClick_ = function (evt) {
+ var action = evt.target.getAttribute('data-action');
+ var name = evt.target.getAttribute('data-name');
+ if (action === 'load') {
+ if (window.confirm('This will erase your current piskel. Continue ?')) {
+ this.service_.load(name);
+ this.closeDialog();
+ }
+ } else if (action === 'delete') {
+ if (window.confirm('This will permanently DELETE this piskel from your computer. Continue ?')) {
+ this.service_.remove(name);
+ this.fillLocalPiskelsList_();
+ }
+ }
+ };
+
+ ns.BrowseLocalController.prototype.fillLocalPiskelsList_ = function () {
+ var html = "";
+ var keys = this.service_.getKeys();
+
+ keys.sort(function (k1, k2) {
+ if (k1.date < k2.date) {return 1;}
+ if (k1.date > k2.date) {return -1;}
+ return 0;
+ });
+
+ keys.forEach((function (key) {
+ var date = pskl.utils.DateUtils.format(key.date, "{{Y}}/{{M}}/{{D}} {{H}}:{{m}}");
+ html += pskl.utils.Template.replace(this.localStorageItemTemplate_, {name : key.name, date : date});
+ }).bind(this));
+
+ var tableBody_ = this.piskelsList.get(0).tBodies[0];
+ tableBody_.innerHTML = html;
+ };
})();;(function () {
var ns = $.namespace('pskl.controller.dialogs');
@@ -20240,6 +20474,14 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
'manage-palettes' : {
template : 'templates/dialogs/manage-palettes.html',
controller : ns.PaletteManagerController
+ },
+ 'browse-local' : {
+ template : 'templates/dialogs/browse-local.html',
+ controller : ns.BrowseLocalController
+ },
+ 'import-image' : {
+ template : 'templates/dialogs/import-image.html',
+ controller : ns.ImportImageController
}
};
@@ -20255,15 +20497,25 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
$.subscribe(Events.DIALOG_HIDE, this.onDialogHideEvent_.bind(this));
pskl.app.shortcutService.addShortcut('alt+P', this.onDialogDisplayEvent_.bind(this, null, 'manage-palettes'));
+ this.dialogWrapper_.classList.add('animated');
};
- ns.DialogsController.prototype.onDialogDisplayEvent_ = function (evt, dialogId) {
+ ns.DialogsController.prototype.onDialogDisplayEvent_ = function (evt, args) {
+ var dialogId, initArgs;
+ if (typeof args === 'string') {
+ dialogId = args;
+ } else {
+ dialogId = args.dialogId;
+ initArgs = args.initArgs;
+ }
if (!this.isDisplayed()) {
var config = dialogs[dialogId];
if (config) {
this.dialogContainer_.innerHTML = pskl.utils.Template.get(config.template);
+ this.dialogContainer_.classList.add(dialogId);
+
var controller = new config.controller(this.piskelController);
- controller.init();
+ controller.init(initArgs);
this.showDialogWrapper_();
this.currentDialog_ = {
@@ -20289,6 +20541,10 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
var currentDialog = this.currentDialog_;
if (currentDialog) {
currentDialog.controller.destroy();
+ var dialogId = this.currentDialog_.id;
+ window.setTimeout(function () {
+ this.dialogContainer_.classList.remove(dialogId);
+ }.bind(this), 800);
}
this.hideDialogWrapper_();
@@ -21092,17 +21348,23 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
})();;(function () {
var ns = $.namespace('pskl.service');
- ns.ImageDropperService = function (piskelController, drawingAreaContainer) {
+ ns.FileDropperService = function (piskelController, drawingAreaContainer) {
this.piskelController = piskelController;
this.drawingAreaContainer = drawingAreaContainer;
};
- ns.ImageDropperService.prototype.init = function () {
+ ns.FileDropperService.prototype.init = function () {
document.body.addEventListener('drop', this.onFileDrop.bind(this), false);
document.body.addEventListener('dragover', this.onFileDragOver.bind(this), false);
};
- ns.ImageDropperService.prototype.onFileDrop = function (event) {
+ ns.FileDropperService.prototype.onFileDragOver = function (event) {
+ event.stopPropagation();
+ event.preventDefault();
+ event.dataTransfer.dropEffect = 'copy';
+ };
+
+ ns.FileDropperService.prototype.onFileDrop = function (event) {
event.preventDefault();
event.stopPropagation();
@@ -21116,28 +21378,31 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
var isImage = file.type.indexOf('image') === 0;
if (isImage) {
this.readImageFile_(file);
+ } else if (/\.piskel$/i.test(file.name)) {
+ pskl.utils.PiskelFileUtils.loadFromFile(file, this.onPiskelFileLoaded_);
}
}
};
- ns.ImageDropperService.prototype.onFileDragOver = function (event) {
- event.stopPropagation();
- event.preventDefault();
- event.dataTransfer.dropEffect = 'copy'; // Explicitly show this is a copy.
+ ns.FileDropperService.prototype.onPiskelFileLoaded_ = function (piskel, descriptor, fps) {
+ if (window.confirm('This will replace your current animation')) {
+ piskel.setDescriptor(descriptor);
+ pskl.app.piskelController.setPiskel(piskel);
+ pskl.app.animationController.setFPS(fps);
+ }
};
-
- ns.ImageDropperService.prototype.readImageFile_ = function (imageFile) {
+ ns.FileDropperService.prototype.readImageFile_ = function (imageFile) {
pskl.utils.FileUtils.readFile(imageFile, this.processImageSource_.bind(this));
};
- ns.ImageDropperService.prototype.processImageSource_ = function (imageSource) {
+ ns.FileDropperService.prototype.processImageSource_ = function (imageSource) {
this.importedImage_ = new Image();
this.importedImage_.onload = this.onImageLoaded_.bind(this);
this.importedImage_.src = imageSource;
};
- ns.ImageDropperService.prototype.onImageLoaded_ = function () {
+ ns.FileDropperService.prototype.onImageLoaded_ = function () {
var frame = pskl.utils.FrameUtils.createFromImage(this.importedImage_);
var currentFrame = this.piskelController.getCurrentFrame();
@@ -21145,6 +21410,14 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
var yCoord = this.coords_.y - Math.floor(frame.height/2);
xCoord = Math.max(0, xCoord);
yCoord = Math.max(0, yCoord);
+
+ if (frame.width <= currentFrame.width) {
+ xCoord = Math.min(xCoord, currentFrame.width - frame.width);
+ }
+
+ if (frame.height <= currentFrame.height) {
+ yCoord = Math.min(yCoord, currentFrame.height - frame.height);
+ }
currentFrame.forEachPixel(function (color, x, y) {
var fColor = frame.getPixel(x-xCoord, y-yCoord);
if (fColor && fColor != Constants.TRANSPARENT_COLOR) {
@@ -22398,9 +22671,8 @@ zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License
this.beforeUnloadService = new pskl.service.BeforeUnloadService(this.piskelController);
this.beforeUnloadService.init();
- this.imageDropperService = new pskl.service.ImageDropperService(this.piskelController, $('#drawing-canvas-container').get(0));
- this.imageDropperService.init();
-
+ this.fileDropperService = new pskl.service.FileDropperService(this.piskelController, $('#drawing-canvas-container').get(0));
+ this.fileDropperService.init();
if (this.isAppEngineVersion) {
this.storageService = new pskl.service.AppEngineStorageService(this.piskelController);
diff --git a/js/piskel-packaged-min-2014-07-12-06-35.js b/js/piskel-packaged-min-2014-07-12-06-35.js
new file mode 100644
index 00000000..a3495f01
--- /dev/null
+++ b/js/piskel-packaged-min-2014-07-12-06-35.js
@@ -0,0 +1,13 @@
+!function(a,b){function c(a){var b=ob[a]={};return $.each(a.split(bb),function(a,c){b[c]=!0}),b}function d(a,c,d){if(d===b&&1===a.nodeType){var e="data-"+c.replace(qb,"-$1").toLowerCase();if(d=a.getAttribute(e),"string"==typeof d){try{d="true"===d?!0:"false"===d?!1:"null"===d?null:+d+""===d?+d:pb.test(d)?$.parseJSON(d):d}catch(f){}$.data(a,c,d)}else d=b}return d}function e(a){var b;for(b in a)if(("data"!==b||!$.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function f(){return!1}function g(){return!0}function h(a){return!a||!a.parentNode||11===a.parentNode.nodeType}function i(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}function j(a,b,c){if(b=b||0,$.isFunction(b))return $.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return $.grep(a,function(a){return a===b===c});if("string"==typeof b){var d=$.grep(a,function(a){return 1===a.nodeType});if(Kb.test(b))return $.filter(b,d,!c);b=$.filter(b,d)}return $.grep(a,function(a){return $.inArray(a,b)>=0===c})}function k(a){var b=Nb.split("|"),c=a.createDocumentFragment();if(c.createElement)for(;b.length;)c.createElement(b.pop());return c}function l(a,b){return a.getElementsByTagName(b)[0]||a.appendChild(a.ownerDocument.createElement(b))}function m(a,b){if(1===b.nodeType&&$.hasData(a)){var c,d,e,f=$._data(a),g=$._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)$.event.add(b,c,h[c][d])}g.data&&(g.data=$.extend({},g.data))}}function n(a,b){var c;1===b.nodeType&&(b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase(),"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),$.support.html5Clone&&a.innerHTML&&!$.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Xb.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.selected=a.defaultSelected:"input"===c||"textarea"===c?b.defaultValue=a.defaultValue:"script"===c&&b.text!==a.text&&(b.text=a.text),b.removeAttribute($.expando))}function o(a){return"undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName("*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll("*"):[]}function p(a){Xb.test(a.type)&&(a.defaultChecked=a.checked)}function q(a,b){if(b in a)return b;for(var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=qc.length;e--;)if(b=qc[e]+c,b in a)return b;return d}function r(a,b){return a=b||a,"none"===$.css(a,"display")||!$.contains(a.ownerDocument,a)}function s(a,b){for(var c,d,e=[],f=0,g=a.length;g>f;f++)c=a[f],c.style&&(e[f]=$._data(c,"olddisplay"),b?(e[f]||"none"!==c.style.display||(c.style.display=""),""===c.style.display&&r(c)&&(e[f]=$._data(c,"olddisplay",w(c.nodeName)))):(d=cc(c,"display"),e[f]||"none"===d||$._data(c,"olddisplay",d)));for(f=0;g>f;f++)c=a[f],c.style&&(b&&"none"!==c.style.display&&""!==c.style.display||(c.style.display=b?e[f]||"":"none"));return a}function t(a,b,c){var d=jc.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function u(a,b,c,d){for(var e=c===(d?"border":"content")?4:"width"===b?1:0,f=0;4>e;e+=2)"margin"===c&&(f+=$.css(a,c+pc[e],!0)),d?("content"===c&&(f-=parseFloat(cc(a,"padding"+pc[e]))||0),"margin"!==c&&(f-=parseFloat(cc(a,"border"+pc[e]+"Width"))||0)):(f+=parseFloat(cc(a,"padding"+pc[e]))||0,"padding"!==c&&(f+=parseFloat(cc(a,"border"+pc[e]+"Width"))||0));return f}function v(a,b,c){var d="width"===b?a.offsetWidth:a.offsetHeight,e=!0,f=$.support.boxSizing&&"border-box"===$.css(a,"boxSizing");if(0>=d){if(d=cc(a,b),(0>d||null==d)&&(d=a.style[b]),kc.test(d))return d;e=f&&($.support.boxSizingReliable||d===a.style[b]),d=parseFloat(d)||0}return d+u(a,b,c||(f?"border":"content"),e)+"px"}function w(a){if(mc[a])return mc[a];var b=$("<"+a+">").appendTo(P.body),c=b.css("display");return b.remove(),("none"===c||""===c)&&(dc=P.body.appendChild(dc||$.extend(P.createElement("iframe"),{frameBorder:0,width:0,height:0})),ec&&dc.createElement||(ec=(dc.contentWindow||dc.contentDocument).document,ec.write(""),ec.close()),b=ec.body.appendChild(ec.createElement(a)),c=cc(b,"display"),P.body.removeChild(dc)),mc[a]=c,c}function x(a,b,c,d){var e;if($.isArray(b))$.each(b,function(b,e){c||tc.test(a)?d(a,e):x(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==$.type(b))d(a,b);else for(e in b)x(a+"["+e+"]",b[e],c,d)}function y(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e,f,g=b.toLowerCase().split(bb),h=0,i=g.length;if($.isFunction(c))for(;i>h;h++)d=g[h],f=/^\+/.test(d),f&&(d=d.substr(1)||"*"),e=a[d]=a[d]||[],e[f?"unshift":"push"](c)}}function z(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;for(var h,i=a[f],j=0,k=i?i.length:0,l=a===Jc;k>j&&(l||!h);j++)h=i[j](c,d,e),"string"==typeof h&&(!l||g[h]?h=b:(c.dataTypes.unshift(h),h=z(a,c,d,e,h,g)));return!l&&h||g["*"]||(h=z(a,c,d,e,"*",g)),h}function A(a,c){var d,e,f=$.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((f[d]?a:e||(e={}))[d]=c[d]);e&&$.extend(!0,a,e)}function B(a,c,d){var e,f,g,h,i=a.contents,j=a.dataTypes,k=a.responseFields;for(f in k)f in d&&(c[k[f]]=d[f]);for(;"*"===j[0];)j.shift(),e===b&&(e=a.mimeType||c.getResponseHeader("content-type"));if(e)for(f in i)if(i[f]&&i[f].test(e)){j.unshift(f);break}if(j[0]in d)g=j[0];else{for(f in d){if(!j[0]||a.converters[f+" "+j[0]]){g=f;break}h||(h=f)}g=g||h}return g?(g!==j[0]&&j.unshift(g),d[g]):void 0}function C(a,b){var c,d,e,f,g=a.dataTypes.slice(),h=g[0],i={},j=0;if(a.dataFilter&&(b=a.dataFilter(b,a.dataType)),g[1])for(c in a.converters)i[c.toLowerCase()]=a.converters[c];for(;e=g[++j];)if("*"!==e){if("*"!==h&&h!==e){if(c=i[h+" "+e]||i["* "+e],!c)for(d in i)if(f=d.split(" "),f[1]===e&&(c=i[h+" "+f[0]]||i["* "+f[0]])){c===!0?c=i[d]:i[d]!==!0&&(e=f[0],g.splice(j--,0,e));break}if(c!==!0)if(c&&a["throws"])b=c(b);else try{b=c(b)}catch(k){return{state:"parsererror",error:c?k:"No conversion from "+h+" to "+e}}}h=e}return{state:"success",data:b}}function D(){try{return new a.XMLHttpRequest}catch(b){}}function E(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function F(){return setTimeout(function(){Uc=b},0),Uc=$.now()}function G(a,b){$.each(b,function(b,c){for(var d=($c[b]||[]).concat($c["*"]),e=0,f=d.length;f>e;e++)if(d[e].call(a,b,c))return})}function H(a,b,c){var d,e=0,f=Zc.length,g=$.Deferred().always(function(){delete h.elem}),h=function(){for(var b=Uc||F(),c=Math.max(0,i.startTime+i.duration-b),d=1-(c/i.duration||0),e=0,f=i.tweens.length;f>e;e++)i.tweens[e].run(d);return g.notifyWith(a,[i,d,c]),1>d&&f?c:(g.resolveWith(a,[i]),!1)},i=g.promise({elem:a,props:$.extend({},b),opts:$.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Uc||F(),duration:c.duration,tweens:[],createTween:function(b,c){var d=$.Tween(a,i.opts,b,c,i.opts.specialEasing[b]||i.opts.easing);return i.tweens.push(d),d},stop:function(b){for(var c=0,d=b?i.tweens.length:0;d>c;c++)i.tweens[c].run(1);return b?g.resolveWith(a,[i,b]):g.rejectWith(a,[i,b]),this}}),j=i.props;for(I(j,i.opts.specialEasing);f>e;e++)if(d=Zc[e].call(i,a,j,i.opts))return d;return G(i,j),$.isFunction(i.opts.start)&&i.opts.start.call(a,i),$.fx.timer($.extend(h,{anim:i,queue:i.opts.queue,elem:a})),i.progress(i.opts.progress).done(i.opts.done,i.opts.complete).fail(i.opts.fail).always(i.opts.always)}function I(a,b){var c,d,e,f,g;for(c in a)if(d=$.camelCase(c),e=b[d],f=a[c],$.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=$.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function J(a,b,c){var d,e,f,g,h,i,j,k,l=this,m=a.style,n={},o=[],p=a.nodeType&&r(a);c.queue||(j=$._queueHooks(a,"fx"),null==j.unqueued&&(j.unqueued=0,k=j.empty.fire,j.empty.fire=function(){j.unqueued||k()}),j.unqueued++,l.always(function(){l.always(function(){j.unqueued--,$.queue(a,"fx").length||j.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[m.overflow,m.overflowX,m.overflowY],"inline"===$.css(a,"display")&&"none"===$.css(a,"float")&&($.support.inlineBlockNeedsLayout&&"inline"!==w(a.nodeName)?m.zoom=1:m.display="inline-block")),c.overflow&&(m.overflow="hidden",$.support.shrinkWrapBlocks||l.done(function(){m.overflow=c.overflow[0],m.overflowX=c.overflow[1],m.overflowY=c.overflow[2]}));for(d in b)if(f=b[d],Wc.exec(f)){if(delete b[d],f===(p?"hide":"show"))continue;o.push(d)}if(g=o.length)for(h=$._data(a,"fxshow")||$._data(a,"fxshow",{}),p?$(a).show():l.done(function(){$(a).hide()}),l.done(function(){var b;$.removeData(a,"fxshow",!0);for(b in n)$.style(a,b,n[b])}),d=0;g>d;d++)e=o[d],i=l.createTween(e,p?h[e]:0),n[e]=h[e]||$.style(a,e),e in h||(h[e]=i.start,p&&(i.end=i.start,i.start="width"===e||"height"===e?1:0))}function K(a,b,c,d,e){return new K.prototype.init(a,b,c,d,e)}function L(a,b){for(var c,d={height:a},e=0;4>e;e+=2-b)c=pc[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function M(a){return $.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var N,O,P=a.document,Q=a.location,R=a.navigator,S=a.jQuery,T=a.$,U=Array.prototype.push,V=Array.prototype.slice,W=Array.prototype.indexOf,X=Object.prototype.toString,Y=Object.prototype.hasOwnProperty,Z=String.prototype.trim,$=function(a,b){return new $.fn.init(a,b,N)},_=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,ab=/\S/,bb=/\s+/,cb=ab.test("Â ")?/^[\s\xA0]+|[\s\xA0]+$/g:/^\s+|\s+$/g,db=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,eb=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,fb=/^[\],:{}\s]*$/,gb=/(?:^|:|,)(?:\s*\[)+/g,hb=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,ib=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,jb=/^-ms-/,kb=/-([\da-z])/gi,lb=function(a,b){return(b+"").toUpperCase()},mb=function(){P.addEventListener?(P.removeEventListener("DOMContentLoaded",mb,!1),$.ready()):"complete"===P.readyState&&(P.detachEvent("onreadystatechange",mb),$.ready())},nb={};$.fn=$.prototype={constructor:$,init:function(a,c,d){var e,f,g;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if("string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:db.exec(a),!e||!e[1]&&c)return!c||c.jquery?(c||d).find(a):this.constructor(c).find(a);if(e[1])return c=c instanceof $?c[0]:c,g=c&&c.nodeType?c.ownerDocument||c:P,a=$.parseHTML(e[1],g,!0),eb.test(e[1])&&$.isPlainObject(c)&&this.attr.call(a,c,!0),$.merge(this,a);if(f=P.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2])return d.find(a);this.length=1,this[0]=f}return this.context=P,this.selector=a,this}return $.isFunction(a)?d.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),$.makeArray(a,this))},selector:"",jquery:"1.8.0",length:0,size:function(){return this.length},toArray:function(){return V.call(this)},get:function(a){return null==a?this.toArray():0>a?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=$.merge(this.constructor(),a);return d.prevObject=this,d.context=this.context,"find"===b?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")"),d},each:function(a,b){return $.each(this,a,b)},ready:function(a){return $.ready.promise().done(a),this},eq:function(a){return a=+a,-1===a?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(V.apply(this,arguments),"slice",V.call(arguments).join(","))},map:function(a){return this.pushStack($.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:U,sort:[].sort,splice:[].splice},$.fn.init.prototype=$.fn,$.extend=$.fn.extend=function(){var a,c,d,e,f,g,h=arguments[0]||{},i=1,j=arguments.length,k=!1;for("boolean"==typeof h&&(k=h,h=arguments[1]||{},i=2),"object"==typeof h||$.isFunction(h)||(h={}),j===i&&(h=this,--i);j>i;i++)if(null!=(a=arguments[i]))for(c in a)d=h[c],e=a[c],h!==e&&(k&&e&&($.isPlainObject(e)||(f=$.isArray(e)))?(f?(f=!1,g=d&&$.isArray(d)?d:[]):g=d&&$.isPlainObject(d)?d:{},h[c]=$.extend(k,g,e)):e!==b&&(h[c]=e));return h},$.extend({noConflict:function(b){return a.$===$&&(a.$=T),b&&a.jQuery===$&&(a.jQuery=S),$},isReady:!1,readyWait:1,holdReady:function(a){a?$.readyWait++:$.ready(!0)},ready:function(a){if(a===!0?!--$.readyWait:!$.isReady){if(!P.body)return setTimeout($.ready,1);$.isReady=!0,a!==!0&&--$.readyWait>0||(O.resolveWith(P,[$]),$.fn.trigger&&$(P).trigger("ready").off("ready"))}},isFunction:function(a){return"function"===$.type(a)},isArray:Array.isArray||function(a){return"array"===$.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null==a?String(a):nb[X.call(a)]||"object"},isPlainObject:function(a){if(!a||"object"!==$.type(a)||a.nodeType||$.isWindow(a))return!1;try{if(a.constructor&&!Y.call(a,"constructor")&&!Y.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||Y.call(a,d)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},error:function(a){throw new Error(a)},parseHTML:function(a,b,c){var d;return a&&"string"==typeof a?("boolean"==typeof b&&(c=b,b=0),b=b||P,(d=eb.exec(a))?[b.createElement(d[1])]:(d=$.buildFragment([a],b,c?null:[]),$.merge([],(d.cacheable?$.clone(d.fragment):d.fragment).childNodes))):null},parseJSON:function(b){return b&&"string"==typeof b?(b=$.trim(b),a.JSON&&a.JSON.parse?a.JSON.parse(b):fb.test(b.replace(hb,"@").replace(ib,"]").replace(gb,""))?new Function("return "+b)():($.error("Invalid JSON: "+b),void 0)):null},parseXML:function(c){var d,e;if(!c||"string"!=typeof c)return null;try{a.DOMParser?(e=new DOMParser,d=e.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(f){d=b}return d&&d.documentElement&&!d.getElementsByTagName("parsererror").length||$.error("Invalid XML: "+c),d},noop:function(){},globalEval:function(b){b&&ab.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(jb,"ms-").replace(kb,lb)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var e,f=0,g=a.length,h=g===b||$.isFunction(a);if(d)if(h){for(e in a)if(c.apply(a[e],d)===!1)break}else for(;g>f&&c.apply(a[f++],d)!==!1;);else if(h){for(e in a)if(c.call(a[e],e,a[e])===!1)break}else for(;g>f&&c.call(a[f],f,a[f++])!==!1;);return a},trim:Z?function(a){return null==a?"":Z.call(a)}:function(a){return null==a?"":a.toString().replace(cb,"")},makeArray:function(a,b){var c,d=b||[];return null!=a&&(c=$.type(a),null==a.length||"string"===c||"function"===c||"regexp"===c||$.isWindow(a)?U.call(d,a):$.merge(d,a)),d},inArray:function(a,b,c){var d;if(b){if(W)return W.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=c.length,e=a.length,f=0;if("number"==typeof d)for(;d>f;f++)a[e++]=c[f];else for(;c[f]!==b;)a[e++]=c[f++];return a.length=e,a},grep:function(a,b,c){var d,e=[],f=0,g=a.length;for(c=!!c;g>f;f++)d=!!b(a[f],f),c!==d&&e.push(a[f]);return e},map:function(a,c,d){var e,f,g=[],h=0,i=a.length,j=a instanceof $||i!==b&&"number"==typeof i&&(i>0&&a[0]&&a[i-1]||0===i||$.isArray(a));if(j)for(;i>h;h++)e=c(a[h],h,d),null!=e&&(g[g.length]=e);else for(f in a)e=c(a[f],f,d),null!=e&&(g[g.length]=e);return g.concat.apply([],g)},guid:1,proxy:function(a,c){var d,e,f;return"string"==typeof c&&(d=a[c],c=a,a=d),$.isFunction(a)?(e=V.call(arguments,2),f=function(){return a.apply(c,e.concat(V.call(arguments)))},f.guid=a.guid=a.guid||f.guid||$.guid++,f):b},access:function(a,c,d,e,f,g,h){var i,j=null==d,k=0,l=a.length;if(d&&"object"==typeof d){for(k in d)$.access(a,c,k,d[k],1,g,e);f=1}else if(e!==b){if(i=h===b&&$.isFunction(e),j&&(i?(i=c,c=function(a,b,c){return i.call($(a),c)}):(c.call(a,e),c=null)),c)for(;l>k;k++)c(a[k],d,i?e.call(a[k],k,c(a[k],d)):e,h);f=1}return f?a:j?c.call(a):l?c(a[0],d):g},now:function(){return(new Date).getTime()}}),$.ready.promise=function(b){if(!O)if(O=$.Deferred(),"complete"===P.readyState||"loading"!==P.readyState&&P.addEventListener)setTimeout($.ready,1);else if(P.addEventListener)P.addEventListener("DOMContentLoaded",mb,!1),a.addEventListener("load",$.ready,!1);else{P.attachEvent("onreadystatechange",mb),a.attachEvent("onload",$.ready);var c=!1;try{c=null==a.frameElement&&P.documentElement}catch(d){}c&&c.doScroll&&function e(){if(!$.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}$.ready()}}()}return O.promise(b)},$.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){nb["[object "+b+"]"]=b.toLowerCase()}),N=$(P);var ob={};$.Callbacks=function(a){a="string"==typeof a?ob[a]||c(a):$.extend({},a);var d,e,f,g,h,i,j=[],k=!a.once&&[],l=function(b){for(d=a.memory&&b,e=!0,i=g||0,g=0,h=j.length,f=!0;j&&h>i;i++)if(j[i].apply(b[0],b[1])===!1&&a.stopOnFalse){d=!1;break}f=!1,j&&(k?k.length&&l(k.shift()):d?j=[]:m.disable())},m={add:function(){if(j){var b=j.length;!function c(b){$.each(b,function(b,d){!$.isFunction(d)||a.unique&&m.has(d)?d&&d.length&&c(d):j.push(d)})}(arguments),f?h=j.length:d&&(g=b,l(d))}return this},remove:function(){return j&&$.each(arguments,function(a,b){for(var c;(c=$.inArray(b,j,c))>-1;)j.splice(c,1),f&&(h>=c&&h--,i>=c&&i--)}),this},has:function(a){return $.inArray(a,j)>-1},empty:function(){return j=[],this},disable:function(){return j=k=d=b,this},disabled:function(){return!j},lock:function(){return k=b,d||m.disable(),this},locked:function(){return!k},fireWith:function(a,b){return b=b||[],b=[a,b.slice?b.slice():b],!j||e&&!k||(f?k.push(b):l(b)),this},fire:function(){return m.fireWith(this,arguments),this},fired:function(){return!!e}};return m},$.extend({Deferred:function(a){var b=[["resolve","done",$.Callbacks("once memory"),"resolved"],["reject","fail",$.Callbacks("once memory"),"rejected"],["notify","progress",$.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return $.Deferred(function(c){$.each(b,function(b,d){var f=d[0],g=a[b];e[d[1]]($.isFunction(g)?function(){var a=g.apply(this,arguments);a&&$.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f+"With"](this===e?c:this,[a])}:c[f])}),a=null}).promise()},promise:function(a){return"object"==typeof a?$.extend(a,d):d}},e={};return d.pipe=d.then,$.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=g.fire,e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b,c,d,e=0,f=V.call(arguments),g=f.length,h=1!==g||a&&$.isFunction(a.promise)?g:0,i=1===h?a:$.Deferred(),j=function(a,c,d){return function(e){c[a]=this,d[a]=arguments.length>1?V.call(arguments):e,d===b?i.notifyWith(c,d):--h||i.resolveWith(c,d)}};if(g>1)for(b=new Array(g),c=new Array(g),d=new Array(g);g>e;e++)f[e]&&$.isFunction(f[e].promise)?f[e].promise().done(j(e,d,f)).fail(i.reject).progress(j(e,c,b)):--h;return h||i.resolveWith(d,f),i.promise()}}),$.support=function(){var b,c,d,e,f,g,h,i,j,k,l,m=P.createElement("div");if(m.setAttribute("className","t"),m.innerHTML="
a ",c=m.getElementsByTagName("*"),d=m.getElementsByTagName("a")[0],d.style.cssText="top:1px;float:left;opacity:.5",!c||!c.length||!d)return{};e=P.createElement("select"),f=e.appendChild(P.createElement("option")),g=m.getElementsByTagName("input")[0],b={leadingWhitespace:3===m.firstChild.nodeType,tbody:!m.getElementsByTagName("tbody").length,htmlSerialize:!!m.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:"/a"===d.getAttribute("href"),opacity:/^0.5/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:"on"===g.value,optSelected:f.selected,getSetAttribute:"t"!==m.className,enctype:!!P.createElement("form").enctype,html5Clone:"<:nav>"!==P.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===P.compatMode,submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},g.checked=!0,b.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,b.optDisabled=!f.disabled;try{delete m.test}catch(n){b.deleteExpando=!1}if(!m.addEventListener&&m.attachEvent&&m.fireEvent&&(m.attachEvent("onclick",l=function(){b.noCloneEvent=!1}),m.cloneNode(!0).fireEvent("onclick"),m.detachEvent("onclick",l)),g=P.createElement("input"),g.value="t",g.setAttribute("type","radio"),b.radioValue="t"===g.value,g.setAttribute("checked","checked"),g.setAttribute("name","t"),m.appendChild(g),h=P.createDocumentFragment(),h.appendChild(m.lastChild),b.checkClone=h.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=g.checked,h.removeChild(g),h.appendChild(m),m.attachEvent)for(j in{submit:!0,change:!0,focusin:!0})i="on"+j,k=i in m,k||(m.setAttribute(i,"return;"),k="function"==typeof m[i]),b[j+"Bubbles"]=k;return $(function(){var c,d,e,f,g="padding:0;margin:0;border:0;display:block;overflow:hidden;",h=P.getElementsByTagName("body")[0];h&&(c=P.createElement("div"),c.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",h.insertBefore(c,h.firstChild),d=P.createElement("div"),c.appendChild(d),d.innerHTML="
",e=d.getElementsByTagName("td"),e[0].style.cssText="padding:0;margin:0;border:0;display:none",k=0===e[0].offsetHeight,e[0].style.display="",e[1].style.display="none",b.reliableHiddenOffsets=k&&0===e[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",b.boxSizing=4===d.offsetWidth,b.doesNotIncludeMarginInBodyOffset=1!==h.offsetTop,a.getComputedStyle&&(b.pixelPosition="1%"!==(a.getComputedStyle(d,null)||{}).top,b.boxSizingReliable="4px"===(a.getComputedStyle(d,null)||{width:"4px"}).width,f=P.createElement("div"),f.style.cssText=d.style.cssText=g,f.style.marginRight=f.style.width="0",d.style.width="1px",d.appendChild(f),b.reliableMarginRight=!parseFloat((a.getComputedStyle(f,null)||{}).marginRight)),"undefined"!=typeof d.style.zoom&&(d.innerHTML="",d.style.cssText=g+"width:1px;padding:1px;display:inline;zoom:1",b.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.style.overflow="visible",d.innerHTML="
",d.firstChild.style.width="5px",b.shrinkWrapBlocks=3!==d.offsetWidth,c.style.zoom=1),h.removeChild(c),c=d=e=f=null)}),h.removeChild(m),c=d=e=f=g=h=m=null,b}();var pb=/^(?:\{.*\}|\[.*\])$/,qb=/([A-Z])/g;$.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+($.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?$.cache[a[$.expando]]:a[$.expando],!!a&&!e(a)},data:function(a,c,d,e){if($.acceptData(a)){var f,g,h=$.expando,i="string"==typeof c,j=a.nodeType,k=j?$.cache:a,l=j?a[h]:a[h]&&h;if(l&&k[l]&&(e||k[l].data)||!i||d!==b)return l||(j?a[h]=l=$.deletedIds.pop()||++$.uuid:l=h),k[l]||(k[l]={},j||(k[l].toJSON=$.noop)),("object"==typeof c||"function"==typeof c)&&(e?k[l]=$.extend(k[l],c):k[l].data=$.extend(k[l].data,c)),f=k[l],e||(f.data||(f.data={}),f=f.data),d!==b&&(f[$.camelCase(c)]=d),i?(g=f[c],null==g&&(g=f[$.camelCase(c)])):g=f,g}},removeData:function(a,b,c){if($.acceptData(a)){var d,f,g,h=a.nodeType,i=h?$.cache:a,j=h?a[$.expando]:$.expando;if(i[j]){if(b&&(d=c?i[j]:i[j].data)){$.isArray(b)||(b in d?b=[b]:(b=$.camelCase(b),b=b in d?[b]:b.split(" ")));for(f=0,g=b.length;g>f;f++)delete d[b[f]];if(!(c?e:$.isEmptyObject)(d))return}(c||(delete i[j].data,e(i[j])))&&(h?$.cleanData([a],!0):$.support.deleteExpando||i!=i.window?delete i[j]:i[j]=null)}}},_data:function(a,b,c){return $.data(a,b,c,!0)},acceptData:function(a){var b=a.nodeName&&$.noData[a.nodeName.toLowerCase()];return!b||b!==!0&&a.getAttribute("classid")===b}}),$.fn.extend({data:function(a,c){var e,f,g,h,i,j=this[0],k=0,l=null;if(a===b){if(this.length&&(l=$.data(j),1===j.nodeType&&!$._data(j,"parsedAttrs"))){for(g=j.attributes,i=g.length;i>k;k++)h=g[k].name,0===h.indexOf("data-")&&(h=$.camelCase(h.substring(5)),d(j,h,l[h]));$._data(j,"parsedAttrs",!0)}return l}return"object"==typeof a?this.each(function(){$.data(this,a)}):(e=a.split(".",2),e[1]=e[1]?"."+e[1]:"",f=e[1]+"!",$.access(this,function(c){return c===b?(l=this.triggerHandler("getData"+f,[e[0]]),l===b&&j&&(l=$.data(j,a),l=d(j,a,l)),l===b&&e[1]?this.data(e[0]):l):(e[1]=c,this.each(function(){var b=$(this);b.triggerHandler("setData"+f,e),$.data(this,a,c),b.triggerHandler("changeData"+f,e)}),void 0)},null,c,arguments.length>1,null,!1))},removeData:function(a){return this.each(function(){$.removeData(this,a)})}}),$.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=$._data(a,b),c&&(!d||$.isArray(c)?d=$._data(a,b,$.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=$.queue(a,b),d=c.shift(),e=$._queueHooks(a,b),f=function(){$.dequeue(a,b)};"inprogress"===d&&(d=c.shift()),d&&("fx"===b&&c.unshift("inprogress"),delete e.stop,d.call(a,f,e)),!c.length&&e&&e.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return $._data(a,c)||$._data(a,c,{empty:$.Callbacks("once memory").add(function(){$.removeData(a,b+"queue",!0),$.removeData(a,c,!0)})})}}),$.fn.extend({queue:function(a,c){var d=2;return"string"!=typeof a&&(c=a,a="fx",d--),arguments.length
1)},removeAttr:function(a){return this.each(function(){$.removeAttr(this,a)})},prop:function(a,b){return $.access(this,$.prop,a,b,arguments.length>1)},removeProp:function(a){return a=$.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if($.isFunction(a))return this.each(function(b){$(this).addClass(a.call(this,b,this.className))});if(a&&"string"==typeof a)for(b=a.split(bb),c=0,d=this.length;d>c;c++)if(e=this[c],1===e.nodeType)if(e.className||1!==b.length){for(f=" "+e.className+" ",g=0,h=b.length;h>g;g++)~f.indexOf(" "+b[g]+" ")||(f+=b[g]+" ");e.className=$.trim(f)}else e.className=a;return this},removeClass:function(a){var c,d,e,f,g,h,i;if($.isFunction(a))return this.each(function(b){$(this).removeClass(a.call(this,b,this.className))});if(a&&"string"==typeof a||a===b)for(c=(a||"").split(bb),h=0,i=this.length;i>h;h++)if(e=this[h],1===e.nodeType&&e.className){for(d=(" "+e.className+" ").replace(ub," "),f=0,g=c.length;g>f;f++)for(;d.indexOf(" "+c[f]+" ")>-1;)d=d.replace(" "+c[f]+" "," ");e.className=a?$.trim(d):""}return this},toggleClass:function(a,b){var c=typeof a,d="boolean"==typeof b;return $.isFunction(a)?this.each(function(c){$(this).toggleClass(a.call(this,c,this.className,b),b)}):this.each(function(){if("string"===c)for(var e,f=0,g=$(this),h=b,i=a.split(bb);e=i[f++];)h=d?h:!g.hasClass(e),g[h?"addClass":"removeClass"](e);else("undefined"===c||"boolean"===c)&&(this.className&&$._data(this,"__className__",this.className),this.className=this.className||a===!1?"":$._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];{if(arguments.length)return e=$.isFunction(a),this.each(function(d){var f,g=$(this);1===this.nodeType&&(f=e?a.call(this,d,g.val()):a,null==f?f="":"number"==typeof f?f+="":$.isArray(f)&&(f=$.map(f,function(a){return null==a?"":a+""})),c=$.valHooks[this.type]||$.valHooks[this.nodeName.toLowerCase()],c&&"set"in c&&c.set(this,f,"value")!==b||(this.value=f))});if(f)return c=$.valHooks[f.type]||$.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,"string"==typeof d?d.replace(vb,""):null==d?"":d)}}}),$.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i="select-one"===a.type;if(0>f)return null;for(c=i?f:0,d=i?f+1:h.length;d>c;c++)if(e=h[c],!(!e.selected||($.support.optDisabled?e.disabled:null!==e.getAttribute("disabled"))||e.parentNode.disabled&&$.nodeName(e.parentNode,"optgroup"))){if(b=$(e).val(),i)return b;g.push(b)}return i&&!g.length&&h.length?$(h[f]).val():g},set:function(a,b){var c=$.makeArray(b);return $(a).find("option").each(function(){this.selected=$.inArray($(this).val(),c)>=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(a&&3!==i&&8!==i&&2!==i)return e&&$.isFunction($.fn[c])?$(a)[c](d):"undefined"==typeof a.getAttribute?$.prop(a,c,d):(h=1!==i||!$.isXMLDoc(a),h&&(c=c.toLowerCase(),g=$.attrHooks[c]||(zb.test(c)?sb:rb)),d!==b?null===d?($.removeAttr(a,c),void 0):g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d):g&&"get"in g&&h&&null!==(f=g.get(a,c))?f:(f=a.getAttribute(c),null===f?b:f))},removeAttr:function(a,b){var c,d,e,f,g=0;if(b&&1===a.nodeType)for(d=b.split(bb);g=0:void 0}})});var Bb=/^(?:textarea|input|select)$/i,Cb=/^([^\.]*|)(?:\.(.+)|)$/,Db=/(?:^|\s)hover(\.\S+|)\b/,Eb=/^key/,Fb=/^(?:mouse|contextmenu)|click/,Gb=/^(?:focusinfocus|focusoutblur)$/,Hb=function(a){return $.event.special.hover?a:a.replace(Db,"mouseenter$1 mouseleave$1")};$.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q;if(3!==a.nodeType&&8!==a.nodeType&&c&&d&&(g=$._data(a))){for(d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=$.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return"undefined"==typeof $||a&&$.event.triggered===a.type?b:$.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=$.trim(Hb(c)).split(" "),j=0;j=0&&(q=q.slice(0,-1),h=!0),q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),e&&!$.event.customEvent[q]||$.event.global[q]))if(c="object"==typeof c?c[$.expando]?c:new $.Event(q,c):new $.Event(q),c.type=q,c.isTrigger=!0,c.exclusive=h,c.namespace=r.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,l=q.indexOf(":")<0?"on"+q:"",e){if(c.result=b,c.target||(c.target=e),d=null!=d?$.makeArray(d):[],d.unshift(c),m=$.event.special[q]||{},!m.trigger||m.trigger.apply(e,d)!==!1){if(o=[[e,m.bindType||q]],!f&&!m.noBubble&&!$.isWindow(e)){for(p=m.delegateType||q,j=Gb.test(p+q)?e:e.parentNode,k=e;j;j=j.parentNode)o.push([j,p]),k=j;k===(e.ownerDocument||P)&&o.push([k.defaultView||k.parentWindow||a,p])}for(i=0;id;d++)l=n[d],m=l.selector,i[m]===b&&(i[m]=g.is(m)),i[m]&&k.push(l);k.length&&s.push({elem:f,matches:k})}for(n.length>o&&s.push({elem:this,matches:n.slice(o)}),d=0;d0?this.on(b,null,a,c):this.trigger(b)},Eb.test(b)&&($.event.fixHooks[b]=$.event.keyHooks),Fb.test(b)&&($.event.fixHooks[b]=$.event.mouseHooks)}),function(a,b){function c(a,b,c,d){for(var e=0,f=b.length;f>e;e++)fb(a,b[e],c,d)}function d(a,b,d,e,f,g){var h,i=gb.setFilters[b.toLowerCase()];return i||fb.error(b),(a||!(h=f))&&c(a||"*",e,h=[],f),h.length>0?i(h,d,g):[]}function e(a,e,f,g,h){for(var i,j,k,l,m,n,o,p,q=0,r=h.length,s=S.POS,t=new RegExp("^"+s.source+"(?!"+y+")","i"),u=function(){for(var a=1,c=arguments.length-2;c>a;a++)arguments[a]===b&&(i[a]=b)};r>q;q++){for(s.exec(""),a=h[q],l=[],k=0,m=g;i=s.exec(a);)p=s.lastIndex=i.index+i[0].length,p>k&&(o=a.slice(k,i.index),k=p,n=[e],I.test(o)&&(m&&(n=m),m=g),(j=O.test(o))&&(o=o.slice(0,-5).replace(I,"$&*")),i.length>1&&i[0].replace(t,u),m=d(o,i[1],i[2],n,m,j));m?(l=l.concat(m),(o=a.slice(k))&&")"!==o?I.test(o)?c(o,l,f,g):fb(o,e,f,g?g.concat(m):m):w.apply(f,l)):fb(a,e,f,g)}return 1===r?f:fb.uniqueSort(f)}function f(a,b,c){for(var d,e,f,g=[],h=0,i=K.exec(a),j=!i.pop()&&!i.pop(),k=j&&a.match(J)||[""],l=gb.preFilter,m=gb.filter,n=!c&&b!==p;null!=(e=k[h])&&j;h++)for(g.push(d=[]),n&&(e=" "+e);e;){j=!1,(i=I.exec(e))&&(e=e.slice(i[0].length),j=d.push({part:i.pop().replace(H," "),captures:i}));for(f in m)!(i=S[f].exec(e))||l[f]&&!(i=l[f](i,b,c))||(e=e.slice(i.shift().length),j=d.push({part:f,captures:i}));if(!j)break}return j||fb.error(a),g}function g(a,b,c){var d=b.dir,e=u++;return a||(a=function(a){return a===c}),b.first?function(b,c){for(;b=b[d];)if(1===b.nodeType)return a(b,c)&&b}:function(b,c){for(var f,g=e+"."+l,h=g+"."+k;b=b[d];)if(1===b.nodeType){if((f=b[x])===h)return b.sizset;if("string"==typeof f&&0===f.indexOf(g)){if(b.sizset)return b}else{if(b[x]=h,a(b,c))return b.sizset=!0,b;b.sizset=!1}}}}function h(a,b){return a?function(c,d){var e=b(c,d);return e&&a(e===!0?c:e,d)}:b}function i(a,b,c){for(var d,e,f=0;d=a[f];f++)gb.relative[d.part]?e=g(e,gb.relative[d.part],b):(d.captures.push(b,c),e=h(e,gb.filter[d.part].apply(null,d.captures)));return e}function j(a){return function(b,c){for(var d,e=0;d=a[e];e++)if(d(b,c))return!0;return!1}}var k,l,m,n,o,p=a.document,q=p.documentElement,r="undefined",s=!1,t=!0,u=0,v=[].slice,w=[].push,x=("sizcache"+Math.random()).replace(".",""),y="[\\x20\\t\\r\\n\\f]",z="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",A=z.replace("w","w#"),B="([*^$|!~]?=)",C="\\["+y+"*("+z+")"+y+"*(?:"+B+y+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+A+")|)|)"+y+"*\\]",D=":("+z+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|((?:[^,]|\\\\,|(?:,(?=[^\\[]*\\]))|(?:,(?=[^\\(]*\\))))*))\\)|)",E=":(nth|eq|gt|lt|first|last|even|odd)(?:\\((\\d*)\\)|)(?=[^-]|$)",F=y+"*([\\x20\\t\\r\\n\\f>+~])"+y+"*",G="(?=[^\\x20\\t\\r\\n\\f])(?:\\\\.|"+C+"|"+D.replace(2,7)+"|[^\\\\(),])+",H=new RegExp("^"+y+"+|((?:^|[^\\\\])(?:\\\\.)*)"+y+"+$","g"),I=new RegExp("^"+F),J=new RegExp(G+"?(?="+y+"*,|$)","g"),K=new RegExp("^(?:(?!,)(?:(?:^|,)"+y+"*"+G+")*?|"+y+"*(.*?))(\\)|$)"),L=new RegExp(G.slice(19,-6)+"\\x20\\t\\r\\n\\f>+~])+|"+F,"g"),M=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,N=/[\x20\t\r\n\f]*[+~]/,O=/:not\($/,P=/h\d/i,Q=/input|select|textarea|button/i,R=/\\(?!\\)/g,S={ID:new RegExp("^#("+z+")"),CLASS:new RegExp("^\\.("+z+")"),NAME:new RegExp("^\\[name=['\"]?("+z+")['\"]?\\]"),TAG:new RegExp("^("+z.replace("[-","[-\\*")+")"),ATTR:new RegExp("^"+C),PSEUDO:new RegExp("^"+D),CHILD:new RegExp("^:(only|nth|last|first)-child(?:\\("+y+"*(even|odd|(([+-]|)(\\d*)n|)"+y+"*(?:([+-]|)"+y+"*(\\d+)|))"+y+"*\\)|)","i"),POS:new RegExp(E,"ig"),needsContext:new RegExp("^"+y+"*[>+~]|"+E,"i")},T={},U=[],V={},W=[],X=function(a){return a.sizzleFilter=!0,a},Y=function(a){return function(b){return"input"===b.nodeName.toLowerCase()&&b.type===a}},Z=function(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}},_=function(a){var b=!1,c=p.createElement("div");try{b=a(c)}catch(d){}return c=null,b},ab=_(function(a){a.innerHTML=" ";var b=typeof a.lastChild.getAttribute("multiple");return"boolean"!==b&&"string"!==b}),bb=_(function(a){a.id=x+0,a.innerHTML="
",q.insertBefore(a,q.firstChild);var b=p.getElementsByName&&p.getElementsByName(x).length===2+p.getElementsByName(x+0).length;return o=!p.getElementById(x),q.removeChild(a),b}),cb=_(function(a){return a.appendChild(p.createComment("")),0===a.getElementsByTagName("*").length}),db=_(function(a){return a.innerHTML=" ",a.firstChild&&typeof a.firstChild.getAttribute!==r&&"#"===a.firstChild.getAttribute("href")}),eb=_(function(a){return a.innerHTML="
",a.getElementsByClassName&&0!==a.getElementsByClassName("e").length?(a.lastChild.className="e",1!==a.getElementsByClassName("e").length):!1}),fb=function(a,b,c,d){c=c||[],b=b||p;var e,f,g,h,i=b.nodeType;if(1!==i&&9!==i)return[];if(!a||"string"!=typeof a)return c;if(g=ib(b),!g&&!d&&(e=M.exec(a)))if(h=e[1]){if(9===i){if(f=b.getElementById(h),!f||!f.parentNode)return c;if(f.id===h)return c.push(f),c}else if(b.ownerDocument&&(f=b.ownerDocument.getElementById(h))&&jb(b,f)&&f.id===h)return c.push(f),c}else{if(e[2])return w.apply(c,v.call(b.getElementsByTagName(a),0)),c;if((h=e[3])&&eb&&b.getElementsByClassName)return w.apply(c,v.call(b.getElementsByClassName(h),0)),c}return mb(a,b,c,d,g)},gb=fb.selectors={cacheLength:50,match:S,order:["ID","TAG"],attrHandle:{},createPseudo:X,find:{ID:o?function(a,b,c){if(typeof b.getElementById!==r&&!c){var d=b.getElementById(a);return d&&d.parentNode?[d]:[]}}:function(a,c,d){if(typeof c.getElementById!==r&&!d){var e=c.getElementById(a);return e?e.id===a||typeof e.getAttributeNode!==r&&e.getAttributeNode("id").value===a?[e]:b:[]}},TAG:cb?function(a,b){return typeof b.getElementsByTagName!==r?b.getElementsByTagName(a):void 0}:function(a,b){var c=b.getElementsByTagName(a);if("*"===a){for(var d,e=[],f=0;d=c[f];f++)1===d.nodeType&&e.push(d);return e}return c}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(R,""),a[3]=(a[4]||a[5]||"").replace(R,""),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1]?(a[2]||fb.error(a[0]),a[3]=+(a[3]?a[4]+(a[5]||1):2*("even"===a[2]||"odd"===a[2])),a[4]=+(a[6]+a[7]||"odd"===a[2])):a[2]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=a[4];return S.CHILD.test(a[0])?null:(c&&(b=K.exec(c))&&b.pop()&&(a[0]=a[0].slice(0,b[0].length-c.length-1),c=b[0].slice(0,-1)),a.splice(2,3,c||a[3]),a)}},filter:{ID:o?function(a){return a=a.replace(R,""),function(b){return b.getAttribute("id")===a}}:function(a){return a=a.replace(R,""),function(b){var c=typeof b.getAttributeNode!==r&&b.getAttributeNode("id");return c&&c.value===a}},TAG:function(a){return"*"===a?function(){return!0}:(a=a.replace(R,"").toLowerCase(),function(b){return b.nodeName&&b.nodeName.toLowerCase()===a})},CLASS:function(a){var b=T[a];return b||(b=T[a]=new RegExp("(^|"+y+")"+a+"("+y+"|$)"),U.push(a),U.length>gb.cacheLength&&delete T[U.shift()]),function(a){return b.test(a.className||typeof a.getAttribute!==r&&a.getAttribute("class")||"")}},ATTR:function(a,b,c){return b?function(d){var e=fb.attr(d,a),f=e+"";if(null==e)return"!="===b;switch(b){case"=":return f===c;case"!=":return f!==c;case"^=":return c&&0===f.indexOf(c);case"*=":return c&&f.indexOf(c)>-1;case"$=":return c&&f.substr(f.length-c.length)===c;case"~=":return(" "+f+" ").indexOf(c)>-1;case"|=":return f===c||f.substr(0,c.length+1)===c+"-"}}:function(b){return null!=fb.attr(b,a)}},CHILD:function(a,b,c,d){if("nth"===a){var e=u++;return function(a){var b,f,g=0,h=a;if(1===c&&0===d)return!0;if(b=a.parentNode,b&&(b[x]!==e||!a.sizset)){for(h=b.firstChild;h&&(1!==h.nodeType||(h.sizset=++g,h!==a));h=h.nextSibling);b[x]=e}return f=a.sizset-d,0===c?0===f:0===f%c&&f/c>=0}}return function(b){var c=b;switch(a){case"only":case"first":for(;c=c.previousSibling;)if(1===c.nodeType)return!1;if("first"===a)return!0;c=b;case"last":for(;c=c.nextSibling;)if(1===c.nodeType)return!1;return!0}}},PSEUDO:function(a,b,c,d){var e=gb.pseudos[a]||gb.pseudos[a.toLowerCase()];return e||fb.error("unsupported pseudo: "+a),e.sizzleFilter?e(b,c,d):e}},pseudos:{not:X(function(a,b,c){var d=lb(a.replace(H,"$1"),b,c);return function(a){return!d(a)}}),enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!gb.pseudos.empty(a)},empty:function(a){var b;for(a=a.firstChild;a;){if(a.nodeName>"@"||3===(b=a.nodeType)||4===b)return!1;a=a.nextSibling}return!0},contains:X(function(a){return function(b){return(b.textContent||b.innerText||kb(b)).indexOf(a)>-1}}),has:X(function(a){return function(b){return fb(a,b).length>0}}),header:function(a){return P.test(a.nodeName)},text:function(a){var b,c;return"input"===a.nodeName.toLowerCase()&&"text"===(b=a.type)&&(null==(c=a.getAttribute("type"))||c.toLowerCase()===b)},radio:Y("radio"),checkbox:Y("checkbox"),file:Y("file"),password:Y("password"),image:Y("image"),submit:Z("submit"),reset:Z("reset"),button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},input:function(a){return Q.test(a.nodeName)},focus:function(a){var b=a.ownerDocument;return!(a!==b.activeElement||b.hasFocus&&!b.hasFocus()||!a.type&&!a.href)},active:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b,c){return c?a.slice(1):[a[0]]},last:function(a,b,c){var d=a.pop();return c?a:[d]},even:function(a,b,c){for(var d=[],e=c?1:0,f=a.length;f>e;e+=2)d.push(a[e]);return d},odd:function(a,b,c){for(var d=[],e=c?0:1,f=a.length;f>e;e+=2)d.push(a[e]);return d},lt:function(a,b,c){return c?a.slice(+b):a.slice(0,+b)},gt:function(a,b,c){return c?a.slice(0,+b+1):a.slice(+b+1)},eq:function(a,b,c){var d=a.splice(+b,1);return c?a:d}}};gb.setFilters.nth=gb.setFilters.eq,gb.filters=gb.pseudos,db||(gb.attrHandle={href:function(a){return a.getAttribute("href",2)},type:function(a){return a.getAttribute("type")}}),bb&&(gb.order.push("NAME"),gb.find.NAME=function(a,b){return typeof b.getElementsByName!==r?b.getElementsByName(a):void 0}),eb&&(gb.order.splice(1,0,"CLASS"),gb.find.CLASS=function(a,b,c){return typeof b.getElementsByClassName===r||c?void 0:b.getElementsByClassName(a)});try{v.call(q.childNodes,0)[0].nodeType}catch(hb){v=function(a){for(var b,c=[];b=this[a];a++)c.push(b);return c}}var ib=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},jb=fb.contains=q.compareDocumentPosition?function(a,b){return!!(16&a.compareDocumentPosition(b))}:q.contains?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b.parentNode;return a===d||!!(d&&1===d.nodeType&&c.contains&&c.contains(d))}:function(a,b){for(;b=b.parentNode;)if(b===a)return!0;return!1},kb=fb.getText=function(a){var b,c="",d=0,e=a.nodeType;if(e){if(1===e||9===e||11===e){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=kb(a)}else if(3===e||4===e)return a.nodeValue}else for(;b=a[d];d++)c+=kb(b);return c};fb.attr=function(a,b){var c,d=ib(a);return d||(b=b.toLowerCase()),gb.attrHandle[b]?gb.attrHandle[b](a):ab||d?a.getAttribute(b):(c=a.getAttributeNode(b),c?"boolean"==typeof a[b]?a[b]?b:null:c.specified?c.value:null:null)},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},[0,0].sort(function(){return t=0}),q.compareDocumentPosition?m=function(a,b){return a===b?(s=!0,0):(a.compareDocumentPosition&&b.compareDocumentPosition?4&a.compareDocumentPosition(b):a.compareDocumentPosition)?-1:1}:(m=function(a,b){if(a===b)return s=!0,0;if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,h=b.parentNode,i=g;if(g===h)return n(a,b);if(!g)return-1;if(!h)return 1;for(;i;)e.unshift(i),i=i.parentNode;for(i=h;i;)f.unshift(i),i=i.parentNode;c=e.length,d=f.length;for(var j=0;c>j&&d>j;j++)if(e[j]!==f[j])return n(e[j],f[j]);return j===c?n(a,f[j],-1):n(e[j],b,1)},n=function(a,b,c){if(a===b)return c;for(var d=a.nextSibling;d;){if(d===b)return-1;d=d.nextSibling}return 1}),fb.uniqueSort=function(a){var b,c=1;if(m&&(s=t,a.sort(m),s))for(;b=a[c];c++)b===a[c-1]&&a.splice(c--,1);return a};var lb=fb.compile=function(a,b,c){var d,e,g,h=V[a];if(h&&h.context===b)return h;for(e=f(a,b,c),g=0;d=e[g];g++)e[g]=i(d,b,c);return h=V[a]=j(e),h.context=b,h.runs=h.dirruns=0,W.push(a),W.length>gb.cacheLength&&delete V[W.shift()],h};fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){return fb(b,null,null,[a]).length>0};var mb=function(a,b,c,d,f){a=a.replace(H,"$1");var g,h,i,j,m,n,o,p,q,r=a.match(J),s=a.match(L),t=b.nodeType;if(S.POS.test(a))return e(a,b,c,d,r);if(d)g=v.call(d,0);else if(r&&1===r.length){if(s.length>1&&9===t&&!f&&(r=S.ID.exec(s[0]))){if(b=gb.find.ID(r[1],b,f)[0],!b)return c;a=a.slice(s.shift().length)}for(p=(r=N.exec(s[0]))&&!r.index&&b.parentNode||b,q=s.pop(),n=q.split(":not")[0],i=0,j=gb.order.length;j>i;i++)if(o=gb.order[i],r=S[o].exec(n)){if(g=gb.find[o]((r[1]||"").replace(R,""),p,f),null==g)continue;n===q&&(a=a.slice(0,a.length-q.length)+n.replace(S[o],""),a||w.apply(c,v.call(g,0)));break}}if(a)for(h=lb(a,b,f),l=h.dirruns++,null==g&&(g=gb.find.TAG("*",N.test(a)&&b.parentNode||b)),i=0;m=g[i];i++)k=h.runs++,h(m,b)&&c.push(m);return c};p.querySelectorAll&&function(){var a,b=mb,c=/'|\\/g,d=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,e=[],f=[":active"],g=q.matchesSelector||q.mozMatchesSelector||q.webkitMatchesSelector||q.oMatchesSelector||q.msMatchesSelector;_(function(a){a.innerHTML=" ",a.querySelectorAll("[selected]").length||e.push("\\["+y+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),a.querySelectorAll(":checked").length||e.push(":checked")}),_(function(a){a.innerHTML="
",a.querySelectorAll("[test^='']").length&&e.push("[*^$]="+y+"*(?:\"\"|'')"),a.innerHTML=" ",a.querySelectorAll(":enabled").length||e.push(":enabled",":disabled")}),e=e.length&&new RegExp(e.join("|")),mb=function(a,d,f,g,h){if(!(g||h||e&&e.test(a)))if(9===d.nodeType)try{return w.apply(f,v.call(d.querySelectorAll(a),0)),f}catch(i){}else if(1===d.nodeType&&"object"!==d.nodeName.toLowerCase()){var j=d.getAttribute("id"),k=j||x,l=N.test(a)&&d.parentNode||d;j?k=k.replace(c,"\\$&"):d.setAttribute("id",k);try{return w.apply(f,v.call(l.querySelectorAll(a.replace(J,"[id='"+k+"'] $&")),0)),f}catch(i){}finally{j||d.removeAttribute("id")}}return b(a,d,f,g,h)},g&&(_(function(b){a=g.call(b,"div");try{g.call(b,"[test!='']:sizzle"),f.push(gb.match.PSEUDO)}catch(c){}}),f=new RegExp(f.join("|")),fb.matchesSelector=function(b,c){if(c=c.replace(d,"='$1']"),!(ib(b)||f.test(c)||e&&e.test(c)))try{var h=g.call(b,c);if(h||a||b.document&&11!==b.document.nodeType)return h}catch(i){}return fb(c,null,null,[b]).length>0})}(),fb.attr=$.attr,$.find=fb,$.expr=fb.selectors,$.expr[":"]=$.expr.pseudos,$.unique=fb.uniqueSort,$.text=fb.getText,$.isXMLDoc=fb.isXML,$.contains=fb.contains}(a);var Ib=/Until$/,Jb=/^(?:parents|prev(?:Until|All))/,Kb=/^.[^:#\[\.,]*$/,Lb=$.expr.match.needsContext,Mb={children:!0,contents:!0,next:!0,prev:!0};$.fn.extend({find:function(a){var b,c,d,e,f,g,h=this;if("string"!=typeof a)return $(a).filter(function(){for(b=0,c=h.length;c>b;b++)if($.contains(h[b],this))return!0});for(g=this.pushStack("","find",a),b=0,c=this.length;c>b;b++)if(d=g.length,$.find(a,this[b],g),b>0)for(e=d;ef;f++)if(g[f]===g[e]){g.splice(e--,1);break}return g},has:function(a){var b,c=$(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if($.contains(this,c[b]))return!0})},not:function(a){return this.pushStack(j(this,a,!1),"not",a)},filter:function(a){return this.pushStack(j(this,a,!0),"filter",a)},is:function(a){return!!a&&("string"==typeof a?Lb.test(a)?$(a,this.context).index(this[0])>=0:$.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=Lb.test(a)||"string"!=typeof a?$(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c.ownerDocument&&c!==b&&11!==c.nodeType;){if(g?g.index(c)>-1:$.find.matchesSelector(c,a)){f.push(c);break}c=c.parentNode}return f=f.length>1?$.unique(f):f,this.pushStack(f,"closest",a)},index:function(a){return a?"string"==typeof a?$.inArray(this[0],$(a)):$.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c="string"==typeof a?$(a,b):$.makeArray(a&&a.nodeType?[a]:a),d=$.merge(this.get(),c);return this.pushStack(h(c[0])||h(d[0])?d:$.unique(d))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}}),$.fn.andSelf=$.fn.addBack,$.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return $.dir(a,"parentNode")},parentsUntil:function(a,b,c){return $.dir(a,"parentNode",c)},next:function(a){return i(a,"nextSibling")},prev:function(a){return i(a,"previousSibling")},nextAll:function(a){return $.dir(a,"nextSibling")},prevAll:function(a){return $.dir(a,"previousSibling")},nextUntil:function(a,b,c){return $.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return $.dir(a,"previousSibling",c)},siblings:function(a){return $.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return $.sibling(a.firstChild)},contents:function(a){return $.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:$.merge([],a.childNodes)}},function(a,b){$.fn[a]=function(c,d){var e=$.map(this,b,c);return Ib.test(a)||(d=c),d&&"string"==typeof d&&(e=$.filter(d,e)),e=this.length>1&&!Mb[a]?$.unique(e):e,this.length>1&&Jb.test(a)&&(e=e.reverse()),this.pushStack(e,a,V.call(arguments).join(","))}}),$.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),1===b.length?$.find.matchesSelector(b[0],a)?[b[0]]:[]:$.find.matches(a,b)},dir:function(a,c,d){for(var e=[],f=a[c];f&&9!==f.nodeType&&(d===b||1!==f.nodeType||!$(f).is(d));)1===f.nodeType&&e.push(f),f=f[c];return e},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}});var Nb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Ob=/ jQuery\d+="(?:null|\d+)"/g,Pb=/^\s+/,Qb=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Rb=/<([\w:]+)/,Sb=/ ]","i"),Xb=/^(?:checkbox|radio)$/,Yb=/checked\s*(?:[^=]|=\s*.checked.)/i,Zb=/\/(java|ecma)script/i,$b=/^\s*\s*$/g,_b={option:[1,""," "],legend:[1,""," "],thead:[1,""],tr:[2,""],td:[3,""],col:[2,""],area:[1,""," "],_default:[0,"",""]},ac=k(P),bc=ac.appendChild(P.createElement("div"));
+_b.optgroup=_b.option,_b.tbody=_b.tfoot=_b.colgroup=_b.caption=_b.thead,_b.th=_b.td,$.support.htmlSerialize||(_b._default=[1,"X","
"]),$.fn.extend({text:function(a){return $.access(this,function(a){return a===b?$.text(this):this.empty().append((this[0]&&this[0].ownerDocument||P).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if($.isFunction(a))return this.each(function(b){$(this).wrapAll(a.call(this,b))});if(this[0]){var b=$(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){for(var a=this;a.firstChild&&1===a.firstChild.nodeType;)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return $.isFunction(a)?this.each(function(b){$(this).wrapInner(a.call(this,b))}):this.each(function(){var b=$(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=$.isFunction(a);return this.each(function(c){$(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){$.nodeName(this,"body")||$(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){(1===this.nodeType||11===this.nodeType)&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){(1===this.nodeType||11===this.nodeType)&&this.insertBefore(a,this.firstChild)})},before:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(a,this),"before",this.selector)}},after:function(){if(!h(this[0]))return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=$.clean(arguments);return this.pushStack($.merge(this,a),"after",this.selector)}},remove:function(a,b){for(var c,d=0;null!=(c=this[d]);d++)(!a||$.filter(a,[c]).length)&&(b||1!==c.nodeType||($.cleanData(c.getElementsByTagName("*")),$.cleanData([c])),c.parentNode&&c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)for(1===a.nodeType&&$.cleanData(a.getElementsByTagName("*"));a.firstChild;)a.removeChild(a.firstChild);return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return $.clone(this,a,b)})},html:function(a){return $.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return 1===c.nodeType?c.innerHTML.replace(Ob,""):b;if(!("string"!=typeof a||Ub.test(a)||!$.support.htmlSerialize&&Wb.test(a)||!$.support.leadingWhitespace&&Pb.test(a)||_b[(Rb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(Qb,"<$1>$2>");try{for(;e>d;d++)c=this[d]||{},1===c.nodeType&&($.cleanData(c.getElementsByTagName("*")),c.innerHTML=a);c=0}catch(f){}}c&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(a){return h(this[0])?this.length?this.pushStack($($.isFunction(a)?a():a),"replaceWith",a):this:$.isFunction(a)?this.each(function(b){var c=$(this),d=c.html();c.replaceWith(a.call(this,b,d))}):("string"!=typeof a&&(a=$(a).detach()),this.each(function(){var b=this.nextSibling,c=this.parentNode;$(this).remove(),b?$(b).before(a):$(c).append(a)}))},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){a=[].concat.apply([],a);var e,f,g,h,i=0,j=a[0],k=[],m=this.length;if(!$.support.checkClone&&m>1&&"string"==typeof j&&Yb.test(j))return this.each(function(){$(this).domManip(a,c,d)});if($.isFunction(j))return this.each(function(e){var f=$(this);a[0]=j.call(this,e,c?f.html():b),f.domManip(a,c,d)});if(this[0]){if(e=$.buildFragment(a,this,k),g=e.fragment,f=g.firstChild,1===g.childNodes.length&&(g=f),f)for(c=c&&$.nodeName(f,"tr"),h=e.cacheable||m-1;m>i;i++)d.call(c&&$.nodeName(this[i],"table")?l(this[i],"tbody"):this[i],i===h?g:$.clone(g,!0,!0));g=f=null,k.length&&$.each(k,function(a,b){b.src?$.ajax?$.ajax({url:b.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):$.error("no ajax"):$.globalEval((b.text||b.textContent||b.innerHTML||"").replace($b,"")),b.parentNode&&b.parentNode.removeChild(b)})}return this}}),$.buildFragment=function(a,c,d){var e,f,g,h=a[0];return c=c||P,c=(c[0]||c).ownerDocument||c[0]||c,"undefined"==typeof c.createDocumentFragment&&(c=P),!(1===a.length&&"string"==typeof h&&h.length<512&&c===P&&"<"===h.charAt(0))||Vb.test(h)||!$.support.checkClone&&Yb.test(h)||!$.support.html5Clone&&Wb.test(h)||(f=!0,e=$.fragments[h],g=e!==b),e||(e=c.createDocumentFragment(),$.clean(a,c,e,d),f&&($.fragments[h]=g&&e)),{fragment:e,cacheable:f}},$.fragments={},$.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){$.fn[a]=function(c){var d,e=0,f=[],g=$(c),h=g.length,i=1===this.length&&this[0].parentNode;if((null==i||i&&11===i.nodeType&&1===i.childNodes.length)&&1===h)return g[b](this[0]),this;for(;h>e;e++)d=(e>0?this.clone(!0):this).get(),$(g[e])[b](d),f=f.concat(d);return this.pushStack(f,a,g.selector)}}),$.extend({clone:function(a,b,c){var d,e,f,g;if($.support.html5Clone||$.isXMLDoc(a)||!Wb.test("<"+a.nodeName+">")?g=a.cloneNode(!0):(bc.innerHTML=a.outerHTML,bc.removeChild(g=bc.firstChild)),!($.support.noCloneEvent&&$.support.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||$.isXMLDoc(a)))for(n(a,g),d=o(a),e=o(g),f=0;d[f];++f)e[f]&&n(d[f],e[f]);if(b&&(m(a,g),c))for(d=o(a),e=o(g),f=0;d[f];++f)m(d[f],e[f]);return d=e=null,g},clean:function(a,b,c,d){var e,f,g,h,i,j,l,m,n,o,q,r=0,s=[];for(b&&"undefined"!=typeof b.createDocumentFragment||(b=P),f=b===P&∾null!=(g=a[r]);r++)if("number"==typeof g&&(g+=""),g){if("string"==typeof g)if(Tb.test(g)){for(f=f||k(b),l=l||f.appendChild(b.createElement("div")),g=g.replace(Qb,"<$1>$2>"),h=(Rb.exec(g)||["",""])[1].toLowerCase(),i=_b[h]||_b._default,j=i[0],l.innerHTML=i[1]+g+i[2];j--;)l=l.lastChild;if(!$.support.tbody)for(m=Sb.test(g),n="table"!==h||m?""!==i[1]||m?[]:l.childNodes:l.firstChild&&l.firstChild.childNodes,e=n.length-1;e>=0;--e)$.nodeName(n[e],"tbody")&&!n[e].childNodes.length&&n[e].parentNode.removeChild(n[e]);!$.support.leadingWhitespace&&Pb.test(g)&&l.insertBefore(b.createTextNode(Pb.exec(g)[0]),l.firstChild),g=l.childNodes,l=f.lastChild}else g=b.createTextNode(g);g.nodeType?s.push(g):s=$.merge(s,g)}if(l&&(f.removeChild(l),g=l=f=null),!$.support.appendChecked)for(r=0;null!=(g=s[r]);r++)$.nodeName(g,"input")?p(g):"undefined"!=typeof g.getElementsByTagName&&$.grep(g.getElementsByTagName("input"),p);if(c)for(o=function(a){return!a.type||Zb.test(a.type)?d?d.push(a.parentNode?a.parentNode.removeChild(a):a):c.appendChild(a):void 0},r=0;null!=(g=s[r]);r++)$.nodeName(g,"script")&&o(g)||(c.appendChild(g),"undefined"!=typeof g.getElementsByTagName&&(q=$.grep($.merge([],g.getElementsByTagName("script")),o),s.splice.apply(s,[r+1,0].concat(q)),r+=q.length));return s},cleanData:function(a,b){for(var c,d,e,f,g=0,h=$.expando,i=$.cache,j=$.support.deleteExpando,k=$.event.special;null!=(e=a[g]);g++)if((b||$.acceptData(e))&&(d=e[h],c=d&&i[d])){if(c.events)for(f in c.events)k[f]?$.event.remove(e,f):$.removeEvent(e,f,c.handle);i[d]&&(delete i[d],j?delete e[h]:e.removeAttribute?e.removeAttribute(h):e[h]=null,$.deletedIds.push(d))}}}),function(){var a,b;$.uaMatch=function(a){a=a.toLowerCase();var b=/(chrome)[ \/]([\w.]+)/.exec(a)||/(webkit)[ \/]([\w.]+)/.exec(a)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(a)||/(msie) ([\w.]+)/.exec(a)||a.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},a=$.uaMatch(R.userAgent),b={},a.browser&&(b[a.browser]=!0,b.version=a.version),b.webkit&&(b.safari=!0),$.browser=b,$.sub=function(){function a(b,c){return new a.fn.init(b,c)}$.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(c,d){return d&&d instanceof $&&!(d instanceof a)&&(d=a(d)),$.fn.init.call(this,c,d,b)},a.fn.init.prototype=a.fn;var b=a(P);return a}}();var cc,dc,ec,fc=/alpha\([^)]*\)/i,gc=/opacity=([^)]*)/,hc=/^(top|right|bottom|left)$/,ic=/^margin/,jc=new RegExp("^("+_+")(.*)$","i"),kc=new RegExp("^("+_+")(?!px)[a-z%]+$","i"),lc=new RegExp("^([-+])=("+_+")","i"),mc={},nc={position:"absolute",visibility:"hidden",display:"block"},oc={letterSpacing:0,fontWeight:400,lineHeight:1},pc=["Top","Right","Bottom","Left"],qc=["Webkit","O","Moz","ms"],rc=$.fn.toggle;$.fn.extend({css:function(a,c){return $.access(this,function(a,c,d){return d!==b?$.style(a,c,d):$.css(a,c)},a,c,arguments.length>1)},show:function(){return s(this,!0)},hide:function(){return s(this)},toggle:function(a,b){var c="boolean"==typeof a;return $.isFunction(a)&&$.isFunction(b)?rc.apply(this,arguments):this.each(function(){(c?a:r(this))?$(this).show():$(this).hide()})}}),$.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=cc(a,"opacity");return""===c?"1":c}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":$.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var f,g,h,i=$.camelCase(c),j=a.style;if(c=$.cssProps[i]||($.cssProps[i]=q(j,i)),h=$.cssHooks[c]||$.cssHooks[i],d===b)return h&&"get"in h&&(f=h.get(a,!1,e))!==b?f:j[c];if(g=typeof d,"string"===g&&(f=lc.exec(d))&&(d=(f[1]+1)*f[2]+parseFloat($.css(a,c)),g="number"),!(null==d||"number"===g&&isNaN(d)||("number"!==g||$.cssNumber[i]||(d+="px"),h&&"set"in h&&(d=h.set(a,d,e))===b)))try{j[c]=d}catch(k){}}},css:function(a,c,d,e){var f,g,h,i=$.camelCase(c);return c=$.cssProps[i]||($.cssProps[i]=q(a.style,i)),h=$.cssHooks[c]||$.cssHooks[i],h&&"get"in h&&(f=h.get(a,!0,e)),f===b&&(f=cc(a,c)),"normal"===f&&c in oc&&(f=oc[c]),d||e!==b?(g=parseFloat(f),d||$.isNumeric(g)?g||0:f):f},swap:function(a,b,c){var d,e,f={};for(e in b)f[e]=a.style[e],a.style[e]=b[e];d=c.call(a);for(e in b)a.style[e]=f[e];return d}}),a.getComputedStyle?cc=function(a,b){var c,d,e,f,g=getComputedStyle(a,null),h=a.style;return g&&(c=g[b],""!==c||$.contains(a.ownerDocument.documentElement,a)||(c=$.style(a,b)),kc.test(c)&&ic.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=c,c=g.width,h.width=d,h.minWidth=e,h.maxWidth=f)),c}:P.documentElement.currentStyle&&(cc=function(a,b){var c,d,e=a.currentStyle&&a.currentStyle[b],f=a.style;return null==e&&f&&f[b]&&(e=f[b]),kc.test(e)&&!hc.test(b)&&(c=f.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),f.left="fontSize"===b?"1em":e,e=f.pixelLeft+"px",f.left=c,d&&(a.runtimeStyle.left=d)),""===e?"auto":e}),$.each(["height","width"],function(a,b){$.cssHooks[b]={get:function(a,c,d){return c?0!==a.offsetWidth||"none"!==cc(a,"display")?v(a,b,d):$.swap(a,nc,function(){return v(a,b,d)}):void 0},set:function(a,c,d){return t(a,c,d?u(a,b,d,$.support.boxSizing&&"border-box"===$.css(a,"boxSizing")):0)}}}),$.support.opacity||($.cssHooks.opacity={get:function(a,b){return gc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=$.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,b>=1&&""===$.trim(f.replace(fc,""))&&c.removeAttribute&&(c.removeAttribute("filter"),d&&!d.filter)||(c.filter=fc.test(f)?f.replace(fc,e):f+" "+e)}}),$(function(){$.support.reliableMarginRight||($.cssHooks.marginRight={get:function(a,b){return $.swap(a,{display:"inline-block"},function(){return b?cc(a,"marginRight"):void 0})}}),!$.support.pixelPosition&&$.fn.position&&$.each(["top","left"],function(a,b){$.cssHooks[b]={get:function(a,c){if(c){var d=cc(a,b);return kc.test(d)?$(a).position()[b]+"px":d}}}})}),$.expr&&$.expr.filters&&($.expr.filters.hidden=function(a){return 0===a.offsetWidth&&0===a.offsetHeight||!$.support.reliableHiddenOffsets&&"none"===(a.style&&a.style.display||cc(a,"display"))},$.expr.filters.visible=function(a){return!$.expr.filters.hidden(a)}),$.each({margin:"",padding:"",border:"Width"},function(a,b){$.cssHooks[a+b]={expand:function(c){var d,e="string"==typeof c?c.split(" "):[c],f={};for(d=0;4>d;d++)f[a+pc[d]+b]=e[d]||e[d-2]||e[0];return f}},ic.test(a)||($.cssHooks[a+b].set=t)});var sc=/%20/g,tc=/\[\]$/,uc=/\r?\n/g,vc=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,wc=/^(?:select|textarea)/i;$.fn.extend({serialize:function(){return $.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?$.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||wc.test(this.nodeName)||vc.test(this.type))}).map(function(a,b){var c=$(this).val();return null==c?null:$.isArray(c)?$.map(c,function(a){return{name:b.name,value:a.replace(uc,"\r\n")}}):{name:b.name,value:c.replace(uc,"\r\n")}}).get()}}),$.param=function(a,c){var d,e=[],f=function(a,b){b=$.isFunction(b)?b():null==b?"":b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(c===b&&(c=$.ajaxSettings&&$.ajaxSettings.traditional),$.isArray(a)||a.jquery&&!$.isPlainObject(a))$.each(a,function(){f(this.name,this.value)});else for(d in a)x(d,a[d],c,f);return e.join("&").replace(sc,"+")};var xc,yc,zc=/#.*$/,Ac=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Bc=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,Cc=/^(?:GET|HEAD)$/,Dc=/^\/\//,Ec=/\?/,Fc=/
-
-
- Download GIF
- Export online
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/settings/export-png.html b/templates-2014-07-12-12-20/settings/export-png.html
deleted file mode 100644
index 08c9ee66..00000000
--- a/templates-2014-07-12-12-20/settings/export-png.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
- Export Spritesheet as PNG
-
-
-
Preview :
-
-
-
Download PNG
-
Export online
-
-
-
-
- Export Spritesheet as ZIP
-
-
-
A ZIP archive will be created with one PNG file per frame.
-
- Download ZIP
-
-
-
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/settings/import.html b/templates-2014-07-12-12-20/settings/import.html
deleted file mode 100644
index 6041cd3b..00000000
--- a/templates-2014-07-12-12-20/settings/import.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/settings/save.html b/templates-2014-07-12-12-20/settings/save.html
deleted file mode 100644
index 54e6a126..00000000
--- a/templates-2014-07-12-12-20/settings/save.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/cheatsheet.html b/templates/cheatsheet.html
similarity index 100%
rename from templates-2014-07-12-12-20/cheatsheet.html
rename to templates/cheatsheet.html
diff --git a/templates/dialogs/browse-local.html b/templates/dialogs/browse-local.html
new file mode 100644
index 00000000..800ac0ce
--- /dev/null
+++ b/templates/dialogs/browse-local.html
@@ -0,0 +1,27 @@
+
+
+ Browse Local Piskels
+ X
+
+
+
+
+
+ Name
+ Date
+ Actions
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/dialogs/import-image.html b/templates/dialogs/import-image.html
new file mode 100644
index 00000000..8746d971
--- /dev/null
+++ b/templates/dialogs/import-image.html
@@ -0,0 +1,27 @@
+
+
+ Import Image
+ X
+
+
+
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/dialogs/manage-palettes.html b/templates/dialogs/manage-palettes.html
similarity index 95%
rename from templates-2014-07-12-12-20/dialogs/manage-palettes.html
rename to templates/dialogs/manage-palettes.html
index 59cb296f..795cbcaa 100644
--- a/templates-2014-07-12-12-20/dialogs/manage-palettes.html
+++ b/templates/dialogs/manage-palettes.html
@@ -1,7 +1,7 @@
-
+
Palette manager
- X
+ X
diff --git a/templates-2014-07-12-12-20/drawing-tools.html b/templates/drawing-tools.html
similarity index 100%
rename from templates-2014-07-12-12-20/drawing-tools.html
rename to templates/drawing-tools.html
diff --git a/templates-2014-07-12-12-20/frames-list.html b/templates/frames-list.html
similarity index 100%
rename from templates-2014-07-12-12-20/frames-list.html
rename to templates/frames-list.html
diff --git a/templates-2014-07-12-12-20/layers-list.html b/templates/layers-list.html
similarity index 100%
rename from templates-2014-07-12-12-20/layers-list.html
rename to templates/layers-list.html
diff --git a/templates-2014-07-12-12-20/palettes-list.html b/templates/palettes-list.html
similarity index 100%
rename from templates-2014-07-12-12-20/palettes-list.html
rename to templates/palettes-list.html
diff --git a/templates-2014-07-12-12-20/preview.html b/templates/preview.html
similarity index 100%
rename from templates-2014-07-12-12-20/preview.html
rename to templates/preview.html
diff --git a/templates-2014-07-12-12-20/settings.html b/templates/settings.html
similarity index 73%
rename from templates-2014-07-12-12-20/settings.html
rename to templates/settings.html
index 24760296..d50d1164 100644
--- a/templates-2014-07-12-12-20/settings.html
+++ b/templates/settings.html
@@ -1,10 +1,5 @@
-
-
+
+
+
+
+
+
+
-
+
-
ANIM
-
-
-
- SHEET
-
+
-->
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/settings/application.html b/templates/settings/application.html
similarity index 100%
rename from templates-2014-07-12-12-20/settings/application.html
rename to templates/settings/application.html
diff --git a/templates/settings/export.html b/templates/settings/export.html
new file mode 100644
index 00000000..7a32c810
--- /dev/null
+++ b/templates/settings/export.html
@@ -0,0 +1,40 @@
+
+
+ Export Spritesheet
+
+
+
+ PNG with all frames side by side.
+ Download PNG
+
+
+
ZIP with one PNG file per frame.
+
+ Download ZIP
+
+
+
+ Export to Animated GIF
+
+
+
+
+ Select resolution:
+
+
+
+
+ Download GIF
+ Get public URL
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates/settings/import.html b/templates/settings/import.html
new file mode 100644
index 00000000..e7adb92b
--- /dev/null
+++ b/templates/settings/import.html
@@ -0,0 +1,55 @@
+
+
+ Load from Browser
+
+
+
Load a local piskel saved in this Browser
+
+ Browse local saves
+
+
+
+ Load .piskel file
+
+
+
Load a .piskel file from your computer
+
+
+ Browse .piskel files
+
+
+
+
+
+ Import From Picture
+
+
+
Supports : PNG, JPG, BMP, Animated GIF ...
+
+ Browse images
+
+
+
+
+ Recover recent sessions
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/templates-2014-07-12-12-20/settings/localstorage.html b/templates/settings/localstorage.html
similarity index 100%
rename from templates-2014-07-12-12-20/settings/localstorage.html
rename to templates/settings/localstorage.html
diff --git a/templates-2014-07-12-12-20/settings/resize.html b/templates/settings/resize.html
similarity index 100%
rename from templates-2014-07-12-12-20/settings/resize.html
rename to templates/settings/resize.html
diff --git a/templates/settings/save.html b/templates/settings/save.html
new file mode 100644
index 00000000..20e7be89
--- /dev/null
+++ b/templates/settings/save.html
@@ -0,0 +1,42 @@
+
+
+ Describe your piskel
+
+
+ Title :
+
+
+
+
+
+
+
+ Public :
+
+
+
+ Save online
+
+ Save offline in Browser
+
+
Your piskel will be saved locally and will only be accessible from this browser.
+
+
+ Save offline as File
+
+
+
+
+
+
+
\ No newline at end of file