mice 0.2.10 → 0.2.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +44 -36
  3. data/lib/mice/version.rb +1 -1
  4. metadata +2 -67
  5. data/vendor/assets/fonts/FontAwesome.otf +0 -0
  6. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.svg +0 -414
  8. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  9. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  10. data/vendor/assets/images/ZeroClipboard.swf +0 -0
  11. data/vendor/assets/javascripts/mice/ZeroClipboard.js +0 -1031
  12. data/vendor/assets/javascripts/mice/ZeroClipboard.min.js +0 -9
  13. data/vendor/assets/javascripts/mice/alert.js +0 -92
  14. data/vendor/assets/javascripts/mice/carousel.js +0 -66
  15. data/vendor/assets/javascripts/mice/jquery.autocomplete.min.js +0 -29
  16. data/vendor/assets/javascripts/mice/jquery.autofix_anything.js +0 -83
  17. data/vendor/assets/javascripts/mice/jquery.email-autocomplete.js +0 -178
  18. data/vendor/assets/javascripts/mice/jquery.js +0 -9597
  19. data/vendor/assets/javascripts/mice/jquery.min.js +0 -5
  20. data/vendor/assets/javascripts/mice/jquery.min.map +0 -1
  21. data/vendor/assets/javascripts/mice/jquery.onepage-scroll.js +0 -411
  22. data/vendor/assets/javascripts/mice/message.coffee +0 -104
  23. data/vendor/assets/javascripts/mice/modal.coffee +0 -237
  24. data/vendor/assets/javascripts/mice/slider.coffee +0 -20
  25. data/vendor/assets/javascripts/mice/slider.js +0 -223
  26. data/vendor/assets/javascripts/mice/tooltip.coffee +0 -338
  27. data/vendor/assets/javascripts/mice/transition.coffee +0 -36
  28. data/vendor/assets/javascripts/mice.js +0 -6
  29. data/vendor/assets/stylesheets/mice/_alerts.scss +0 -70
  30. data/vendor/assets/stylesheets/mice/_autofix_anything.scss +0 -14
  31. data/vendor/assets/stylesheets/mice/_breadcrumbs.scss +0 -26
  32. data/vendor/assets/stylesheets/mice/_buttons.scss +0 -407
  33. data/vendor/assets/stylesheets/mice/_callouts.scss +0 -71
  34. data/vendor/assets/stylesheets/mice/_close.scss +0 -35
  35. data/vendor/assets/stylesheets/mice/_code.scss +0 -63
  36. data/vendor/assets/stylesheets/mice/_component-animations.scss +0 -11
  37. data/vendor/assets/stylesheets/mice/_forms.scss +0 -402
  38. data/vendor/assets/stylesheets/mice/_grid.scss +0 -95
  39. data/vendor/assets/stylesheets/mice/_icons.scss +0 -564
  40. data/vendor/assets/stylesheets/mice/_images.scss +0 -250
  41. data/vendor/assets/stylesheets/mice/_labels.scss +0 -82
  42. data/vendor/assets/stylesheets/mice/_lists.scss +0 -186
  43. data/vendor/assets/stylesheets/mice/_media.scss +0 -53
  44. data/vendor/assets/stylesheets/mice/_menu.scss +0 -42
  45. data/vendor/assets/stylesheets/mice/_message.scss +0 -78
  46. data/vendor/assets/stylesheets/mice/_mixins.scss +0 -176
  47. data/vendor/assets/stylesheets/mice/_modals.scss +0 -160
  48. data/vendor/assets/stylesheets/mice/_navbar.scss +0 -86
  49. data/vendor/assets/stylesheets/mice/_normalize.scss +0 -425
  50. data/vendor/assets/stylesheets/mice/_pagination.scss +0 -171
  51. data/vendor/assets/stylesheets/mice/_panels.scss +0 -236
  52. data/vendor/assets/stylesheets/mice/_progress.scss +0 -65
  53. data/vendor/assets/stylesheets/mice/_scaffolding.scss +0 -101
  54. data/vendor/assets/stylesheets/mice/_sidebar.scss +0 -37
  55. data/vendor/assets/stylesheets/mice/_slider.scss +0 -310
  56. data/vendor/assets/stylesheets/mice/_tables.scss +0 -144
  57. data/vendor/assets/stylesheets/mice/_tabs.scss +0 -70
  58. data/vendor/assets/stylesheets/mice/_timeline.scss +0 -157
  59. data/vendor/assets/stylesheets/mice/_tipsy.scss +0 -36
  60. data/vendor/assets/stylesheets/mice/_tooltips.scss +0 -124
  61. data/vendor/assets/stylesheets/mice/_typography.scss +0 -113
  62. data/vendor/assets/stylesheets/mice/_utilities.scss +0 -48
  63. data/vendor/assets/stylesheets/mice/_variables.scss +0 -577
  64. data/vendor/assets/stylesheets/mice-mobile.scss +0 -23
  65. data/vendor/assets/stylesheets/mice.scss +0 -46
  66. data/vendor/assets/stylesheets/mobile/bars.scss +0 -76
  67. data/vendor/assets/stylesheets/mobile/base.scss +0 -52
  68. data/vendor/assets/stylesheets/mobile/cards.scss +0 -29
  69. data/vendor/assets/stylesheets/mobile/variables.scss +0 -37
