From 078a6b6a080a986fecc23e54993e93b3a82095ef Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 23 May 2017 17:37:33 +0800 Subject: [PATCH] add --- bi/core.js | 95 +++++++++++++++++++++------------------- demo/version.js | 4 +- docs/core.js | 95 +++++++++++++++++++++------------------- docs/demo.js | 4 +- src/core/proto/jquery.js | 95 +++++++++++++++++++++------------------- 5 files changed, 154 insertions(+), 139 deletions(-) diff --git a/bi/core.js b/bi/core.js index b5300f68e..2e88efc9b 100644 --- a/bi/core.js +++ b/bi/core.js @@ -6547,59 +6547,64 @@ Function.prototype.after = function (func) { * All rights reserved. */ if (jQuery) { - (function($){ + (function ($) { // richer:容器在其各个边缘留出的空间 - $.fn.insets = function () { - var p = this.padding(), - b = this.border(); - return { - 'top': p.top, - 'bottom': p.bottom + b.bottom + b.top, - 'left': p.left, - 'right': p.right + b.right + b.left + if (!$.fn.insets) { + $.fn.insets = function () { + var p = this.padding(), + b = this.border(); + return { + 'top': p.top, + 'bottom': p.bottom + b.bottom + b.top, + 'left': p.left, + 'right': p.right + b.right + b.left + }; }; - }; + } // richer:获取 && 设置jQuery元素的边界 - $.fn.bounds = function (value) { - var tmp = {hasIgnoredBounds : true}; + if (!$.fn.bounds) { + $.fn.bounds = function (value) { + var tmp = {hasIgnoredBounds: true}; - if (value) { - if (!isNaN(value.x)) { - tmp.left = value.x; - } - if (!isNaN(value.y)) { - tmp.top = value.y; - } - if (value.width != null) { - tmp.width = (value.width - (this.outerWidth(true) - this.width())); - tmp.width = (tmp.width >= 0) ? tmp.width : value.width; - // fix chrome - //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + if (value) { + if (!isNaN(value.x)) { + tmp.left = value.x; + } + if (!isNaN(value.y)) { + tmp.top = value.y; + } + if (value.width != null) { + tmp.width = (value.width - (this.outerWidth(true) - this.width())); + tmp.width = (tmp.width >= 0) ? tmp.width : value.width; + // fix chrome + //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + } + if (value.height != null) { + tmp.height = value.height - (this.outerHeight(true) - this.height()); + tmp.height = (tmp.height >= 0) ? tmp.height : value.height; + // fix chrome + //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + } + this.css(tmp); + return this; } - if (value.height != null) { - tmp.height = value.height - (this.outerHeight(true) - this.height()); - tmp.height = (tmp.height >= 0) ? tmp.height : value.height; - // fix chrome - //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + else { + // richer:注意此方法只对可见元素有效 + tmp = this.position(); + return { + 'x': tmp.left, + 'y': tmp.top, + // richer:这里计算外部宽度和高度的时候,都不包括边框 + 'width': this.outerWidth(), + 'height': this.outerHeight() + }; } - this.css(tmp); - return this; - } - else { - // richer:注意此方法只对可见元素有效 - tmp = this.position(); - return { - 'x': tmp.left, - 'y': tmp.top, - // richer:这里计算外部宽度和高度的时候,都不包括边框 - 'width': this.outerWidth(), - 'height': this.outerHeight() - }; - } - }; + }; + } })(jQuery); -};if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || +} +;if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") { (function () { diff --git a/demo/version.js b/demo/version.js index b1075f22d..afe18ced1 100644 --- a/demo/version.js +++ b/demo/version.js @@ -6,6 +6,6 @@ BI.i18n = { "BI-Basic_OK": "确定" }; -BI.servletURL = "docs/"; -BI.resourceURL = "docs/resource/"; +BI.servletURL = ""; +BI.resourceURL = "resource/"; BI.i18n = {}; \ No newline at end of file diff --git a/docs/core.js b/docs/core.js index 44c9a2757..854962a55 100644 --- a/docs/core.js +++ b/docs/core.js @@ -24081,59 +24081,64 @@ Function.prototype.after = function (func) { * All rights reserved. */ if (jQuery) { - (function($){ + (function ($) { // richer:容器在其各个边缘留出的空间 - $.fn.insets = function () { - var p = this.padding(), - b = this.border(); - return { - 'top': p.top, - 'bottom': p.bottom + b.bottom + b.top, - 'left': p.left, - 'right': p.right + b.right + b.left + if (!$.fn.insets) { + $.fn.insets = function () { + var p = this.padding(), + b = this.border(); + return { + 'top': p.top, + 'bottom': p.bottom + b.bottom + b.top, + 'left': p.left, + 'right': p.right + b.right + b.left + }; }; - }; + } // richer:获取 && 设置jQuery元素的边界 - $.fn.bounds = function (value) { - var tmp = {hasIgnoredBounds : true}; + if (!$.fn.bounds) { + $.fn.bounds = function (value) { + var tmp = {hasIgnoredBounds: true}; - if (value) { - if (!isNaN(value.x)) { - tmp.left = value.x; - } - if (!isNaN(value.y)) { - tmp.top = value.y; - } - if (value.width != null) { - tmp.width = (value.width - (this.outerWidth(true) - this.width())); - tmp.width = (tmp.width >= 0) ? tmp.width : value.width; - // fix chrome - //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + if (value) { + if (!isNaN(value.x)) { + tmp.left = value.x; + } + if (!isNaN(value.y)) { + tmp.top = value.y; + } + if (value.width != null) { + tmp.width = (value.width - (this.outerWidth(true) - this.width())); + tmp.width = (tmp.width >= 0) ? tmp.width : value.width; + // fix chrome + //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + } + if (value.height != null) { + tmp.height = value.height - (this.outerHeight(true) - this.height()); + tmp.height = (tmp.height >= 0) ? tmp.height : value.height; + // fix chrome + //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + } + this.css(tmp); + return this; } - if (value.height != null) { - tmp.height = value.height - (this.outerHeight(true) - this.height()); - tmp.height = (tmp.height >= 0) ? tmp.height : value.height; - // fix chrome - //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + else { + // richer:注意此方法只对可见元素有效 + tmp = this.position(); + return { + 'x': tmp.left, + 'y': tmp.top, + // richer:这里计算外部宽度和高度的时候,都不包括边框 + 'width': this.outerWidth(), + 'height': this.outerHeight() + }; } - this.css(tmp); - return this; - } - else { - // richer:注意此方法只对可见元素有效 - tmp = this.position(); - return { - 'x': tmp.left, - 'y': tmp.top, - // richer:这里计算外部宽度和高度的时候,都不包括边框 - 'width': this.outerWidth(), - 'height': this.outerHeight() - }; - } - }; + }; + } })(jQuery); -};if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || +} +;if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || (1000000000000000128).toFixed(0) !== "1000000000000000128") { (function () { diff --git a/docs/demo.js b/docs/demo.js index 59416a304..23accd576 100644 --- a/docs/demo.js +++ b/docs/demo.js @@ -6,8 +6,8 @@ BI.i18n = { "BI-Basic_OK": "确定" }; -BI.servletURL = "docs/"; -BI.resourceURL = "docs/resource/"; +BI.servletURL = ""; +BI.resourceURL = "resource/"; BI.i18n = {};$(function () { var ref; BI.createWidget({ diff --git a/src/core/proto/jquery.js b/src/core/proto/jquery.js index 408285a4f..522c9c31d 100644 --- a/src/core/proto/jquery.js +++ b/src/core/proto/jquery.js @@ -6,56 +6,61 @@ * All rights reserved. */ if (jQuery) { - (function($){ + (function ($) { // richer:容器在其各个边缘留出的空间 - $.fn.insets = function () { - var p = this.padding(), - b = this.border(); - return { - 'top': p.top, - 'bottom': p.bottom + b.bottom + b.top, - 'left': p.left, - 'right': p.right + b.right + b.left + if (!$.fn.insets) { + $.fn.insets = function () { + var p = this.padding(), + b = this.border(); + return { + 'top': p.top, + 'bottom': p.bottom + b.bottom + b.top, + 'left': p.left, + 'right': p.right + b.right + b.left + }; }; - }; + } // richer:获取 && 设置jQuery元素的边界 - $.fn.bounds = function (value) { - var tmp = {hasIgnoredBounds : true}; + if (!$.fn.bounds) { + $.fn.bounds = function (value) { + var tmp = {hasIgnoredBounds: true}; - if (value) { - if (!isNaN(value.x)) { - tmp.left = value.x; - } - if (!isNaN(value.y)) { - tmp.top = value.y; - } - if (value.width != null) { - tmp.width = (value.width - (this.outerWidth(true) - this.width())); - tmp.width = (tmp.width >= 0) ? tmp.width : value.width; - // fix chrome - //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + if (value) { + if (!isNaN(value.x)) { + tmp.left = value.x; + } + if (!isNaN(value.y)) { + tmp.top = value.y; + } + if (value.width != null) { + tmp.width = (value.width - (this.outerWidth(true) - this.width())); + tmp.width = (tmp.width >= 0) ? tmp.width : value.width; + // fix chrome + //tmp.width = (tmp.width >= 0) ? tmp.width : 0; + } + if (value.height != null) { + tmp.height = value.height - (this.outerHeight(true) - this.height()); + tmp.height = (tmp.height >= 0) ? tmp.height : value.height; + // fix chrome + //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + } + this.css(tmp); + return this; } - if (value.height != null) { - tmp.height = value.height - (this.outerHeight(true) - this.height()); - tmp.height = (tmp.height >= 0) ? tmp.height : value.height; - // fix chrome - //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; + else { + // richer:注意此方法只对可见元素有效 + tmp = this.position(); + return { + 'x': tmp.left, + 'y': tmp.top, + // richer:这里计算外部宽度和高度的时候,都不包括边框 + 'width': this.outerWidth(), + 'height': this.outerHeight() + }; } - this.css(tmp); - return this; - } - else { - // richer:注意此方法只对可见元素有效 - tmp = this.position(); - return { - 'x': tmp.left, - 'y': tmp.top, - // richer:这里计算外部宽度和高度的时候,都不包括边框 - 'width': this.outerWidth(), - 'height': this.outerHeight() - }; - } - }; + }; + } })(jQuery); -}; \ No newline at end of file +} +; \ No newline at end of file