From b83050e4cefb2a9161f0690773d3fecddf69a456 Mon Sep 17 00:00:00 2001 From: bergware Date: Tue, 26 May 2020 00:52:39 +0200 Subject: [PATCH 1/8] Add sprintf javascript function --- plugins/dynamix/javascript/dynamix.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/dynamix/javascript/dynamix.js b/plugins/dynamix/javascript/dynamix.js index 23d4902ec..0e7836ccc 100644 --- a/plugins/dynamix/javascript/dynamix.js +++ b/plugins/dynamix/javascript/dynamix.js @@ -34,3 +34,5 @@ var context=context||function(){function b(b){a=$.extend({},a,b),$(document).on( !function(t,e,s){"use strict";var i=function(t,e){var s={};function i(t){return t?function(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}(t):void 0}(function(){var i=["responseType","withCredentials","timeout","onprogress"];function r(t,e,s){t[e]=t[e]||s}s.ajax=function(s,n){var o=s.headers||{},a=s.body,h=s.method||(a?"POST":"GET"),c=!1,l=function(e){if(e&&t.XDomainRequest&&!/MSIE 1/.test(navigator.userAgent))return new XDomainRequest;if(t.XMLHttpRequest)return new XMLHttpRequest}(s.cors);function d(t,s){return function(){c||(n(l.status===e?t:l.status,0===l.status?"Error":l.response||l.responseText||s,l),c=!0)}}l.open(h,s.url,!0);var u=l.onload=d(200);l.onreadystatechange=function(){4===l.readyState&&u()},l.onerror=d(null,"Error"),l.ontimeout=d(null,"Timeout"),l.onabort=d(null,"Abort"),a&&(r(o,"X-Requested-With","XMLHttpRequest"),t.FormData&&a instanceof t.FormData||r(o,"Content-Type","application/x-www-form-urlencoded"));for(var p=0,m=i.length;pi;++i)s[i].apply(this,e);return this},i.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},i.prototype.hasListeners=function(t){return!!this.listeners(t).length};var r,n=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){return function(){t.apply(e,arguments)}},o={};function a(e,s){if("undefined"!=typeof window&&this===window)throw"use 'new NchanSubscriber(...)' to initialize";if(this.url=e,"string"==typeof(s=s||{})&&(s={subscriber:s}),s.transport&&!s.subscriber&&(s.subscriber=s.transport),"string"==typeof s.subscriber&&(s.subscriber=[s.subscriber]),this.desiredTransport=s.subscriber,s.shared){if(!("localStorage"in t))throw"localStorage unavailable for use in shared NchanSubscriber";var i="NchanSubscriber:"+this.url+":shared:",r=function(t){return i+t},o=t.localStorage;this.shared={id:""+Math.random()+Math.random(),key:r,get:function(t){return o.getItem(r(t))},set:function(t,e){return o.setItem(r(t),e)},setWithId:n(function(t,e){return this.shared.set(t,"##"+this.shared.id+":"+e)},this),getWithId:n(function(t){return this.shared.stripIdFromVal(this.shared.get(t))},this),stripIdFromVal:function(t){if(!t)return t;var e=t.indexOf(":");return t[0]==t[1]&&"#"==t[0]&&e?t.substring(e+1,t.length):t},remove:function(t){return o.removeItem(r(t))},matchEventKey:n(function(t,e){return(!t.storageArea||t.storageArea==o)&&t.key==r(e)},this),matchEventKeyWithId:n(function(t,e){if(this.shared.matchEventKey(t,e)){var s=t.newValue,i=s.indexOf(":");if(s[0]!=s[1]||"#"!=s[0]||!i)return!0;var r=s.substring(2,i);return r!=this.shared.id}return!1},this),setRole:n(function(t){if("master"==t&&"master"!=this.shared.role){var e=(new Date).getTime()/1e3;this.shared.setWithId("master:created",e),this.shared.setWithId("master:lastSeen",e)}return"slave"!=t||this.lastMessageId||(this.lastMessageId=this.shared.get("msg:id")),this.shared.role=t,this},this),demoteToSlave:n(function(){if("master"!=this.shared.role)throw"can't demote non-master to slave";this.running?(this.stop(),this.shared.setRole("slave"),this.initializeTransport(),this.start()):this.initializeTransport()},this),maybePromoteToMaster:n(function(){if(!this.running&&!this.starting)return this;if(!this.shared.maybePromotingToMaster){var e;this.shared.maybePromotingToMaster=!0;var s,i=0,r=Math.random(),o=r,a=n(function(t){var s=parseFloat(this.shared.getWithId("lotteryTime")),i=parseFloat(this.shared.getWithId("lottery")),r=!s||s>(new Date).getTime()-4e3;r&&i&&(!o||i>o)&&(o=i),t||e()},this);a(!0),this.shared.setWithId("lottery",r),this.shared.setWithId("lotteryTime",(new Date).getTime()/1e3);var h=n(function(t){if(this.shared.matchEventKeyWithId(t,"lottery")&&t.newValue){i+=1;var e=parseFloat(this.shared.stripIdFromVal(t.newValue)),s=parseFloat(this.shared.stripIdFromVal(t.oldValue));s>e&&this.shared.setWithId("lottery",s),(!o||e>=o)&&(o=e)}},this);t.addEventListener("storage",h);var c=n(function(){this.shared.maybePromotingToMaster=!1,t.removeEventListener("storage",h),s&&clearInterval(s),this.shared&&"master"==this.shared.role&&(this.shared.remove("lottery"),this.shared.remove("lotteryTime")),this.running?(this.stop(),this.initializeTransport(),this.start()):(this.initializeTransport(),this.starting&&this.start())},this);e=n(function(){r=o&&(0==i?(this.shared.setRole("master"),c()):i=0)},this),s=t.setInterval(a,2e3)}},this),masterCheckInterval:1e4}}var a;if(this.lastMessageId=s.id||s.msgId,this.reconnect=void 0===s.reconnect||s.reconnect,this.reconnectTimeout=s.reconnectTimeout||1e3,s.reconnect){var h,c="NchanSubscriber:"+e+":lastMessageId";if("persist"==s.reconnect){if(!(h="localStorage"in t&&t.localStorage))throw"can't use reconnect: 'persist' option: localStorage not available"}else{if("session"!=s.reconnect)throw"invalid 'reconnect' option value "+s.reconnect;if(!(h="sessionStorage"in t&&t.sessionStorage))throw"can't use reconnect: 'session' option: sessionStorage not available"}a=n(function(t){this.shared&&"slave"==this.shared.role||h.setItem(c,t)},this),this.lastMessageId=h.getItem(c)}else a=function(){};var l,d,u=n(function(){this.running&&this.stop(),this.shared&&"master"==this.shared.role&&this.shared.setWithId("status","disconnected")},this);t.addEventListener("beforeunload",u,!1),t.addEventListener("DOMContentLoaded",function(){t.removeEventListener("beforeunload",u,!1),t.addEventListener("unload",u,!1)},!1),l=this.shared?n(function(t,e){"master"==this.shared.role&&("message"==t?(this.shared.set("msg:id",e[1]&&e[1].id||""),this.shared.set("msg:content-type",e[1]&&e[1]["content-type"]||""),this.shared.set("msg",e[0])):"error"==t||("connecting"==t?this.shared.setWithId("status","connecting"):"connect"==t?this.shared.setWithId("status","connected"):"reconnect"==t?this.shared.setWithId("status","reconnecting"):"disconnect"==t&&this.shared.setWithId("status","disconnected")))},this):function(){};var p=n(function(){d||!this.running||!this.reconnect||this.transport.reconnecting||this.transport.doNotReconnect?l("disconnect"):(l("reconnect"),d=t.setTimeout(n(function(){d=null,this.stop(),this.start()},this),this.reconnectTimeout))},this);this.on("message",function(t,e){this.lastMessageId=e.id,e.id&&a(e.id),l("message",[t,e])}),this.on("error",function(t,e){p(t,e),l("error",[t,e])}),this.on("connect",function(){this.connected=!0,l("connect")}),this.on("__disconnect",function(t,e){this.connected=!1,this.emit("disconnect",t,e),p(t,e)})}function h(t,e){if(e){var s=t.match(/(\?.*)$/);t+=(s?"&":"?")+"last_event_id="+encodeURIComponent(e)}return t}return i(a.prototype),a.prototype.initializeTransport=function(t){if(t&&(this.desiredTransport=t),this.shared&&"slave"==this.shared.role)this.transport=new this.SubscriberClass.__slave(n(this.emit,this));else{var e,s=n(function(t){if(!this.SubscriberClass[t])throw"unknown subscriber type "+t;try{return this.transport=new this.SubscriberClass[t](n(this.emit,this)),this.transport}catch(t){}},this);if(this.desiredTransport)for(e=0;e=200&&t<=210){var i=s.getResponseHeader("Content-Type");this.parseMultipartMixedMessage(i,e,s)||this.emit("message",e||"",{"content-type":i,id:this.msgIdFromResponseHeaders(s)}),this.req&&this.pollingRequest()}else 0==t&&"Error"==e&&4==s.readyState||null===t&&"Abort"!=e?(this.emit("__disconnect",t||0,e),delete this.req):null!==t?(this.emit("error",t,e),delete this.req):(delete this.req,this.emit("__disconnect"))},this),this.pollingRequest(),this.emit("connect"),this},t.prototype.parseMultipartMixedMessage=function(t,e,s){var i=t&&t.match(/^multipart\/mixed;\s+boundary=(.*)$/);if(!i)return!1;var r=i[1],n=e.split("--"+r);if(""!=n[0]||!n[n.length-1].match(/--\r?\n/))throw"weird multipart/mixed split";n=n.slice(1,-1);for(var o in n){var a=(i=n[o].match(/^(.*)\r?\n\r?\n([\s\S]*)\r?\n$/m))[1].split("\n"),h={};for(var c in a){var l=a[c].match(/^([^:]+):\s+(.*)/);l&&"Content-Type"==l[1]&&(h["content-type"]=l[2])}o==n.length-1&&(h.id=this.msgIdFromResponseHeaders(s)),this.emit("message",i[2],h)}return!0},t.prototype.msgIdFromResponseHeaders=function(t){var e,s;return e=t.getResponseHeader("Last-Modified"),s=t.getResponseHeader("Etag"),e?Date.parse(e)/1e3+":"+(s||"0"):s||null},t.prototype.cancel=function(){return this.req&&(this.emit("transportNativeBeforeDestroy",this.req,this.name),this.req.abort(),delete this.req),this},t}(),__slave:function(){function s(t){this.emit=t,this.doNotReconnect=!0,this.shared=null,this.name="__slave",this.opt={url:null,msgid:null,headers:{}}}return s.prototype.setup=function(){this.emit("transportSetup",this.opt,this.name);var t,e=0;for(t in this.opt.headers)e++;if(0!=e)throw"__slave does not support headers"},s.prototype.listen=function(s,i){this.shared=i,this.opt.url=s,this.setup(),this.statusChangeChecker=n(function(t){if(this.shared.matchEventKey(t,"msg")){var s=this.shared.get("msg:id"),i=this.shared.get("msg:content-type"),r=this.shared.get("msg");this.emit("message",r,{id:""==s?e:s,"content-type":""==i?e:i})}},this),t.addEventListener("storage",this.statusChangeChecker)},s.prototype.cancel=function(){t.removeEventListener("storage",this.statusChangeChecker)},s}()},a}(t);"object"==typeof module&&null!=module&&module.exports?module.exports=i:"function"==typeof define&&define.amd?define(function(){return i}):t.NchanSubscriber=i}("undefined"!=typeof window?window:this); /* shortcuts, Version: 2.01.B, Copyright Binny V A */ shortcut={all_shortcuts:{},add:function(l,p,i){var e={type:"keydown",propagate:!1,disable_in_input:!1,target:document,keycode:!1};if(i)for(var t in e)void 0===i[t]&&(i[t]=e[t]);else i=e;var a=i.target;"string"==typeof i.target&&(a=document.getElementById(i.target));l=l.toLowerCase();function r(e){var t;if(e=e||window.event,!i.disable_in_input||(e.target?t=e.target:e.srcElement&&(t=e.srcElement),3==t.nodeType&&(t=t.parentNode),"INPUT"!=t.tagName&&"TEXTAREA"!=t.tagName)){e.keyCode?code=e.keyCode:e.which&&(code=e.which);var a=String.fromCharCode(code).toLowerCase();188==code&&(a=","),190==code&&(a=".");var r=l.split("+"),n=0,s={"`":"~",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(",0:")","-":"_","=":"+",";":":","'":'"',",":"<",".":">","/":"?","\\":"|"},o={esc:27,escape:27,tab:9,space:32,return:13,enter:13,backspace:8,scrolllock:145,scroll_lock:145,scroll:145,capslock:20,caps_lock:20,caps:20,numlock:144,num_lock:144,num:144,pause:19,break:19,insert:45,home:36,delete:46,end:35,pageup:33,page_up:33,pu:33,pagedown:34,page_down:34,pd:34,left:37,up:38,right:39,down:40,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},d={shift:{wanted:!1,pressed:!1},ctrl:{wanted:!1,pressed:!1},alt:{wanted:!1,pressed:!1},meta:{wanted:!1,pressed:!1}};e.ctrlKey&&(d.ctrl.pressed=!0),e.shiftKey&&(d.shift.pressed=!0),e.altKey&&(d.alt.pressed=!0),e.metaKey&&(d.meta.pressed=!0);for(var c=0;k=r[c],c Date: Tue, 26 May 2020 10:53:26 +0200 Subject: [PATCH 2/8] Multi-language support --- logging.htm | 9 +++++++-- plugins/dynamix/include/DefaultPageLayout.php | 2 +- update.htm | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/logging.htm b/logging.htm index 5ffdbb5ec..378041704 100644 --- a/logging.htm +++ b/logging.htm @@ -1,8 +1,12 @@ - + + + + +