mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-12 23:17:02 +02:00
mobile theme fixes and enhancements
This commit is contained in:
1
webui/view/javascript/jquery.resizableColumns.min.js
vendored
Normal file
1
webui/view/javascript/jquery.resizableColumns.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
var __bind=function(a,b){return function(){return a.apply(b,arguments)}},__slice=[].slice;!function(a,b){var c,d,e;return d=function(a){return parseFloat(a.style.width.replace("%",""))},e=function(a,b){return b=b.toFixed(2),a.style.width=""+b+"%"},c=function(){function c(c,d){this.mousedown=__bind(this.mousedown,this);var e=this;this.options=a.extend({},this.defaults,d),this.$table=c,this.setHeaders(),this.restoreColumnWidths(),this.syncHandleWidths(),a(b).on("resize.rc",function(){return e.syncHandleWidths()})}return c.prototype.defaults={store:b.store,rigidSizing:!1,resizeFromBody:!0},c.prototype.getColumnId=function(a){return this.$table.data("resizable-columns-id")+"-"+a.data("resizable-column-id")},c.prototype.setHeaders=function(){return this.$tableHeaders=this.$table.find("tr th:visible"),this.assignPercentageWidths(),this.createHandles()},c.prototype.destroy=function(){return this.$handleContainer.remove(),this.$table.removeData("resizableColumns"),a(b).off(".rc")},c.prototype.assignPercentageWidths=function(){var b=this;return this.$tableHeaders.each(function(c,d){var f;return f=a(d),e(f[0],100*(f.outerWidth()/b.$table.width()))})},c.prototype.createHandles=function(){var b=this;return a(".rc-handle-container").remove(),this.$table.before(this.$handleContainer=a("<div class='rc-handle-container' />")),this.$tableHeaders.each(function(c,d){var e;if(0!==b.$tableHeaders.eq(c+1).length&&null==b.$tableHeaders.eq(c).attr("data-noresize")&&null==b.$tableHeaders.eq(c+1).attr("data-noresize"))return e=a("<div class='rc-handle' />"),e.data("th",a(d)),e.appendTo(b.$handleContainer)}),this.$handleContainer.on("mousedown",".rc-handle",this.mousedown)},c.prototype.syncHandleWidths=function(){var b=this;return this.setHeaders(),this.$handleContainer.width(this.$table.width()).find(".rc-handle").each(function(c,d){var e;return e=a(d),e.css({left:e.data("th").outerWidth()+(e.data("th").offset().left-b.$handleContainer.offset().left),height:b.options.resizeFromBody?b.$table.height():b.$table.find("thead").height()})})},c.prototype.saveColumnWidths=function(){var b=this;return this.$tableHeaders.each(function(c,e){var f;return f=a(e),null==f.attr("data-noresize")&&null!=b.options.store?store.set(b.getColumnId(f),d(f[0])):void 0})},c.prototype.restoreColumnWidths=function(){var b=this;return this.$tableHeaders.each(function(c,d){var f,g;return f=a(d),null!=b.options.store&&(g=store.get(b.getColumnId(f)))?e(f[0],g):void 0})},c.prototype.totalColumnWidths=function(){var b;return b=0,this.$tableHeaders.each(function(c,d){return b+=parseFloat(a(d)[0].style.width.replace("%",""))}),b},c.prototype.mousedown=function(b){var c,f,g,h,i,j=this;return b.preventDefault(),h=b.pageX,c=a(b.currentTarget),f=c.data("th"),g=this.$tableHeaders.eq(this.$tableHeaders.index(f)+1),i={left:d(f[0]),right:d(g[0])},this.$table.addClass("rc-table-resizing"),a(document).on("mousemove.rc",function(a){var b;return b=100*((a.pageX-h)/j.$table.width()),e(g[0],i.right-b),e(f[0],i.left+b)}),a(document).one("mouseup",function(){return a(document).off("mousemove.rc"),j.$table.removeClass("rc-table-resizing"),j.syncHandleWidths(),j.saveColumnWidths()})},c}(),a.fn.extend({resizableColumns:function(){var b,d;return d=arguments[0],b=2<=arguments.length?__slice.call(arguments,1):[],this.each(function(){var e,f;return e=a(this),f=e.data("resizableColumns"),f||e.data("resizableColumns",f=new c(e,d)),"string"==typeof d?f[d].apply(f,b):void 0})}})}(window.jQuery,window);
|
@ -148,6 +148,10 @@ var Piler =
|
||||
Piler.fill_current_messages_array();
|
||||
Piler.spinner('stop');
|
||||
$('#resultsheader').show();
|
||||
|
||||
/*$("table").resizableColumns({
|
||||
store: store
|
||||
});*/
|
||||
})
|
||||
.fail(function( a, b )// jqXHR, textStatus, errorThrown
|
||||
{
|
||||
|
153
webui/view/javascript/store.js
Normal file
153
webui/view/javascript/store.js
Normal file
@ -0,0 +1,153 @@
|
||||
;(function(){
|
||||
var store = {},
|
||||
win = window,
|
||||
doc = win.document,
|
||||
localStorageName = 'localStorage',
|
||||
namespace = '__storejs__',
|
||||
storage
|
||||
|
||||
store.disabled = false
|
||||
store.set = function(key, value) {}
|
||||
store.get = function(key) {}
|
||||
store.remove = function(key) {}
|
||||
store.clear = function() {}
|
||||
store.transact = function(key, defaultVal, transactionFn) {
|
||||
var val = store.get(key)
|
||||
if (transactionFn == null) {
|
||||
transactionFn = defaultVal
|
||||
defaultVal = null
|
||||
}
|
||||
if (typeof val == 'undefined') { val = defaultVal || {} }
|
||||
transactionFn(val)
|
||||
store.set(key, val)
|
||||
}
|
||||
store.getAll = function() {}
|
||||
|
||||
store.serialize = function(value) {
|
||||
return JSON.stringify(value)
|
||||
}
|
||||
store.deserialize = function(value) {
|
||||
if (typeof value != 'string') { return undefined }
|
||||
try { return JSON.parse(value) }
|
||||
catch(e) { return value || undefined }
|
||||
}
|
||||
|
||||
// Functions to encapsulate questionable FireFox 3.6.13 behavior
|
||||
// when about.config::dom.storage.enabled === false
|
||||
// See https://github.com/marcuswestin/store.js/issues#issue/13
|
||||
function isLocalStorageNameSupported() {
|
||||
try { return (localStorageName in win && win[localStorageName]) }
|
||||
catch(err) { return false }
|
||||
}
|
||||
|
||||
if (isLocalStorageNameSupported()) {
|
||||
storage = win[localStorageName]
|
||||
store.set = function(key, val) {
|
||||
if (val === undefined) { return store.remove(key) }
|
||||
storage.setItem(key, store.serialize(val))
|
||||
return val
|
||||
}
|
||||
store.get = function(key) { return store.deserialize(storage.getItem(key)) }
|
||||
store.remove = function(key) { storage.removeItem(key) }
|
||||
store.clear = function() { storage.clear() }
|
||||
store.getAll = function() {
|
||||
var ret = {}
|
||||
for (var i=0; i<storage.length; ++i) {
|
||||
var key = storage.key(i)
|
||||
ret[key] = store.get(key)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
} else if (doc.documentElement.addBehavior) {
|
||||
var storageOwner,
|
||||
storageContainer
|
||||
// Since #userData storage applies only to specific paths, we need to
|
||||
// somehow link our data to a specific path. We choose /favicon.ico
|
||||
// as a pretty safe option, since all browsers already make a request to
|
||||
// this URL anyway and being a 404 will not hurt us here. We wrap an
|
||||
// iframe pointing to the favicon in an ActiveXObject(htmlfile) object
|
||||
// (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx)
|
||||
// since the iframe access rules appear to allow direct access and
|
||||
// manipulation of the document element, even for a 404 page. This
|
||||
// document can be used instead of the current document (which would
|
||||
// have been limited to the current path) to perform #userData storage.
|
||||
try {
|
||||
storageContainer = new ActiveXObject('htmlfile')
|
||||
storageContainer.open()
|
||||
storageContainer.write('<s' + 'cript>document.w=window</s' + 'cript><iframe src="/favicon.ico"></iframe>')
|
||||
storageContainer.close()
|
||||
storageOwner = storageContainer.w.frames[0].document
|
||||
storage = storageOwner.createElement('div')
|
||||
} catch(e) {
|
||||
// somehow ActiveXObject instantiation failed (perhaps some special
|
||||
// security settings or otherwse), fall back to per-path storage
|
||||
storage = doc.createElement('div')
|
||||
storageOwner = doc.body
|
||||
}
|
||||
function withIEStorage(storeFunction) {
|
||||
return function() {
|
||||
var args = Array.prototype.slice.call(arguments, 0)
|
||||
args.unshift(storage)
|
||||
// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx
|
||||
// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx
|
||||
storageOwner.appendChild(storage)
|
||||
storage.addBehavior('#default#userData')
|
||||
storage.load(localStorageName)
|
||||
var result = storeFunction.apply(store, args)
|
||||
storageOwner.removeChild(storage)
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// In IE7, keys may not contain special chars. See all of https://github.com/marcuswestin/store.js/issues/40
|
||||
var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g")
|
||||
function ieKeyFix(key) {
|
||||
return key.replace(forbiddenCharsRegex, '___')
|
||||
}
|
||||
store.set = withIEStorage(function(storage, key, val) {
|
||||
key = ieKeyFix(key)
|
||||
if (val === undefined) { return store.remove(key) }
|
||||
storage.setAttribute(key, store.serialize(val))
|
||||
storage.save(localStorageName)
|
||||
return val
|
||||
})
|
||||
store.get = withIEStorage(function(storage, key) {
|
||||
key = ieKeyFix(key)
|
||||
return store.deserialize(storage.getAttribute(key))
|
||||
})
|
||||
store.remove = withIEStorage(function(storage, key) {
|
||||
key = ieKeyFix(key)
|
||||
storage.removeAttribute(key)
|
||||
storage.save(localStorageName)
|
||||
})
|
||||
store.clear = withIEStorage(function(storage) {
|
||||
var attributes = storage.XMLDocument.documentElement.attributes
|
||||
storage.load(localStorageName)
|
||||
for (var i=0, attr; attr=attributes[i]; i++) {
|
||||
storage.removeAttribute(attr.name)
|
||||
}
|
||||
storage.save(localStorageName)
|
||||
})
|
||||
store.getAll = withIEStorage(function(storage) {
|
||||
var attributes = storage.XMLDocument.documentElement.attributes
|
||||
var ret = {}
|
||||
for (var i=0, attr; attr=attributes[i]; ++i) {
|
||||
var key = ieKeyFix(attr.name)
|
||||
ret[attr.name] = store.deserialize(storage.getAttribute(key))
|
||||
}
|
||||
return ret
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
store.set(namespace, namespace)
|
||||
if (store.get(namespace) != namespace) { store.disabled = true }
|
||||
store.remove(namespace)
|
||||
} catch(e) {
|
||||
store.disabled = true
|
||||
}
|
||||
store.enabled = !store.disabled
|
||||
if (typeof module != 'undefined' && module.exports) { module.exports = store }
|
||||
else if (typeof define === 'function' && define.amd) { define(store) }
|
||||
else { this.store = store }
|
||||
})();
|
Reference in New Issue
Block a user