jQuery.cookie is deprecated so use js-cookie instead (+ composer), some js tweaking too
Conflicts: ext/blotter/script.js ext/handle_pixel/script.js ext/index/script.js ext/pools/script.js lib/shimmie.js
This commit is contained in:
parent
951323abcf
commit
caed53de6a
6 changed files with 24 additions and 176 deletions
|
@ -29,15 +29,17 @@
|
|||
"bower-asset/jquery" : "1.12.3",
|
||||
"bower-asset/jquery-timeago" : "1.5.2",
|
||||
"bower-asset/tablesorter" : "2.0.5",
|
||||
"bower-asset/mediaelement" : "2.21.1"
|
||||
"bower-asset/mediaelement" : "2.21.1",
|
||||
"bower-asset/js-cookie" : "2.1.1"
|
||||
},
|
||||
|
||||
"vendor-copy": {
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.js" : "lib/vendor/js/jquery-1.12.3.min.js",
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.map" : "lib/vendor/js/jquery-1.12.3.min.map",
|
||||
"vendor/bower-asset/jquery-timeago/jquery.timeago.js" : "lib/vendor/js/jquery.timeago.js",
|
||||
"vendor/bower-asset/tablesorter/jquery.tablesorter.min.js" : "lib/vendor/js/jquery.tablesorter.min.js"
|
||||
"vendor/bower-asset/mediaelement/build/flashmediaelement.swf" : "lib/vendor/swf/flashmediaelement.swf"
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.js" : "lib/vendor/js/jquery-1.12.3.min.js",
|
||||
"vendor/bower-asset/jquery/dist/jquery.min.map" : "lib/vendor/js/jquery-1.12.3.min.map",
|
||||
"vendor/bower-asset/jquery-timeago/jquery.timeago.js" : "lib/vendor/js/jquery.timeago.js",
|
||||
"vendor/bower-asset/tablesorter/jquery.tablesorter.min.js" : "lib/vendor/js/jquery.tablesorter.min.js",
|
||||
"vendor/bower-asset/mediaelement/build/flashmediaelement.swf" : "lib/vendor/swf/flashmediaelement.swf",
|
||||
"vendor/bower-asset/js-cookie/src/js.cookie.js" : "lib/vendor/js/js.cookie.js"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
|
||||
$(function() {
|
||||
var order_pool = Cookies.get("shm_ui-order-pool") || "created";
|
||||
$("#order_pool option[value="+order_pool+"]").attr("selected", true);
|
||||
|
||||
$('#order_pool').change(function(){
|
||||
var val = $("#order_pool option:selected").val();
|
||||
Cookies.set("shm_ui-order-pool", val, {expires: 365}); //FIXME: This won't play nice if COOKIE_PREFIX is not "shm_".
|
||||
Cookies.set("shm_ui-order-pool", val, {path: '/', expires: 365}); //FIXME: This won't play nice if COOKIE_PREFIX is not "shm_".
|
||||
window.location.href = '';
|
||||
});
|
||||
});
|
||||
|
|
|
@ -86,14 +86,14 @@ class PoolsTheme extends Themelet {
|
|||
|
||||
$html .= "</tbody></table>";
|
||||
|
||||
$order_html = '
|
||||
<select id="order_pool">
|
||||
<option value="created">Recently created</option>
|
||||
<option value="updated">Last updated</option>
|
||||
<option value="name">Name</option>
|
||||
<option value="count">Post count</option>
|
||||
</select>
|
||||
';
|
||||
$order_html = '<select id="order_pool">';
|
||||
$order_selected = $page->get_cookie('ui-order-pool');
|
||||
$order_arr = ['created' => 'Recently created', 'updated' => 'Last updated', 'name' => 'Name', 'count' => 'Post Count'];
|
||||
foreach($order_arr as $value => $text) {
|
||||
$selected = ($value == $order_selected ? "selected" : "");
|
||||
$order_html .= "<option value=\"{$value}\" {$selected}>{$text}</option>\n";
|
||||
}
|
||||
$order_html .= '</select>';
|
||||
|
||||
$this->display_top(null, "Pools");
|
||||
$page->add_block(new Block("Order By", $order_html, "left", 15));
|
||||
|
|
151
lib/js.cookie.js
151
lib/js.cookie.js
|
@ -1,151 +0,0 @@
|
|||
/*!
|
||||
* JavaScript Cookie v2.1.2
|
||||
* https://github.com/js-cookie/js-cookie
|
||||
*
|
||||
* Copyright 2006, 2015 Klaus Hartl & Fagner Brack
|
||||
* Released under the MIT license
|
||||
*/
|
||||
;(function (factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
var OldCookies = window.Cookies;
|
||||
var api = window.Cookies = factory();
|
||||
api.noConflict = function () {
|
||||
window.Cookies = OldCookies;
|
||||
return api;
|
||||
};
|
||||
}
|
||||
}(function () {
|
||||
function extend () {
|
||||
var i = 0;
|
||||
var result = {};
|
||||
for (; i < arguments.length; i++) {
|
||||
var attributes = arguments[ i ];
|
||||
for (var key in attributes) {
|
||||
result[key] = attributes[key];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function init (converter) {
|
||||
function api (key, value, attributes) {
|
||||
var result;
|
||||
if (typeof document === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Write
|
||||
|
||||
if (arguments.length > 1) {
|
||||
attributes = extend({
|
||||
path: '/'
|
||||
}, api.defaults, attributes);
|
||||
|
||||
if (typeof attributes.expires === 'number') {
|
||||
var expires = new Date();
|
||||
expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5);
|
||||
attributes.expires = expires;
|
||||
}
|
||||
|
||||
try {
|
||||
result = JSON.stringify(value);
|
||||
if (/^[\{\[]/.test(result)) {
|
||||
value = result;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (!converter.write) {
|
||||
value = encodeURIComponent(String(value))
|
||||
.replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent);
|
||||
} else {
|
||||
value = converter.write(value, key);
|
||||
}
|
||||
|
||||
key = encodeURIComponent(String(key));
|
||||
key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent);
|
||||
key = key.replace(/[\(\)]/g, escape);
|
||||
|
||||
return (document.cookie = [
|
||||
key, '=', value,
|
||||
attributes.expires && '; expires=' + attributes.expires.toUTCString(), // use expires attribute, max-age is not supported by IE
|
||||
attributes.path && '; path=' + attributes.path,
|
||||
attributes.domain && '; domain=' + attributes.domain,
|
||||
attributes.secure ? '; secure' : ''
|
||||
].join(''));
|
||||
}
|
||||
|
||||
// Read
|
||||
|
||||
if (!key) {
|
||||
result = {};
|
||||
}
|
||||
|
||||
// To prevent the for loop in the first place assign an empty array
|
||||
// in case there are no cookies at all. Also prevents odd result when
|
||||
// calling "get()"
|
||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
||||
var rdecode = /(%[0-9A-Z]{2})+/g;
|
||||
var i = 0;
|
||||
|
||||
for (; i < cookies.length; i++) {
|
||||
var parts = cookies[i].split('=');
|
||||
var cookie = parts.slice(1).join('=');
|
||||
|
||||
if (cookie.charAt(0) === '"') {
|
||||
cookie = cookie.slice(1, -1);
|
||||
}
|
||||
|
||||
try {
|
||||
var name = parts[0].replace(rdecode, decodeURIComponent);
|
||||
cookie = converter.read ?
|
||||
converter.read(cookie, name) : converter(cookie, name) ||
|
||||
cookie.replace(rdecode, decodeURIComponent);
|
||||
|
||||
if (this.json) {
|
||||
try {
|
||||
cookie = JSON.parse(cookie);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if (key === name) {
|
||||
result = cookie;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!key) {
|
||||
result[name] = cookie;
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
api.set = api;
|
||||
api.get = function (key) {
|
||||
return api(key);
|
||||
};
|
||||
api.getJSON = function () {
|
||||
return api.apply({
|
||||
json: true
|
||||
}, [].slice.call(arguments));
|
||||
};
|
||||
api.defaults = {};
|
||||
|
||||
api.remove = function (key, attributes) {
|
||||
api(key, '', extend(attributes, {
|
||||
expires: -1
|
||||
}));
|
||||
};
|
||||
|
||||
api.withConverter = init;
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
return init(function () {});
|
||||
}));
|
|
@ -17,14 +17,14 @@ class CustomSetupTheme extends SetupTheme {
|
|||
$(\"#$i-toggle\").click(function() {
|
||||
$(\"#$i\").slideToggle(\"slow\", function() {
|
||||
if($(\"#$i\").is(\":hidden\")) {
|
||||
$.cookie(\"$i-hidden\", 'true', {path: '/'});
|
||||
Cookies.set(\"$i-hidden\", 'true', {path: '/'});
|
||||
}
|
||||
else {
|
||||
$.cookie(\"$i-hidden\", 'false', {path: '/'});
|
||||
Cookies.set(\"$i-hidden\", 'false', {path: '/'});
|
||||
}
|
||||
});
|
||||
});
|
||||
if($.cookie(\"$i-hidden\") == 'true') {
|
||||
if(Cookies.get(\"$i-hidden\") == 'true') {
|
||||
$(\"#$i\").hide();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ $(function(){
|
|||
} else {
|
||||
$("#left-block").prependTo("#main-grid")
|
||||
}
|
||||
$.cookie("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
Cookies.set("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
zoom("width");
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ $(function(){
|
|||
} else {
|
||||
$("#left-block").prependTo("#main-grid")
|
||||
}
|
||||
$.cookie("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
Cookies.set("ui-layout-type", layout_type, {path: '/', expires: 365});
|
||||
zoom("width");
|
||||
}
|
||||
current_layout = $.cookie("layout-type");
|
||||
current_layout = Cookies.get("layout-type");
|
||||
if (current_layout != null) {
|
||||
if(current_layout =="top" || current_layout == "bottom"){
|
||||
leftAddFullSize(current_layout);
|
||||
|
@ -91,5 +91,5 @@ function zoom(zoom_type) {
|
|||
|
||||
$(".shm-zoomer").val(zoom_type);
|
||||
|
||||
$.cookie("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
||||
Cookies.set("ui-image-zoom", zoom_type, {path: '/', expires: 365});
|
||||
}
|
||||
|
|
Reference in a new issue