@@ -1,1031 +0,0 @@
1
- /*!
2
- * ZeroClipboard
3
- * The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
4
- * Copyright (c) 2014 Jon Rohan, James M. Greene
5
- * Licensed MIT
6
- * http://zeroclipboard.org/
7
- * v1.3.5
8
- */
9
- (function(window) {
10
- "use strict";
11
- var currentElement;
12
- var flashState = {
13
- bridge: null,
14
- version: "0.0.0",
15
- disabled: null,
16
- outdated: null,
17
- ready: null
18
- };
19
- var _clipData = {};
20
- var clientIdCounter = 0;
21
- var _clientMeta = {};
22
- var elementIdCounter = 0;
23
- var _elementMeta = {};
24
- var _amdModuleId = null;
25
- var _cjsModuleId = null;
26
- var _swfPath = function() {
27
- var i, jsDir, tmpJsPath, jsPath, swfPath = "ZeroClipboard.swf";
28
- if (document.currentScript && (jsPath = document.currentScript.src)) {} else {
29
- var scripts = document.getElementsByTagName("script");
30
- if ("readyState" in scripts[0]) {
31
- for (i = scripts.length; i--; ) {
32
- if (scripts[i].readyState === "interactive" && (jsPath = scripts[i].src)) {
33
- break;
34
- }
35
- }
36
- } else if (document.readyState === "loading") {
37
- jsPath = scripts[scripts.length - 1].src;
38
- } else {
39
- for (i = scripts.length; i--; ) {
40
- tmpJsPath = scripts[i].src;
41
- if (!tmpJsPath) {
42
- jsDir = null;
43
- break;
44
- }
45
- tmpJsPath = tmpJsPath.split("#")[0].split("?")[0];
46
- tmpJsPath = tmpJsPath.slice(0, tmpJsPath.lastIndexOf("/") + 1);
47
- if (jsDir == null) {
48
- jsDir = tmpJsPath;
49
- } else if (jsDir !== tmpJsPath) {
50
- jsDir = null;
51
- break;
52
- }
53
- }
54
- if (jsDir !== null) {
55
- jsPath = jsDir;
56
- }
57
- }
58
- }
59
- if (jsPath) {
60
- jsPath = jsPath.split("#")[0].split("?")[0];
61
- swfPath = jsPath.slice(0, jsPath.lastIndexOf("/") + 1) + swfPath;
62
- }
63
- return swfPath;
64
- }();
65
- var _camelizeCssPropName = function() {
66
- var matcherRegex = /\-([a-z])/g, replacerFn = function(match, group) {
67
- return group.toUpperCase();
68
- };
69
- return function(prop) {
70
- return prop.replace(matcherRegex, replacerFn);
71
- };
72
- }();
73
- var _getStyle = function(el, prop) {
74
- var value, camelProp, tagName, possiblePointers, i, len;
75
- if (window.getComputedStyle) {
76
- value = window.getComputedStyle(el, null).getPropertyValue(prop);
77
- } else {
78
- camelProp = _camelizeCssPropName(prop);
79
- if (el.currentStyle) {
80
- value = el.currentStyle[camelProp];
81
- } else {
82
- value = el.style[camelProp];
83
- }
84
- }
85
- if (prop === "cursor") {
86
- if (!value || value === "auto") {
87
- tagName = el.tagName.toLowerCase();
88
- if (tagName === "a") {
89
- return "pointer";
90
- }
91
- }
92
- }
93
- return value;
94
- };
95
- var _elementMouseOver = function(event) {
96
- if (!event) {
97
- event = window.event;
98
- }
99
- var target;
100
- if (this !== window) {
101
- target = this;
102
- } else if (event.target) {
103
- target = event.target;
104
- } else if (event.srcElement) {
105
- target = event.srcElement;
106
- }
107
- ZeroClipboard.activate(target);
108
- };
109
- var _addEventHandler = function(element, method, func) {
110
- if (!element || element.nodeType !== 1) {
111
- return;
112
- }
113
- if (element.addEventListener) {
114
- element.addEventListener(method, func, false);
115
- } else if (element.attachEvent) {
116
- element.attachEvent("on" + method, func);
117
- }
118
- };
119
- var _removeEventHandler = function(element, method, func) {
120
- if (!element || element.nodeType !== 1) {
121
- return;
122
- }
123
- if (element.removeEventListener) {
124
- element.removeEventListener(method, func, false);
125
- } else if (element.detachEvent) {
126
- element.detachEvent("on" + method, func);
127
- }
128
- };
129
- var _addClass = function(element, value) {
130
- if (!element || element.nodeType !== 1) {
131
- return element;
132
- }
133
- if (element.classList) {
134
- if (!element.classList.contains(value)) {
135
- element.classList.add(value);
136
- }
137
- return element;
138
- }
139
- if (value && typeof value === "string") {
140
- var classNames = (value || "").split(/\s+/);
141
- if (element.nodeType === 1) {
142
- if (!element.className) {
143
- element.className = value;
144
- } else {
145
- var className = " " + element.className + " ", setClass = element.className;
146
- for (var c = 0, cl = classNames.length; c < cl; c++) {
147
- if (className.indexOf(" " + classNames[c] + " ") < 0) {
148
- setClass += " " + classNames[c];
149
- }
150
- }
151
- element.className = setClass.replace(/^\s+|\s+$/g, "");
152
- }
153
- }
154
- }
155
- return element;
156
- };
157
- var _removeClass = function(element, value) {
158
- if (!element || element.nodeType !== 1) {
159
- return element;
160
- }
161
- if (element.classList) {
162
- if (element.classList.contains(value)) {
163
- element.classList.remove(value);
164
- }
165
- return element;
166
- }
167
- if (value && typeof value === "string" || value === undefined) {
168
- var classNames = (value || "").split(/\s+/);
169
- if (element.nodeType === 1 && element.className) {
170
- if (value) {
171
- var className = (" " + element.className + " ").replace(/[\n\t]/g, " ");
172
- for (var c = 0, cl = classNames.length; c < cl; c++) {
173
- className = className.replace(" " + classNames[c] + " ", " ");
174
- }
175
- element.className = className.replace(/^\s+|\s+$/g, "");
176
- } else {
177
- element.className = "";
178
- }
179
- }
180
- }
181
- return element;
182
- };
183
- var _getZoomFactor = function() {
184
- var rect, physicalWidth, logicalWidth, zoomFactor = 1;
185
- if (typeof document.body.getBoundingClientRect === "function") {
186
- rect = document.body.getBoundingClientRect();
187
- physicalWidth = rect.right - rect.left;
188
- logicalWidth = document.body.offsetWidth;
189
- zoomFactor = Math.round(physicalWidth / logicalWidth * 100) / 100;
190
- }
191
- return zoomFactor;
192
- };
193
- var _getDOMObjectPosition = function(obj, defaultZIndex) {
194
- var info = {
195
- left: 0,
196
- top: 0,
197
- width: 0,
198
- height: 0,
199
- zIndex: _getSafeZIndex(defaultZIndex) - 1
200
- };
201
- if (obj.getBoundingClientRect) {
202
- var rect = obj.getBoundingClientRect();
203
- var pageXOffset, pageYOffset, zoomFactor;
204
- if ("pageXOffset" in window && "pageYOffset" in window) {
205
- pageXOffset = window.pageXOffset;
206
- pageYOffset = window.pageYOffset;
207
- } else {
208
- zoomFactor = _getZoomFactor();
209
- pageXOffset = Math.round(document.documentElement.scrollLeft / zoomFactor);
210
- pageYOffset = Math.round(document.documentElement.scrollTop / zoomFactor);
211
- }
212
- var leftBorderWidth = document.documentElement.clientLeft || 0;
213
- var topBorderWidth = document.documentElement.clientTop || 0;
214
- info.left = rect.left + pageXOffset - leftBorderWidth;
215
- info.top = rect.top + pageYOffset - topBorderWidth;
216
- info.width = "width" in rect ? rect.width : rect.right - rect.left;
217
- info.height = "height" in rect ? rect.height : rect.bottom - rect.top;
218
- }
219
- return info;
220
- };
221
- var _cacheBust = function(path, options) {
222
- var cacheBust = options == null || options && options.cacheBust === true && options.useNoCache === true;
223
- if (cacheBust) {
224
- return (path.indexOf("?") === -1 ? "?" : "&") + "noCache=" + new Date().getTime();
225
- } else {
226
- return "";
227
- }
228
- };
229
- var _vars = function(options) {
230
- var i, len, domain, str = [], domains = [], trustedOriginsExpanded = [];
231
- if (options.trustedOrigins) {
232
- if (typeof options.trustedOrigins === "string") {
233
- domains.push(options.trustedOrigins);
234
- } else if (typeof options.trustedOrigins === "object" && "length" in options.trustedOrigins) {
235
- domains = domains.concat(options.trustedOrigins);
236
- }
237
- }
238
- if (options.trustedDomains) {
239
- if (typeof options.trustedDomains === "string") {
240
- domains.push(options.trustedDomains);
241
- } else if (typeof options.trustedDomains === "object" && "length" in options.trustedDomains) {
242
- domains = domains.concat(options.trustedDomains);
243
- }
244
- }
245
- if (domains.length) {
246
- for (i = 0, len = domains.length; i < len; i++) {
247
- if (domains.hasOwnProperty(i) && domains[i] && typeof domains[i] === "string") {
248
- domain = _extractDomain(domains[i]);
249
- if (!domain) {
250
- continue;
251
- }
252
- if (domain === "*") {
253
- trustedOriginsExpanded = [ domain ];
254
- break;
255
- }
256
- trustedOriginsExpanded.push.apply(trustedOriginsExpanded, [ domain, "//" + domain, window.location.protocol + "//" + domain ]);
257
- }
258
- }
259
- }
260
- if (trustedOriginsExpanded.length) {
261
- str.push("trustedOrigins=" + encodeURIComponent(trustedOriginsExpanded.join(",")));
262
- }
263
- if (typeof options.jsModuleId === "string" && options.jsModuleId) {
264
- str.push("jsModuleId=" + encodeURIComponent(options.jsModuleId));
265
- }
266
- return str.join("&");
267
- };
268
- var _inArray = function(elem, array, fromIndex) {
269
- if (typeof array.indexOf === "function") {
270
- return array.indexOf(elem, fromIndex);
271
- }
272
- var i, len = array.length;
273
- if (typeof fromIndex === "undefined") {
274
- fromIndex = 0;
275
- } else if (fromIndex < 0) {
276
- fromIndex = len + fromIndex;
277
- }
278
- for (i = fromIndex; i < len; i++) {
279
- if (array.hasOwnProperty(i) && array[i] === elem) {
280
- return i;
281
- }
282
- }
283
- return -1;
284
- };
285
- var _prepClip = function(elements) {
286
- if (typeof elements === "string") throw new TypeError("ZeroClipboard doesn't accept query strings.");
287
- if (!elements.length) return [ elements ];
288
- return elements;
289
- };
290
- var _dispatchCallback = function(func, context, args, async) {
291
- if (async) {
292
- window.setTimeout(function() {
293
- func.apply(context, args);
294
- }, 0);
295
- } else {
296
- func.apply(context, args);
297
- }
298
- };
299
- var _getSafeZIndex = function(val) {
300
- var zIndex, tmp;
301
- if (val) {
302
- if (typeof val === "number" && val > 0) {
303
- zIndex = val;
304
- } else if (typeof val === "string" && (tmp = parseInt(val, 10)) && !isNaN(tmp) && tmp > 0) {
305
- zIndex = tmp;
306
- }
307
- }
308
- if (!zIndex) {
309
- if (typeof _globalConfig.zIndex === "number" && _globalConfig.zIndex > 0) {
310
- zIndex = _globalConfig.zIndex;
311
- } else if (typeof _globalConfig.zIndex === "string" && (tmp = parseInt(_globalConfig.zIndex, 10)) && !isNaN(tmp) && tmp > 0) {
312
- zIndex = tmp;
313
- }
314
- }
315
- return zIndex || 0;
316
- };
317
- var _deprecationWarning = function(deprecatedApiName, debugEnabled) {
318
- if (deprecatedApiName && debugEnabled !== false && typeof console !== "undefined" && console && (console.warn || console.log)) {
319
- var deprecationWarning = "`" + deprecatedApiName + "` is deprecated. See docs for more info:\n" + " https://github.com/zeroclipboard/zeroclipboard/blob/master/docs/instructions.md#deprecations";
320
- if (console.warn) {
321
- console.warn(deprecationWarning);
322
- } else {
323
- console.log(deprecationWarning);
324
- }
325
- }
326
- };
327
- var _extend = function() {
328
- var i, len, arg, prop, src, copy, target = arguments[0] || {};
329
- for (i = 1, len = arguments.length; i < len; i++) {
330
- if ((arg = arguments[i]) != null) {
331
- for (prop in arg) {
332
- if (arg.hasOwnProperty(prop)) {
333
- src = target[prop];
334
- copy = arg[prop];
335
- if (target === copy) {
336
- continue;
337
- }
338
- if (copy !== undefined) {
339
- target[prop] = copy;
340
- }
341
- }
342
- }
343
- }
344
- }
345
- return target;
346
- };
347
- var _extractDomain = function(originOrUrl) {
348
- if (originOrUrl == null || originOrUrl === "") {
349
- return null;
350
- }
351
- originOrUrl = originOrUrl.replace(/^\s+|\s+$/g, "");
352
- if (originOrUrl === "") {
353
- return null;
354
- }
355
- var protocolIndex = originOrUrl.indexOf("//");
356
- originOrUrl = protocolIndex === -1 ? originOrUrl : originOrUrl.slice(protocolIndex + 2);
357
- var pathIndex = originOrUrl.indexOf("/");
358
- originOrUrl = pathIndex === -1 ? originOrUrl : protocolIndex === -1 || pathIndex === 0 ? null : originOrUrl.slice(0, pathIndex);
359
- if (originOrUrl && originOrUrl.slice(-4).toLowerCase() === ".swf") {
360
- return null;
361
- }
362
- return originOrUrl || null;
363
- };
364
- var _determineScriptAccess = function() {
365
- var _extractAllDomains = function(origins, resultsArray) {
366
- var i, len, tmp;
367
- if (origins != null && resultsArray[0] !== "*") {
368
- if (typeof origins === "string") {
369
- origins = [ origins ];
370
- }
371
- if (typeof origins === "object" && "length" in origins) {
372
- for (i = 0, len = origins.length; i < len; i++) {
373
- if (origins.hasOwnProperty(i)) {
374
- tmp = _extractDomain(origins[i]);
375
- if (tmp) {
376
- if (tmp === "*") {
377
- resultsArray.length = 0;
378
- resultsArray.push("*");
379
- break;
380
- }
381
- if (_inArray(tmp, resultsArray) === -1) {
382
- resultsArray.push(tmp);
383
- }
384
- }
385
- }
386
- }
387
- }
388
- }
389
- };
390
- var _accessLevelLookup = {
391
- always: "always",
392
- samedomain: "sameDomain",
393
- never: "never"
394
- };
395
- return function(currentDomain, configOptions) {
396
- var asaLower, allowScriptAccess = configOptions.allowScriptAccess;
397
- if (typeof allowScriptAccess === "string" && (asaLower = allowScriptAccess.toLowerCase()) && /^always|samedomain|never$/.test(asaLower)) {
398
- return _accessLevelLookup[asaLower];
399
- }
400
- var swfDomain = _extractDomain(configOptions.moviePath);
401
- if (swfDomain === null) {
402
- swfDomain = currentDomain;
403
- }
404
- var trustedDomains = [];
405
- _extractAllDomains(configOptions.trustedOrigins, trustedDomains);
406
- _extractAllDomains(configOptions.trustedDomains, trustedDomains);
407
- var len = trustedDomains.length;
408
- if (len > 0) {
409
- if (len === 1 && trustedDomains[0] === "*") {
410
- return "always";
411
- }
412
- if (_inArray(currentDomain, trustedDomains) !== -1) {
413
- if (len === 1 && currentDomain === swfDomain) {
414
- return "sameDomain";
415
- }
416
- return "always";
417
- }
418
- }
419
- return "never";
420
- };
421
- }();
422
- var _objectKeys = function(obj) {
423
- if (obj == null) {
424
- return [];
425
- }
426
- if (Object.keys) {
427
- return Object.keys(obj);
428
- }
429
- var keys = [];
430
- for (var prop in obj) {
431
- if (obj.hasOwnProperty(prop)) {
432
- keys.push(prop);
433
- }
434
- }
435
- return keys;
436
- };
437
- var _deleteOwnProperties = function(obj) {
438
- if (obj) {
439
- for (var prop in obj) {
440
- if (obj.hasOwnProperty(prop)) {
441
- delete obj[prop];
442
- }
443
- }
444
- }
445
- return obj;
446
- };
447
- var _safeActiveElement = function() {
448
- try {
449
- return document.activeElement;
450
- } catch (err) {}
451
- return null;
452
- };
453
- var _detectFlashSupport = function() {
454
- var hasFlash = false;
455
- if (typeof flashState.disabled === "boolean") {
456
- hasFlash = flashState.disabled === false;
457
- } else {
458
- if (typeof ActiveXObject === "function") {
459
- try {
460
- if (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) {
461
- hasFlash = true;
462
- }
463
- } catch (error) {}
464
- }
465
- if (!hasFlash && navigator.mimeTypes["application/x-shockwave-flash"]) {
466
- hasFlash = true;
467
- }
468
- }
469
- return hasFlash;
470
- };
471
- function _parseFlashVersion(flashVersion) {
472
- return flashVersion.replace(/,/g, ".").replace(/[^0-9\.]/g, "");
473
- }
474
- function _isFlashVersionSupported(flashVersion) {
475
- return parseFloat(_parseFlashVersion(flashVersion)) >= 10;
476
- }
477
- var ZeroClipboard = function(elements, options) {
478
- if (!(this instanceof ZeroClipboard)) {
479
- return new ZeroClipboard(elements, options);
480
- }
481
- this.id = "" + clientIdCounter++;
482
- _clientMeta[this.id] = {
483
- instance: this,
484
- elements: [],
485
- handlers: {}
486
- };
487
- if (elements) {
488
- this.clip(elements);
489
- }
490
- if (typeof options !== "undefined") {
491
- _deprecationWarning("new ZeroClipboard(elements, options)", _globalConfig.debug);
492
- ZeroClipboard.config(options);
493
- }
494
- this.options = ZeroClipboard.config();
495
- if (typeof flashState.disabled !== "boolean") {
496
- flashState.disabled = !_detectFlashSupport();
497
- }
498
- if (flashState.disabled === false && flashState.outdated !== true) {
499
- if (flashState.bridge === null) {
500
- flashState.outdated = false;
501
- flashState.ready = false;
502
- _bridge();
503
- }
504
- }
505
- };
506
- ZeroClipboard.prototype.setText = function(newText) {
507
- if (newText && newText !== "") {
508
- _clipData["text/plain"] = newText;
509
- if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setText === "function") {
510
- flashState.bridge.setText(newText);
511
- } else {
512
- flashState.ready = false;
513
- }
514
- }
515
- return this;
516
- };
517
- ZeroClipboard.prototype.setSize = function(width, height) {
518
- if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setSize === "function") {
519
- flashState.bridge.setSize(width, height);
520
- } else {
521
- flashState.ready = false;
522
- }
523
- return this;
524
- };
525
- var _setHandCursor = function(enabled) {
526
- if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setHandCursor === "function") {
527
- flashState.bridge.setHandCursor(enabled);
528
- } else {
529
- flashState.ready = false;
530
- }
531
- };
532
- ZeroClipboard.prototype.destroy = function() {
533
- this.unclip();
534
- this.off();
535
- delete _clientMeta[this.id];
536
- };
537
- var _getAllClients = function() {
538
- var i, len, client, clients = [], clientIds = _objectKeys(_clientMeta);
539
- for (i = 0, len = clientIds.length; i < len; i++) {
540
- client = _clientMeta[clientIds[i]].instance;
541
- if (client && client instanceof ZeroClipboard) {
542
- clients.push(client);
543
- }
544
- }
545
- return clients;
546
- };
547
- ZeroClipboard.version = "1.3.5";
548
- var _globalConfig = {
549
- swfPath: _swfPath,
550
- trustedDomains: window.location.host ? [ window.location.host ] : [],
551
- cacheBust: true,
552
- forceHandCursor: false,
553
- zIndex: 999999999,
554
- debug: true,
555
- title: null,
556
- autoActivate: true
557
- };
558
- ZeroClipboard.config = function(options) {
559
- if (typeof options === "object" && options !== null) {
560
- _extend(_globalConfig, options);
561
- }
562
- if (typeof options === "string" && options) {
563
- if (_globalConfig.hasOwnProperty(options)) {
564
- return _globalConfig[options];
565
- }
566
- return;
567
- }
568
- var copy = {};
569
- for (var prop in _globalConfig) {
570
- if (_globalConfig.hasOwnProperty(prop)) {
571
- if (typeof _globalConfig[prop] === "object" && _globalConfig[prop] !== null) {
572
- if ("length" in _globalConfig[prop]) {
573
- copy[prop] = _globalConfig[prop].slice(0);
574
- } else {
575
- copy[prop] = _extend({}, _globalConfig[prop]);
576
- }
577
- } else {
578
- copy[prop] = _globalConfig[prop];
579
- }
580
- }
581
- }
582
- return copy;
583
- };
584
- ZeroClipboard.destroy = function() {
585
- ZeroClipboard.deactivate();
586
- for (var clientId in _clientMeta) {
587
- if (_clientMeta.hasOwnProperty(clientId) && _clientMeta[clientId]) {
588
- var client = _clientMeta[clientId].instance;
589
- if (client && typeof client.destroy === "function") {
590
- client.destroy();
591
- }
592
- }
593
- }
594
- var htmlBridge = _getHtmlBridge(flashState.bridge);
595
- if (htmlBridge && htmlBridge.parentNode) {
596
- htmlBridge.parentNode.removeChild(htmlBridge);
597
- flashState.ready = null;
598
- flashState.bridge = null;
599
- }
600
- };
601
- ZeroClipboard.activate = function(element) {
602
- if (currentElement) {
603
- _removeClass(currentElement, _globalConfig.hoverClass);
604
- _removeClass(currentElement, _globalConfig.activeClass);
605
- }
606
- currentElement = element;
607
- _addClass(element, _globalConfig.hoverClass);
608
- _reposition();
609
- var newTitle = _globalConfig.title || element.getAttribute("title");
610
- if (newTitle) {
611
- var htmlBridge = _getHtmlBridge(flashState.bridge);
612
- if (htmlBridge) {
613
- htmlBridge.setAttribute("title", newTitle);
614
- }
615
- }
616
- var useHandCursor = _globalConfig.forceHandCursor === true || _getStyle(element, "cursor") === "pointer";
617
- _setHandCursor(useHandCursor);
618
- };
619
- ZeroClipboard.deactivate = function() {
620
- var htmlBridge = _getHtmlBridge(flashState.bridge);
621
- if (htmlBridge) {
622
- htmlBridge.style.left = "0px";
623
- htmlBridge.style.top = "-9999px";
624
- htmlBridge.removeAttribute("title");
625
- }
626
- if (currentElement) {
627
- _removeClass(currentElement, _globalConfig.hoverClass);
628
- _removeClass(currentElement, _globalConfig.activeClass);
629
- currentElement = null;
630
- }
631
- };
632
- var _bridge = function() {
633
- var flashBridge, len;
634
- var container = document.getElementById("global-zeroclipboard-html-bridge");
635
- if (!container) {
636
- var opts = ZeroClipboard.config();
637
- opts.jsModuleId = typeof _amdModuleId === "string" && _amdModuleId || typeof _cjsModuleId === "string" && _cjsModuleId || null;
638
- var allowScriptAccess = _determineScriptAccess(window.location.host, _globalConfig);
639
- var flashvars = _vars(opts);
640
- var swfUrl = _globalConfig.moviePath + _cacheBust(_globalConfig.moviePath, _globalConfig);
641
- var html = ' <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="global-zeroclipboard-flash-bridge" width="100%" height="100%"> <param name="movie" value="' + swfUrl + '"/> <param name="allowScriptAccess" value="' + allowScriptAccess + '"/> <param name="scale" value="exactfit"/> <param name="loop" value="false"/> <param name="menu" value="false"/> <param name="quality" value="best" /> <param name="bgcolor" value="#ffffff"/> <param name="wmode" value="transparent"/> <param name="flashvars" value="' + flashvars + '"/> <embed src="' + swfUrl + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="100%" height="100%" name="global-zeroclipboard-flash-bridge" allowScriptAccess="' + allowScriptAccess + '" allowFullScreen="false" type="application/x-shockwave-flash" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" scale="exactfit"> </embed> </object>';
642
- container = document.createElement("div");
643
- container.id = "global-zeroclipboard-html-bridge";
644
- container.setAttribute("class", "global-zeroclipboard-container");
645
- container.style.position = "absolute";
646
- container.style.left = "0px";
647
- container.style.top = "-9999px";
648
- container.style.width = "15px";
649
- container.style.height = "15px";
650
- container.style.zIndex = "" + _getSafeZIndex(_globalConfig.zIndex);
651
- document.body.appendChild(container);
652
- container.innerHTML = html;
653
- }
654
- flashBridge = document["global-zeroclipboard-flash-bridge"];
655
- if (flashBridge && (len = flashBridge.length)) {
656
- flashBridge = flashBridge[len - 1];
657
- }
658
- flashState.bridge = flashBridge || container.children[0].lastElementChild;
659
- };
660
- var _getHtmlBridge = function(flashBridge) {
661
- var isFlashElement = /^OBJECT|EMBED$/;
662
- var htmlBridge = flashBridge && flashBridge.parentNode;
663
- while (htmlBridge && isFlashElement.test(htmlBridge.nodeName) && htmlBridge.parentNode) {
664
- htmlBridge = htmlBridge.parentNode;
665
- }
666
- return htmlBridge || null;
667
- };
668
- var _reposition = function() {
669
- if (currentElement) {
670
- var pos = _getDOMObjectPosition(currentElement, _globalConfig.zIndex);
671
- var htmlBridge = _getHtmlBridge(flashState.bridge);
672
- if (htmlBridge) {
673
- htmlBridge.style.top = pos.top + "px";
674
- htmlBridge.style.left = pos.left + "px";
675
- htmlBridge.style.width = pos.width + "px";
676
- htmlBridge.style.height = pos.height + "px";
677
- htmlBridge.style.zIndex = pos.zIndex + 1;
678
- }
679
- if (flashState.ready === true && flashState.bridge && typeof flashState.bridge.setSize === "function") {
680
- flashState.bridge.setSize(pos.width, pos.height);
681
- } else {
682
- flashState.ready = false;
683
- }
684
- }
685
- return this;
686
- };
687
- ZeroClipboard.prototype.on = function(eventName, func) {
688
- var i, len, events, added = {}, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
689
- if (typeof eventName === "string" && eventName) {
690
- events = eventName.toLowerCase().split(/\s+/);
691
- } else if (typeof eventName === "object" && eventName && typeof func === "undefined") {
692
- for (i in eventName) {
693
- if (eventName.hasOwnProperty(i) && typeof i === "string" && i && typeof eventName[i] === "function") {
694
- this.on(i, eventName[i]);
695
- }
696
- }
697
- }
698
- if (events && events.length) {
699
- for (i = 0, len = events.length; i < len; i++) {
700
- eventName = events[i].replace(/^on/, "");
701
- added[eventName] = true;
702
- if (!handlers[eventName]) {
703
- handlers[eventName] = [];
704
- }
705
- handlers[eventName].push(func);
706
- }
707
- if (added.noflash && flashState.disabled) {
708
- _receiveEvent.call(this, "noflash", {});
709
- }
710
- if (added.wrongflash && flashState.outdated) {
711
- _receiveEvent.call(this, "wrongflash", {
712
- flashVersion: flashState.version
713
- });
714
- }
715
- if (added.load && flashState.ready) {
716
- _receiveEvent.call(this, "load", {
717
- flashVersion: flashState.version
718
- });
719
- }
720
- }
721
- return this;
722
- };
723
- ZeroClipboard.prototype.off = function(eventName, func) {
724
- var i, len, foundIndex, events, perEventHandlers, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
725
- if (arguments.length === 0) {
726
- events = _objectKeys(handlers);
727
- } else if (typeof eventName === "string" && eventName) {
728
- events = eventName.split(/\s+/);
729
- } else if (typeof eventName === "object" && eventName && typeof func === "undefined") {
730
- for (i in eventName) {
731
- if (eventName.hasOwnProperty(i) && typeof i === "string" && i && typeof eventName[i] === "function") {
732
- this.off(i, eventName[i]);
733
- }
734
- }
735
- }
736
- if (events && events.length) {
737
- for (i = 0, len = events.length; i < len; i++) {
738
- eventName = events[i].toLowerCase().replace(/^on/, "");
739
- perEventHandlers = handlers[eventName];
740
- if (perEventHandlers && perEventHandlers.length) {
741
- if (func) {
742
- foundIndex = _inArray(func, perEventHandlers);
743
- while (foundIndex !== -1) {
744
- perEventHandlers.splice(foundIndex, 1);
745
- foundIndex = _inArray(func, perEventHandlers, foundIndex);
746
- }
747
- } else {
748
- handlers[eventName].length = 0;
749
- }
750
- }
751
- }
752
- }
753
- return this;
754
- };
755
- ZeroClipboard.prototype.handlers = function(eventName) {
756
- var prop, copy = null, handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers;
757
- if (handlers) {
758
- if (typeof eventName === "string" && eventName) {
759
- return handlers[eventName] ? handlers[eventName].slice(0) : null;
760
- }
761
- copy = {};
762
- for (prop in handlers) {
763
- if (handlers.hasOwnProperty(prop) && handlers[prop]) {
764
- copy[prop] = handlers[prop].slice(0);
765
- }
766
- }
767
- }
768
- return copy;
769
- };
770
- var _dispatchClientCallbacks = function(eventName, context, args, async) {
771
- var handlers = _clientMeta[this.id] && _clientMeta[this.id].handlers[eventName];
772
- if (handlers && handlers.length) {
773
- var i, len, func, originalContext = context || this;
774
- for (i = 0, len = handlers.length; i < len; i++) {
775
- func = handlers[i];
776
- context = originalContext;
777
- if (typeof func === "string" && typeof window[func] === "function") {
778
- func = window[func];
779
- }
780
- if (typeof func === "object" && func && typeof func.handleEvent === "function") {
781
- context = func;
782
- func = func.handleEvent;
783
- }
784
- if (typeof func === "function") {
785
- _dispatchCallback(func, context, args, async);
786
- }
787
- }
788
- }
789
- return this;
790
- };
791
- ZeroClipboard.prototype.clip = function(elements) {
792
- elements = _prepClip(elements);
793
- for (var i = 0; i < elements.length; i++) {
794
- if (elements.hasOwnProperty(i) && elements[i] && elements[i].nodeType === 1) {
795
- if (!elements[i].zcClippingId) {
796
- elements[i].zcClippingId = "zcClippingId_" + elementIdCounter++;
797
- _elementMeta[elements[i].zcClippingId] = [ this.id ];
798
- if (_globalConfig.autoActivate === true) {
799
- _addEventHandler(elements[i], "mouseover", _elementMouseOver);
800
- }
801
- } else if (_inArray(this.id, _elementMeta[elements[i].zcClippingId]) === -1) {
802
- _elementMeta[elements[i].zcClippingId].push(this.id);
803
- }
804
- var clippedElements = _clientMeta[this.id].elements;
805
- if (_inArray(elements[i], clippedElements) === -1) {
806
- clippedElements.push(elements[i]);
807
- }
808
- }
809
- }
810
- return this;
811
- };
812
- ZeroClipboard.prototype.unclip = function(elements) {
813
- var meta = _clientMeta[this.id];
814
- if (meta) {
815
- var clippedElements = meta.elements;
816
- var arrayIndex;
817
- if (typeof elements === "undefined") {
818
- elements = clippedElements.slice(0);
819
- } else {
820
- elements = _prepClip(elements);
821
- }
822
- for (var i = elements.length; i--; ) {
823
- if (elements.hasOwnProperty(i) && elements[i] && elements[i].nodeType === 1) {
824
- arrayIndex = 0;
825
- while ((arrayIndex = _inArray(elements[i], clippedElements, arrayIndex)) !== -1) {
826
- clippedElements.splice(arrayIndex, 1);
827
- }
828
- var clientIds = _elementMeta[elements[i].zcClippingId];
829
- if (clientIds) {
830
- arrayIndex = 0;
831
- while ((arrayIndex = _inArray(this.id, clientIds, arrayIndex)) !== -1) {
832
- clientIds.splice(arrayIndex, 1);
833
- }
834
- if (clientIds.length === 0) {
835
- if (_globalConfig.autoActivate === true) {
836
- _removeEventHandler(elements[i], "mouseover", _elementMouseOver);
837
- }
838
- delete elements[i].zcClippingId;
839
- }
840
- }
841
- }
842
- }
843
- }
844
- return this;
845
- };
846
- ZeroClipboard.prototype.elements = function() {
847
- var meta = _clientMeta[this.id];
848
- return meta && meta.elements ? meta.elements.slice(0) : [];
849
- };
850
- var _getAllClientsClippedToElement = function(element) {
851
- var elementMetaId, clientIds, i, len, client, clients = [];
852
- if (element && element.nodeType === 1 && (elementMetaId = element.zcClippingId) && _elementMeta.hasOwnProperty(elementMetaId)) {
853
- clientIds = _elementMeta[elementMetaId];
854
- if (clientIds && clientIds.length) {
855
- for (i = 0, len = clientIds.length; i < len; i++) {
856
- client = _clientMeta[clientIds[i]].instance;
857
- if (client && client instanceof ZeroClipboard) {
858
- clients.push(client);
859
- }
860
- }
861
- }
862
- }
863
- return clients;
864
- };
865
- _globalConfig.hoverClass = "zeroclipboard-is-hover";
866
- _globalConfig.activeClass = "zeroclipboard-is-active";
867
- _globalConfig.trustedOrigins = null;
868
- _globalConfig.allowScriptAccess = null;
869
- _globalConfig.useNoCache = true;
870
- _globalConfig.moviePath = "ZeroClipboard.swf";
871
- ZeroClipboard.detectFlashSupport = function() {
872
- _deprecationWarning("ZeroClipboard.detectFlashSupport", _globalConfig.debug);
873
- return _detectFlashSupport();
874
- };
875
- ZeroClipboard.dispatch = function(eventName, args) {
876
- if (typeof eventName === "string" && eventName) {
877
- var cleanEventName = eventName.toLowerCase().replace(/^on/, "");
878
- if (cleanEventName) {
879
- var clients = currentElement && _globalConfig.autoActivate === true ? _getAllClientsClippedToElement(currentElement) : _getAllClients();
880
- for (var i = 0, len = clients.length; i < len; i++) {
881
- _receiveEvent.call(clients[i], cleanEventName, args);
882
- }
883
- }
884
- }
885
- };
886
- ZeroClipboard.prototype.setHandCursor = function(enabled) {
887
- _deprecationWarning("ZeroClipboard.prototype.setHandCursor", _globalConfig.debug);
888
- enabled = typeof enabled === "boolean" ? enabled : !!enabled;
889
- _setHandCursor(enabled);
890
- _globalConfig.forceHandCursor = enabled;
891
- return this;
892
- };
893
- ZeroClipboard.prototype.reposition = function() {
894
- _deprecationWarning("ZeroClipboard.prototype.reposition", _globalConfig.debug);
895
- return _reposition();
896
- };
897
- ZeroClipboard.prototype.receiveEvent = function(eventName, args) {
898
- _deprecationWarning("ZeroClipboard.prototype.receiveEvent", _globalConfig.debug);
899
- if (typeof eventName === "string" && eventName) {
900
- var cleanEventName = eventName.toLowerCase().replace(/^on/, "");
901
- if (cleanEventName) {
902
- _receiveEvent.call(this, cleanEventName, args);
903
- }
904
- }
905
- };
906
- ZeroClipboard.prototype.setCurrent = function(element) {
907
- _deprecationWarning("ZeroClipboard.prototype.setCurrent", _globalConfig.debug);
908
- ZeroClipboard.activate(element);
909
- return this;
910
- };
911
- ZeroClipboard.prototype.resetBridge = function() {
912
- _deprecationWarning("ZeroClipboard.prototype.resetBridge", _globalConfig.debug);
913
- ZeroClipboard.deactivate();
914
- return this;
915
- };
916
- ZeroClipboard.prototype.setTitle = function(newTitle) {
917
- _deprecationWarning("ZeroClipboard.prototype.setTitle", _globalConfig.debug);
918
- newTitle = newTitle || _globalConfig.title || currentElement && currentElement.getAttribute("title");
919
- if (newTitle) {
920
- var htmlBridge = _getHtmlBridge(flashState.bridge);
921
- if (htmlBridge) {
922
- htmlBridge.setAttribute("title", newTitle);
923
- }
924
- }
925
- return this;
926
- };
927
- ZeroClipboard.setDefaults = function(options) {
928
- _deprecationWarning("ZeroClipboard.setDefaults", _globalConfig.debug);
929
- ZeroClipboard.config(options);
930
- };
931
- ZeroClipboard.prototype.addEventListener = function(eventName, func) {
932
- _deprecationWarning("ZeroClipboard.prototype.addEventListener", _globalConfig.debug);
933
- return this.on(eventName, func);
934
- };
935
- ZeroClipboard.prototype.removeEventListener = function(eventName, func) {
936
- _deprecationWarning("ZeroClipboard.prototype.removeEventListener", _globalConfig.debug);
937
- return this.off(eventName, func);
938
- };
939
- ZeroClipboard.prototype.ready = function() {
940
- _deprecationWarning("ZeroClipboard.prototype.ready", _globalConfig.debug);
941
- return flashState.ready === true;
942
- };
943
- var _receiveEvent = function(eventName, args) {
944
- eventName = eventName.toLowerCase().replace(/^on/, "");
945
- var cleanVersion = args && args.flashVersion && _parseFlashVersion(args.flashVersion) || null;
946
- var element = currentElement;
947
- var performCallbackAsync = true;
948
- switch (eventName) {
949
- case "load":
950
- if (cleanVersion) {
951
- if (!_isFlashVersionSupported(cleanVersion)) {
952
- _receiveEvent.call(this, "onWrongFlash", {
953
- flashVersion: cleanVersion
954
- });
955
- return;
956
- }
957
- flashState.outdated = false;
958
- flashState.ready = true;
959
- flashState.version = cleanVersion;
960
- }
961
- break;
962
-
963
- case "wrongflash":
964
- if (cleanVersion && !_isFlashVersionSupported(cleanVersion)) {
965
- flashState.outdated = true;
966
- flashState.ready = false;
967
- flashState.version = cleanVersion;
968
- }
969
- break;
970
-
971
- case "mouseover":
972
- _addClass(element, _globalConfig.hoverClass);
973
- break;
974
-
975
- case "mouseout":
976
- if (_globalConfig.autoActivate === true) {
977
- ZeroClipboard.deactivate();
978
- }
979
- break;
980
-
981
- case "mousedown":
982
- _addClass(element, _globalConfig.activeClass);
983
- break;
984
-
985
- case "mouseup":
986
- _removeClass(element, _globalConfig.activeClass);
987
- break;
988
-
989
- case "datarequested":
990
- if (element) {
991
- var targetId = element.getAttribute("data-clipboard-target"), targetEl = !targetId ? null : document.getElementById(targetId);
992
- if (targetEl) {
993
- var textContent = targetEl.value || targetEl.textContent || targetEl.innerText;
994
- if (textContent) {
995
- this.setText(textContent);
996
- }
997
- } else {
998
- var defaultText = element.getAttribute("data-clipboard-text");
999
- if (defaultText) {
1000
- this.setText(defaultText);
1001
- }
1002
- }
1003
- }
1004
- performCallbackAsync = false;
1005
- break;
1006
-
1007
- case "complete":
1008
- _deleteOwnProperties(_clipData);
1009
- if (element && element !== _safeActiveElement() && element.focus) {
1010
- element.focus();
1011
- }
1012
- break;
1013
- }
1014
- var context = element;
1015
- var eventArgs = [ this, args ];
1016
- return _dispatchClientCallbacks.call(this, eventName, context, eventArgs, performCallbackAsync);
1017
- };
1018
- if (typeof define === "function" && define.amd) {
1019
- define([ "require", "exports", "module" ], function(require, exports, module) {
1020
- _amdModuleId = module && module.id || null;
1021
- return ZeroClipboard;
1022
- });
1023
- } else if (typeof module === "object" && module && typeof module.exports === "object" && module.exports && typeof window.require === "function") {
1024
- _cjsModuleId = module.id || null;
1025
- module.exports = ZeroClipboard;
1026
- } else {
1027
- window.ZeroClipboard = ZeroClipboard;
1028
- }
1029
- })(function() {
1030
- return this;
1031
- }());