rename ls and cmd keys + remove some log
This commit is contained in:
parent
8a0613baae
commit
4ec53b4d1f
|
@ -84,7 +84,7 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('.cmd-sync').on('click', function(){
|
$('.cmd-sync').on('click', function(){
|
||||||
$v('h2').html('pluie.org bt demo (sync on '+(new Date).getTime()+') :');
|
$('h2').html('pluie.org bt demo (sync on '+(new Date).getTime()+') :');
|
||||||
$bt.sync('h2');
|
$bt.sync('h2');
|
||||||
});
|
});
|
||||||
$('.cmd-reload').on('click', function(){
|
$('.cmd-reload').on('click', function(){
|
||||||
|
|
14
src/bt.js
14
src/bt.js
|
@ -105,21 +105,21 @@ var $bt = {
|
||||||
VERSION : 0.5,
|
VERSION : 0.5,
|
||||||
TRACE : true && !$.isNone(console),
|
TRACE : true && !$.isNone(console),
|
||||||
/*! @constant LS_TABS localStorage key for browsertabs list */
|
/*! @constant LS_TABS localStorage key for browsertabs list */
|
||||||
LS_TABS : 'bt.tabs',
|
LS_TABS : 'bt.list',
|
||||||
/*! @constant LS_CURTAB localStorage key for current browsertab */
|
/*! @constant LS_CURTAB localStorage key for current browsertab */
|
||||||
LS_CURTAB : 'bt.ctab',
|
LS_CURTAB : 'bt.current',
|
||||||
/*! @constant LS_CMD localStorage key command to interact with other tabs */
|
/*! @constant LS_CMD localStorage key command to interact with other tabs */
|
||||||
LS_CMD : 'bt.cmd',
|
LS_CMD : 'bt.event',
|
||||||
/*! @constant CMD_SYNC internal command to perform a browser tab synchro */
|
/*! @constant CMD_SYNC internal command to perform a browser tab synchro */
|
||||||
CMD_SYNC : 'bt.sync',
|
CMD_SYNC : 'bt.sync',
|
||||||
/*! @constant CMD_VAR_SET internal command to perform a browser tab var set */
|
/*! @constant CMD_VAR_SET internal command to perform a browser tab var set */
|
||||||
CMD_VAR_SET : 'var.set',
|
CMD_VAR_SET : 'bt.set',
|
||||||
/*! @constant CMD_VAR_GET internal command to perform a browser tab var get */
|
/*! @constant CMD_VAR_GET internal command to perform a browser tab var get */
|
||||||
CMD_VAR_GET : 'var.get',
|
CMD_VAR_GET : 'bt.get',
|
||||||
/*! @constant CMD_APPEND internal command to perform a dom append */
|
/*! @constant CMD_APPEND internal command to perform a dom append */
|
||||||
CMD_APPEND : 'dom.append',
|
CMD_APPEND : 'bt.dom.append',
|
||||||
/*! @constant CMD_HTML internal command to perform a dom html */
|
/*! @constant CMD_HTML internal command to perform a dom html */
|
||||||
CMD_HTML : 'dom.html',
|
CMD_HTML : 'bt.dom.rewrite',
|
||||||
/*! @constant CMD_RELOAD internal command to perform a browser tab reload */
|
/*! @constant CMD_RELOAD internal command to perform a browser tab reload */
|
||||||
CMD_RELOAD : 'bt.reload',
|
CMD_RELOAD : 'bt.reload',
|
||||||
/*! @var vars */
|
/*! @var vars */
|
||||||
|
|
2
src/svan-min.js
vendored
2
src/svan-min.js
vendored
|
@ -1 +1 @@
|
||||||
/* by a-sansara - v 0.3 - https://github.com/pluie-org/svan */!function(){{var t=function(t,n){return typeof t==n},n=function(t,i){return new n.init(t,i)},i=n.isNone=function(n){return t(n,"undefined")},o=n.isStr=function(n){return t(n,"string")},e=n.isFunc=function(n){return t(n,"function")},s=n.isObj=function(n){return t(n,"object")};n.isNode=function(t){return s(t)&&!i(t.nodeType)},n.isWin=function(t){return!i(t.window)&&t.window==t}}n.prototype={regsan:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},first:function(){return this.found?this.list[0]:null},last:function(){return this.found?this.list[this.list.length-1]:b},index:function(t){return this.found&&t>0&&t<this.list.length?this.list[t]:b},all:function(){return this.list},find:function(t){return this.found?[].slice.call(this.list[0].querySelectorAll(t)):[]},foreach:function(t){this.found&&this.list.forEach(t)},html:function(t){return t?void this.foreach(function(n){n.innerHTML=t}):this.found?this.list[0].innerHTML:""},append:function(t){this.foreach(function(n){n.innerHTML+=t})},on:function(t,n,i){console.log("ON START "+t+" - capture ? "+i),console.log("node"),console.log(this.first()),console.log("context"),console.log(this.context),console.log("list"),console.log(this.list),console.log("found"),console.log(this.found),this.foreach(function(o){console.log("inside foreach loop"),o.addEventListener(t,n,i===!0)})},val:function(t){return t?void this.foreach(function(n){n.value=t}):this.found?this.list[0].value:null},attr:function(t,n){return 1==arguments.length?this.found?this.list[0].getAttribute(t):null:void this.foreach(function(i){i.setAttribute(t,n)})},toggle:function(t){this.foreach(function(n){n.classList.toggle(t)})},hasClass:function(t){return this.found?this.list[0].contains(t):this.found},removeClass:function(t){this.foreach(function(n){n.classList.contains(t)&&n.classList.toggle(t)})},addClass:function(t){this.foreach(function(n){n.classList.contains(t)||n.classList.toggle(t)})},fadeIn:function(t,n,i){if(this.found){t||(t=this.FADE_DURATION);var o=parseFloat(1/t*20),e=this.first();e.style.opacity=0,e.style.display=i||"block",function t(){var i=parseFloat(e.style.opacity);(i+=o)<1?(e.style.opacity=i,requestAnimationFrame(t)):"function"==typeof n&&n.call(e)}(t)}},fadeOut:function(t,n){if(this.found){t||(t=this.FADE_DURATION);var i=parseFloat(1/t*20),o=this.first();o.style.opacity=1,function t(){var e=parseFloat(o.style.opacity);(e-=i)<0?(o.style.display="none","function"==typeof n&&n.call(o)):(o.style.opacity=e,requestAnimationFrame(t))}(t)}},ready:function(t){this.context.addEventListener("DOMContentLoaded",t)}},n.eachObj=function(t,n,i){for(var o in t)t.hasOwnProperty(o)&&n.call(i,o,t[o])},n.ajax=function(t){this.eachObj(t,function(t,n){console.log(t),console.log(n)});var n=new XMLHttpRequest;n.onreadystatechange=function(n){4==this.readyState&&(200==this.status?e(t.done)&&t.done.call(t.context,n,this.responseText,this.statusText):e(t.fail)&&t.fail.call(t.context,n,this.responseText,this.statusText),e(t.always)&&t.always.call(t.context,n,this.responseText,this.statusText))},!i(t.timeout)&&t.async&&(n.timeout=t.timeout),e(t.before)&&t.before.call(n),n.open(t.method,t.url,t.async),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var o="";s(t.data)&&this.eachObj(t.data,function(t,n){o+=t+"="+encodeURIComponent(n)}),n.send(o)};var c=n.init=function(t,e){return this.FADE_DURATION=700,this.VERSION=.3,this.context=i(e)?document:e,this.list=o(t)?[].slice.call(this.context.querySelectorAll(t)):n.isNode(t)||n.isWin(t)?[t]:[],this.found=this.list.length>0,this};c.prototype=n.prototype,window.Svan=n,i(window.$)&&(window.$=n)}();
|
/* by a-sansara - v 0.4 - https://github.com/pluie-org/svan */!function(){var t=function(t,n){return typeof t==n},n=function(t,i){return new n.init(t,i)},i=n.isNone=function(n){return t(n,"undefined")},e=n.isStr=function(n){return t(n,"string")},s=n.isFunc=function(n){return t(n,"function")},o=n.isObj=function(n){return t(n,"object")},a=n.isNode=function(t){return o(t)&&!i(t.nodeType)},c=n.isWin=function(t){return!i(t.window)&&t.window==t};n.prototype={regsan:function(t){return t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},first:function(){return this.found?this.list[0]:null},last:function(){return this.found?this.list[this.list.length-1]:b},index:function(t){return this.found&&t>0&&t<this.list.length?this.list[t]:b},all:function(){return this.list},find:function(t){return this.found?[].slice.call(this.list[0].querySelectorAll(t)):[]},foreach:function(t){this.found&&this.list.forEach(t)},html:function(t){return t?void this.foreach(function(n){n.innerHTML=t}):this.found?this.list[0].innerHTML:""},append:function(t){this.foreach(function(n){n.innerHTML+=t})},on:function(t,n,i){this.foreach(function(e){e.addEventListener(t,n,i===!0)})},val:function(t){return t?void this.foreach(function(n){n.value=t}):this.found?this.list[0].value:null},attr:function(t,n){return 1==arguments.length?this.found?this.list[0].getAttribute(t):null:void this.foreach(function(i){i.setAttribute(t,n)})},toggle:function(t){this.foreach(function(n){n.classList.toggle(t)})},hasClass:function(t){return this.found?this.list[0].contains(t):this.found},removeClass:function(t){this.foreach(function(n){n.classList.contains(t)&&n.classList.toggle(t)})},addClass:function(t){this.foreach(function(n){n.classList.contains(t)||n.classList.toggle(t)})},fadeIn:function(t,n,i){if(this.found){t||(t=this.FADE_DURATION);var e=parseFloat(1/t*20),s=this.first();s.style.opacity=0,s.style.display=i||"block",function t(){var i=parseFloat(s.style.opacity);(i+=e)<1?(s.style.opacity=i,requestAnimationFrame(t)):"function"==typeof n&&n.call(s)}(t)}},fadeOut:function(t,n){if(this.found){t||(t=this.FADE_DURATION);var i=parseFloat(1/t*20),e=this.first();e.style.opacity=1,function t(){var s=parseFloat(e.style.opacity);(s-=i)<0?(e.style.display="none","function"==typeof n&&n.call(e)):(e.style.opacity=s,requestAnimationFrame(t))}(t)}},ready:function(t){this.context.addEventListener("DOMContentLoaded",t)}},n.eachObj=function(t,n,i){for(var e in t)t.hasOwnProperty(e)&&n.call(i,e,t[e])},n.ajax=function(t){this.eachObj(t,function(t,n){console.log(t),console.log(n)});var n=new XMLHttpRequest;n.onreadystatechange=function(n){4==this.readyState&&(200==this.status?s(t.done)&&t.done.call(t.context,n,this.responseText,this.statusText):s(t.fail)&&t.fail.call(t.context,n,this.responseText,this.statusText),s(t.always)&&t.always.call(t.context,n,this.responseText,this.statusText))},!i(t.timeout)&&t.async&&(n.timeout=t.timeout),s(t.before)&&t.before.call(n),n.open(t.method,t.url,t.async),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded");var e="";o(t.data)&&this.eachObj(t.data,function(t,n){e+=t+"="+encodeURIComponent(n)}),n.send(e)};var u=n.init=function(t,n){return this.FADE_DURATION=700,this.VERSION=.4,this.context=i(n)?document:n,this.list=e(t)?[].slice.call(this.context.querySelectorAll(t)):a(t)||c(t)?[t]:[],this.found=this.list.length>0,this};u.prototype=n.prototype,window.Svan=n,i(window.$)&&(window.$=n)}();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user