浏览代码

make colormask pasteable #1412

Robin Herbots 9 年之前
父节点
当前提交
b5d3b9099e

+ 1 - 1
bower.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.3.4-45",
+  "version": "3.3.4-46",
   "main": [
 	  "./dist/inputmask/inputmask.loader.js"
   ],

+ 1 - 1
component.json

@@ -2,7 +2,7 @@
   "name": "jquery_inputmask",
   "repository": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.4-45",
+  "version": "3.3.4-46",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "main": "./dist/inputmask/inputmask.loader.js",
   "scripts": [

+ 1 - 1
composer.json

@@ -1,7 +1,7 @@
 {
   "name": "robinherbots/jquery.inputmask",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
-  "version": "3.3.4-45",
+  "version": "3.3.4-46",
   "type": "library",
   "keywords": ["jquery", "plugins", "input", "form", "inputmask", "mask"],
   "homepage": "http://robinherbots.github.io/jquery.inputmask",

+ 1 - 1
dist/inputmask/inputmask.date.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.dependencyLib.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define("inputmask.dependencyLib", [ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : factory(jQuery);

+ 1 - 1
dist/inputmask/inputmask.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 8 - 9
dist/inputmask/inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define("inputmask", [ "inputmask.dependencyLib" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib")) : factory(window.dependencyLib || jQuery);
@@ -1173,23 +1173,22 @@
                 return document.body.removeChild(e), caretPos;
             }
             function position() {
-                colorMask.style.position = "absolute", colorMask.style.top = offset.top + parseInt(computedStyle.borderTopWidth) + "px", 
-                colorMask.style.left = offset.left + parseInt(computedStyle.borderLeftWidth) + "px", 
-                colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px", 
+                colorMask.style.position = "absolute", colorMask.style.top = offset.top + "px", 
+                colorMask.style.left = offset.left + "px", colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px", 
                 colorMask.style.height = parseInt(input.offsetHeight) - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom) - parseInt(computedStyle.borderTopWidth) - parseInt(computedStyle.borderBottomWidth) + "px", 
-                colorMask.style.lineHeight = colorMask.style.height, colorMask.style.border = "";
+                colorMask.style.lineHeight = colorMask.style.height, colorMask.style.zIndex = isNaN(computedStyle.zIndex) ? -1 : computedStyle.zIndex - 1, 
+                colorMask.style.webkitAppearance = "textfield", colorMask.style.mozAppearance = "textfield", 
+                colorMask.style.Appearance = "textfield";
             }
             var offset = $(input).position(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
             input.parentNode;
             colorMask = document.createElement("div"), document.body.appendChild(colorMask);
             for (var style in computedStyle) isNaN(style) && "cssText" !== style && style.indexOf("webkit") == -1 && (colorMask.style[style] = computedStyle[style]);
+            input.style.backgroundColor = "transparent", input.style.color = "transparent", 
+            input.style.webkitAppearance = "caret", input.style.mozAppearance = "caret", input.style.Appearance = "caret", 
             position(), $(window).on("resize", function(e) {
                 offset = $(input).position(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null), 
                 position();
-            }), $(colorMask).on("mouseenter", function(e) {
-                mouseenterEvent.call(input, e);
-            }), $(colorMask).on("mouseleave", function(e) {
-                mouseleaveEvent.call(input, e);
             }), $(colorMask).on("click", function(e) {
                 input.focus(), caret(input, findCaretPos(e.clientX)), $(input).trigger("click");
             });

文件差异内容过多而无法显示
+ 1 - 1
dist/inputmask/inputmask.loader.js


+ 1 - 1
dist/inputmask/inputmask.numeric.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.phone.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/inputmask.regex.extensions.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "inputmask.dependencyLib", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("./inputmask.dependencyLib"), require("./inputmask")) : factory(window.dependencyLib || jQuery, window.Inputmask);

+ 1 - 1
dist/inputmask/jquery.inputmask.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(factory) {
     "function" == typeof define && define.amd ? define([ "jquery", "inputmask" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery"), require("./inputmask")) : factory(jQuery, window.Inputmask);

+ 8 - 9
dist/jquery.inputmask.bundle.js

@@ -3,7 +3,7 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function($) {
     function Inputmask(alias, options) {
@@ -1171,23 +1171,22 @@
                 return document.body.removeChild(e), caretPos;
             }
             function position() {
-                colorMask.style.position = "absolute", colorMask.style.top = offset.top + parseInt(computedStyle.borderTopWidth) + "px", 
-                colorMask.style.left = offset.left + parseInt(computedStyle.borderLeftWidth) + "px", 
-                colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px", 
+                colorMask.style.position = "absolute", colorMask.style.top = offset.top + "px", 
+                colorMask.style.left = offset.left + "px", colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px", 
                 colorMask.style.height = parseInt(input.offsetHeight) - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom) - parseInt(computedStyle.borderTopWidth) - parseInt(computedStyle.borderBottomWidth) + "px", 
-                colorMask.style.lineHeight = colorMask.style.height, colorMask.style.border = "";
+                colorMask.style.lineHeight = colorMask.style.height, colorMask.style.zIndex = isNaN(computedStyle.zIndex) ? -1 : computedStyle.zIndex - 1, 
+                colorMask.style.webkitAppearance = "textfield", colorMask.style.mozAppearance = "textfield", 
+                colorMask.style.Appearance = "textfield";
             }
             var offset = $(input).position(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
             input.parentNode;
             colorMask = document.createElement("div"), document.body.appendChild(colorMask);
             for (var style in computedStyle) isNaN(style) && "cssText" !== style && style.indexOf("webkit") == -1 && (colorMask.style[style] = computedStyle[style]);
+            input.style.backgroundColor = "transparent", input.style.color = "transparent", 
+            input.style.webkitAppearance = "caret", input.style.mozAppearance = "caret", input.style.Appearance = "caret", 
             position(), $(window).on("resize", function(e) {
                 offset = $(input).position(), computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null), 
                 position();
-            }), $(colorMask).on("mouseenter", function(e) {
-                mouseenterEvent.call(input, e);
-            }), $(colorMask).on("mouseleave", function(e) {
-                mouseleaveEvent.call(input, e);
             }), $(colorMask).on("click", function(e) {
                 input.focus(), caret(input, findCaretPos(e.clientX)), $(input).trigger("click");
             });

文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.date.extensions.min.js


+ 1 - 1
dist/min/inputmask/inputmask.dependencyLib.min.js

@@ -3,6 +3,6 @@
 * https://github.com/RobinHerbots/jquery.inputmask
 * Copyright (c) 2010 - 2016 Robin Herbots
 * Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-* Version: 3.3.4-45
+* Version: 3.3.4-46
 */
 !function(a){"function"==typeof define&&define.amd?define("inputmask.dependencyLib",["jquery"],a):"object"==typeof exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return window.dependencyLib=a,a});

文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.loader.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/min/inputmask/inputmask.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.numeric.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.phone.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/inputmask.regex.extensions.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/min/inputmask/jquery.inputmask.min.js


文件差异内容过多而无法显示
+ 3 - 3
dist/min/jquery.inputmask.bundle.min.js


+ 21 - 9
js/inputmask.js

@@ -2745,13 +2745,17 @@
 
 			function position() {
 				colorMask.style.position = "absolute";
-				colorMask.style.top = offset.top + parseInt(computedStyle.borderTopWidth) + "px";
-				colorMask.style.left = offset.left + parseInt(computedStyle.borderLeftWidth) + "px";
+				colorMask.style.top = offset.top + "px";
+				colorMask.style.left = offset.left + "px";
 				colorMask.style.width = parseInt(input.offsetWidth) - parseInt(computedStyle.paddingLeft) - parseInt(computedStyle.paddingRight) - parseInt(computedStyle.borderLeftWidth) - parseInt(computedStyle.borderRightWidth) + "px";
 				colorMask.style.height = parseInt(input.offsetHeight) - parseInt(computedStyle.paddingTop) - parseInt(computedStyle.paddingBottom) - parseInt(computedStyle.borderTopWidth) - parseInt(computedStyle.borderBottomWidth) + "px";
 
 				colorMask.style.lineHeight = colorMask.style.height;
-				colorMask.style.border = "";
+				colorMask.style.zIndex = isNaN(computedStyle.zIndex) ? -1 : computedStyle.zIndex - 1;
+				colorMask.style.webkitAppearance = "textfield";
+				colorMask.style.mozAppearance = "textfield";
+				colorMask.style.Appearance = "textfield";
+
 			}
 
 			var offset = $(input).position(),
@@ -2765,6 +2769,14 @@
 					colorMask.style[style] = computedStyle[style];
 				}
 			}
+
+			//restyle input
+			input.style.backgroundColor = "transparent";
+			input.style.color = "transparent";
+			input.style.webkitAppearance = "caret";
+			input.style.mozAppearance = "caret";
+			input.style.Appearance = "caret";
+
 			position();
 
 			//event passthrough
@@ -2773,12 +2785,12 @@
 				computedStyle = (input.ownerDocument.defaultView || window).getComputedStyle(input, null);
 				position();
 			});
-			$(colorMask).on("mouseenter", function (e) {
-				mouseenterEvent.call(input, e);
-			});
-			$(colorMask).on("mouseleave", function (e) {
-				mouseleaveEvent.call(input, e);
-			});
+			//$(colorMask).on("mouseenter", function (e) {
+			//	mouseenterEvent.call(input, e);
+			//});
+			//$(colorMask).on("mouseleave", function (e) {
+			//	mouseleaveEvent.call(input, e);
+			//});
 			$(colorMask).on("click", function (e) {
 				input.focus();
 				caret(input, findCaretPos(e.clientX));

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "jquery.inputmask",
-  "version": "3.3.4-45",
+  "version": "3.3.4-46",
   "description": "jquery.inputmask is a jquery plugin which create an input mask.",
   "main": "./dist/inputmask/inputmask.loader.js",
   "files": [