meta.js update from edide

This commit is contained in:
Jussi Rytkönen 2019-11-11 17:33:22 +02:00
parent c99ad39c56
commit 301f8910fb

View File

@ -14,7 +14,8 @@
} }
} }
if(typeof module !== "undefined"){ var common = module } if(typeof module !== "undefined"){ var common = module }
/* UNBUILD */
;USE(function(module){ ;USE(function(module){
var noop = function(){}, u; var noop = function(){}, u;
$.fn.or = function(s){ return this.length ? this : $(s||'body') }; $.fn.or = function(s){ return this.length ? this : $(s||'body') };
@ -145,9 +146,8 @@
;USE(function(module){ ;USE(function(module){
try{ try{
/* UI */ /* UI */
if(meta.css){ return }
var $m = $('<div>').attr('id', 'meta'); var $m = $('<div>').attr('id', 'meta');
$m.append($('<span>').html('&#9776;').addClass('meta-start')); $m.append($('<span>').text('+').addClass('meta-start'));
$m.append($('<div>').addClass('meta-menu meta-none').append('<ul>')); $m.append($('<div>').addClass('meta-menu meta-none').append('<ul>'));
$(document.body).append($m); $(document.body).append($m);
css({ css({
@ -159,7 +159,7 @@
background: 'white', background: 'white',
'font-size': '18pt', 'font-size': '18pt',
'font-family': 'Tahoma, arial', 'font-family': 'Tahoma, arial',
//'box-shadow': '0px 0px 1px #000044', 'box-shadow': '0px 0px 1px #000044',
'border-radius': '1em', 'border-radius': '1em',
'text-align': 'center', 'text-align': 'center',
'z-index': 999999, 'z-index': 999999,
@ -231,9 +231,10 @@
}); });
var tag = document.createElement('style'); var tag = document.createElement('style');
tag.innerHTML = tmp; tag.innerHTML = tmp;
document.body.appendChild(tag); $m.append(tag)
} }
}catch(e){} }catch(e){}
})(USE, './metaUI'); })(USE, './metaUI');
;USE(function(module){ ;USE(function(module){
// include basic text editing by default. // include basic text editing by default.
@ -377,6 +378,8 @@
on: function(eve){ meta.text.editor('fontSize', 7) }, on: function(eve){ meta.text.editor('fontSize', 7) },
up: function(){} up: function(){}
}); });
})(USE, './metaText'); })(USE, './metaText');
;USE(function(module){ ;USE(function(module){
var m = meta, k = m.key; var m = meta, k = m.key;
@ -394,10 +397,10 @@
}); });
$(document).on('touchstart', '#meta .meta-start', function(eve){ m.tap.stun = true }); $(document).on('touchstart', '#meta .meta-start', function(eve){ m.tap.stun = true });
$(document).on('click', '#meta .meta-menu li', function(eve){ $(document).on('click', '#meta .meta-menu li', function(eve){
eve.fake = eve.which = $(this).data().combo.slice(-1)[0].charCodeAt(0); var combo = $(this).data().combo;
eve.fake = eve.which = combo && combo.slice(-1)[0].charCodeAt(0);
eve.tap = true; eve.tap = true;
k.down(eve); k.down(eve); k.up(eve);
//k.up(eve);
return; return;
if(m.tap.stun){ return m.tap.stun = false } if(m.tap.stun){ return m.tap.stun = false }
if(!(eve.fake = eve.which = (($(this).text().match(/[A-Z]/)||{})[0]||'').toUpperCase().charCodeAt(0))){ return } if(!(eve.fake = eve.which = (($(this).text().match(/[A-Z]/)||{})[0]||'').toUpperCase().charCodeAt(0))){ return }
@ -408,4 +411,4 @@
$(document).on('keydown', k.down).on('keyup', k.up); $(document).on('keydown', k.down).on('keyup', k.up);
$(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.text.on); $(document).on('select contextmenu keyup mouseup', '[contenteditable=true]', m.text.on);
})(USE, './metaEvents'); })(USE, './metaEvents');
}()); }());