The LM Control website. Simple yet efficient.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. //Writen/Compiled by Bedirhan Teymur, with the help of StackOverflow ofc
  2. (function(glob){
  3. var globVar = 'e'; // Change global variable here if needed!
  4. var e = (function (){
  5. 'use strict';
  6. var hc = function(a, b){
  7. try{
  8. if(e.type(a.className) !== 'string') return !1;
  9. var c = a.className.split(' ');
  10. for(var i = 0; i < c.length; i++) if(c[i] === b) return !0
  11. } catch(k){}
  12. return !1
  13. },
  14. rc = function(a) {
  15. var b = '',
  16. c = this,
  17. d = c.className.split(' ');
  18. if(!hc(c, a)) return;
  19. for(var i = 0; i < d.length; i++) {
  20. if(d[i] !== a) {
  21. b += d[i] + ' ';
  22. }
  23. }
  24. c.className = b.trim();
  25. },
  26. mk = {
  27. html: function(a){
  28. var b = this,
  29. d = b.length;
  30. if(b.empty) return this;
  31. if(e.type(a) !== 'string') return b[0].innerHTML;
  32. for(var i = 0; i < d; i++) {
  33. b[i].innerHTML = a
  34. }
  35. return this
  36. },
  37. swapClass: function(a, c, j){
  38. var b = j ? [this[j]] : this,
  39. d = b.length;
  40. if(d === 0) return this;
  41. for(var i = 0; i < d; i++){
  42. if(hc(b[i], a)){
  43. rc.call(b[i], a);
  44. b[i].className = b[i].className + ' ' + c;
  45. } else if(hc(b[i], c)){
  46. rc.call(b[i], c);
  47. b[i].className = b[i].className + ' ' + a;
  48. }
  49. }
  50. return this;
  51. },
  52. removeClass: function(a){
  53. var b = this,
  54. d = b.length;
  55. for(var i = 0; i < d; i++) {
  56. rc.call(b[i], a);
  57. }
  58. return this
  59. },
  60. hasClass: function(a){
  61. var b = this,
  62. d = b.length,
  63. c = !1;
  64. for(var i = 0; i < d; i++) {
  65. if(hc(b[i], a)) c = !0;
  66. }
  67. return c;
  68. },
  69. addClass: function(a){
  70. var b = this,
  71. d = b.length;
  72. for(var i = 0; i < d; i++) {
  73. if(!hc(b[i], a)) b[i].className = b[i].className + ' ' + a;
  74. }
  75. return this
  76. },
  77. listen: function(a, c, k){
  78. var b = this,
  79. d = b.length,
  80. f = new Function();
  81. if(d === 0) return this;
  82. if(e.type(a) === 'array'){
  83. for(var i = 0; i < a.length; i++) {
  84. this.listen(a[i], c||f, k||!1);
  85. }
  86. return this;
  87. }
  88. for(var i = 0; i < d; i++) {
  89. if(e.type(c) === 'object'){
  90. e.foreach(c, function(j, l){
  91. b[i].addEventListener(j, (e.type(l) === 'function') ? l : f, k||!1);
  92. });
  93. } else b[i].addEventListener(a, c||f, k||!1);
  94. }
  95. return this;
  96. },
  97. each: function(c){
  98. var b = this,
  99. g = e.clone(b);
  100. if(g.length < 1) return this;
  101. for(var j = 0; j < g.length; j++) c.call(g[j]);
  102. return this;
  103. },
  104. css: function(c, ki){
  105. var b = this;
  106. if(b.length === 0) return this;
  107. if(!c) {
  108. var k = getComputedStyle(ki ? b[ki]:b[0]), fn = {};
  109. e.foreach(k, function(l, j){
  110. fn[j] = k.getPropertyValue(j);
  111. });
  112. return fn;
  113. }
  114. if(e.type(c) === 'object'){
  115. for(var j = 0; j < b.length; j++) {
  116. for(var i in c) if(c.hasOwnProperty(i)){
  117. b[j].style[i] = c[i];
  118. }
  119. }
  120. }
  121. return this;
  122. },
  123. onDrag: function(m, f){
  124. var b = this,
  125. t,
  126. k = function(g){
  127. (m).call(t, g);
  128. },
  129. y = function(i){
  130. i.addEventListener('mousedown', function(a){
  131. t = this;
  132. a.preventDefault();
  133. document.addEventListener('mousemove', k, !1)
  134. });
  135. document.addEventListener('mouseup', function(a){
  136. var u = t;
  137. if(t == null) return;
  138. t = null;
  139. document.removeEventListener('mousemove', k, !1);
  140. if(e.type(f) == 'function') f.call(u, a);
  141. if(f === !0) k.call(u, a);
  142. });
  143. }
  144. for(var j = 0; j < b.length; j++) y(b[j]);
  145. return this
  146. }
  147. },
  148. km = function(a, g){
  149. var c = [];
  150. if(e.type(a) === 'function'){
  151. return document.addEventListener('DOMContentLoaded' , a);
  152. }
  153. if(typeof a === 'string'){
  154. if(!e.isEmpty(a)){
  155. var b = a.split(':'),
  156. d = ((!!g && !!g['querySelectorAll']) ? g : document).querySelectorAll(b[0]),
  157. f = (b.length > 1) ? (b[1] == 'first' ? [d[0]] : b[1] == 'last' ? [d[d.length-1]] : d) : d;
  158. for(var i = 0; i < f.length; i++){
  159. c[c.length] = f[i];
  160. }
  161. }
  162. } else if(a instanceof Array) {
  163. for(var i = 0; i < a.length; i++){
  164. var d = document.querySelectorAll(a[i]);
  165. for(var j = 0; j < d.length; j++){
  166. c[c.length] = d[j];
  167. }
  168. }
  169. } else if (a instanceof NodeList || a instanceof HTMLCollection){
  170. for(var i = 0; i < a.length; i++) {
  171. c[c.length] = a[i];
  172. }
  173. } else c[c.length] = a;
  174. return e.extend(c, mk, {empty: c.length < 1, f: c[0]});
  175. }
  176. //End
  177. return km;
  178. })(),
  179. p = function(){
  180. var a = ['webkit','moz','ms','o'];
  181. if ('hidden' in document) return 'hidden';
  182. for (var i = 0; i < a.length; i++){
  183. if ((a[i] + 'Hidden') in document)
  184. return a[i] + 'Hidden';
  185. }
  186. return !1;
  187. }, qq = {
  188. arrayCompare: function(a, b){
  189. if (!b || !a) return !1;
  190. if (a.length != b.length) return !1;
  191. for(var i = 0, l = a.length; i < l; i++){
  192. if(b[i] instanceof Array && a[i] instanceof Array){
  193. if(!a[i].equals(b[i])) return !1;
  194. }
  195. else if(a[i] != b[i]){
  196. return !1;
  197. }
  198. }
  199. return !0;
  200. },
  201. randomize: function(u, h){
  202. var a = this.clone(u),
  203. b = a.length, c, d,
  204. f = (this.type(h) === 'number'),
  205. g = 'a';
  206. while(0 < b){
  207. d = Math.floor(Math.random() * b);
  208. c = a[--b];
  209. a[b] = a[d];
  210. a[d] = c
  211. g = (f && g == 'a') ? ((h === d) ? b : ((h === b) ? d : g)) : g;
  212. }
  213. return (f) ? {pos: (g == 'a') ? null : g, array: a} : a;
  214. },
  215. isMobile: function(){
  216. var a = window.navigator.userAgent.toLowerCase(),
  217. b = ['iphone', 'ipad', 'android', 'blackberry', 'nokia', 'opera mini', 'windows mobile', 'windows phone', 'iemobile', 'mobile safari', 'bb10; touch'];
  218. for (var i in b) if (a.indexOf(b[i]) > 0) return !0;
  219. return !1;
  220. },
  221. isFirefox: function(){
  222. var a = window.navigator.userAgent.toLowerCase();
  223. if (a.indexOf('firefox') > 0) return !0;
  224. return !1;
  225. },
  226. isVis: function(){
  227. if(p()){
  228. return !document[p()] || !1;
  229. }
  230. return !1
  231. },
  232. winScroll: function(){
  233. return (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;
  234. },
  235. screenSize: function(){
  236. var w = window,
  237. d = document,
  238. e = d.documentElement,
  239. g = d.getElementsByTagName('body')[0],
  240. x = w.innerWidth || e.clientWidth || g.clientWidth,
  241. y = w.innerHeight || e.clientHeight || g.clientHeight;
  242. return {
  243. x : x,
  244. y : y
  245. }
  246. },
  247. foreach: function(a, b){
  248. for(var i in a) {
  249. if(a.hasOwnProperty(i)) {
  250. if(b(i, a[i]) === !1) break;
  251. }
  252. }
  253. },
  254. replace: function(a, b, g){
  255. var h;
  256. if(this.type(a) !== 'string') throw 'First argument must be a string!';
  257. switch(this.type(b)){
  258. case 'string':
  259. if(e.type(g) !== 'string') throw 'Last argument invalid!';
  260. h = this.parseJson('{'+b+':"'+g+'"}');
  261. break;
  262. case 'object':
  263. h = b;
  264. }
  265. var d = new RegExp(Object.keys(h).join("|"), "gi");
  266. return a.replace(d, function(f){
  267. return h[f];
  268. });
  269. },
  270. isEmpty: function(a){
  271. if(typeof a === 'string') {
  272. if (a.trim() !== '')
  273. return !1
  274. } else {
  275. for (var b in a)
  276. return !1
  277. }
  278. return !0
  279. },
  280. clone: function(a){
  281. var b, s = this.clone;
  282. if(null === a || "object" != typeof a)
  283. return a;
  284. if(a instanceof Node || a instanceof Element) {
  285. return a
  286. }
  287. if(a instanceof Date) {
  288. b = new Date();
  289. b.setTime(a.getTime());
  290. return b
  291. }
  292. if(a instanceof Array) {
  293. b = [];
  294. for(var i = 0; i < a.length; i++) {
  295. b[i] = s(a[i]);
  296. }
  297. return b
  298. }
  299. if(a instanceof Object) {
  300. b = {};
  301. for(var c in a) {
  302. if(a.hasOwnProperty(c))
  303. b[c] = s(a[c]);
  304. }
  305. return b
  306. }
  307. throw new TypeError('Unsupported type')
  308. },
  309. extend: function(){
  310. var p,
  311. l = arguments.length,
  312. f = arguments[0] || {},
  313. h = this.type(f),
  314. e = (f instanceof Node) ? f : (h === 'object' || h === 'string'|| h === 'boolean') ? {} : (h === 'array') ? [] : f,
  315. i = (h === 'string' || f instanceof Node || h === 'boolean') ? 1 : 0;
  316. for(;i < l; i++) {
  317. for(p in arguments[i]){
  318. if(Object.prototype.hasOwnProperty.call(arguments[i], p)){
  319. e[p] = arguments[i][p];
  320. }
  321. }
  322. }
  323. return e;
  324. },
  325. type: function(a){
  326. var b = typeof a,
  327. c = ['object', 'array', 'function', 'number', '[object Window]', '[object Array]', '[object Function]', 'undefined'],
  328. d = Object.prototype.toString.call(a);
  329. if (c[0] == b)
  330. if(a){
  331. if(a instanceof Array)
  332. return c[1];
  333. if(a instanceof Object)
  334. return b;
  335. if(c[4] == d)
  336. return c[0];
  337. if(c[5] == d || c[3] == typeof a.length && c[7] != typeof a.splice && c[7] != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable('splice'))
  338. return c[1];
  339. if(c[6] == d || c[7] != typeof a.call && c[7] != typeof a.propertyIsEnumerable && !a.propertyIsEnumerable('call'))
  340. return c[2];
  341. } else return 'null';
  342. else if(c[2] == b && c[7] == typeof a.call) return c[0];
  343. return b
  344. },
  345. post: function(a, b, c){ //a = URL, b = params(object), c = object with functions to call(done/fail/loading), it can also be a function(success only).
  346. var xhr = new XMLHttpRequest(),
  347. p = '',
  348. j = new Function(),
  349. l = {
  350. done: j,
  351. fail: j,
  352. loading: j,
  353. type: '',
  354. data: null,
  355. json: !1
  356. },
  357. h = this.type(c),
  358. f = (h === 'object') ? this.extend(l, c) : (h === 'function') ? this.extend(l, {done: c}) : l,
  359. v = this;
  360. xhr.open('POST', a);
  361. xhr.responseType = f.type;
  362. xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  363. xhr.onreadystatechange = function(){
  364. if(this.readyState == 3){
  365. f.loading(xhr.response);
  366. };
  367. if(this.readyState == 4){
  368. switch(this.status == 200){
  369. case !0:
  370. if(f.json){
  371. try{
  372. var p = v.parseJson(xhr.response);
  373. } catch(h){
  374. return f.fail(h);
  375. }
  376. f.done(p);
  377. } else f.done(xhr.response);
  378. break;
  379. case !1:
  380. f.fail(xhr.response);
  381. break
  382. }
  383. }
  384. }
  385. if(b && v.type(b) == 'object'){
  386. v.foreach(b, function(k, m){
  387. p += encodeURIComponent(k) + '=' + encodeURIComponent(m) + '&';
  388. });
  389. p = p.substr(0, p.length-1)
  390. }
  391. xhr.send(p);
  392. },
  393. promisePost: function(a, b, c){//Experimental
  394. var k = this;
  395. return new Promise(function(j, r){
  396. k.post(a, b, {
  397. done: function(g){
  398. j(g);
  399. },
  400. fail: function(g){
  401. r(g);
  402. },
  403. json: c
  404. });
  405. });
  406. }
  407. }
  408. glob[globVar] = qq.extend(e, qq);
  409. })(this);