;(function(){ var root; if(typeof window !== "undefined"){ root = window } if(typeof global !== "undefined"){ root = global } root = root || {}; var console = root.console || {log: function(){}}; function USE(arg, req){ return req? require(arg) : arg.slice? USE[R(arg)] : function(mod, path){ arg(mod = {exports: {}}); USE[R(path)] = mod.exports; } function R(p){ return p.split('/').slice(-1).toString().replace('.js',''); } } if(typeof module !== "undefined"){ var common = module } ;USE(function(module){ var noop = function(){}, u; $.fn.or = function(s){ return this.length ? this : $(s||'body') }; var m = window.meta = {edit:[]}; var k = m.key = {}; k.meta = {17:17, 91:17, 93:17, 224:17}; k.down = function(eve){ if(eve.repeat){ return } var key = (k.eve = m.eve = eve).which = eve.which || eve.fake || eve.keyCode; if(!eve.fake && key === k.last){ return } k.last = key; if(!eve.fake && $(eve.target).closest('input, textarea, [contenteditable=true]').length){ if(k.meta[key]){ k.down.meta = key = -1 } if(!k.down.meta){ return } } (k.combo || (k.combo = [])).push(key); m.check('on', key, k.at || (k.at = m.edit)); if(k.meta[key]){ m.list(k.at.back || m.edit); if(k.at && !k.at.back){ m.flip() } } } k.up = function(eve){ var tmp; var key = (k.eve = m.eve = eve).which = eve.which || eve.fake || eve.keyCode; if(!eve.fake && $(eve.target).closest('input, textarea, [contenteditable=true]').length){ if(k.meta[key]){ k.down.meta = null; key = -1; } else if(!k.down.meta){ return } } k.last = null; if($(':focus').closest('#meta').length){ return } m.check('up', key); if(-1 === key || 27 === eve.which){ k.wipe() } } m.flip = function(tmp){ var board = $('#meta .meta-menu'); ((tmp === false) || (!tmp && board.is(':visible')))? board.addClass('meta-none') : board.removeClass('meta-none'); } m.flip.is = function(){ return $('#meta .meta-menu').is(':visible'); } m.flip.wait = 500; m.check = function(how, key, at){ at = k.at || m.edit; var edit = at[key]; if(!edit){ return } var tmp = k.eve || noop; if(tmp.preventDefault){ tmp.preventDefault() } if(edit[how]){ if(tmp.fake && !edit.fake){ m.tap.edit = edit; } else { edit[how](m.eve); /*if(k.at !== m.edit && 'up' === how){ if(k.down.meta){ m.list(k.at = m.edit) } else { k.wipe() } }*/ } } if('up' != how){ return } if(at != edit){ edit.back = at } m.list(edit, true); } m.list = function(at, opt){ if(!at){ return m.flip(false) } var l = []; $.each(at, function(i,k){ 'back' != i && k.combo && k.name && l.push(k) }); if(!l.length){ return } k.at = at; l = l.sort(function(a,b){ a = a.combo.slice(-1)[0] || 0; if(a.length){ a = a.toUpperCase().charCodeAt(0) } b = b.combo.slice(-1)[0] || 0; if(b.length){ b = b.toUpperCase().charCodeAt(0) } return (a < b)? -1 : 1; }); var $ul = $('#meta .meta-menu ul') $ul.children('li').addClass('meta-none').hide(); setTimeout(function(){ $ul.children('.meta-none').remove() },250); // necessary fix for weird bug glitch $.each(l, function(i, k){ $ul.append($('