1/// <reference path="../bower_components/jquery/dist/jquery.js" /> 2/* 3jquery-resizable 4Version 0.35 - 11/18/2019 5© 2015-2019 Rick Strahl, West Wind Technologies 6www.west-wind.com 7Licensed under MIT License 8*/ 9(function(factory, undefined) { 10 if (typeof define === 'function' && define.amd) { 11 // AMD 12 define(['jquery'], factory); 13 } else if (typeof module === 'object' && typeof module.exports === 'object') { 14 // CommonJS 15 module.exports = factory(require('jquery')); 16 } else { 17 // Global jQuery 18 factory(jQuery); 19 } 20}(function($, undefined) { 21 22 if ($.fn.resizableSafe) 23 return; 24 25 $.fn.resizableSafe = function fnResizable(options) { 26 var defaultOptions = { 27 // selector for handle that starts dragging 28 handleSelector: null, 29 // resize the width 30 resizeWidth: true, 31 // resize the height 32 resizeHeight: true, 33 // the side that the width resizing is relative to 34 resizeWidthFrom: 'right', 35 // the side that the height resizing is relative to 36 resizeHeightFrom: 'bottom', 37 // hook into start drag operation (event passed) 38 onDragStart: null, 39 // hook into stop drag operation (event passed) 40 onDragEnd: null, 41 // hook into each drag operation (event passed) 42 onDrag: null, 43 // disable touch-action on $handle 44 // prevents browser level actions like forward back gestures 45 touchActionNone: true, 46 // instance id 47 instanceId: null 48 }; 49 if (typeof options == "object") 50 defaultOptions = $.extend(defaultOptions, options); 51 52 return this.each(function () { 53 var opt = $.extend({}, defaultOptions); 54 if (!opt.instanceId) 55 opt.instanceId = "rsz_" + new Date().getTime(); 56 57 var startPos, startTransition; 58 59 // get the element to resize 60 var $el = $(this); 61 var $handle; 62 63 if (options === 'destroy') { 64 opt = $el.data('resizable'); 65 if (!opt) 66 return; 67 68 $handle = getHandle(opt.handleSelector, $el); 69 $handle.off("mousedown." + opt.instanceId + " touchstart." + opt.instanceId); 70 if (opt.touchActionNone) 71 $handle.css("touch-action", ""); 72 $el.removeClass("resizable"); 73 return; 74 } 75 76 $el.data('resizable', opt); 77 78 // get the drag handle 79 80 $handle = getHandle(opt.handleSelector, $el); 81 82 if (opt.touchActionNone) 83 $handle.css("touch-action", "none"); 84 85 $el.addClass("resizable"); 86 $handle.on("mousedown." + opt.instanceId + " touchstart." + opt.instanceId, startDragging); 87 88 function noop(e) { 89 e.stopPropagation(); 90 e.preventDefault(); 91 }; 92 93 function startDragging(e) { 94 // Prevent dragging a ghost image in HTML5 / Firefox and maybe others 95 if ( e.preventDefault ) { 96 e.preventDefault(); 97 } 98 99 startPos = getMousePos(e); 100 startPos.width = parseInt($el.width(), 10); 101 startPos.height = parseInt($el.height(), 10); 102 103 startTransition = $el.css("transition"); 104 $el.css("transition", "none"); 105 106 if (opt.onDragStart) { 107 if (opt.onDragStart(e, $el, opt) === false) 108 return; 109 } 110 111 $(document).on('mousemove.' + opt.instanceId, doDrag); 112 $(document).on('mouseup.' + opt.instanceId, stopDragging); 113 if (window.Touch || navigator.maxTouchPoints) { 114 $(document).on('touchmove.' + opt.instanceId, doDrag); 115 $(document).on('touchend.' + opt.instanceId, stopDragging); 116 } 117 $(document).on('selectstart.' + opt.instanceId, noop); // disable selection 118 $("iframe").css("pointer-events","none"); 119 } 120 121 function doDrag(e) { 122 123 var pos = getMousePos(e), newWidth, newHeight; 124 125 if (opt.resizeWidthFrom === 'left') 126 newWidth = startPos.width - pos.x + startPos.x; 127 else 128 newWidth = startPos.width + pos.x - startPos.x; 129 130 if (opt.resizeHeightFrom === 'top') 131 newHeight = startPos.height - pos.y + startPos.y; 132 else 133 newHeight = startPos.height + pos.y - startPos.y; 134 135 if (!opt.onDrag || opt.onDrag(e, $el, newWidth, newHeight, opt) !== false) { 136 if (opt.resizeHeight) 137 $el.height(newHeight); 138 139 if (opt.resizeWidth) 140 $el.width(newWidth); 141 } 142 } 143 144 function stopDragging(e) { 145 e.stopPropagation(); 146 e.preventDefault(); 147 148 $(document).off('mousemove.' + opt.instanceId); 149 $(document).off('mouseup.' + opt.instanceId); 150 151 if (window.Touch || navigator.maxTouchPoints) { 152 $(document).off('touchmove.' + opt.instanceId); 153 $(document).off('touchend.' + opt.instanceId); 154 } 155 $(document).off('selectstart.' + opt.instanceId, noop); 156 157 // reset changed values 158 $el.css("transition", startTransition); 159 $("iframe").css("pointer-events","auto"); 160 161 if (opt.onDragEnd) 162 opt.onDragEnd(e, $el, opt); 163 164 return false; 165 } 166 167 function getMousePos(e) { 168 var pos = { x: 0, y: 0, width: 0, height: 0 }; 169 if (typeof e.clientX === "number") { 170 pos.x = e.clientX; 171 pos.y = e.clientY; 172 } else if (e.originalEvent.touches) { 173 pos.x = e.originalEvent.touches[0].clientX; 174 pos.y = e.originalEvent.touches[0].clientY; 175 } else 176 return null; 177 178 return pos; 179 } 180 181 function getHandle(selector, $el) { 182 if (selector && selector.trim()[0] === ">") { 183 selector = selector.trim().replace(/^>\s*/, ""); 184 return $el.find(selector); 185 } 186 187 // Search for the selector, but only in the parent element to limit the scope 188 // This works for multiple objects on a page (using .class syntax most likely) 189 // as long as each has a separate parent container. 190 return selector ? $el.parent().find(selector) : $el; 191 } 192 }); 193 }; 194 195 if (!$.fn.resizable) 196 $.fn.resizable = $.fn.resizableSafe; 197}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.