X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=roojs-debug.js;h=94b9ff7166aec9739299a61be7bb4cf2b2c55f48;hb=8946284bad10596673ce59afe8ef1ea49ba0b790;hp=d0b21744ed91f4683906f58d9a3d81d34e01a33d;hpb=8d05087bde0afb1a31df3ee4ae78f3f439acc372;p=roojs1 diff --git a/roojs-debug.js b/roojs-debug.js index d0b21744ed..94b9ff7166 100644 --- a/roojs-debug.js +++ b/roojs-debug.js @@ -6302,6 +6302,7 @@ Roo.EventManager = function(){ } } + var listen = function(element, ename, opt, fn, scope){ var o = (!opt || typeof opt == "boolean") ? {} : opt; @@ -8232,7 +8233,32 @@ if(opt.anim.isAnimated()){ if (this.dom) { Roo.EventManager.on(this.dom, eventName, fn, scope || this, options); } + if (eventName == 'dblclick') { + this.addListener('touchstart', this.onTapHandler, this); + } }, + tapedTwice : false, + onTapHandler : function(event) + { + if(!this.tapedTwice) { + this.tapedTwice = true; + var s = this; + setTimeout( function() { + s.tapedTwice = false; + }, 300 ); + return; + } + event.preventDefault(); + var revent = new MouseEvent('dblclick', { + view: window, + bubbles: true, + cancelable: true + }); + + this.dom.dispatchEvent(revent); + //action on double tap goes below + + }, /** * Removes an event handler from this element @@ -9364,7 +9390,7 @@ if(opt.anim.isAnimated()){ /** * @private */ - fitToParentDelegate : Roo.emptyFn, // keep a reference to the fitToParent delegate + fitToParentDelegate : Roo.emptyFn, // keep a reference to the fitToParent delegate /** * Sizes this element to its parent element's dimensions performing @@ -13964,7 +13990,26 @@ Roo.util.Format = function(){ */ stripTags : function(v){ return !v ? v : String(v).replace(this.stripTagsRE, ""); + }, + + /** + * Size in Mb,Gb etc. + * @param {Number} value The number to be formated + * @param {number} decimals how many decimal places + * @return {String} the formated string + */ + size : function(value, decimals) + { + var sizes = ['b', 'k', 'M', 'G', 'T']; + if (value == 0) { + return 0; + } + var i = parseInt(Math.floor(Math.log(value) / Math.log(1024))); + return Roo.util.Format.number(value/ Math.pow(1024, i) ,decimals) + sizes[i]; } + + + }; }(); Roo.util.Format.defaults = { @@ -14479,7 +14524,44 @@ Roo.extend(Roo.util.ClickRepeater, Roo.util.Observable, { this.el.removeClass(this.pressClass); this.fireEvent("mouseup", this); } -});/* +});/** + * @class Roo.util.Clipboard + * @static + * + * Clipboard UTILS + * + **/ +Roo.util.Clipboard = { + /** + * Writes a string to the clipboard - using the Clipboard API if https, otherwise using text area. + * @param {String} text to copy to clipboard + */ + write : function(text) { + // navigator clipboard api needs a secure context (https) + if (navigator.clipboard && window.isSecureContext) { + // navigator clipboard api method' + navigator.clipboard.writeText(text); + return ; + } + // text area method + var ta = document.createElement("textarea"); + ta.value = text; + // make the textarea out of viewport + ta.style.position = "fixed"; + ta.style.left = "-999999px"; + ta.style.top = "-999999px"; + document.body.appendChild(ta); + ta.focus(); + ta.select(); + document.execCommand('copy'); + (function() { + ta.remove(); + }).defer(100); + + } + +} + /* * Based on: * Ext JS Library 1.1.1 * Copyright(c) 2006-2007, Ext JS, LLC. @@ -25205,35 +25287,35 @@ Roo.extend(Roo.data.ArrayReader, Roo.data.JsonReader, { readRecords : function(o) { var sid = this.meta ? this.meta.id : null; - var recordType = this.recordType, fields = recordType.prototype.fields; - var records = []; - var root = o; - for(var i = 0; i < root.length; i++){ - var n = root[i]; - var values = {}; - var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null); - for(var j = 0, jlen = fields.length; j < jlen; j++){ - var f = fields.items[j]; - var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j; - var v = n[k] !== undefined ? n[k] : f.defaultValue; - v = f.convert(v); - values[f.name] = v; - } - var record = new recordType(values, id); - record.json = n; - records[records.length] = record; - } - return { - records : records, - totalRecords : records.length - }; + var recordType = this.recordType, fields = recordType.prototype.fields; + var records = []; + var root = o; + for(var i = 0; i < root.length; i++){ + var n = root[i]; + var values = {}; + var id = ((sid || sid === 0) && n[sid] !== undefined && n[sid] !== "" ? n[sid] : null); + for(var j = 0, jlen = fields.length; j < jlen; j++){ + var f = fields.items[j]; + var k = f.mapping !== undefined && f.mapping !== null ? f.mapping : j; + var v = n[k] !== undefined ? n[k] : f.defaultValue; + v = f.convert(v); + values[f.name] = v; + } + var record = new recordType(values, id); + record.json = n; + records[records.length] = record; + } + return { + records : records, + totalRecords : records.length + }; }, // used when loading children.. @see loadDataFromChildren toLoadData: function(rec) { - // expect rec just to be an array.. eg [a,b,c, [...] << cn ] - return typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn; - + // expect rec just to be an array.. eg [a,b,c, [...] << cn ] + return typeof(rec.data.cn) == 'undefined' ? [] : rec.data.cn; + } @@ -38354,7 +38436,7 @@ Roo.menu.TextItem = function(cfg){ Roo.extend(Roo.menu.TextItem, Roo.menu.BaseItem, { /** - * @cfg {Boolean} text Text to show on item. + * @cfg {String} text Text to show on item. */ text : '', @@ -56779,7 +56861,7 @@ Roo.extend(Roo.grid.GridView, Roo.grid.AbstractGridView, { ); */ if(ctop < stop){ - c.scrollTop = ctop; + c.scrollTop = ctop; //Roo.log("set scrolltop to ctop DISABLE?"); }else if(cbot > sbot){ //Roo.log("set scrolltop to cbot-ch");