clear-urls-browser-extension/external_js/pick-a-color-1.2.3.min.js

2 lines
24 KiB
JavaScript
Raw Normal View History

/*! Pick-a-Color v1.2.3 | Copyright 2013 Lauren Sperber and Broadstreet Ads https://github.com/lauren/pick-a-color/blob/master/LICENSE | pick-a-color 2014-04-24 */
!function(a){"use strict";a.fn.pickAColor=function(b){var c="ontouchstart"in window,d=(parseInt(a(window).width(),10)<767?!0:!1,"localStorage"in window&&null!==window.localStorage&&"object"==typeof JSON),e=document.all&&!window.atob,f=c?"touchstart.pickAColor":"mousedown.pickAColor",g=c?"touchmove.pickAColor":"mousemove.pickAColor",h=c?"touchend.pickAColor":"mouseup.pickAColor",i=c?"touchend.pickAColor":"click.pickAColor",j="dragging.pickAColor",k="endDrag.pickAColor",l=a.extend({showSpectrum:!0,showSavedColors:!0,saveColorsPerElement:!1,fadeMenuToggle:!0,showAdvanced:!0,showBasicColors:!0,showHexInput:!0,allowBlank:!1,inlineDropdown:!1,basicColors:{white:"fff",red:"f00",orange:"f60",yellow:"ff0",green:"008000",blue:"00f",purple:"800080",black:"000"}},b);l.showAdvanced||l.showBasicColors||(l.showBasicColors=!0);var m=l.showSavedColors&&l.showAdvanced||l.showBasicColors&&l.showSavedColors||l.showBasicColors&&l.showAdvanced,n=function(){var b=a("<div>").addClass("input-group-btn"),c=a("<button type='button'>").addClass("btn btn-default color-dropdown dropdown-toggle"),d=a("<span>").addClass("color-preview current-color"),f=a("<span>").addClass("caret"),g=a("<div>").addClass("color-menu dropdown-menu");if(l.inlineDropdown&&g.addClass("color-menu--inline"),l.showHexInput||(c.addClass("no-hex"),g.addClass("no-hex")),b.append(c.append(d).append(f)),m||l.showSpectrum||g.addClass("small"),m){var h=a("<div>").addClass("color-menu-tabs"),i=l.showBasicColors?"savedColors-tab tab":"savedColors-tab tab tab-active";l.showBasicColors&&h.append(a("<span>").addClass("basicColors-tab tab tab-active").append(a("<a>").text("Basic Colors"))),l.showSavedColors&&h.append(a("<span>").addClass(i).append(a("<a>").text("Saved Colors"))),l.showAdvanced&&h.append(a("<span>").addClass("advanced-tab tab").append(a("<a>").text("Advanced"))),g.append(h)}if(l.showBasicColors){var j=a("<div>").addClass("basicColors-content active-content");l.showSpectrum&&j.append(a("<h6>").addClass("color-menu-instructions").text("Tap spectrum or drag band to change color"));var k=a("<ul>").addClass("basic-colors-list");a.each(l.basicColors,function(b,c){var d=a("<li>").addClass("color-item"),f=a("<a>").addClass(b+" color-link"),g=a("<span>").addClass("color-preview "+b),h=a("<span>").addClass("color-label").text(b);if(f.append(g,h),g.append(),"#"!==c[0]&&(c="#"+c),g.css("background-color",c),l.showSpectrum){var i=a("<span>").addClass("color-box spectrum-"+b);e&&a.each([0,1],function(d){"fff"!==c&&"000"!==b&&i.append(a("<span>").addClass(b+"-spectrum-"+d+" ie-spectrum"))});var j=a("<span>").addClass("highlight-band");a.each([0,1,2],function(){j.append(a("<span>").addClass("highlight-band-stripe"))}),f.append(i.append(j))}k.append(d.append(f))}),g.append(j.append(k))}if(l.showSavedColors){var n=l.showBasicColors?"inactive-content":"active-content",o=a("<div>").addClass("savedColors-content").addClass(n);o.append(a("<p>").addClass("saved-colors-instructions").text("Type in a color or use the spectrums to lighten or darken an existing color.")),g.append(o)}if(l.showAdvanced){var p=l.showBasicColors||l.showSavedColors?"inactive-content":"active-content",q=a("<div>").addClass("advanced-content").addClass(p).append(a("<h6>").addClass("advanced-instructions").text("Tap spectrum or drag band to change color")),r=a("<ul>").addClass("advanced-list"),s=a("<li>").addClass("hue-item"),t=a("<span>").addClass("hue-text").text("Hue: ").append(a("<span>").addClass("hue-value").text("0")),u=a("<span>").addClass("color-box spectrum-hue");e&&a.each([0,1,2,3,4,5,6],function(b){u.append(a("<span>").addClass("hue-spectrum-"+b+" ie-spectrum hue"))});var v=a("<span>").addClass("highlight-band");a.each([0,1,2],function(){v.append(a("<span>").addClass("highlight-band-stripe"))}),r.append(s.append(t).append(u.append(v)));var w=a("<li>").addClass("lightness-item"),x=a("<span>").addClass("color-box spectrum-lightness"),y=a("<span>").addClass("lightness-text").text("Lightness: ").append(a("<span>").addClass("lightness-value").text("50%"));e&&a.each([0,1],function(b){x.append(a("<span>").addClass("lig