Slide Anything – Responsive Content / HTML Slider and Carousel - Version 1.0

Version Description

  • Initial release of this plugin.

=

Download this release

Release Info

Developer simonpedge
Plugin Icon 128x128 Slide Anything – Responsive Content / HTML Slider and Carousel
Version 1.0
Comparing to
See all releases

Version 1.0

Files changed (76) hide show
  1. css/admin-user-interface.min.css +7 -0
  2. css/slide-anything-admin.css +504 -0
  3. images/icon_copy.png +0 -0
  4. images/icon_info.png +0 -0
  5. images/icon_next.png +0 -0
  6. images/icon_prev.png +0 -0
  7. images/padding_bottom.png +0 -0
  8. images/padding_left.png +0 -0
  9. images/padding_left_right.png +0 -0
  10. images/padding_right.png +0 -0
  11. images/padding_top.png +0 -0
  12. images/padding_top_bottom.png +0 -0
  13. images/sample_logo1.png +0 -0
  14. images/sample_logo2.png +0 -0
  15. images/sample_logo3.png +0 -0
  16. images/sample_logo4.png +0 -0
  17. images/sample_logo5.png +0 -0
  18. images/sample_logo6.png +0 -0
  19. images/sample_logo7.png +0 -0
  20. images/sample_logo8.png +0 -0
  21. images/ui-icons_444444_256x240.png +0 -0
  22. images/ui-icons_555555_256x240.png +0 -0
  23. images/ui-icons_777620_256x240.png +0 -0
  24. images/ui-icons_777777_256x240.png +0 -0
  25. images/ui-icons_cc0000_256x240.png +0 -0
  26. images/ui-icons_ffffff_256x240.png +0 -0
  27. js/slide-anything-admin.js +519 -0
  28. owl-carousel/owl-theme.css +73 -0
  29. owl-carousel/owl.carousel.css +71 -0
  30. owl-carousel/owl.carousel.min.js +47 -0
  31. owl-carousel/owl.transitions.css +163 -0
  32. php/slide-anything-admin.php +927 -0
  33. php/slide-anything-frontend.php +155 -0
  34. readme.txt +60 -0
  35. slide-anything.php +31 -0
  36. spectrum/spectrum.css +507 -0
  37. spectrum/spectrum.js +2323 -0
  38. trunk/css/admin-user-interface.min.css +7 -0
  39. trunk/css/slide-anything-admin.css +504 -0
  40. trunk/images/icon_copy.png +0 -0
  41. trunk/images/icon_info.png +0 -0
  42. trunk/images/icon_next.png +0 -0
  43. trunk/images/icon_prev.png +0 -0
  44. trunk/images/padding_bottom.png +0 -0
  45. trunk/images/padding_left.png +0 -0
  46. trunk/images/padding_left_right.png +0 -0
  47. trunk/images/padding_right.png +0 -0
  48. trunk/images/padding_top.png +0 -0
  49. trunk/images/padding_top_bottom.png +0 -0
  50. trunk/images/sample_logo1.png +0 -0
  51. trunk/images/sample_logo2.png +0 -0
  52. trunk/images/sample_logo3.png +0 -0
  53. trunk/images/sample_logo4.png +0 -0
  54. trunk/images/sample_logo5.png +0 -0
  55. trunk/images/sample_logo6.png +0 -0
  56. trunk/images/sample_logo7.png +0 -0
  57. trunk/images/sample_logo8.png +0 -0
  58. trunk/images/ui-icons_444444_256x240.png +0 -0
  59. trunk/images/ui-icons_555555_256x240.png +0 -0
  60. trunk/images/ui-icons_777620_256x240.png +0 -0
  61. trunk/images/ui-icons_777777_256x240.png +0 -0
  62. trunk/images/ui-icons_cc0000_256x240.png +0 -0
  63. trunk/images/ui-icons_ffffff_256x240.png +0 -0
  64. trunk/js/slide-anything-admin.js +519 -0
  65. trunk/owl-carousel/owl-theme.css +73 -0
  66. trunk/owl-carousel/owl.carousel.css +71 -0
  67. trunk/owl-carousel/owl.carousel.min.js +47 -0
  68. trunk/owl-carousel/owl.transitions.css +163 -0
  69. trunk/php/slide-anything-admin.php +927 -0
  70. trunk/php/slide-anything-frontend.php +155 -0
  71. trunk/readme.txt +60 -0
  72. trunk/slide-anything.php +31 -0
  73. trunk/spectrum/spectrum.css +507 -0
  74. trunk/spectrum/spectrum.js +2323 -0
  75. trunk/uninstall.php +18 -0
  76. uninstall.php +18 -0
css/admin-user-interface.min.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.11.4 - 2015-12-12
2
+ * http://jqueryui.com
3
+ * Includes: core.css, draggable.css, resizable.css, selectable.css, sortable.css, accordion.css, button.css, dialog.css, slider.css, spinner.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#2b2b2b;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:0 0 0 0;padding:5px;background:#666;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
css/slide-anything-admin.css ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ##################################################################
3
+ ### SLIDE ANYTHING PLUGIN - JAVASCRIPT FOR WORDPRESS DASHBOARD ###
4
+ ##################################################################
5
+ */
6
+
7
+ /* ### GENERAL STYLE ### */
8
+ .postbox-container .meta-box-sortables .postbox h3 span {
9
+ font-family:'Open Sans', sans-serif !important;
10
+ font-weight:600 !important;
11
+ font-size:20px !important;
12
+ line-height:26px !important;
13
+ }
14
+ .sa_hidden {
15
+ display:none !important;
16
+ }
17
+
18
+ /* ### METABOX 'Slider Settings' ### */
19
+ #sa_slider_settings {
20
+ padding:10px 0px 0px;
21
+ }
22
+ #sa_slider_settings hr {
23
+ margin:20px 0px !important;
24
+ border-top-style:none !important;
25
+ border-bottom:solid 1px #e8e8e8 !important;
26
+ }
27
+ #sa_slider_settings .sa_slider_value {
28
+ position:relative;
29
+ margin:0px 5px 15px;
30
+ }
31
+ #sa_slider_settings .sa_slider_value span {
32
+ display:inline-block;
33
+ padding-right:10px;
34
+ color:#303030;
35
+ font-family:'Open Sans', sans-serif;
36
+ font-size:14px;
37
+ line-height:20px;
38
+ }
39
+ #sa_slider_settings .sa_slider_value .sa_tooltip {
40
+ position:absolute;
41
+ top:4px;
42
+ margin-left:5px !important;
43
+ cursor:help;
44
+ }
45
+ #sa_slider_settings .sa_slider_value input {
46
+ width:40px !important;
47
+ margin:0px !important;
48
+ border-style:none !important;
49
+ border-radius:3px !important;
50
+ outline-color:transparent !important;
51
+ box-shadow:none !important;
52
+ -webkit-box-shadow:none !important;
53
+ background-color:#f0f0f0 !important;
54
+ }
55
+ #sa_slider_settings .sa_slider_value em {
56
+ display:inline-block;
57
+ padding-left:5px;
58
+ color:#a0a0a0;
59
+ font-family:'Open Sans', sans-serif;
60
+ font-size:14px;
61
+ line-height:20px;
62
+ }
63
+ #sa_slider_settings .jquery_ui_slider {
64
+ margin:0px 5px 5px !important;
65
+ background-color:#007fff !important;
66
+ border-radius:0px !important;
67
+ }
68
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle {
69
+ outline-color:transparent !important;
70
+ background-color:#f0f0f0 !important;
71
+ border-color:#c0c0c0 !important;
72
+ transition:background .3s ease-in-out;
73
+ -webkit-transition:background .3s ease-in-out;
74
+ -moz-transition:background .3s ease-in-out;
75
+ -o-transition:background .3s ease-in-out;
76
+ }
77
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle:hover,
78
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle:focus {
79
+ background-color:#d0d0d0 !important;
80
+ }
81
+ #sa_slider_settings .jquery_ui_slider .ui-slider-range {
82
+ border-radius:0px !important;
83
+ }
84
+ .half_width_column {
85
+ float:left;
86
+ width:50%;
87
+ }
88
+ .half_width_column .sa_setting_checkbox {
89
+ position:relative;
90
+ padding:0px 5px 10px 5px;
91
+ }
92
+ .half_width_column .sa_setting_checkbox span {
93
+ display:inline-block;
94
+ width:125px;
95
+ color:#303030;
96
+ font-family:'Open Sans', sans-serif;
97
+ font-size:14px;
98
+ line-height:20px;
99
+ }
100
+ .half_width_column .sa_setting_checkbox .sa_tooltip {
101
+ position:absolute;
102
+ top:2px;
103
+ margin-left:5px !important;
104
+ cursor:help;
105
+ }
106
+ @media only screen and (max-width:479px) {
107
+ .half_width_column { float:none; width:100%; }
108
+ }
109
+
110
+ /* ### METABOX 'Slides' - DISABLE VISUAL EDITOR CHECKBOX ### */
111
+ #sa_visual_editor_checkbox {
112
+ padding:10px 5px 0px;
113
+ }
114
+ #sa_visual_editor_checkbox span {
115
+ display:inline-block;
116
+ padding-right:10px;
117
+ color:#303030;
118
+ font-family:'Open Sans', sans-serif;
119
+ font-size:14px;
120
+ line-height:20px;
121
+ }
122
+ /* ### METABOX 'Slides' - ACCORDION CONTAINING SLIDE CONTENT ### */
123
+ #slider_accordion {
124
+ margin:20px 0px 10px !important;
125
+ }
126
+ #slider_accordion > h3 {
127
+ margin-top:3px !important;
128
+ padding:6px 10px !important;
129
+ font-family:Arial, Helvetica, sans-serif !important;
130
+ font-weight:normal !important;
131
+ font-size:15px !important;
132
+ line-height:20px !important;
133
+ text-transform:uppercase !important;
134
+ }
135
+ #slider_accordion > h3 .ui-accordion-header-icon {
136
+ display:none !important;
137
+ }
138
+ #slider_accordion > div {
139
+ padding:15px 15px !important;
140
+ }
141
+ /* slide backround image/color */
142
+ .sa_slide_bg_wrapper {
143
+ position:relative;
144
+ margin-top:15px;
145
+ border:solid 1px #e0e0e0;
146
+ padding:20px 15px 14px;
147
+ background-color:#f8f8f8;
148
+ }
149
+ .sa_slide_bg_wrapper h4 {
150
+ position:absolute;
151
+ display:inline-block;
152
+ top:-10px;
153
+ left:10px;
154
+ margin:0px;
155
+ padding:0px 5px;
156
+ background-color:#ffffff;
157
+ color:#303030;
158
+ font-family:'Open Sans', sans-serif;
159
+ font-size:14px;
160
+ font-weight:600;
161
+ line-height:20px;
162
+ }
163
+ .sa_slide_bg_wrapper .sa_slide_thumb {
164
+ position:relative;
165
+ float:left;
166
+ margin-right:15px;
167
+ border:solid 1px #e0e0e0;
168
+ padding:5px;
169
+ background-color:#f3f3f3;
170
+ }
171
+ .sa_slide_bg_wrapper .sa_slide_thumb > div {
172
+ height:150px;
173
+ width:150px;
174
+ background-repeat:no-repeat;
175
+ background-position:top left;
176
+ background-size:100% auto;
177
+ }
178
+ .sa_slide_bg_wrapper .sa_slide_thumb > span {
179
+ display:inline-block;
180
+ position:absolute;
181
+ top:0px;
182
+ right:0px;
183
+ font-family:Arial, Helvetica, sans-serif;
184
+ font-size:14px;
185
+ line-height:14px;
186
+ padding:3px 3px;
187
+ background-color:rgba(0,0,0,0.5);
188
+ color:#ffffff;
189
+ cursor:pointer;
190
+ transition:all .3s ease-in-out;
191
+ -webkit-transition:all .3s ease-in-out;
192
+ -moz-transition:all .3s ease-in-out;
193
+ -o-transition:all .3s ease-in-out;
194
+ }
195
+ .sa_slide_bg_wrapper .sa_slide_thumb > span:hover {
196
+ background-color:crimson;
197
+ }
198
+ .sa_slide_bg_wrapper .slide_image_add {
199
+ margin:5px 0px 0px !important;
200
+ }
201
+ .sa_slide_bg_wrapper .slide_image_settings_line {
202
+ margin:10px 0px 0px 177px;
203
+ }
204
+ .sa_slide_bg_wrapper .slide_image_settings_line span {
205
+ display:inline-block;
206
+ width:130px;
207
+ color:#303030;
208
+ font-family:'Open Sans', sans-serif;
209
+ font-weight:400;
210
+ font-size:13px;
211
+ }
212
+ .sa_slide_bg_wrapper .slide_image_settings_line select {
213
+ min-width:110px;
214
+ }
215
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer { /* spectrum color picker */
216
+ background-color:#f0f0f0 !important;
217
+ border:solid 1px #e0e0e0 !important;
218
+ margin:2px 1px !important;
219
+ padding:2px !important;
220
+ border-radius:3px !important;
221
+ }
222
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer .sp-preview { /* spectrum color picker */
223
+ width:87px !important;
224
+ height:18px !important;
225
+ border:solid 1px #c0c0c0 !important;
226
+ margin-right:3px !important;
227
+ }
228
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer .sp-dd { /* spectrum color picker */
229
+ height:18px !important;
230
+ padding:0px !important;
231
+ margin-right:2px !important;
232
+ }
233
+
234
+ /* SLIDE BUTTONS (DELETE SLIDE, DUPLICATE SLIDE) */
235
+ #slider_accordion > div .button-secondary {
236
+ margin:10px 0px 0px;
237
+ }
238
+
239
+ /* ### METABOX 'Slider Shortcode' ### */
240
+ #sa_slider_shortcode {
241
+ display:block;
242
+ margin:10px 0px 0px;
243
+ padding:7px 10px;
244
+ background-color:#f0f0f0;
245
+ color:firebrick;
246
+ font-family:'Open Sans', sans-serif;
247
+ font-weight:normal;
248
+ font-size:14px;
249
+ line-height:20px;
250
+ border-radius:3px;
251
+ text-align:center;
252
+ cursor:default;
253
+ }
254
+ #sa_shortcode_copy {
255
+ float:right;
256
+ margin:10px 0px 0px;
257
+ }
258
+
259
+ /* ### METABOX 'Items Displayed' ### */
260
+ #items_displayed_metabox > h4 {
261
+ color:#303030;
262
+ margin:10px 0px 5px;
263
+ font-family:'Open Sans', sans-serif;
264
+ font-size:14px;
265
+ font-weight:600;
266
+ line-height:20px;
267
+ }
268
+ #items_displayed_metabox > div {
269
+ clear:both;
270
+ }
271
+ #items_displayed_metabox > div em {
272
+ display:block;
273
+ float:left;
274
+ margin-left:10px;
275
+ line-height:30px !important;
276
+ height:32px !important;
277
+ background-position:0px 8px !important;
278
+ cursor:help;
279
+ }
280
+ #items_displayed_metabox > div span {
281
+ display:block;
282
+ float:left;
283
+ padding-left:5px;
284
+ color:#303030;
285
+ width:120px;
286
+ font-family:'Open Sans', sans-serif;
287
+ font-weight:400;
288
+ font-size:13px;
289
+ line-height:32px;
290
+ height:32px !important;
291
+ }
292
+ #items_displayed_metabox > div select {
293
+ margin:1px 1px 3px !important;
294
+ }
295
+
296
+ /* ### METABOX 'Slider Style' ### */
297
+ #slider_style_metabox h4 {
298
+ position:relative;
299
+ color:#303030;
300
+ margin:15px 0px 10px;
301
+ font-family:'Open Sans', sans-serif;
302
+ font-size:14px;
303
+ font-weight:600;
304
+ line-height:20px;
305
+ }
306
+ #slider_style_metabox h4 span {
307
+ color:#909090 !important;
308
+ font-weight:400;
309
+ }
310
+ #slider_style_metabox h4 span {
311
+ color:firebrick;
312
+ }
313
+ #slider_style_metabox h4 em {
314
+ display:inline-block;
315
+ position:absolute;
316
+ top:1px;
317
+ width:16px;
318
+ height:16px;
319
+ background-position:0px 0px !important;
320
+ cursor:help;
321
+ margin-left:5px;
322
+ }
323
+ #slider_style_metabox #sa_css_id {
324
+ width:100%;
325
+ margin-bottom:15px;
326
+ font-size:14px !important;
327
+ line-height:20px !important;
328
+ padding:5px 7px !important;
329
+ }
330
+ #slider_style_metabox #css_note_text {
331
+ padding-left:3px;
332
+ padding-bottom:5px;
333
+ }
334
+ #slider_style_metabox #css_note_value {
335
+ margin-left:3px;
336
+ margin-bottom:25px !important;
337
+ padding:4px 5px 4px 32px;
338
+ background:#f0f0f0 url('../images/icon_copy.png') no-repeat 2px 2px;
339
+ font-size:13px;
340
+ line-height:20px;
341
+ height:20px;
342
+ color:firebrick;
343
+ cursor:pointer;
344
+ }
345
+ #slider_style_metabox .ca_style_hr {
346
+ border-top:solid 1px #e0e0e0;
347
+ width:80%;
348
+ margin:0px 10%;
349
+ }
350
+ /* slider padding*/
351
+ #slider_style_metabox .ca_style_padding > div {
352
+ float:left;
353
+ display:inline-block;
354
+ background-color:transparent;
355
+ background-repeat:no-repeat;
356
+ background-position:0px 2px;
357
+ width:45px;
358
+ height:23px;
359
+ padding:0px 0px 3px 19px;
360
+ }
361
+ #slider_style_metabox .ca_style_padding #padd_top { background-image:url('../images/padding_top.png'); }
362
+ #slider_style_metabox .ca_style_padding #padd_right { background-image:url('../images/padding_right.png'); }
363
+ #slider_style_metabox .ca_style_padding #padd_bottom { background-image:url('../images/padding_bottom.png'); }
364
+ #slider_style_metabox .ca_style_padding #padd_left { background-image:url('../images/padding_left.png'); width:38px !important; }
365
+
366
+ #slider_style_metabox .ca_style_padding div input {
367
+ width:33px !important;
368
+ margin:3px 2px !important;
369
+ outline-style:none !important;
370
+ border-style:none !important;
371
+ box-shadow:none !important;
372
+ -webkit-box-shadow:none !important;
373
+ color:#303030 !important;
374
+ font-size:13px !important;
375
+ }
376
+ /* slide style & Style for Slides */
377
+ #slider_style_metabox .ca_style_setting_line {
378
+ padding-left:5px;
379
+ padding-bottom:10px;
380
+ }
381
+ #slider_style_metabox .ca_style_setting_line span {
382
+ display:inline-block;
383
+ width:100px;
384
+ font-family:'Open Sans', sans-serif;
385
+ font-size:13px;
386
+ line-height:18px;
387
+ }
388
+ #slider_style_metabox .ca_style_setting_line .ui-spinner {
389
+ width:auto !important;
390
+ }
391
+ #slider_style_metabox .ca_style_setting_line input {
392
+ width:50px !important;
393
+ margin:3px 5px !important;
394
+ outline-style:none !important;
395
+ border-style:none !important;
396
+ box-shadow:none !important;
397
+ -webkit-box-shadow:none !important;
398
+ color:#303030 !important;
399
+ font-size:13px !important;
400
+ }
401
+ #slider_style_metabox .ca_style_setting_line em {
402
+ display:inline-block;
403
+ padding:0px 10px 0px 5px;
404
+ font-style:normal;
405
+ color:#a0a0a0;
406
+ font-family:'Open Sans', sans-serif;
407
+ font-size:14px;
408
+ line-height:18px;
409
+ }
410
+ #slider_style_metabox .ca_style_setting_line .sp-replacer { /* spectrum color picker */
411
+ background-color:#f0f0f0 !important;
412
+ border:solid 1px #e0e0e0 !important;
413
+ padding:2px !important;
414
+ border-radius:3px !important;
415
+ }
416
+ #slider_style_metabox .ca_style_setting_line .sp-replacer .sp-preview { /* spectrum color picker */
417
+ width:38px !important;
418
+ height:16px !important;
419
+ border:solid 1px #c0c0c0 !important;
420
+ margin-right:3px !important;
421
+ }
422
+ #slider_style_metabox .ca_style_setting_line .sp-replacer .sp-dd { /* spectrum color picker */
423
+ height:16px !important;
424
+ padding:0px !important;
425
+ margin-right:2px !important;
426
+ }
427
+ #slider_style_metabox #sa_border_width,
428
+ #slider_style_metabox #sa_border_radius {
429
+ width:35px !important;
430
+ }
431
+ #slider_style_metabox #ca_style_padding_top_bottom {
432
+ background:transparent url('../images/padding_top_bottom.png') no-repeat 5px 0px !important;
433
+ padding-left:28px !important;
434
+ }
435
+ #slider_style_metabox #ca_style_padding_left_right {
436
+ background:transparent url('../images/padding_left_right.png') no-repeat 5px 0px !important;
437
+ padding-left:28px !important;
438
+ }
439
+ #slider_style_metabox #ca_style_padding_top_bottom > span,
440
+ #slider_style_metabox #ca_style_padding_left_right > span {
441
+ width:77px;
442
+ background-position:57px 2px !important;
443
+ height:20px !important;
444
+ cursor:help;
445
+ }
446
+
447
+ /* ### METABOX 'Information' - 'SLIDE ADDED', 'SLIDE DELETED', 'SLIDE DUPLICATED' & 'SLIDE MOVED' INFO MESSAGES ### */
448
+ #sa_slide_added_mess,
449
+ #sa_slide_duplicated_mess,
450
+ #sa_slide_moved_mess {
451
+ margin:0px !important;
452
+ color:#4285F4;
453
+ font-family:'Open Sans', sans-serif;
454
+ font-weight:normal;
455
+ font-size:20px !important;
456
+ line-height:26px !important;
457
+ }
458
+ #sa_slide_deleted_mess {
459
+ margin:0px !important;
460
+ color:crimson;
461
+ font-family:'Open Sans', sans-serif;
462
+ font-weight:normal;
463
+ font-size:20px !important;
464
+ line-height:26px !important;
465
+ }
466
+
467
+ /* ### JQUERY UI - TOOLTIPS ### */
468
+ .sa_tooltip {
469
+ display:inline-block;
470
+ width:16px;
471
+ height:16px;
472
+ background:transparent url('../images/icon_info.png') no-repeat top left;
473
+ }
474
+
475
+ /* ### JQUERY UI - DIALOG BOX ### */
476
+ .ui-dialog .ui-dialog-titlebar {
477
+ padding:7px 12px !important;
478
+ line-height:22px !important;
479
+ height:22px !important;
480
+ }
481
+ .ui-dialog .ui-dialog-titlebar .ui-dialog-title {
482
+ color:#333333 !important;
483
+ font-family:Arial, Helvetica, sans-serif !important;
484
+ font-weight:bold !important;
485
+ font-size:16px !important;
486
+ line-height:22px !important;
487
+ }
488
+ .ui-dialog .ui-dialog-titlebar button:before {
489
+ font-size:16px !important;
490
+ line-height:16px !important;
491
+ height:16px !important;
492
+ width:16px !important;
493
+ }
494
+ .ui-dialog #sa_dialog_box {
495
+ padding:15px 10px 10px !important;
496
+ }
497
+
498
+ /* ### JQUERY UI - SPINNER ### */
499
+ .ui-state-default .ui-icon {
500
+ background-image:url('../images/ui-icons_777777_256x240.png') !important;
501
+ }
502
+ .ui-state-hover .ui-icon {
503
+ background-image:url('../images/ui-icons_444444_256x240.png') !important;
504
+ }
images/icon_copy.png ADDED
Binary file
images/icon_info.png ADDED
Binary file
images/icon_next.png ADDED
Binary file
images/icon_prev.png ADDED
Binary file
images/padding_bottom.png ADDED
Binary file
images/padding_left.png ADDED
Binary file
images/padding_left_right.png ADDED
Binary file
images/padding_right.png ADDED
Binary file
images/padding_top.png ADDED
Binary file
images/padding_top_bottom.png ADDED
Binary file
images/sample_logo1.png ADDED
Binary file
images/sample_logo2.png ADDED
Binary file
images/sample_logo3.png ADDED
Binary file
images/sample_logo4.png ADDED
Binary file
images/sample_logo5.png ADDED
Binary file
images/sample_logo6.png ADDED
Binary file
images/sample_logo7.png ADDED
Binary file
images/sample_logo8.png ADDED
Binary file
images/ui-icons_444444_256x240.png ADDED
Binary file
images/ui-icons_555555_256x240.png ADDED
Binary file
images/ui-icons_777620_256x240.png ADDED
Binary file
images/ui-icons_777777_256x240.png ADDED
Binary file
images/ui-icons_cc0000_256x240.png ADDED
Binary file
images/ui-icons_ffffff_256x240.png ADDED
Binary file
js/slide-anything-admin.js ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ##################################################################
2
+ // ### SLIDE ANYTHING PLUGIN - JAVASCRIPT FOR WORDPRESS DASHBOARD ###
3
+ // ##################################################################
4
+
5
+ jQuery(function() {
6
+ // ##### JQUERY-UI TOOLTIPS #####
7
+ jQuery(".sa_tooltip").tooltip();
8
+
9
+ // ##### JQUERY-UI - SLIDE DURATION SLIDER/INPUT #####
10
+ var init_value = jQuery("#sa_slide_duration").val();
11
+ jQuery("#jq_slider_duration").slider({
12
+ range:"max",
13
+ min:0,
14
+ max:30,
15
+ step:0.1,
16
+ value:init_value,
17
+ slide:function(event, ui) {
18
+ jQuery("#sa_slide_duration").val(ui.value);
19
+ }
20
+ });
21
+ jQuery("#sa_slide_duration").val(jQuery("#jq_slider_duration").slider("value"));
22
+
23
+ // ##### JQUERY-UI - SLIDE TRANSITION SLIDER/INPUT #####
24
+ var init_value = jQuery("#sa_slide_transition").val();
25
+ jQuery("#jq_slider_transition").slider({
26
+ range:"max",
27
+ min:0,
28
+ max:3,
29
+ step:0.1,
30
+ value:init_value,
31
+ slide:function(event, ui) {
32
+ jQuery("#sa_slide_transition").val(ui.value);
33
+ }
34
+ });
35
+ jQuery("#sa_slide_transition").val(jQuery("#jq_slider_transition").slider("value"));
36
+
37
+ // ##### CHANGE EVENT HANDLER FOR 'Disable Visual Editor' CHECKBOX #####
38
+ jQuery('#sa_disable_visual_editor').change(function() {
39
+ // save the custom post type
40
+ jQuery('#sa_disable_visual_editor').css('cursor', 'wait');
41
+ jQuery('body').css('cursor', 'wait');
42
+ jQuery('#publish').click();
43
+ })
44
+
45
+ // ##### JQUERY-UI ACCORDION CONTAINING CONTENT FOR ALL SLIDES #####
46
+ jQuery("#slider_accordion").accordion({
47
+ heightStyle: "content"
48
+ });
49
+
50
+ // ##### CLICK EVENT HANDLER FOR THE 'Add Slide' BUTTON #####
51
+ // increment the hidden 'number of slides' input field and save the custom post type
52
+ jQuery('#sa_add_slide').click(function() {
53
+ var num = + jQuery("#num_slides_id").val() + 1;
54
+ jQuery("#num_slides_id").val(num);
55
+ // set hidden input field to notify that a status message must be displayed
56
+ var info_added = document.getElementById('sa_info_added');
57
+ info_added.value = "1";
58
+ // save the custom post type
59
+ jQuery('#sa_add_slide').css('cursor', 'wait');
60
+ jQuery('body').css('cursor', 'wait');
61
+ jQuery('#publish').click();
62
+ });
63
+
64
+ // ##### CLICK EVENT HANDLER FOR THE SHORTCODE 'Copy to Clipboard' BUTTON #####
65
+ jQuery('#sa_shortcode_copy').click(function() {
66
+ var shortcode = document.getElementById('sa_slider_shortcode').innerHTML;
67
+ var aux = document.createElement("input"); // Create a "hidden" input
68
+ aux.setAttribute("value", shortcode); // Assign it the value of the specified element
69
+ document.body.appendChild(aux); // Append it to the body
70
+ aux.select(); // Highlight its content
71
+ document.execCommand("copy"); // Copy the highlighted text
72
+ document.body.removeChild(aux); // Remove it from the body
73
+ // DISPLAY 'Shortcode Copied' message
74
+ document.getElementById('sa_slider_shortcode').innerHTML = "Copied!";
75
+ setTimeout(function(){ document.getElementById('sa_slider_shortcode').innerHTML = shortcode; }, 1000);
76
+ });
77
+
78
+ // ##### CHANGE EVENT HANDLER FOR CSS ID INPUT BOX #####
79
+ jQuery('#sa_css_id').change(function() {
80
+ var css_id = document.getElementById('sa_css_id').value;
81
+ document.getElementById('css_note_value').innerHTML = '#' + css_id + ' .owl-item';
82
+ });
83
+
84
+ // ##### CLICK EVENT HANDLER FOR THE CSS SELECTOR 'Copy to Clipboard' BUTTON #####
85
+ jQuery('#css_note_value').click(function() {
86
+ var css_selector = document.getElementById('css_note_value').innerHTML;
87
+ var aux = document.createElement("input"); // Create a "hidden" input
88
+ aux.setAttribute("value", css_selector); // Assign it the value of the specified element
89
+ document.body.appendChild(aux); // Append it to the body
90
+ aux.select(); // Highlight its content
91
+ document.execCommand("copy"); // Copy the highlighted text
92
+ document.body.removeChild(aux); // Remove it from the body
93
+ // DISPLAY 'Shortcode Copied' message
94
+ document.getElementById('css_note_value').innerHTML = "Copied!";
95
+ setTimeout(function(){ document.getElementById('css_note_value').innerHTML = css_selector; }, 1000);
96
+ });
97
+
98
+ // ##### SPECTRUM COLOR PICKER - SLIDER BACKGROUND COLOR #####
99
+ var background_color = document.getElementById('sa_background_color').value;
100
+ jQuery("#sa_background_color").spectrum({
101
+ showPaletteOnly: true,
102
+ togglePaletteOnly: true,
103
+ togglePaletteMoreText: 'more',
104
+ togglePaletteLessText: 'less',
105
+ showInput: true,
106
+ allowEmpty:true,
107
+ preferredFormat: "rgb",
108
+ showAlpha: true,
109
+ color: background_color,
110
+ palette: [
111
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
112
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
113
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
114
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
115
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
116
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
117
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
118
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
119
+ ]
120
+ });
121
+
122
+ // ##### JQUERY-UI SPINNER - SLIDER BORDER WIDTH #####
123
+ jQuery("#sa_border_width").spinner({
124
+ step: 1,
125
+ min: 0,
126
+ max: 10,
127
+ numberFormat: "n"
128
+ });
129
+ // ##### CHANGE EVENT HANDLER - SLIDER BORDER WIDTH #####
130
+ jQuery('#sa_border_width').change(function() {
131
+ var border_width = document.getElementById('sa_border_width').value;
132
+ if (jQuery.isNumeric(border_width)) {
133
+ if ((border_width >= 0) && (border_width <= 10)) {
134
+ // valid number
135
+ } else {
136
+ document.getElementById('sa_border_width').value = '0'; // number out of range
137
+ }
138
+ } else {
139
+ document.getElementById('sa_border_width').value = '0'; // not a valid number
140
+ }
141
+ });
142
+ // ##### SPECTRUM COLOR PICKER - SLIDER BORDER COLOR #####
143
+ var border_color = document.getElementById('sa_border_color').value;
144
+ jQuery("#sa_border_color").spectrum({
145
+ showPaletteOnly: true,
146
+ togglePaletteOnly: true,
147
+ togglePaletteMoreText: 'more',
148
+ togglePaletteLessText: 'less',
149
+ showInput: true,
150
+ allowEmpty:true,
151
+ preferredFormat: "rgb",
152
+ showAlpha: true,
153
+ color: border_color,
154
+ palette: [
155
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
156
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
157
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
158
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
159
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
160
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
161
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
162
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
163
+ ]
164
+ });
165
+
166
+ // ##### JQUERY-UI SPINNER - SLIDER BORDER RADIUS #####
167
+ jQuery("#sa_border_radius").spinner({
168
+ step: 1,
169
+ min: 0,
170
+ max: 20,
171
+ numberFormat: "n"
172
+ });
173
+ // ##### CHANGE EVENT HANDLER - SLIDER BORDER RADIUS #####
174
+ jQuery('#sa_border_radius').change(function() {
175
+ var border_radius = document.getElementById('sa_border_radius').value;
176
+ if (jQuery.isNumeric(border_radius)) {
177
+ if ((border_radius >= 0) && (border_radius <= 20)) {
178
+ // valid number
179
+ } else {
180
+ document.getElementById('sa_border_radius').value = '0'; // number out of range
181
+ }
182
+ } else {
183
+ document.getElementById('sa_border_radius').value = '0'; // not a valid number
184
+ }
185
+ });
186
+
187
+ // ##### JQUERY-UI SPINNERS - WRAPPER PADDING (TOP, RIGHT, BOTTOM, LEFT) #####
188
+ jQuery("#sa_wrapper_padd_top").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
189
+ jQuery("#sa_wrapper_padd_right").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
190
+ jQuery("#sa_wrapper_padd_bottom").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
191
+ jQuery("#sa_wrapper_padd_left").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
192
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING TOP #####
193
+ jQuery('#sa_wrapper_padd_top').change(function() {
194
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_top').value;
195
+ if (jQuery.isNumeric(wrapper_padding)) {
196
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
197
+ // valid number
198
+ } else {
199
+ document.getElementById('sa_wrapper_padd_top').value = '0'; // number out of range
200
+ }
201
+ } else {
202
+ document.getElementById('sa_wrapper_padd_top').value = '0'; // not a valid number
203
+ }
204
+ });
205
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING RIGHT #####
206
+ jQuery('#sa_wrapper_padd_right').change(function() {
207
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_right').value;
208
+ if (jQuery.isNumeric(wrapper_padding)) {
209
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
210
+ // valid number
211
+ } else {
212
+ document.getElementById('sa_wrapper_padd_right').value = '0'; // number out of range
213
+ }
214
+ } else {
215
+ document.getElementById('sa_wrapper_padd_right').value = '0'; // not a valid number
216
+ }
217
+ });
218
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING BOTTOM #####
219
+ jQuery('#sa_wrapper_padd_bottom').change(function() {
220
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_bottom').value;
221
+ if (jQuery.isNumeric(wrapper_padding)) {
222
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
223
+ // valid number
224
+ } else {
225
+ document.getElementById('sa_wrapper_padd_bottom').value = '0'; // number out of range
226
+ }
227
+ } else {
228
+ document.getElementById('sa_wrapper_padd_bottom').value = '0'; // not a valid number
229
+ }
230
+ });
231
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING LEFT #####
232
+ jQuery('#sa_wrapper_padd_left').change(function() {
233
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_left').value;
234
+ if (jQuery.isNumeric(wrapper_padding)) {
235
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
236
+ // valid number
237
+ } else {
238
+ document.getElementById('sa_wrapper_padd_left').value = '0'; // number out of range
239
+ }
240
+ } else {
241
+ document.getElementById('sa_wrapper_padd_left').value = '0'; // not a valid number
242
+ }
243
+ });
244
+
245
+ // ##### JQUERY-UI SPINNER FOR SLIDE MINIMUM HEIGHT #####
246
+ jQuery("#sa_slide_min_height").spinner({
247
+ step: 1,
248
+ min: 0,
249
+ max: 999,
250
+ numberFormat: "n"
251
+ });
252
+ // ##### CHANGE EVENT HANDLER FOR SLIDE MINIMUM HEIGHT #####
253
+ jQuery('#sa_slide_min_height').change(function() {
254
+ var slide_min_height = document.getElementById('sa_slide_min_height').value;
255
+ if (jQuery.isNumeric(slide_min_height)) {
256
+ if ((slide_min_height >= 0) && (slide_min_height <= 999)) {
257
+ // valid number
258
+ } else {
259
+ document.getElementById('sa_slide_min_height').value = '0'; // number out of range
260
+ }
261
+ } else {
262
+ document.getElementById('sa_slide_min_height').value = '0'; // not a valid number
263
+ }
264
+ });
265
+
266
+ // ##### JQUERY-UI SPINNER FOR SLIDE PADDING TOP/BOTTOM #####
267
+ jQuery("#sa_slide_padding_tb").spinner({
268
+ step: 0.1,
269
+ min: 0,
270
+ max: 30,
271
+ numberFormat: "n"
272
+ });
273
+ // ##### CHANGE EVENT HANDLER FOR SLIDE PADDING TOP/BOTTOM #####
274
+ jQuery('#sa_slide_padding_tb').change(function() {
275
+ var slide_padding_tb = document.getElementById('sa_slide_padding_tb').value;
276
+ if (jQuery.isNumeric(slide_padding_tb)) {
277
+ if ((slide_padding_tb >= 0) && (slide_padding_tb <= 30)) {
278
+ // valid number
279
+ } else {
280
+ document.getElementById('sa_slide_padding_tb').value = '0'; // number out of range
281
+ }
282
+ } else {
283
+ document.getElementById('sa_slide_padding_tb').value = '0'; // not a valid number
284
+ }
285
+ });
286
+
287
+ // ##### JQUERY-UI SPINNER FOR SLIDE PADDING LEFT/RIGHT #####
288
+ jQuery("#sa_slide_padding_lr").spinner({
289
+ step: 0.1,
290
+ min: 0,
291
+ max: 30,
292
+ numberFormat: "n"
293
+ });
294
+ // ##### CHANGE EVENT HANDLER FOR SLIDE PADDING LEFT/RIGHT #####
295
+ jQuery('#sa_slide_padding_lr').change(function() {
296
+ var slide_padding_lr = document.getElementById('sa_slide_padding_lr').value;
297
+ if (jQuery.isNumeric(slide_padding_lr)) {
298
+ if ((slide_padding_lr >= 0) && (slide_padding_lr <= 30)) {
299
+ // valid number
300
+ } else {
301
+ document.getElementById('sa_slide_padding_lr').value = '0'; // number out of range
302
+ }
303
+ } else {
304
+ document.getElementById('sa_slide_padding_lr').value = '0'; // not a valid number
305
+ }
306
+ });
307
+ })
308
+
309
+
310
+
311
+ jQuery(function() {
312
+ // THE VAIRABLE THAT HOLDS THE IFRAME FOR WORDPRESS MEDIA UPLOADS
313
+ var frame;
314
+
315
+ // ##### CLICK EVENT HANDLER - 'Set Background Image' LINK (BUTTON) FOR ALL SLIDES #####
316
+ jQuery('.slide_image_add').click(function(event) {
317
+ // GET THE SLIDE NUMBER (GET parameter within anchor 'href' attribute)
318
+ var anchor_element = event.target;
319
+ var upload_url = anchor_element.getAttribute('href');
320
+ var split_arr = upload_url.split("&slide=");
321
+ var slide_no = split_arr[1];
322
+
323
+ // PREVENT THE ANCHOR LINK FROM OPENING HREF TARGET PAGE
324
+ event.preventDefault();
325
+
326
+ // SET THE HTML ELEMENTS TO BE USED WITHIN THIS FUNCTION
327
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
328
+ var image_id = "#sa_slide" + slide_no + "_image_id";
329
+ var del_img_but = "#slide" + slide_no + "_image_del";
330
+
331
+ // CREATE A NEW MEDIA UPLOAD FRAME
332
+ frame = wp.media({
333
+ title: 'Select the background image for your slide',
334
+ button: {
335
+ text: 'Use selected image'
336
+ },
337
+ multiple: false // only a single file may be selected
338
+ });
339
+
340
+ // AN IMAGE HAS BEEN SELECTED WITHIN THE MEDIA UPLOAD FRAME...
341
+ frame.on('select', function() {
342
+ // Get media attachment details from the frame state
343
+ var attachment = frame.state().get('selection').first().toJSON();
344
+ // Set the background image of the thumbnail preview DIV to the attachment URL
345
+ jQuery(thumb_preview).css('background-image', 'url(' + attachment.url + ')');
346
+ // Send the attachment id to our hidden input box
347
+ jQuery(image_id).val(attachment.id);
348
+ // Unhide the delete image button
349
+ jQuery(del_img_but).removeClass('sa_hidden');
350
+ });
351
+ // Finally, open the modal on click
352
+ frame.open();
353
+ });
354
+ })
355
+
356
+
357
+
358
+ // ##### CLICK EVENT HANDLER - 'Remove Background Image' BUTTON FOR ALL SLIDES #####
359
+ function remove_slide_bg_image(slide_no) {
360
+ // SET THE HTML ELEMENTS TO BE USED WITHIN THIS FUNCTION
361
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
362
+ var image_id = "#sa_slide" + slide_no + "_image_id";
363
+ var del_img_but = "#slide" + slide_no + "_image_del";
364
+
365
+ // Reset the background image of the thumbnail preview div
366
+ jQuery(thumb_preview).css('background-image', '');
367
+ // Delete the image id from the hidden input
368
+ jQuery(image_id).val('');
369
+ // Hide the delete image button
370
+ jQuery(del_img_but).addClass('sa_hidden');
371
+ }
372
+
373
+
374
+
375
+ // ##### CHANGE EVENT HANDLER - BACKGROUND SIZE DROPDOWN FOR ALL SLIDES #####
376
+ function change_slide_image_size(slide_no) {
377
+ var background_size = document.getElementById("sa_slide" + slide_no + "_image_size").value;
378
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
379
+ jQuery(thumb_preview).css('background-size', background_size);
380
+ }
381
+
382
+
383
+
384
+ // ##### CHANGE EVENT HANDLER - BACKGROUND SIZE DROPDOWN FOR ALL SLIDES #####
385
+ function change_slide_image_repeat(slide_no) {
386
+ var background_repeat = document.getElementById("sa_slide" + slide_no + "_image_repeat").value;
387
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
388
+ jQuery(thumb_preview).css('background-repeat', background_repeat);
389
+ }
390
+
391
+
392
+
393
+ jQuery(function() {
394
+ var num_slides = parseInt(document.getElementById('num_slides_id').value);
395
+ // ##### LOOP THRU EACH SLIDE #####
396
+ for (i = 1; i <= num_slides; i++) {
397
+ // ##### SPECTRUM COLOR PICKER - SLIDE BACKGROUND COLOR #####
398
+ var color_picker_id = 'sa_slide' + i + '_image_color';
399
+ var background_color = document.getElementById(color_picker_id).value;
400
+ jQuery('#' + color_picker_id).spectrum({
401
+ showPaletteOnly: true,
402
+ togglePaletteOnly: true,
403
+ togglePaletteMoreText: 'more',
404
+ togglePaletteLessText: 'less',
405
+ showInput: true,
406
+ allowEmpty: true,
407
+ preferredFormat: "rgb",
408
+ showAlpha: true,
409
+ color: background_color,
410
+ palette: [
411
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
412
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
413
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
414
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
415
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
416
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
417
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
418
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
419
+ ]
420
+ });
421
+ }
422
+ })
423
+ // ##### CHANGE EVENT HANDLER - SLIDE BACKGROUND COLOR PICKER #####
424
+ function change_slide_image_color(slide_no) {
425
+ var background_color = document.getElementById("sa_slide" + slide_no + "_image_color").value;
426
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
427
+ jQuery(thumb_preview).css('background-color', background_color);
428
+ }
429
+
430
+
431
+
432
+ // ##### CLICK EVENT HANDLER FOR THE 'Delete Slide' BUTTON (FOR EACH SLIDE) #####
433
+ // Set the hidden 'delete status' input field to zero and save the custom post type
434
+ function delete_sa_slide(delete_id) {
435
+ jQuery(function() {
436
+ var dialog_box = document.getElementById('sa_dialog_box');
437
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to delete this slide.";
438
+ jQuery("#sa_dialog_box").dialog({ title: 'DELETE SLIDE' });
439
+ jQuery("#sa_dialog_box").dialog({
440
+ buttons: {
441
+ OK: function() {
442
+ var del_status = document.getElementById(delete_id);
443
+ del_status.value = "0";
444
+ // set hidden input field to notify that a status message must be displayed
445
+ var info_deleted = document.getElementById('sa_info_deleted');
446
+ info_deleted.value = "1";
447
+ // save the custom post type
448
+ jQuery('body').css('cursor', 'wait');
449
+ jQuery('.ui-button').css('cursor', 'wait');
450
+ jQuery('#publish').click();
451
+ },
452
+ Cancel: function() {
453
+ jQuery(this).dialog("close");
454
+ }
455
+ }
456
+ });
457
+ jQuery("#sa_dialog_box").dialog("open");
458
+ })
459
+ }
460
+
461
+ // ##### CLICK EVENT HANDLER FOR THE 'Duplicate Slide' BUTTON (FOR EACH SLIDE) #####
462
+ // Set the hidden 'duplicate slide' input field to the slide number to be duplicated and save the custom post type
463
+ function duplicate_slide(slide_no) {
464
+ jQuery(function() {
465
+ var dialog_box = document.getElementById('sa_dialog_box');
466
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to make a duplicate (copy) of this slide.";
467
+ jQuery("#sa_dialog_box").dialog({ title: 'DUPLICATE SLIDE' });
468
+ jQuery("#sa_dialog_box").dialog({
469
+ buttons: {
470
+ OK: function() {
471
+ // set hidden 'duplicate slide' input field to the slide number to be duplicated
472
+ var duplicate_slide = document.getElementById('sa_duplicate_slide');
473
+ duplicate_slide.value = slide_no;
474
+ // set hidden input field to notify that a status message must be displayed
475
+ var info_duplicated = document.getElementById('sa_info_duplicated');
476
+ info_duplicated.value = "1";
477
+ // save the custom post type
478
+ jQuery('body').css('cursor', 'wait');
479
+ jQuery('.ui-button').css('cursor', 'wait');
480
+ jQuery('#publish').click();
481
+ },
482
+ Cancel: function() {
483
+ jQuery(this).dialog("close");
484
+ }
485
+ }
486
+ });
487
+ jQuery("#sa_dialog_box").dialog("open");
488
+ })
489
+ }
490
+
491
+ // ##### CLICK EVENT HANDLER FOR THE 'Move Slide Up' BUTTON (FOR EACH SLIDE) #####
492
+ // Set the hidden 'move slide up' input field to the slide number to be moved up and save the custom post type
493
+ function move_slide_up(slide_no) {
494
+ jQuery(function() {
495
+ var dialog_box = document.getElementById('sa_dialog_box');
496
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to move this slide up within the slide order.";
497
+ jQuery("#sa_dialog_box").dialog({ title: 'MOVE SLIDE UP' });
498
+ jQuery("#sa_dialog_box").dialog({
499
+ buttons: {
500
+ OK: function() {
501
+ // set hidden 'move slide up' input field to the slide number to be moved
502
+ var move_slide_up = document.getElementById('sa_move_slide_up');
503
+ move_slide_up.value = slide_no;
504
+ // set hidden input field to notify that a status message must be displayed
505
+ var info_moved = document.getElementById('sa_info_moved');
506
+ info_moved.value = "1";
507
+ // save the custom post type
508
+ jQuery('body').css('cursor', 'wait');
509
+ jQuery('.ui-button').css('cursor', 'wait');
510
+ jQuery('#publish').click();
511
+ },
512
+ Cancel: function() {
513
+ jQuery(this).dialog("close");
514
+ }
515
+ }
516
+ });
517
+ jQuery("#sa_dialog_box").dialog("open");
518
+ })
519
+ }
owl-carousel/owl-theme.css ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ##############################################################
3
+ ### OWL CAROUSEL THEME (CSS) FOR THE SLIDE ANYTHING PLUGIN ###
4
+ ##############################################################
5
+ */
6
+
7
+ /* ### PAGINATION BUTTONS ### */
8
+ .owl-theme .owl-controls .owl-pagination {
9
+ position:absolute;
10
+ width:100%;
11
+ padding:10px 0px 0px !important;
12
+ bottom:-22px !important;
13
+ text-align:center !important;
14
+ font-size:12px !important;
15
+ line-height:12px !important;
16
+ }
17
+ .owl-theme .owl-controls .owl-pagination .owl-page {
18
+ display: inline-block !important;
19
+ }
20
+ .owl-theme .owl-controls .owl-pagination .owl-page span {
21
+ display:inline-block !important;
22
+ border-style:none !important;
23
+ background-color:rgba(0,0,0,0.2) !important;
24
+ width:10px !important;
25
+ height:10px !important;
26
+ border-radius:50% !important;
27
+ margin:0px 3px !important;
28
+ transition:all .3s ease-in-out !important;
29
+ -webkit-transition:all .3s ease-in-out !important;
30
+ -moz-transition:all .3s ease-in-out !important;
31
+ -o-transition:all .3s ease-in-out !important;
32
+ }
33
+ .owl-theme .owl-controls .owl-pagination .active span {
34
+ background-color:rgba(0,0,0,0.5) !important;
35
+ }
36
+ .owl-theme .owl-controls .owl-pagination .owl-page span:hover {
37
+ background-color:rgba(0,0,0,0.5) !important;
38
+ }
39
+ .owl-pagination-true {
40
+ margin-bottom:22px !important;
41
+ }
42
+
43
+ /* ### PREVIOUS AND NEXT ARROW BUTTONS ### */
44
+ .owl-theme .owl-controls .owl-buttons {
45
+ display:none !important;
46
+ }
47
+ .owl-theme:hover .owl-controls .owl-buttons {
48
+ display:block !important;
49
+ }
50
+ .owl-theme .owl-controls .owl-buttons div {
51
+ position:absolute;
52
+ top:50%;
53
+ padding:2px 0px !important;
54
+ display:inline-block !important;
55
+ margin-top:-15px !important;
56
+ line-height:30px !important;
57
+ height:30px !important;
58
+ width:18px !important;
59
+ transition:all .3s ease-in-out !important;
60
+ -webkit-transition:all .3s ease-in-out !important;
61
+ -moz-transition:all .3s ease-in-out !important;
62
+ -o-transition:all .3s ease-in-out !important;
63
+ }
64
+ .owl-theme .owl-controls .owl-buttons .owl-prev {
65
+ left:5px;
66
+ background:transparent url('../images/icon_prev.png') no-repeat 1px 3px !important;
67
+ padding:2px 7px 2px 5px !important;
68
+ }
69
+ .owl-theme .owl-controls .owl-buttons .owl-next {
70
+ right:5px;
71
+ background:transparent url('../images/icon_next.png') no-repeat 1px 3px !important;
72
+ padding:2px 5px 2px 7px !important;
73
+ }
owl-carousel/owl.carousel.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Core Owl Carousel CSS File
3
+ * v1.3.3
4
+ */
5
+
6
+ /* clearfix */
7
+ .owl-carousel .owl-wrapper:after {
8
+ content: ".";
9
+ display: block;
10
+ clear: both;
11
+ visibility: hidden;
12
+ line-height: 0;
13
+ height: 0;
14
+ }
15
+ /* display none until init */
16
+ .owl-carousel{
17
+ display: none;
18
+ position: relative;
19
+ width: 100%;
20
+ -ms-touch-action: pan-y;
21
+ }
22
+ .owl-carousel .owl-wrapper{
23
+ display: none;
24
+ position: relative;
25
+ -webkit-transform: translate3d(0px, 0px, 0px);
26
+ }
27
+ .owl-carousel .owl-wrapper-outer{
28
+ overflow: hidden;
29
+ position: relative;
30
+ width: 100%;
31
+ }
32
+ .owl-carousel .owl-wrapper-outer.autoHeight{
33
+ -webkit-transition: height 500ms ease-in-out;
34
+ -moz-transition: height 500ms ease-in-out;
35
+ -ms-transition: height 500ms ease-in-out;
36
+ -o-transition: height 500ms ease-in-out;
37
+ transition: height 500ms ease-in-out;
38
+ }
39
+
40
+ .owl-carousel .owl-item{
41
+ float: left;
42
+ }
43
+ .owl-controls .owl-page,
44
+ .owl-controls .owl-buttons div{
45
+ cursor: pointer;
46
+ }
47
+ .owl-controls {
48
+ -webkit-user-select: none;
49
+ -khtml-user-select: none;
50
+ -moz-user-select: none;
51
+ -ms-user-select: none;
52
+ user-select: none;
53
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
54
+ }
55
+
56
+ /* mouse grab icon */
57
+ .grabbing {
58
+ cursor:url(grabbing.png) 8 8, move;
59
+ }
60
+
61
+ /* fix */
62
+ .owl-carousel .owl-wrapper,
63
+ .owl-carousel .owl-item{
64
+ -webkit-backface-visibility: hidden;
65
+ -moz-backface-visibility: hidden;
66
+ -ms-backface-visibility: hidden;
67
+ -webkit-transform: translate3d(0,0,0);
68
+ -moz-transform: translate3d(0,0,0);
69
+ -ms-transform: translate3d(0,0,0);
70
+ }
71
+
owl-carousel/owl.carousel.min.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g});
2
+ (function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath?
3
+ (e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length;
4
+ this.wrapItems();this.$owlItems=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&&
5
+ (this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this,
6
+ [this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}),
7
+ g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');this.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")},
8
+ baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall=
9
+ !1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]),
10
+ a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&&
11
+ !0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a=
12
+ this,b=0,e=a.itemsAmount-a.options.items;a.$owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/
13
+ this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$owlItems[e]),
14
+ c=c.data("owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.owlControls=f('<div class="owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="owl-buttons"/>');a.owlControls.append(b);a.buttonPrev=
15
+ f("<div/>",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper=
16
+ f('<div class="owl-pagination"/>');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&&
17
+ (a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")===
18
+ f(a.$owlItems[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem===
19
+ this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1;
20
+ this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage?
21
+ this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0),
22
+ !0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},
23
+ c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem=
24
+ this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)},
25
+ checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))},
26
+ addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+
27
+ a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)";
28
+ a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]:
29
+ !1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})},
30
+ gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos;
31
+ "function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY||-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)}
32
+ function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}),
33
+ a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1;
34
+ !1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem=
35
+ a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage?f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)):
36
+ (c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev",function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)});
37
+ a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$owlItems[a]),"loaded"!==b.data("owl-loaded")&&(e=b.data("owl-item"),c=b.find(".lazyOwl"),"string"!==typeof c.data("src")?
38
+ b.data("owl-loaded","loaded"):(void 0===b.data("owl-loaded")&&(c.hide(),b.addClass("loading").data("owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a,b){function e(){a.data("owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this,
39
+ [d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlItems[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b,
40
+ 100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$owlItems[a]).addClass("active");
41
+ this.owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="owl-"+a+"-out";this.inClass="owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$owlItems.eq(a.currentItem),d=a.$owlItems.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+
42
+ "px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a,
43
+ b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$owlWrapper.removeClass("owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},owlStatus:function(){this.owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,owlItems:this.$owlItems,currentItem:this.currentItem,prevItem:this.prevItem,visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect");
44
+ f(k).off(".owl owl");f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.owlControls&&this.owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("owl-originalStyles")||"").attr("class",this.$elem.data("owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions,
45
+ a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0===
46
+ f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,
47
+ responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document);
owl-carousel/owl.transitions.css ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Owl Carousel CSS3 Transitions
3
+ * v1.3.2
4
+ */
5
+
6
+ .owl-origin {
7
+ -webkit-perspective: 1200px;
8
+ -webkit-perspective-origin-x : 50%;
9
+ -webkit-perspective-origin-y : 50%;
10
+ -moz-perspective : 1200px;
11
+ -moz-perspective-origin-x : 50%;
12
+ -moz-perspective-origin-y : 50%;
13
+ perspective : 1200px;
14
+ }
15
+ /* fade */
16
+ .owl-fade-out {
17
+ z-index: 10;
18
+ -webkit-animation: fadeOut .7s both ease;
19
+ -moz-animation: fadeOut .7s both ease;
20
+ animation: fadeOut .7s both ease;
21
+ }
22
+ .owl-fade-in {
23
+ -webkit-animation: fadeIn .7s both ease;
24
+ -moz-animation: fadeIn .7s both ease;
25
+ animation: fadeIn .7s both ease;
26
+ }
27
+ /* backSlide */
28
+ .owl-backSlide-out {
29
+ -webkit-animation: backSlideOut 1s both ease;
30
+ -moz-animation: backSlideOut 1s both ease;
31
+ animation: backSlideOut 1s both ease;
32
+ }
33
+ .owl-backSlide-in {
34
+ -webkit-animation: backSlideIn 1s both ease;
35
+ -moz-animation: backSlideIn 1s both ease;
36
+ animation: backSlideIn 1s both ease;
37
+ }
38
+ /* goDown */
39
+ .owl-goDown-out {
40
+ -webkit-animation: scaleToFade .7s ease both;
41
+ -moz-animation: scaleToFade .7s ease both;
42
+ animation: scaleToFade .7s ease both;
43
+ }
44
+ .owl-goDown-in {
45
+ -webkit-animation: goDown .6s ease both;
46
+ -moz-animation: goDown .6s ease both;
47
+ animation: goDown .6s ease both;
48
+ }
49
+ /* scaleUp */
50
+ .owl-fadeUp-in {
51
+ -webkit-animation: scaleUpFrom .5s ease both;
52
+ -moz-animation: scaleUpFrom .5s ease both;
53
+ animation: scaleUpFrom .5s ease both;
54
+ }
55
+
56
+ .owl-fadeUp-out {
57
+ -webkit-animation: scaleUpTo .5s ease both;
58
+ -moz-animation: scaleUpTo .5s ease both;
59
+ animation: scaleUpTo .5s ease both;
60
+ }
61
+ /* Keyframes */
62
+ /*empty*/
63
+ @-webkit-keyframes empty {
64
+ 0% {opacity: 1}
65
+ }
66
+ @-moz-keyframes empty {
67
+ 0% {opacity: 1}
68
+ }
69
+ @keyframes empty {
70
+ 0% {opacity: 1}
71
+ }
72
+ @-webkit-keyframes fadeIn {
73
+ 0% { opacity:0; }
74
+ 100% { opacity:1; }
75
+ }
76
+ @-moz-keyframes fadeIn {
77
+ 0% { opacity:0; }
78
+ 100% { opacity:1; }
79
+ }
80
+ @keyframes fadeIn {
81
+ 0% { opacity:0; }
82
+ 100% { opacity:1; }
83
+ }
84
+ @-webkit-keyframes fadeOut {
85
+ 0% { opacity:1; }
86
+ 100% { opacity:0; }
87
+ }
88
+ @-moz-keyframes fadeOut {
89
+ 0% { opacity:1; }
90
+ 100% { opacity:0; }
91
+ }
92
+ @keyframes fadeOut {
93
+ 0% { opacity:1; }
94
+ 100% { opacity:0; }
95
+ }
96
+ @-webkit-keyframes backSlideOut {
97
+ 25% { opacity: .5; -webkit-transform: translateZ(-500px); }
98
+ 75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
99
+ 100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
100
+ }
101
+ @-moz-keyframes backSlideOut {
102
+ 25% { opacity: .5; -moz-transform: translateZ(-500px); }
103
+ 75% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
104
+ 100% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
105
+ }
106
+ @keyframes backSlideOut {
107
+ 25% { opacity: .5; transform: translateZ(-500px); }
108
+ 75% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
109
+ 100% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
110
+ }
111
+ @-webkit-keyframes backSlideIn {
112
+ 0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); }
113
+ 75% { opacity: .5; -webkit-transform: translateZ(-500px); }
114
+ 100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); }
115
+ }
116
+ @-moz-keyframes backSlideIn {
117
+ 0%, 25% { opacity: .5; -moz-transform: translateZ(-500px) translateX(200%); }
118
+ 75% { opacity: .5; -moz-transform: translateZ(-500px); }
119
+ 100% { opacity: 1; -moz-transform: translateZ(0) translateX(0); }
120
+ }
121
+ @keyframes backSlideIn {
122
+ 0%, 25% { opacity: .5; transform: translateZ(-500px) translateX(200%); }
123
+ 75% { opacity: .5; transform: translateZ(-500px); }
124
+ 100% { opacity: 1; transform: translateZ(0) translateX(0); }
125
+ }
126
+ @-webkit-keyframes scaleToFade {
127
+ to { opacity: 0; -webkit-transform: scale(.8); }
128
+ }
129
+ @-moz-keyframes scaleToFade {
130
+ to { opacity: 0; -moz-transform: scale(.8); }
131
+ }
132
+ @keyframes scaleToFade {
133
+ to { opacity: 0; transform: scale(.8); }
134
+ }
135
+ @-webkit-keyframes goDown {
136
+ from { -webkit-transform: translateY(-100%); }
137
+ }
138
+ @-moz-keyframes goDown {
139
+ from { -moz-transform: translateY(-100%); }
140
+ }
141
+ @keyframes goDown {
142
+ from { transform: translateY(-100%); }
143
+ }
144
+
145
+ @-webkit-keyframes scaleUpFrom {
146
+ from { opacity: 0; -webkit-transform: scale(1.5); }
147
+ }
148
+ @-moz-keyframes scaleUpFrom {
149
+ from { opacity: 0; -moz-transform: scale(1.5); }
150
+ }
151
+ @keyframes scaleUpFrom {
152
+ from { opacity: 0; transform: scale(1.5); }
153
+ }
154
+
155
+ @-webkit-keyframes scaleUpTo {
156
+ to { opacity: 0; -webkit-transform: scale(1.5); }
157
+ }
158
+ @-moz-keyframes scaleUpTo {
159
+ to { opacity: 0; -moz-transform: scale(1.5); }
160
+ }
161
+ @keyframes scaleUpTo {
162
+ to { opacity: 0; transform: scale(1.5); }
163
+ }
php/slide-anything-admin.php ADDED
@@ -0,0 +1,927 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // #####################################################################
3
+ // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS DASHBOARD ###
4
+ // #####################################################################
5
+
6
+ // ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
7
+ function cpt_slider_plugin_activation() {
8
+ // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE
9
+ $sample_post_title = 'Sample Slider';
10
+
11
+ // check if the 'sample slider' already exists (plugin has been activated before)
12
+ $cpt_post = get_page_by_title($sample_post_title, 'OBJECT', 'sa_slider');
13
+
14
+ if (is_null($cpt_post)) {
15
+ // create the post object
16
+ $sample_post = array(
17
+ 'post_title' => $sample_post_title,
18
+ 'post_content' => '',
19
+ 'post_status' => 'publish',
20
+ 'post_type' => 'sa_slider'
21
+ );
22
+ // insert the post into the database
23
+ $cpt_id = wp_insert_post($sample_post);
24
+
25
+ // insert meta data for the 'sample slider' slides
26
+ for ($i = 1; $i <= 8; $i++) {
27
+ if ($i == 1) {
28
+ $color = "#f4cccc"; $image = "sample_logo1.png";
29
+ } elseif ($i == 2) {
30
+ $color = "#d9ead3"; $image = "sample_logo2.png";
31
+ } elseif ($i == 3) {
32
+ $color = "#fce5cd"; $image = "sample_logo3.png";
33
+ } elseif ($i == 4) {
34
+ $color = "#d0e0e3"; $image = "sample_logo4.png";
35
+ } elseif ($i == 5) {
36
+ $color = "#fff2cc"; $image = "sample_logo5.png";
37
+ } elseif ($i == 6) {
38
+ $color = "#cfe2f3"; $image = "sample_logo6.png";
39
+ } elseif ($i == 7) {
40
+ $color = "#d9d2e9"; $image = "sample_logo7.png";
41
+ } elseif ($i == 8) {
42
+ $color = "#ead1dc"; $image = "sample_logo8.png";
43
+ }
44
+ $content = "<div style='text-align: center; padding-bottom: 10px;'>\n";
45
+ $content .= "<div><img src='".plugins_url()."/slide-anything/images/".$image."' alt='Logo ".$i."' /></div>\n";
46
+ $content .= "<h3>Company Name</h3>\n";
47
+ $content .= "<p>Lorem ipsum dolor sit amet, cu usu cibo vituperata, id ius probo maiestatis inciderint, sit eu vide volutpat.</p>\n";
48
+ $content .= "</div>\n";
49
+ update_post_meta($cpt_id, "sa_slide".$i."_content", $content);
50
+ update_post_meta($cpt_id, "sa_slide".$i."_image_id", "");
51
+ update_post_meta($cpt_id, "sa_slide".$i."_image_size", "contain");
52
+ update_post_meta($cpt_id, "sa_slide".$i."_image_repeat", "no-repeat");
53
+ update_post_meta($cpt_id, "sa_slide".$i."_image_color", $color);
54
+
55
+ }
56
+ // insert meta data for the 'sample slider' configuration
57
+ update_post_meta($cpt_id, 'sa_disable_visual_editor', '');
58
+ update_post_meta($cpt_id, 'sa_num_slides', 8);
59
+ update_post_meta($cpt_id, 'sa_slide_duration', 4);
60
+ update_post_meta($cpt_id, 'sa_slide_transition', 0.3);
61
+ update_post_meta($cpt_id, 'sa_loop_slider', '1');
62
+ update_post_meta($cpt_id, 'sa_stop_hover', '1');
63
+ update_post_meta($cpt_id, 'sa_nav_arrows', '1');
64
+ update_post_meta($cpt_id, 'sa_pagination', '1');
65
+ update_post_meta($cpt_id, 'sa_items_width1', 1);
66
+ update_post_meta($cpt_id, 'sa_items_width2', 2);
67
+ update_post_meta($cpt_id, 'sa_items_width3', 3);
68
+ update_post_meta($cpt_id, 'sa_items_width4', 4);
69
+ update_post_meta($cpt_id, 'sa_items_width5', 4);
70
+ update_post_meta($cpt_id, 'sa_css_id', 'sample_slider');
71
+ update_post_meta($cpt_id, 'sa_background_color', '#fafafa');
72
+ update_post_meta($cpt_id, 'sa_border_width', 1);
73
+ update_post_meta($cpt_id, 'sa_border_color', '#f0f0f0');
74
+ update_post_meta($cpt_id, 'sa_border_radius', 5);
75
+ update_post_meta($cpt_id, 'sa_wrapper_padd_top', 8);
76
+ update_post_meta($cpt_id, 'sa_wrapper_padd_right', 8);
77
+ update_post_meta($cpt_id, 'sa_wrapper_padd_bottom', 8);
78
+ update_post_meta($cpt_id, 'sa_wrapper_padd_left', 8);
79
+ update_post_meta($cpt_id, 'sa_slide_min_height', 100);
80
+ update_post_meta($cpt_id, 'sa_slide_padding_tb', 5);
81
+ update_post_meta($cpt_id, 'sa_slide_padding_lr', 5);
82
+ }
83
+ }
84
+
85
+ /* ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WORDPRESS DASHBOARD ONLY ##### */
86
+ function cpt_register_admin_scripts() {
87
+ $screen = get_current_screen();
88
+ if ($screen->post_type == 'sa_slider') {
89
+ // ONLY LOAD SCRIPTS (JS & CSS) WITHIN 'Slider Anywhere' SCREENS IN WORDPRESS DASHBOARD
90
+ // load 'wordpress jquery-ui' scripts
91
+ wp_enqueue_script( 'jquery-ui-core' );
92
+ wp_enqueue_script( 'jquery-ui-accordion' );
93
+ wp_enqueue_script( 'jquery-ui-slider' );
94
+ wp_enqueue_script( 'jquery-ui-sortable' );
95
+ wp_enqueue_script( 'jquery-ui-draggable' );
96
+ wp_enqueue_script( 'jquery-ui-droppable' );
97
+ wp_enqueue_script( 'jquery-ui-resize' );
98
+ wp_enqueue_script( 'jquery-ui-dialog' );
99
+ wp_enqueue_script( 'jquery-ui-button' );
100
+ wp_enqueue_script( 'jquery-ui-tooltip' );
101
+ wp_enqueue_script( 'jquery-ui-spinner' );
102
+ // load 'spectrum colorpicker' script and css
103
+ wp_register_script('spectrum_js', PLUGIN_PATH.'spectrum/spectrum.js', array('jquery'));
104
+ wp_enqueue_script('spectrum_js');
105
+ wp_register_style('spectrum_css', PLUGIN_PATH.'spectrum/spectrum.css');
106
+ wp_enqueue_style('spectrum_css');
107
+ // load 'jquery-ui' css
108
+ wp_register_style('admin_ui_css', PLUGIN_PATH.'css/admin-user-interface.min.css');
109
+ wp_enqueue_style('admin_ui_css');
110
+ // load 'slide-anywhere' custom javasript and css for wordpress admin
111
+ wp_register_script('sa-slider-admin-script', PLUGIN_PATH.'js/slide-anything-admin.js', array( 'jquery' ));
112
+ wp_enqueue_script('sa-slider-admin-script');
113
+ wp_register_style('sa-slider-admin-css', PLUGIN_PATH.'css/slide-anything-admin.css');
114
+ wp_enqueue_style('sa-slider-admin-css');
115
+ }
116
+ }
117
+
118
+ // ##### ACTION HOOK - REGISTER THE 'Slider Anywhere' CUSTOM POST TYPE #####
119
+ function cpt_slider_register() {
120
+ $labels = array(
121
+ 'name' => _x('Sliders', 'post type general name', 'sa_slider_textdomain'),
122
+ 'singular_name' => _x('Slider', 'post type singular name', 'sa_slider_textdomain'),
123
+ 'menu_name' => __('Sliders', 'sa_slider_textdomain'),
124
+ 'add_new' => __('Add New Slider', 'sa_slider_textdomain'),
125
+ 'add_new_item' => __('Add New Slider', 'sa_slider_textdomain'),
126
+ 'edit_item' => __('Edit Slider', 'sa_slider_textdomain'),
127
+ 'new_item' => __('New Slider', 'sa_slider_textdomain'),
128
+ 'view_item' => __('View Slider', 'sa_slider_textdomain'),
129
+ 'not_found' => __('No sliders found', 'sa_slider_textdomain'),
130
+ 'not_found_in_trash' => __('No sliders found in Trash', 'sa_slider_textdomain'),
131
+ );
132
+ $args = array(
133
+ 'labels' => $labels,
134
+ 'description' => __('Slide Anything carousel/slider', 'sa_slider_textdomain'),
135
+ 'public' => false,
136
+ 'exclude_from_search' => true,
137
+ 'publicly_queryable' => false,
138
+ 'show_ui' => true,
139
+ 'show_in_nav_menus' => false,
140
+ 'show_in_menu' => true,
141
+ 'menu_position' => 10,
142
+ 'menu_icon' => 'dashicons-images-alt2',
143
+ 'hierarchical' => false,
144
+ 'supports' => array('title'),
145
+ 'has_archive' => false,
146
+ 'query_var' => false,
147
+ 'can_export' => true,
148
+ 'rewrite' => true,
149
+ 'capability_type' => 'post'
150
+ );
151
+ register_post_type('sa_slider', $args);
152
+ }
153
+
154
+
155
+
156
+ // ##### ACTION HOOK - ADD/REMOVE (HOVER-OVER) ROW ACTIONS WHEN THIS CUSTOM POST TYPE IS LISTED IN DASHBOARD #####
157
+ function cpt_slider_row_actions($actions, $post) {
158
+ if ($post->post_type == 'sa_slider') {
159
+ // REMOVE 'Quick Edit' ROW ACTION
160
+ unset($actions['inline hide-if-no-js']);
161
+ }
162
+ return $actions;
163
+ }
164
+
165
+
166
+
167
+ // ##### FILTER TO ADD/REMOVE COLUMNS DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD #####
168
+ function cpt_slider_modify_columns($columns) {
169
+ // new columns to be added
170
+ $new_columns = array(
171
+ 'slides' => 'Slides',
172
+ 'shortcode' => 'Shortcode',
173
+ 'css-id' => 'CSS ID'
174
+ );
175
+ $columns = array_slice($columns, 0, 2, true) + $new_columns + array_slice($columns, 2, NULL, true);
176
+ return $columns;
177
+ }
178
+
179
+
180
+
181
+ // ##### DEFINE OUTPUT FOR EACH CUSTOM COLUMN DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD #####
182
+ function cpt_slider_custom_column_content($column) {
183
+ // get post object for this row
184
+ global $post;
185
+
186
+ // output for the 'Slides' column
187
+ if ($column == 'slides') {
188
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
189
+ if ($num_slides == '') {
190
+ $num_slides = '-';
191
+ }
192
+ echo esc_html($num_slides);
193
+ }
194
+
195
+ // output for the 'Shortcode' column
196
+ if ($column == 'shortcode') {
197
+ $shortcode = "[slide-anything id='".$post->ID."']";
198
+ echo esc_html($shortcode);
199
+ }
200
+
201
+ // output for the 'CSS ID' column
202
+ if ($column == 'css-id') {
203
+ $css_id = get_post_meta($post->ID, 'sa_css_id', true);
204
+ if ($css_id == '') {
205
+ $css_id = '-';
206
+ } else {
207
+ $css_id = "#".$css_id;
208
+ }
209
+ echo esc_html($css_id);
210
+ }
211
+ }
212
+
213
+
214
+
215
+ // ##### ACTION HOOK - ADD META BOXES TO THE 'Slider Anywhere' CUSTOM POST TYPE #####
216
+ function cpt_slider_add_meta_boxes() {
217
+ global $post;
218
+
219
+ $info_added = get_post_meta($post->ID, 'sa_info_added', true);
220
+ $info_deleted = get_post_meta($post->ID, 'sa_info_deleted', true);
221
+ $info_duplicated = get_post_meta($post->ID, 'sa_info_duplicated', true);
222
+ $info_moved = get_post_meta($post->ID, 'sa_info_moved', true);
223
+ if ($info_added == '1') {
224
+ add_meta_box('cpt_slide_added', __('Information'), 'cpt_slide_added_content', 'sa_slider', 'normal', 'high');
225
+ update_post_meta($post->ID, 'sa_info_added', '0');
226
+ }
227
+ if ($info_deleted == '1') {
228
+ add_meta_box('cpt_slide_deleted', __('Information'), 'cpt_slide_deleted_content', 'sa_slider', 'normal', 'high');
229
+ update_post_meta($post->ID, 'sa_info_deleted', '0');
230
+ }
231
+ if ($info_duplicated == '1') {
232
+ add_meta_box('cpt_slide_duplicated', __('Information'), 'cpt_slide_duplicated_content', 'sa_slider', 'normal', 'high');
233
+ update_post_meta($post->ID, 'sa_info_duplicated', '0');
234
+ }
235
+ if ($info_moved == '1') {
236
+ add_meta_box('cpt_slide_moved', __('Information'), 'cpt_slide_moved_content', 'sa_slider', 'normal', 'high');
237
+ update_post_meta($post->ID, 'sa_info_moved', '0');
238
+ }
239
+ add_meta_box('cpt_slider_settings', __('Slider Settings'), 'cpt_slider_settings_content', 'sa_slider', 'normal', 'high');
240
+ add_meta_box('cpt_slider_slides', __('Slides'), 'cpt_slider_slides_content', 'sa_slider', 'normal', 'high');
241
+ add_meta_box('cpt_slider_shortcode', __('Slider Shortcode'), 'cpt_slider_shortcode_content', 'sa_slider', 'side', 'high');
242
+ add_meta_box('cpt_slider_items', __('Items Displayed'), 'cpt_slider_items_content', 'sa_slider', 'side', 'default');
243
+ add_meta_box('cpt_slider_style', __('Slider Style'), 'cpt_slider_style_content', 'sa_slider', 'side', 'default');
244
+ }
245
+
246
+
247
+
248
+ // ##### META BOX CONTENT - 'Information' (slide added) BOX #####
249
+ function cpt_slide_added_content() {
250
+ echo "<h3 id='sa_slide_added_mess'>A new slide has been added to this slider.</h3>";
251
+ }
252
+
253
+
254
+
255
+ // ##### META BOX CONTENT - 'Information' (slide deleted) BOX #####
256
+ function cpt_slide_deleted_content() {
257
+ echo "<h3 id='sa_slide_deleted_mess'>A slide has been deleted from this slider.</h3>";
258
+ }
259
+
260
+
261
+
262
+ // ##### META BOX CONTENT - 'Information' (slide duplicated) BOX #####
263
+ function cpt_slide_duplicated_content() {
264
+ echo "<h3 id='sa_slide_duplicated_mess'>A slide has been duplicated (copied) within this slider.</h3>";
265
+ }
266
+
267
+
268
+
269
+ // ##### META BOX CONTENT - 'Information' (slide moved) BOX #####
270
+ function cpt_slide_moved_content() {
271
+ echo "<h3 id='sa_slide_moved_mess'>The slide order of this slider has been has changed.</h3>";
272
+ }
273
+
274
+
275
+
276
+ // ##### META BOX CONTENT - 'Slider Settings' BOX #####
277
+ function cpt_slider_settings_content($post) {
278
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
279
+
280
+ echo "<div id='sa_slider_settings'>\n";
281
+ // NONCE TO PREVENT CSRF SECURITY ATTACKS
282
+ wp_nonce_field(basename(__FILE__), 'nonce_save_slider');
283
+
284
+ // HIDDEN FIELD - NUMBER OF SLIDES
285
+ if ($num_slides == '') {
286
+ // new slider is being created
287
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='3'/>\n";
288
+ } else {
289
+ // existing slider
290
+ $num_slides = intval($num_slides);
291
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='".esc_attr($num_slides)."'/>\n";
292
+ }
293
+ // HIDDEN FIELD - SLIDE ADDED INDICATOR
294
+ echo "<input type='hidden' id='sa_info_added' name='sa_info_added' value='0'/>\n";
295
+ // HIDDEN FIELD - SLIDE DELETED INDICATOR
296
+ echo "<input type='hidden' id='sa_info_deleted' name='sa_info_deleted' value='0'/>\n";
297
+ // HIDDEN FIELD - SLIDE DUPLICATED INDICATOR
298
+ echo "<input type='hidden' id='sa_info_duplicated' name='sa_info_duplicated' value='0'/>\n";
299
+ // HIDDEN FIELD - SLIDE MOVED UP INDICATOR
300
+ echo "<input type='hidden' id='sa_info_moved' name='sa_info_moved' value='0'/>\n";
301
+ // HIDDEN FIELD - DUPLICATE SLIDE NUMBER
302
+ echo "<input type='hidden' id='sa_duplicate_slide' name='sa_duplicate_slide' value='0'/>\n";
303
+ // HIDDEN FIELD - MOVE SLIDE UP (SLIDE NUMBER)
304
+ echo "<input type='hidden' id='sa_move_slide_up' name='sa_move_slide_up' value='0'/>\n";
305
+ // SLIDE DURATION
306
+ $slide_duration = get_post_meta($post->ID, 'sa_slide_duration', true);
307
+ if ($slide_duration == '') {
308
+ $slide_duration = 5;
309
+ }
310
+ echo "<div class='sa_slider_value'><span>Slide Duration:</span>";
311
+ echo "<input type='text' id='sa_slide_duration' name='sa_slide_duration' readonly value='".esc_attr($slide_duration)."'><em>seconds</em>";
312
+ echo "<em class='sa_tooltip' href='' title='Set to 0 to disable slider autoplay (manual slider navigation only)'></em></div>\n";
313
+ echo "<div class='jquery_ui_slider' id='jq_slider_duration'></div><hr/>\n";
314
+ // SLIDE TRANSITION
315
+ $slide_transition = get_post_meta($post->ID, 'sa_slide_transition', true);
316
+ if ($slide_transition == '') {
317
+ $slide_transition = 0.2;
318
+ }
319
+ echo "<div class='sa_slider_value'><span>Slide Transition:</span>";
320
+ echo "<input type='text' id='sa_slide_transition' name='sa_slide_transition' readonly value='".esc_attr($slide_transition)."'><em>seconds</em>\n";
321
+ echo "<em class='sa_tooltip' href='' title='The time it takes to change from one slide to the next slide'></em></div>\n";
322
+ echo "<div class='jquery_ui_slider' id='jq_slider_transition'></div><hr/>\n";
323
+ echo "<div class='half_width_column'>\n";
324
+ // LOOP SLIDER
325
+ $loop_slider = get_post_meta($post->ID, 'sa_loop_slider', true);
326
+ if ($loop_slider == '') {
327
+ $loop_slider = '1';
328
+ }
329
+ echo "<div class='sa_setting_checkbox'><span>Loop Slider:</span>";
330
+ if ($loop_slider == '1') {
331
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1' checked/>";
332
+ } else {
333
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1'/>";
334
+ }
335
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (loops back to first slide after last slide is displayed)'></em>";
336
+ echo "</div>\n";
337
+ // STOP ON HOVER
338
+ $stop_hover = get_post_meta($post->ID, 'sa_stop_hover', true);
339
+ if ($stop_hover == '') {
340
+ $stop_hover = '1';
341
+ }
342
+ echo "<div class='sa_setting_checkbox'><span>Stop on Hover:</span>";
343
+ if ($stop_hover == '1') {
344
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1' checked/>";
345
+ } else {
346
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1'/>";
347
+ }
348
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (slideshow is paused when hovering over a slide)'></em>";
349
+ echo "</div>\n";
350
+ echo "</div>\n";
351
+ echo "<div class='half_width_column'>\n";
352
+ // NAVIGATE ARROWS
353
+ $nav_arrows = get_post_meta($post->ID, 'sa_nav_arrows', true);
354
+ if ($nav_arrows == '') {
355
+ $nav_arrows = '1';
356
+ }
357
+ echo "<div class='sa_setting_checkbox'><span>Navigate Arrows:</span>";
358
+ if ($nav_arrows == '1') {
359
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1' checked/>";
360
+ } else {
361
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1'/>";
362
+ }
363
+ echo "<em class='sa_tooltip' href='' title='Display the \"next slide\" amd \"previous slide\" buttons'></em>\n";
364
+ echo "</div>\n";
365
+ // SHOW PAGINATION
366
+ $pagination = get_post_meta($post->ID, 'sa_pagination', true);
367
+ if ($pagination == '') {
368
+ $pagination = '1';
369
+ }
370
+ echo "<div class='sa_setting_checkbox'><span>Show Pagination:</span>";
371
+ if ($pagination == '1') {
372
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1' checked/>";
373
+ } else {
374
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1'/>";
375
+ }
376
+ echo "<em class='sa_tooltip' href='' title='Display slider pagination below the slider'></em>\n";
377
+ echo "</div>\n";
378
+ echo "</div>\n";
379
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
380
+ echo "</div>\n";
381
+ }
382
+
383
+
384
+
385
+ // ##### META BOX CONTENT - 'Slides' BOX #####
386
+ function cpt_slider_slides_content($post) {
387
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
388
+ // DISABLE VISUAL EDITOR CHECKBOX
389
+ $disable_visual_editor = get_post_meta($post->ID, 'sa_disable_visual_editor', true);
390
+ if ($disable_visual_editor == '') {
391
+ $disable_visual_editor = '0';
392
+ }
393
+ echo "<div id='sa_visual_editor_checkbox'><span>Disable Visual Editor:</span>";
394
+ if ($disable_visual_editor == '1') {
395
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1' checked/></div>\n";
396
+ } else {
397
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1'/></div>\n";
398
+ }
399
+ // SLIDER EDITOR BOX SETTINGS
400
+ if ($disable_visual_editor == '1') {
401
+ $editor_args = array('tinymce' => false, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
402
+ } else {
403
+ $editor_args = array('tinymce' => true, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
404
+ }
405
+ if ($num_slides == '') {
406
+ // A NEW SLIDER IS BEING CREATED - ADD 3 INITIAL SLIDES
407
+ $num_slides = 3;
408
+ $slide_data[0]['edit_id'] = "sa_slide1_content";
409
+ $slide_data[0]['content'] = "Slide content";
410
+ $slide_data[0]['del_id'] = "sa_slide1_delete";
411
+ $slide_data[0]['image_id'] = "sa_slide1_image_id";
412
+ $slide_data[0]['thumb'] = "slide1_thumb";
413
+ $slide_data[0]['image_del'] = "slide1_image_del";
414
+ $slide_data[0]['image_size'] = "sa_slide1_image_size";
415
+ $slide_data[0]['image_repeat'] = "sa_slide1_image_repeat";
416
+ $slide_data[0]['image_color'] = "sa_slide1_image_color";
417
+ $slide_data[0]['slide_no'] = 1;
418
+ $slide_data[1]['edit_id'] = "sa_slide2_content";
419
+ $slide_data[1]['content'] = "Slide content";
420
+ $slide_data[1]['del_id'] = "sa_slide2_delete";
421
+ $slide_data[1]['image_id'] = "sa_slide2_image_id";
422
+ $slide_data[1]['thumb'] = "slide2_thumb";
423
+ $slide_data[1]['image_del'] = "slide2_image_del";
424
+ $slide_data[1]['image_size'] = "sa_slide2_image_size";
425
+ $slide_data[1]['image_repeat'] = "sa_slide2_image_repeat";
426
+ $slide_data[1]['image_color'] = "sa_slide2_image_color";
427
+ $slide_data[1]['slide_no'] = 2;
428
+ $slide_data[2]['edit_id'] = "sa_slide3_content";
429
+ $slide_data[2]['content'] = "Slide content";
430
+ $slide_data[2]['del_id'] = "sa_slide3_delete";
431
+ $slide_data[2]['image_id'] = "sa_slide3_image_id";
432
+ $slide_data[2]['thumb'] = "slide3_thumb";
433
+ $slide_data[2]['image_del'] = "slide3_image_del";
434
+ $slide_data[2]['image_size'] = "sa_slide3_image_size";
435
+ $slide_data[2]['image_repeat'] = "sa_slide3_image_repeat";
436
+ $slide_data[2]['image_color'] = "sa_slide3_image_color";
437
+ $slide_data[2]['slide_no'] = 3;
438
+ } else {
439
+ // AN EXISTING SLIDER - GET SLIDE DATA FROM THE DATABASE AND SAVE WITHIN AN ARRAY
440
+ $num_slides = intval($num_slides);
441
+ $slide_data = array();
442
+ $count = 0;
443
+ for ($i = 1; $i <= $num_slides; $i++) {
444
+ $slide_edit_id = "sa_slide".$i."_content";
445
+ $slide_data[$count]['edit_id'] = $slide_edit_id;
446
+ $slide_data[$count]['content'] = get_post_meta($post->ID, $slide_edit_id, true);
447
+ $slide_data[$count]['del_id'] = "sa_slide".$i."_delete";
448
+ $slide_data[$count]['image_id'] = "sa_slide".$i."_image_id";
449
+ $slide_data[$count]['thumb'] = "slide".$i."_thumb";
450
+ $slide_data[$count]['image_del'] = "slide".$i."_image_del";
451
+ $slide_data[$count]['image_size'] = "sa_slide".$i."_image_size";
452
+ $slide_data[$count]['image_repeat'] = "sa_slide".$i."_image_repeat";
453
+ $slide_data[$count]['image_color'] = "sa_slide".$i."_image_color";
454
+ $slide_data[$count]['slide_no'] = $i;
455
+ $count++;
456
+ }
457
+ }
458
+
459
+ // ###### LOOP TO DISPLAY INPUT ELEMENTS FOR EACH SLIDE ######
460
+ echo "<div id='slider_accordion'>\n";
461
+ for ($i = 0; $i < count($slide_data); $i++) {
462
+ echo "<h3>Slide ".$slide_data[$i]['slide_no']."</h3>\n";
463
+ echo "<div>\n";
464
+
465
+ // ### DISPLAY THE SLIDE CONTENT EDITOR (textarea field) ###
466
+ wp_editor($slide_data[$i]['content'], wp_kses_post($slide_data[$i]['edit_id']), $editor_args);
467
+
468
+ // ### BACKGROUND COLOR/IMAGE FIELDS ###
469
+ // GET BACKGROUND IMAGE DATA FOR THIS SLIDE (image id, size, repeat and color)
470
+ $slide_image_id = get_post_meta($post->ID, $slide_data[$i]['image_id'], true);
471
+ $slide_image_size = get_post_meta($post->ID, $slide_data[$i]['image_size'], true);
472
+ if ($slide_image_size == '') {
473
+ $slide_image_size = 'contain';
474
+ }
475
+ $slide_image_repeat = get_post_meta($post->ID, $slide_data[$i]['image_repeat'], true);
476
+ if ($slide_image_repeat == '') {
477
+ $slide_image_repeat = 'no-repeat';
478
+ }
479
+ $slide_image_color = get_post_meta($post->ID, $slide_data[$i]['image_color'], true);
480
+ if ($slide_image_color == '') {
481
+ $slide_image_color = "rgba(0,0,0,0)";
482
+ }
483
+
484
+ // SLIDE BACKGROUND IMAGE - THUMBNAIL AND 'SET IMAGE' BUTTON
485
+ // get wordpress media upload frame url
486
+ $upload_frame_url = esc_url(get_upload_iframe_src('image', $post->ID)."&slide=".$slide_data[$i]['slide_no']);
487
+ // Get image src for slide background image
488
+ $slide_image_src = wp_get_attachment_image_src($slide_image_id, 'full');
489
+ // check if the slide background image id already exists
490
+ $image_exists = is_array($slide_image_src);
491
+ // slide backround image - thumbnail (and delete button)
492
+ echo "<div class='sa_slide_bg_wrapper'>\n";
493
+ echo "<h4>Slide Background</h4>\n";
494
+ echo "<div id='".$slide_data[$i]['thumb']."' class='sa_slide_thumb'>\n";
495
+ if ($image_exists) {
496
+ echo "<div style='background-image:url(\"".esc_attr($slide_image_src[0])."\"); background-size:".esc_attr($slide_image_size)."; ";
497
+ echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color).";'></div>\n";
498
+ echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
499
+ echo "</div>\n";
500
+ } else {
501
+ echo "<div style='background-color:#ffffff; background-size:".esc_attr($slide_image_size)."; ";
502
+ echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color).";'></div>\n";
503
+ echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' class='sa_hidden' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
504
+ echo "</div>\n";
505
+ }
506
+ // slide background image - 'set image' button
507
+ echo "<a class='button button-secondary slide_image_add' href='".esc_attr($upload_frame_url)."' title='Set the background image for this slide'>Set Image</a>\n";
508
+ // slide background image - image id text field
509
+ echo "<input type='hidden' id='".esc_attr($slide_data[$i]['image_id'])."' name='".esc_attr($slide_data[$i]['image_id'])."' value='".esc_attr($slide_image_id)."'/>\n";
510
+
511
+ // SLIDE BACKGROUND IMAGE - BACKGROUND SIZE (dropdown box)
512
+ echo "<div class='slide_image_settings_line'>";
513
+ echo "<span>Background Size:</span>";
514
+ $option_arr = array();
515
+ $option_arr[0]['value'] = 'auto'; $option_arr[0]['desc'] = 'no resize';
516
+ $option_arr[1]['value'] = 'contain'; $option_arr[1]['desc'] = 'contain';
517
+ $option_arr[2]['value'] = 'cover'; $option_arr[2]['desc'] = 'cover';
518
+ $option_arr[3]['value'] = '100% 100%'; $option_arr[3]['desc'] = '100%';
519
+ $option_arr[4]['value'] = '100% auto'; $option_arr[4]['desc'] = '100% width';
520
+ $option_arr[5]['value'] = 'auto 100%'; $option_arr[5]['desc'] = '100% height';
521
+ echo "<select id='".esc_attr($slide_data[$i]['image_size'])."' name='".esc_attr($slide_data[$i]['image_size'])."' onChange='change_slide_image_size(".esc_attr($slide_data[$i]['slide_no']).");'>";
522
+ for ($j = 0; $j < count($option_arr); $j++) {
523
+ if ($slide_image_size == $option_arr[$j]['value']) {
524
+ echo "<option value='".esc_attr($option_arr[$j]['value'])."' selected>".esc_html($option_arr[$j]['desc'])."</option>";
525
+ } else {
526
+ echo "<option value='".esc_attr($option_arr[$j]['value'])."'>".esc_html($option_arr[$j]['desc'])."</option>";
527
+ }
528
+ }
529
+ echo "</select>";
530
+ echo "</div>\n";
531
+
532
+ // SLIDER BACKGROUND IMAGE - BACKGROUND REPEAT (dropdown box)
533
+ echo "<div class='slide_image_settings_line'>";
534
+ echo "<span>Background Repeat:</span>";
535
+ $option_arr = array();
536
+ $option_arr[0] = 'no-repeat';
537
+ $option_arr[1] = 'repeat';
538
+ $option_arr[2] = 'repeat-x';
539
+ $option_arr[3] = 'repeat-y';
540
+ echo "<select id='".esc_attr($slide_data[$i]['image_repeat'])."' name='".esc_attr($slide_data[$i]['image_repeat'])."' ";
541
+ echo "onChange='change_slide_image_repeat(".esc_attr($slide_data[$i]['slide_no']).");'>";
542
+ for ($j = 0; $j < count($option_arr); $j++) {
543
+ if ($slide_image_repeat == $option_arr[$j]) {
544
+ echo "<option value='".esc_attr($option_arr[$j])."' selected>".esc_html($option_arr[$j])."</option>";
545
+ } else {
546
+ echo "<option value='".esc_attr($option_arr[$j])."'>".esc_html($option_arr[$j])."</option>";
547
+ }
548
+ }
549
+ echo "</select>";
550
+ echo "</div>\n";
551
+
552
+ // SLIDER BACKGROUND IMAGE - BACKGROUND COLOR (color picker)
553
+ echo "<div class='slide_image_settings_line'>";
554
+ echo "<span>Background Color:</span>";
555
+ echo "<input type='text' id='".esc_attr($slide_data[$i]['image_color'])."' name='".esc_attr($slide_data[$i]['image_color'])."' value='".esc_attr($slide_image_color)."' ";
556
+ echo "onChange='change_slide_image_color(".esc_attr($slide_data[$i]['slide_no']).");'>";
557
+ echo "</div>\n";
558
+
559
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
560
+ echo "</div>\n";
561
+
562
+ // 3. DELETE STATUS FIELD (hidden) AND DELETE SLIDE BUTTON
563
+ echo "<input type='hidden' id='".esc_attr($slide_data[$i]['del_id'])."' name='".esc_attr($slide_data[$i]['del_id'])."' value='1'/>\n";
564
+ echo "<div class='button button-secondary' onClick='delete_sa_slide(\"".esc_attr($slide_data[$i]['del_id'])."\");' title='Delete this slide'>Delete Slide</div>\n";
565
+
566
+ // 4. DUPLICATE SLIDE BUTTON
567
+ echo "<div class='button button-secondary' onClick='duplicate_slide(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Duplicate this slide'>Duplicate Slide</div>\n";
568
+
569
+ // 5. MOVE SLIDE UP BUTTON
570
+ if ($slide_data[$i]['slide_no'] != 1) {
571
+ echo "<div class='button button-secondary' onClick='move_slide_up(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Move this slide up within the slide order'>Move Slide Up</div>\n";
572
+ }
573
+
574
+ echo "</div>\n";
575
+ }
576
+ echo "</div>\n";
577
+
578
+ // ADD SLIDE BUTTON
579
+ if ($num_slides < 50) {
580
+ // a maximum of 50 slides allowed
581
+ echo "<div id='sa_add_slide' class='button button-primary button-large' title='Add a new slide'>Add Slide</a>\n";
582
+ }
583
+ // JQUERY-UI DIALOG BOX DIV
584
+ echo "<div id='sa_dialog_box'></div>\n";
585
+ }
586
+
587
+
588
+
589
+ // ##### META BOX CONTENT - 'Slider Shortcode' BOX #####
590
+ function cpt_slider_shortcode_content($post) {
591
+ $shortcode = "[slide-anything id='".$post->ID."']";
592
+ echo "<div id='sa_slider_shortcode'>".esc_html($shortcode)."</div>\n";
593
+ echo "<div id='sa_shortcode_copy' class='button button-secondary'>Copy to Clipboard</div>\n";
594
+ echo "<div style='clear:both; width:100%; height:1px;'></div>\n";
595
+ }
596
+
597
+
598
+
599
+ // ##### META BOX CONTENT - 'Items Displayed' BOX #####
600
+ function cpt_slider_items_content($post) {
601
+ $items_width1 = intval(get_post_meta($post->ID, 'sa_items_width1', true));
602
+ $items_width2 = intval(get_post_meta($post->ID, 'sa_items_width2', true));
603
+ $items_width3 = intval(get_post_meta($post->ID, 'sa_items_width3', true));
604
+ $items_width4 = intval(get_post_meta($post->ID, 'sa_items_width4', true));
605
+ $items_width5 = intval(get_post_meta($post->ID, 'sa_items_width5', true));
606
+ if ($items_width1 == 0) { $items_width1 = 1; }
607
+ if ($items_width2 == 0) { $items_width2 = 1; }
608
+ if ($items_width3 == 0) { $items_width3 = 1; }
609
+ if ($items_width4 == 0) { $items_width4 = 1; }
610
+ if ($items_width5 == 0) { $items_width5 = 1; }
611
+
612
+ echo "<div id='items_displayed_metabox'>\n";
613
+ echo "<h4>Browser/Device Width:</h4>\n";
614
+ // items for browser width category 1
615
+ echo "<div><em class='sa_tooltip' href='' title='Up to 479 pixels'></em><span>Mobile Portrait</span><select name='sa_items_width1'>";
616
+ for ($i = 1; $i <= 12; $i++) {
617
+ if ($i == $items_width1) {
618
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
619
+ } else {
620
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
621
+ }
622
+ }
623
+ echo "</select></div>\n";
624
+ // items for browser width category 2
625
+ echo "<div><em class='sa_tooltip' href='' title='480 to 767 pixels'></em><span>Mobile Landscape</span><select name='sa_items_width2'>";
626
+ for ($i = 1; $i <= 12; $i++) {
627
+ if ($i == $items_width2) {
628
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
629
+ } else {
630
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
631
+ }
632
+ }
633
+ echo "</select></div>\n";
634
+ // items for browser width category 3
635
+ echo "<div><em class='sa_tooltip' href='' title='768 to 979 pixels'></em><span>Tablet Portrait</span><select name='sa_items_width3'>";
636
+ for ($i = 1; $i <= 12; $i++) {
637
+ if ($i == $items_width3) {
638
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
639
+ } else {
640
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
641
+ }
642
+ }
643
+ echo "</select></div>\n";
644
+ // items for browser width category 4
645
+ echo "<div><em class='sa_tooltip' href='' title='980 to 1199 pixels'></em><span>Desktop Small</span><select name='sa_items_width4'>";
646
+ for ($i = 1; $i <= 12; $i++) {
647
+ if ($i == $items_width4) {
648
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
649
+ } else {
650
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
651
+ }
652
+ }
653
+ echo "</select></div>\n";
654
+ // items for browser width category 5
655
+ echo "<div><em class='sa_tooltip' href='' title='Over 1200 pixels'></em><span>Desktop Large</span><select name='sa_items_width5'>";
656
+ for ($i = 1; $i <= 12; $i++) {
657
+ if ($i == $items_width5) {
658
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
659
+ } else {
660
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
661
+ }
662
+ }
663
+ echo "</select></div>\n";
664
+ echo "</div>\n";
665
+ }
666
+
667
+
668
+
669
+ // ##### META BOX CONTENT - 'Slider Style' BOX #####
670
+ function cpt_slider_style_content($post) {
671
+ // CSS ID
672
+ $css_id = get_post_meta($post->ID, 'sa_css_id', true);
673
+ if ($css_id == '') {
674
+ $css_id = "slider_".$post->ID;
675
+ }
676
+ echo "<div id='slider_style_metabox'>\n";
677
+ echo "<h4>CSS <span>#id</span> for Slider:</h4>\n";
678
+ echo "<input type='text' id='sa_css_id' name='sa_css_id' value='".esc_attr($css_id)."'/>\n";
679
+ echo "<div id='css_note_text'>To style slides use CSS selector:</div>";
680
+ echo "<div id='css_note_value'>#".esc_html($css_id)." .owl-item</div>";
681
+ echo "<div class='ca_style_hr'></div>\n";
682
+
683
+ // SLIDER PADDING (TOP, RIGHT, BOTTOM, LEFT)
684
+ $wrapper_padd_top = get_post_meta($post->ID, 'sa_wrapper_padd_top', true);
685
+ if ($wrapper_padd_top == '') { $wrapper_padd_top = '0'; }
686
+ $wrapper_padd_right = get_post_meta($post->ID, 'sa_wrapper_padd_right', true);
687
+ if ($wrapper_padd_right == '') { $wrapper_padd_right = '0'; }
688
+ $wrapper_padd_bottom = get_post_meta($post->ID, 'sa_wrapper_padd_bottom', true);
689
+ if ($wrapper_padd_bottom == '') { $wrapper_padd_bottom = '0'; }
690
+ $wrapper_padd_left = get_post_meta($post->ID, 'sa_wrapper_padd_left', true);
691
+ if ($wrapper_padd_left == '') { $wrapper_padd_left = '0'; }
692
+ $tooltip = "Padding space around the entire carousel/slider";
693
+ echo "<h4>Padding <span>(pixels)</span>:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
694
+ echo "<div class='ca_style_padding'>";
695
+ echo "<div id='padd_top'>";
696
+ echo "<input type='text' id='sa_wrapper_padd_top' name='sa_wrapper_padd_top' value='".esc_attr($wrapper_padd_top)."'></div>";
697
+ echo "<div id='padd_right'>";
698
+ echo "<input type='text' id='sa_wrapper_padd_right' name='sa_wrapper_padd_right' value='".esc_attr($wrapper_padd_right)."'></div>";
699
+ echo "<div type='text' id='padd_bottom'>";
700
+ echo "<input type='text' id='sa_wrapper_padd_bottom' name='sa_wrapper_padd_bottom' value='".esc_attr($wrapper_padd_bottom)."'></div>";
701
+ echo "<div id='padd_left'>";
702
+ echo "<input type='text' id='sa_wrapper_padd_left' name='sa_wrapper_padd_left' value='".esc_attr($wrapper_padd_left)."'></div>";
703
+ echo "</div>\n";
704
+ echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
705
+
706
+ $tooltip = "The background color and border around the entire carousel/slider";
707
+ echo "<h4>Background/Border:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
708
+
709
+ // SLIDER BACKGROUND COLOR
710
+ $background_color = get_post_meta($post->ID, 'sa_background_color', true);
711
+ if ($background_color == '') {
712
+ $background_color = 'rgba(0,0,0,0)';
713
+ }
714
+ echo "<div class='ca_style_setting_line'><span>Background:</span>";
715
+ echo "<input type='text' id='sa_background_color' name='sa_background_color' value='".esc_attr($background_color)."'></div>\n";
716
+
717
+ // SLIDER BORDER (WIDTH & COLOR)
718
+ $border_width = get_post_meta($post->ID, 'sa_border_width', true);
719
+ if ($border_width == '') {
720
+ $border_width = '0';
721
+ }
722
+ $border_color = get_post_meta($post->ID, 'sa_border_color', true);
723
+ if ($border_color == '') {
724
+ $border_color = 'rgba(0,0,0,0)';
725
+ }
726
+ echo "<div class='ca_style_setting_line'><span>Border Style:</span>";
727
+ echo "<input type='text' id='sa_border_width' name='sa_border_width' value='".esc_attr($border_width)."'><em>px</em>";
728
+ echo "<input type='text' id='sa_border_color' name='sa_border_color' value='".esc_attr($border_color)."'></div>\n";
729
+
730
+ // SLIDER BORDER RADIUS
731
+ $border_radius = get_post_meta($post->ID, 'sa_border_radius', true);
732
+ if ($border_radius == '') {
733
+ $border_radius = '0';
734
+ }
735
+ echo "<div class='ca_style_setting_line'><span>Border Radius:</span>";
736
+ echo "<input type='text' id='sa_border_radius' name='sa_border_radius' value='".esc_attr($border_radius)."'></div>\n";
737
+
738
+ echo "<div class='ca_style_hr' style='margin-top:10px;'></div>\n";
739
+ $tooltip = "The style settings for each individual slide (within the slider/carousel)";
740
+ echo "<h4>SLIDE STYLE:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
741
+
742
+ // SLIDE - MINIMUM HEIGHT
743
+ $slide_min_height = get_post_meta($post->ID, 'sa_slide_min_height', true);
744
+ if ($slide_min_height == '') {
745
+ $slide_min_height = '100';
746
+ }
747
+ echo "<div class='ca_style_setting_line'><span>Min Height:</span>";
748
+ echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='".esc_attr($slide_min_height)."'><em>px</em></div>\n";
749
+
750
+ // SLIDE - PADDING TOP/BOTTOM
751
+ $slide_padding_tb = get_post_meta($post->ID, 'sa_slide_padding_tb', true);
752
+ if ($slide_padding_tb == '') {
753
+ $slide_padding_tb = '5';
754
+ }
755
+ $tooltip = "Padding space top/bottom for each individual slide";
756
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_top_bottom'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
757
+ echo "<input type='text' id='sa_slide_padding_tb' name='sa_slide_padding_tb' value='".esc_attr($slide_padding_tb)."'><em>%</em></div>\n";
758
+
759
+ // SLIDE - PADDING LEFT/RIGHT
760
+ $slide_padding_lr = get_post_meta($post->ID, 'sa_slide_padding_lr', true);
761
+ if ($slide_padding_lr == '') {
762
+ $slide_padding_lr = '5';
763
+ }
764
+ $tooltip = "Padding space left/right for each individual slide";
765
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_left_right'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
766
+ echo "<input type='text' id='sa_slide_padding_lr' name='sa_slide_padding_lr' value='".esc_attr($slide_padding_lr)."'><em>%</em></div>\n";
767
+
768
+ echo "</div>\n";
769
+ }
770
+
771
+
772
+
773
+ // ##### ACTION HOOK - SAVE CUSTOM POST TYPE ('Slider Anywhere') DATA #####
774
+ function cpt_slider_save_postdata() {
775
+ global $post;
776
+
777
+ // ### VERIFY 1) LOGGED-IN USER IS ADMINISTRATOR AND 2) VALID NONCE TO PREVENT CSRF HACKER ATTACKS ###
778
+ if (current_user_can('manage_options') &&
779
+ isset($_POST['nonce_save_slider']) && wp_verify_nonce($_POST['nonce_save_slider'], basename(__FILE__))) {
780
+ $total_slides = intval($_POST['sa_num_slides']);
781
+ if (($_POST['sa_duplicate_slide'] == '') || ($_POST['sa_duplicate_slide'] == '0')) {
782
+ $duplicate_slide = 0;
783
+ } else {
784
+ // A SLIDE NEEDS TO BE DUPLICATED
785
+ $duplicate_slide = intval($_POST['sa_duplicate_slide']);
786
+ }
787
+ if (($_POST['sa_move_slide_up'] == '') || ($_POST['sa_move_slide_up'] == '0')) {
788
+ $move_slide_up = 0;
789
+ } else {
790
+ // A SLIDE NEEDS TO BE MOVED
791
+ $move_slide_up = intval($_POST['sa_move_slide_up']);
792
+ }
793
+
794
+ // UPDATE CONTENT FOR EACH SLIDE
795
+ $slides_saved = 0;
796
+ for ($i = 1; $i <= $total_slides; $i++) {
797
+ $slide_edit_id = "sa_slide".$i."_content";
798
+ $slide_image_id = "sa_slide".$i."_image_id";
799
+ $slide_image_size = "sa_slide".$i."_image_size";
800
+ $slide_image_repeat = "sa_slide".$i."_image_repeat";
801
+ $slide_image_color = "sa_slide".$i."_image_color";
802
+ $slide_content = wp_kses_post($_POST[$slide_edit_id]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
803
+ $slide_image_id_val = abs(intval($_POST[$slide_image_id])); // SANATIZE (slide BG image ID is a valid integer)
804
+ $slide_image_size_val = sanitize_text_field($_POST[$slide_image_size]); // SANATIZE (BG image size is a valid text-input string)
805
+ $slide_image_repeat_val = sanitize_text_field($_POST[$slide_image_repeat]); // SANATIZE (BG image repeat is a valid text-input string)
806
+ $slide_image_color_val = sanitize_text_field($_POST[$slide_image_color]); // SANATIZE (BG color is a valid text-input string)
807
+ // check delete status for slide
808
+ $del_status_id = "sa_slide".$i."_delete";
809
+ if (isset($_POST[$del_status_id]) && ($_POST[$del_status_id] != '')) {
810
+ $del_status = $_POST[$del_status_id];
811
+ } else {
812
+ // a new slide has been added
813
+ $del_status = '1';
814
+ $slide_content = '';
815
+ }
816
+ if ($del_status == '1') {
817
+ // save slide content only if slide has not been marked for deletion
818
+ $slides_saved++;
819
+ $slide_edit_id_save = "sa_slide".$slides_saved."_content";
820
+ $slide_image_id_saved = "sa_slide".$slides_saved."_image_id";
821
+ $slide_image_size_saved = "sa_slide".$slides_saved."_image_size";
822
+ $slide_image_repeat_saved = "sa_slide".$slides_saved."_image_repeat";
823
+ $slide_image_color_saved = "sa_slide".$slides_saved."_image_color";
824
+ update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
825
+ update_post_meta($post->ID, $slide_image_id_saved, $slide_image_id_val);
826
+ update_post_meta($post->ID, $slide_image_size_saved, $slide_image_size_val);
827
+ update_post_meta($post->ID, $slide_image_repeat_saved, $slide_image_repeat_val);
828
+ update_post_meta($post->ID, $slide_image_color_saved, $slide_image_color_val);
829
+ if ($i == $duplicate_slide) {
830
+ // the 'duplicate slide' button has been click for this slide - create a new slide that is an exact copy of previous slide
831
+ // (REPEAT THE CODE ABOVE HERE!!!)
832
+ $slides_saved++;
833
+ $slide_edit_id_save = "sa_slide".$slides_saved."_content";
834
+ $slide_image_id_saved = "sa_slide".$slides_saved."_image_id";
835
+ $slide_image_size_saved = "sa_slide".$slides_saved."_image_size";
836
+ $slide_image_repeat_saved = "sa_slide".$slides_saved."_image_repeat";
837
+ $slide_image_color_saved = "sa_slide".$slides_saved."_image_color";
838
+ update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
839
+ update_post_meta($post->ID, $slide_image_id_saved, $slide_image_id_val);
840
+ update_post_meta($post->ID, $slide_image_size_saved, $slide_image_size_val);
841
+ update_post_meta($post->ID, $slide_image_repeat_saved, $slide_image_repeat_val);
842
+ update_post_meta($post->ID, $slide_image_color_saved, $slide_image_color_val);
843
+ }
844
+ }
845
+ }
846
+
847
+ if ($move_slide_up != 0) {
848
+ // A SLIDE NEEDS TO BE MOVED (TWO SLIDES ARE SWAPPED)
849
+ $slide2 = $move_slide_up;
850
+ $slide1 = intval($move_slide_up) - 1;
851
+ $slide1_content = wp_kses_post($_POST["sa_slide".$slide1."_content"]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
852
+ $slide1_image_id = abs(intval($_POST["sa_slide".$slide1."_image_id"])); // SANATIZE (slide BG image ID is a valid integer)
853
+ $slide1_image_size = sanitize_text_field($_POST["sa_slide".$slide1."_image_size"]); // SANATIZE (BG image size is a valid text-input string)
854
+ $slide1_image_repeat = sanitize_text_field($_POST["sa_slide".$slide1."_image_repeat"]); // SANATIZE (BG image repeat is a valid text-input string)
855
+ $slide1_image_color = sanitize_text_field($_POST["sa_slide".$slide1."_image_color"]); // SANATIZE (BG color is a valid text-input string)
856
+ $slide2_content = wp_kses_post($_POST["sa_slide".$slide2."_content"]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
857
+ $slide2_image_id = abs(intval($_POST["sa_slide".$slide2."_image_id"])); // SANATIZE (slide BG image ID is a valid integer)
858
+ $slide2_image_size = sanitize_text_field($_POST["sa_slide".$slide2."_image_size"]); // SANATIZE (BG image size is a valid text-input string)
859
+ $slide2_image_repeat = sanitize_text_field($_POST["sa_slide".$slide2."_image_repeat"]); // SANATIZE (BG image repeat is a valid text-input string)
860
+ $slide2_image_color = sanitize_text_field($_POST["sa_slide".$slide2."_image_color"]); // SANATIZE (BG color is a valid text-input string)
861
+ update_post_meta($post->ID, "sa_slide".$slide2."_content", $slide1_content);
862
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_id", $slide1_image_id);
863
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_size", $slide1_image_size);
864
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_repeat", $slide1_image_repeat);
865
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_color", $slide1_image_color);
866
+ update_post_meta($post->ID, "sa_slide".$slide1."_content", $slide2_content);
867
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_id", $slide2_image_id);
868
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_size", $slide2_image_size);
869
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_repeat", $slide2_image_repeat);
870
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_color", $slide2_image_color);
871
+ }
872
+
873
+ // UPDATE SLIDER SETTINGS
874
+ update_post_meta($post->ID, 'sa_disable_visual_editor', abs(intval($_POST['sa_disable_visual_editor']))); // SANATIZE (valid integer value)
875
+ update_post_meta($post->ID, 'sa_num_slides', abs(intval($slides_saved))); // SANATIZE (valid integer value)
876
+ update_post_meta($post->ID, 'sa_info_added', abs(intval($_POST['sa_info_added']))); // SANATIZE (valid integer value)
877
+ update_post_meta($post->ID, 'sa_info_deleted', abs(intval($_POST['sa_info_deleted']))); // SANATIZE (valid integer value)
878
+ update_post_meta($post->ID, 'sa_duplicate_slide', abs(intval($_POST['sa_duplicate_slide']))); // SANATIZE (valid integer value)
879
+ update_post_meta($post->ID, 'sa_info_duplicated', abs(intval($_POST['sa_info_duplicated']))); // SANATIZE (valid integer value)
880
+ update_post_meta($post->ID, 'sa_move_slide_up', abs(intval($_POST['sa_move_slide_up']))); // SANATIZE (valid integer value)
881
+ update_post_meta($post->ID, 'sa_info_moved', abs(intval($_POST['sa_info_moved']))); // SANATIZE (valid integer value)
882
+ update_post_meta($post->ID, 'sa_slide_duration', abs(floatval($_POST['sa_slide_duration']))); // SANATIZE (valid float value)
883
+ update_post_meta($post->ID, 'sa_slide_transition', abs(floatval($_POST['sa_slide_transition']))); // SANATIZE (valid float value)
884
+ if (isset($_POST['sa_loop_slider']) && ($_POST['sa_loop_slider'] == '1')) {
885
+ update_post_meta($post->ID, 'sa_loop_slider', '1');
886
+ } else {
887
+ update_post_meta($post->ID, 'sa_loop_slider', '0');
888
+ }
889
+ if (isset($_POST['sa_stop_hover']) && ($_POST['sa_stop_hover'] == '1')) {
890
+ update_post_meta($post->ID, 'sa_stop_hover', '1');
891
+ } else {
892
+ update_post_meta($post->ID, 'sa_stop_hover', '0');
893
+ }
894
+ if (isset($_POST['sa_nav_arrows']) && ($_POST['sa_nav_arrows'] == '1')) {
895
+ update_post_meta($post->ID, 'sa_nav_arrows', '1');
896
+ } else {
897
+ update_post_meta($post->ID, 'sa_nav_arrows', '0');
898
+ }
899
+ if (isset($_POST['sa_pagination']) && ($_POST['sa_pagination'] == '1')) {
900
+ update_post_meta($post->ID, 'sa_pagination', '1');
901
+ } else {
902
+ update_post_meta($post->ID, 'sa_pagination', '0');
903
+ }
904
+
905
+ // UPDATE SLIDER ITEMS DISPLAYED
906
+ update_post_meta($post->ID, 'sa_items_width1', abs(intval($_POST['sa_items_width1']))); // SANATIZE (valid integer value)
907
+ update_post_meta($post->ID, 'sa_items_width2', abs(intval($_POST['sa_items_width2']))); // SANATIZE (valid integer value)
908
+ update_post_meta($post->ID, 'sa_items_width3', abs(intval($_POST['sa_items_width3']))); // SANATIZE (valid integer value)
909
+ update_post_meta($post->ID, 'sa_items_width4', abs(intval($_POST['sa_items_width4']))); // SANATIZE (valid integer value)
910
+ update_post_meta($post->ID, 'sa_items_width5', abs(intval($_POST['sa_items_width5']))); // SANATIZE (valid integer value)
911
+
912
+ // UPDATE SLIDER STYLE
913
+ update_post_meta($post->ID, 'sa_css_id', sanitize_text_field($_POST['sa_css_id'])); // SANATIZE (valid text-input string)
914
+ update_post_meta($post->ID, 'sa_background_color', sanitize_text_field($_POST['sa_background_color'])); // SANATIZE (valid text-input string)
915
+ update_post_meta($post->ID, 'sa_border_width', abs(intval($_POST['sa_border_width']))); // SANATIZE (valid integer value)
916
+ update_post_meta($post->ID, 'sa_border_color', sanitize_text_field($_POST['sa_border_color'])); // SANATIZE (valid text-input string)
917
+ update_post_meta($post->ID, 'sa_border_radius', abs(intval($_POST['sa_border_radius']))); // SANATIZE (valid integer value)
918
+ update_post_meta($post->ID, 'sa_wrapper_padd_top', abs(intval($_POST['sa_wrapper_padd_top']))); // SANATIZE (valid integer value)
919
+ update_post_meta($post->ID, 'sa_wrapper_padd_right', abs(intval($_POST['sa_wrapper_padd_right']))); // SANATIZE (valid integer value)
920
+ update_post_meta($post->ID, 'sa_wrapper_padd_bottom', abs(intval($_POST['sa_wrapper_padd_bottom']))); // SANATIZE (valid integer value)
921
+ update_post_meta($post->ID, 'sa_wrapper_padd_left', abs(intval($_POST['sa_wrapper_padd_left']))); // SANATIZE (valid integer value)
922
+ update_post_meta($post->ID, 'sa_slide_min_height', abs(intval($_POST['sa_slide_min_height']))); // SANATIZE (valid integer value)
923
+ update_post_meta($post->ID, 'sa_slide_padding_tb', abs(floatval($_POST['sa_slide_padding_tb']))); // SANATIZE (valid float value)
924
+ update_post_meta($post->ID, 'sa_slide_padding_lr', abs(floatval($_POST['sa_slide_padding_lr']))); // SANATIZE (valid float value)
925
+ }
926
+ }
927
+ ?>
php/slide-anything-frontend.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // #####################################################################
3
+ // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS FRONT-END ###
4
+ // #####################################################################
5
+
6
+ add_shortcode('slide-anything', 'slide_anything_shortcode');
7
+
8
+ /* ##### ROOT FUNCTION THAT IS CALLED TO BY THE 'slide-anything' SHORTCODE ##### */
9
+ function slide_anything_shortcode($atts) {
10
+ wp_enqueue_script('jquery');
11
+ wp_register_script('owl_carousel_js', PLUGIN_PATH.'owl-carousel/owl.carousel.min.js', array('jquery'), '1.3.3', true);
12
+ wp_enqueue_script('owl_carousel_js');
13
+ wp_register_style('owl_carousel_css', PLUGIN_PATH.'owl-carousel/owl.carousel.css');
14
+ wp_enqueue_style('owl_carousel_css');
15
+ wp_register_style('owl_theme_css', PLUGIN_PATH.'owl-carousel/owl-theme.css');
16
+ wp_enqueue_style('owl_theme_css');
17
+
18
+ // EXTRACT SHORTCODE ATTRIBUTES
19
+ extract(shortcode_atts(array(
20
+ 'id' => 0,
21
+ ), $atts));
22
+ $output = '';
23
+
24
+ if ($id == 0) {
25
+ // AN 'id' PARAMETER HAS NOT BEEN PROVIDED IN THE SHORTCODE
26
+ $output .= "<div id='sa_invalid_postid'>A valid 'Slide Anything' ID has not been provided</div>\n";
27
+ } else {
28
+ $metadata = get_metadata('post', $id);
29
+ if (count($metadata) == 0) {
30
+ // THE 'id' PARAMETER PROVIDED IN THE SHORTCODE IS INVALID
31
+ $output .= "<div id='sa_invalid_postid'>A valid 'Slide Anything' ID has not been provided</div>\n";
32
+ } else {
33
+ // ### VALID 'id' PROVIDED - PROCESS SHORTCODE ###
34
+ // GET SLIDE DATA FROM DATABASE AND SAVE IN ARRAY
35
+ $slide_data = array();
36
+ $slide_data['num_slides'] = $metadata['sa_num_slides'][0];
37
+ for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
38
+ // apply 'the_content' filter to slide content to process any shortcodes
39
+ $slide_data["slide".$i."_content"] = apply_filters('the_content', $metadata["sa_slide".$i."_content"][0]);
40
+ $slide_data["slide".$i."_image_id"] = $metadata["sa_slide".$i."_image_id"][0];
41
+ $slide_data["slide".$i."_image_size"] = $metadata["sa_slide".$i."_image_size"][0];
42
+ $slide_data["slide".$i."_image_repeat"] = $metadata["sa_slide".$i."_image_repeat"][0];
43
+ $slide_data["slide".$i."_image_color"] = $metadata["sa_slide".$i."_image_color"][0];
44
+ }
45
+ $slide_data['slide_duration'] = floatval($metadata['sa_slide_duration'][0]) * 1000;
46
+ if ($slide_data['slide_duration'] == 0) {
47
+ $slide_data['slide_duration'] = 'false';
48
+ }
49
+ $slide_data['slide_transition'] = floatval($metadata['sa_slide_transition'][0]) * 1000;
50
+ $slide_data['loop_slider'] = $metadata['sa_loop_slider'][0];
51
+ if ($slide_data['loop_slider'] == '1') {
52
+ $slide_data['loop_slider'] = 'true';
53
+ } else {
54
+ $slide_data['loop_slider'] = 'false';
55
+ }
56
+ $slide_data['stop_hover'] = $metadata['sa_stop_hover'][0];
57
+ if ($slide_data['stop_hover'] == '1') {
58
+ $slide_data['stop_hover'] = 'true';
59
+ } else {
60
+ $slide_data['stop_hover'] = 'false';
61
+ }
62
+ $slide_data['nav_arrows'] = $metadata['sa_nav_arrows'][0];
63
+ if ($slide_data['nav_arrows'] == '1') {
64
+ $slide_data['nav_arrows'] = 'true';
65
+ } else {
66
+ $slide_data['nav_arrows'] = 'false';
67
+ }
68
+ $slide_data['pagination'] = $metadata['sa_pagination'][0];
69
+ if ($slide_data['pagination'] == '1') {
70
+ $slide_data['pagination'] = 'true';
71
+ } else {
72
+ $slide_data['pagination'] = 'false';
73
+ }
74
+ $slide_data['items_width1'] = $metadata['sa_items_width1'][0];
75
+ $slide_data['items_width2'] = $metadata['sa_items_width2'][0];
76
+ $slide_data['items_width3'] = $metadata['sa_items_width3'][0];
77
+ $slide_data['items_width4'] = $metadata['sa_items_width4'][0];
78
+ $slide_data['items_width5'] = $metadata['sa_items_width5'][0];
79
+ $slide_data['css_id'] = $metadata['sa_css_id'][0];
80
+ $slide_data['background_color'] = $metadata['sa_background_color'][0];
81
+ $slide_data['border_width'] = $metadata['sa_border_width'][0];
82
+ $slide_data['border_color'] = $metadata['sa_border_color'][0];
83
+ $slide_data['border_radius'] = $metadata['sa_border_radius'][0];
84
+ $slide_data['wrapper_padd_top'] = $metadata['sa_wrapper_padd_top'][0];
85
+ $slide_data['wrapper_padd_right'] = $metadata['sa_wrapper_padd_right'][0];
86
+ $slide_data['wrapper_padd_bottom'] = $metadata['sa_wrapper_padd_bottom'][0];
87
+ $slide_data['wrapper_padd_left'] = $metadata['sa_wrapper_padd_left'][0];
88
+ $slide_data['slide_min_height'] = $metadata['sa_slide_min_height'][0];
89
+ $slide_data['slide_padding_tb'] = $metadata['sa_slide_padding_tb'][0];
90
+ $slide_data['slide_padding_lr'] = $metadata['sa_slide_padding_lr'][0];
91
+
92
+ // GENERATE HTML CODE FOR THE OWL CAROUSEL SLIDER
93
+ $wrapper_style = "background:".$slide_data['background_color']."; ";
94
+ $wrapper_style .= "border:solid ".$slide_data['border_width']."px ".$slide_data['border_color']."; ";
95
+ $wrapper_style .= "border-radius:".$slide_data['border_radius']."px; ";
96
+ $wrapper_style .= "padding:".$slide_data['wrapper_padd_top']."px ";
97
+ $wrapper_style .= $slide_data['wrapper_padd_right']."px ";
98
+ $wrapper_style .= $slide_data['wrapper_padd_bottom']."px ";
99
+ $wrapper_style .= $slide_data['wrapper_padd_left']."px;";
100
+ $output .= "<div style='".esc_attr($wrapper_style)."'>\n";
101
+ if ($slide_data['pagination'] == 'true') {
102
+ $output .= "<div id='".esc_attr($slide_data['css_id'])."' class='owl-carousel owl-pagination-true'>\n";
103
+ } else {
104
+ $output .= "<div id='".esc_attr($slide_data['css_id'])."' class='owl-carousel'>\n";
105
+ }
106
+ for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
107
+ $slide_content = $slide_data["slide".$i."_content"];
108
+ $slide_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_image_id"], 'full');
109
+ $slide_image_size = $slide_data["slide".$i."_image_size"];
110
+ $slide_image_repeat = $slide_data["slide".$i."_image_repeat"];
111
+ $slide_image_color = $slide_data["slide".$i."_image_color"];
112
+ $slide_style = "padding:".$slide_data['slide_padding_tb']."% ".$slide_data['slide_padding_lr']."%; ";
113
+ $slide_style .= "min-height:".$slide_data['slide_min_height']."px; ";
114
+ $slide_style .= "background-image:url(\"".$slide_image_src[0]."\"); ";
115
+ $slide_style .= "background-size:".$slide_image_size."; ";
116
+ $slide_style .= "background-repeat:".$slide_image_repeat."; ";
117
+ $slide_style .= "background-color:".$slide_image_color."; ";
118
+ $output .= "<div style='".esc_attr($slide_style)."'>".wp_kses_post($slide_content)."</div>\n";
119
+ }
120
+ $output .= "</div>\n";
121
+ $output .= "</div>\n";
122
+
123
+ // GENERATE JQUERY CODE FOR THE OWL CAROUSEL SLIDER
124
+ if (wp_script_is('jquery', 'done')) { // Only generate JQuery code if JQuery has been loaded
125
+ $output .= "<script type='text/javascript'>\n";
126
+ $output .= " jQuery(document).ready(function() {\n";
127
+ $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').owlCarousel({\n";
128
+ $output .= " itemsCustom : [\n";
129
+ $output .= " [0,".esc_attr($slide_data['items_width1'])."],\n";
130
+ $output .= " [480,".esc_attr($slide_data['items_width2'])."],\n";
131
+ $output .= " [768,".esc_attr($slide_data['items_width3'])."],\n";
132
+ $output .= " [980,".esc_attr($slide_data['items_width4'])."],\n";
133
+ $output .= " [1200,".esc_attr($slide_data['items_width5'])."]\n";
134
+ $output .= " ],\n";
135
+ $output .= " autoPlay : ".esc_attr($slide_data['slide_duration']).",\n";
136
+ $output .= " paginationSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
137
+ $output .= " slideSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
138
+ $output .= " rewindSpeed : 1000,\n";
139
+ $output .= " rewindNav : ".esc_attr($slide_data['loop_slider']).",\n";
140
+ $output .= " stopOnHover : ".esc_attr($slide_data['stop_hover']).",\n";
141
+ $output .= " navigation : ".esc_attr($slide_data['nav_arrows']).",\n";
142
+ $output .= " navigationText : ['',''],\n";
143
+ $output .= " pagination : ".esc_attr($slide_data['pagination']).",\n";
144
+ $output .= " itemsScaleUp : false,\n";
145
+ $output .= " mouseDrag : true,\n";
146
+ $output .= " touchDrag : true\n";
147
+ $output .= " });\n";
148
+ $output .= " });\n";
149
+ $output .= "</script>\n";
150
+ }
151
+ }
152
+ }
153
+ return $output;
154
+ }
155
+ ?>
readme.txt ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Slide Anything ===
2
+ Contributors: simonpedge
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RP7JLGK6VT252
4
+ Tags: carousel, content slider, owl carousel, responsive, html slider
5
+ Requires at least: 4.0
6
+ Tested up to: 4.4
7
+ Stable tag: 1.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Create responsive carousels or sliders where the content for each slide can be anything you want - images, text, HTML, and even shortcodes.
12
+
13
+ == Description ==
14
+
15
+ Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
16
+
17
+ = Owl Carousel =
18
+
19
+ [Owl Carousel](http://owlgraphic.com/owlcarousel/) is an extremely powerful and flexible carousel/slider JQuery plugin, and it is also free to use!
20
+ Unfortunately, it's not easy to integrate Owl Carousel into a WordPress site if you are a non-developer, and requires JQuery and PHP coding skills. That is why I developed this plugin.
21
+
22
+ I use Owl Carousel a in various WordPress sites I develop, specifically where I need the additional flexibility to develop a carousel with a more complex layout, or use a layout not catered for by any existing carousel plugin product.
23
+
24
+ Owl Carousel has been tested in following browsers/devices: Chrome, Firefox, Opera, IE7/8/10/11, iPad Safari, iPod4 Safari, Nexus 7 Chrome, Galaxy S4, Nokia 8s and Windows 8.
25
+
26
+ == Installation ==
27
+
28
+ 1. Upload the entire `slide-anything` folder to the `/wp-content/plugins/` directory.
29
+ 1. Activate the plugin through the 'Plugins' menu within the WordPress Dashboard.
30
+
31
+ You will now see the `Sliders` menu in your WordPress admin panel.
32
+
33
+ == Frequently Asked Questions ==
34
+
35
+ = How do I get the `Slide Anything` sliders to display within my WordPress page or post? =
36
+
37
+ When editing your slider within the WordPress Dashboard, You will see a box labeled `Slider Shortcode`.
38
+ Click the `Copy to Clipboard` button within this box to copy the slider shortcode to your clipboard.
39
+ Paste this copied shortcode into the page or post where you would like your slider to appear.
40
+
41
+ = When creating sliders, what is the function of the `Items Displayed` box? =
42
+
43
+ Here you can define the number of slides that are displayed onscreen at a time, depending on the device or window-size of the browser you are using.
44
+ These setting are all initially set to `1` by default, so a traditional slider will be displayed on all devices.
45
+ When these are set to values greater than `1`, a carousel will be displayed, for example you may want to display a carousel with 4 slides visible on desktop devices, 3 slides visible on tables and only 2 slides visible on mobile phones.
46
+
47
+ == Screenshots ==
48
+
49
+ 1. The Create/Edit slider page within the WordPress Dashboard - this is where you define the settings and create the slides for your `Slide Anything` slider or carousel.
50
+ 2. How a carousel created using `Slide Anything` appears within a Website page.
51
+
52
+ == Changelog ==
53
+
54
+ = 1.0 =
55
+ * Initial release of this plugin.
56
+
57
+ == Upgrade Notice ==
58
+
59
+ = 1.0 =
60
+ * Initial release of this plugin.
slide-anything.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Slide Anything
4
+ * Plugin URI: https://wordpress.org/support/plugin/slide-anything
5
+ * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
+ * Author: Simon Edge
7
+ * Version: 1.0
8
+ * License: GPLv2 or later
9
+ */
10
+
11
+ if (!defined('ABSPATH')) exit; // EXIT IF ACCESSED DIRECTLY
12
+
13
+ // SET CONSTANT FOR PLUGIN PATH
14
+ define('PLUGIN_PATH', plugins_url('/', __FILE__));
15
+
16
+ require 'php/slide-anything-admin.php';
17
+ require 'php/slide-anything-frontend.php';
18
+
19
+ /* ##### PLUGIN ACTIVATION HOOK ##### */
20
+ register_activation_hook(__FILE__, 'cpt_slider_plugin_activation' );
21
+
22
+ /* ##### ADD ACTION HOOKS & FILTERS FOR PLUGIN ##### */
23
+ add_action('admin_enqueue_scripts', 'cpt_register_admin_scripts');
24
+ add_action('init', 'cpt_slider_register');
25
+ add_action('post_row_actions', 'cpt_slider_row_actions', 10, 2);
26
+ add_action('add_meta_boxes', 'cpt_slider_add_meta_boxes');
27
+ add_action('save_post', 'cpt_slider_save_postdata');
28
+ add_filter('manage_sa_slider_posts_columns', 'cpt_slider_modify_columns');
29
+ add_filter('manage_sa_slider_posts_custom_column', 'cpt_slider_custom_column_content');
30
+
31
+ ?>
spectrum/spectrum.css ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***
2
+ Spectrum Colorpicker v1.8.0
3
+ https://github.com/bgrins/spectrum
4
+ Author: Brian Grinstead
5
+ License: MIT
6
+ ***/
7
+
8
+ .sp-container {
9
+ position:absolute;
10
+ top:0;
11
+ left:0;
12
+ display:inline-block;
13
+ *display: inline;
14
+ *zoom: 1;
15
+ /* https://github.com/bgrins/spectrum/issues/40 */
16
+ z-index: 9999994;
17
+ overflow: hidden;
18
+ }
19
+ .sp-container.sp-flat {
20
+ position: relative;
21
+ }
22
+
23
+ /* Fix for * { box-sizing: border-box; } */
24
+ .sp-container,
25
+ .sp-container * {
26
+ -webkit-box-sizing: content-box;
27
+ -moz-box-sizing: content-box;
28
+ box-sizing: content-box;
29
+ }
30
+
31
+ /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
32
+ .sp-top {
33
+ position:relative;
34
+ width: 100%;
35
+ display:inline-block;
36
+ }
37
+ .sp-top-inner {
38
+ position:absolute;
39
+ top:0;
40
+ left:0;
41
+ bottom:0;
42
+ right:0;
43
+ }
44
+ .sp-color {
45
+ position: absolute;
46
+ top:0;
47
+ left:0;
48
+ bottom:0;
49
+ right:20%;
50
+ }
51
+ .sp-hue {
52
+ position: absolute;
53
+ top:0;
54
+ right:0;
55
+ bottom:0;
56
+ left:84%;
57
+ height: 100%;
58
+ }
59
+
60
+ .sp-clear-enabled .sp-hue {
61
+ top:33px;
62
+ height: 77.5%;
63
+ }
64
+
65
+ .sp-fill {
66
+ padding-top: 80%;
67
+ }
68
+ .sp-sat, .sp-val {
69
+ position: absolute;
70
+ top:0;
71
+ left:0;
72
+ right:0;
73
+ bottom:0;
74
+ }
75
+
76
+ .sp-alpha-enabled .sp-top {
77
+ margin-bottom: 18px;
78
+ }
79
+ .sp-alpha-enabled .sp-alpha {
80
+ display: block;
81
+ }
82
+ .sp-alpha-handle {
83
+ position:absolute;
84
+ top:-4px;
85
+ bottom: -4px;
86
+ width: 6px;
87
+ left: 50%;
88
+ cursor: pointer;
89
+ border: 1px solid black;
90
+ background: white;
91
+ opacity: .8;
92
+ }
93
+ .sp-alpha {
94
+ display: none;
95
+ position: absolute;
96
+ bottom: -14px;
97
+ right: 0;
98
+ left: 0;
99
+ height: 8px;
100
+ }
101
+ .sp-alpha-inner {
102
+ border: solid 1px #333;
103
+ }
104
+
105
+ .sp-clear {
106
+ display: none;
107
+ }
108
+
109
+ .sp-clear.sp-clear-display {
110
+ background-position: center;
111
+ }
112
+
113
+ .sp-clear-enabled .sp-clear {
114
+ display: block;
115
+ position:absolute;
116
+ top:0px;
117
+ right:0;
118
+ bottom:0;
119
+ left:84%;
120
+ height: 28px;
121
+ }
122
+
123
+ /* Don't allow text selection */
124
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
125
+ -webkit-user-select:none;
126
+ -moz-user-select: -moz-none;
127
+ -o-user-select:none;
128
+ user-select: none;
129
+ }
130
+
131
+ .sp-container.sp-input-disabled .sp-input-container {
132
+ display: none;
133
+ }
134
+ .sp-container.sp-buttons-disabled .sp-button-container {
135
+ display: none;
136
+ }
137
+ .sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
138
+ display: none;
139
+ }
140
+ .sp-palette-only .sp-picker-container {
141
+ display: none;
142
+ }
143
+ .sp-palette-disabled .sp-palette-container {
144
+ display: none;
145
+ }
146
+
147
+ .sp-initial-disabled .sp-initial {
148
+ display: none;
149
+ }
150
+
151
+
152
+ /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
153
+ .sp-sat {
154
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
155
+ background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
156
+ background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
157
+ background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
158
+ background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
159
+ background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
160
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
161
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
162
+ }
163
+ .sp-val {
164
+ background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
165
+ background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
166
+ background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
167
+ background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
168
+ background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
169
+ background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
170
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
171
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
172
+ }
173
+
174
+ .sp-hue {
175
+ background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
176
+ background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
177
+ background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
178
+ background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
179
+ background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
180
+ background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
181
+ }
182
+
183
+ /* IE filters do not support multiple color stops.
184
+ Generate 6 divs, line them up, and do two color gradients for each.
185
+ Yes, really.
186
+ */
187
+ .sp-1 {
188
+ height:17%;
189
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
190
+ }
191
+ .sp-2 {
192
+ height:16%;
193
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
194
+ }
195
+ .sp-3 {
196
+ height:17%;
197
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
198
+ }
199
+ .sp-4 {
200
+ height:17%;
201
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
202
+ }
203
+ .sp-5 {
204
+ height:16%;
205
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
206
+ }
207
+ .sp-6 {
208
+ height:17%;
209
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
210
+ }
211
+
212
+ .sp-hidden {
213
+ display: none !important;
214
+ }
215
+
216
+ /* Clearfix hack */
217
+ .sp-cf:before, .sp-cf:after { content: ""; display: table; }
218
+ .sp-cf:after { clear: both; }
219
+ .sp-cf { *zoom: 1; }
220
+
221
+ /* Mobile devices, make hue slider bigger so it is easier to slide */
222
+ @media (max-device-width: 480px) {
223
+ .sp-color { right: 40%; }
224
+ .sp-hue { left: 63%; }
225
+ .sp-fill { padding-top: 60%; }
226
+ }
227
+ .sp-dragger {
228
+ border-radius: 5px;
229
+ height: 5px;
230
+ width: 5px;
231
+ border: 1px solid #fff;
232
+ background: #000;
233
+ cursor: pointer;
234
+ position:absolute;
235
+ top:0;
236
+ left: 0;
237
+ }
238
+ .sp-slider {
239
+ position: absolute;
240
+ top:0;
241
+ cursor:pointer;
242
+ height: 3px;
243
+ left: -1px;
244
+ right: -1px;
245
+ border: 1px solid #000;
246
+ background: white;
247
+ opacity: .8;
248
+ }
249
+
250
+ /*
251
+ Theme authors:
252
+ Here are the basic themeable display options (colors, fonts, global widths).
253
+ See http://bgrins.github.io/spectrum/themes/ for instructions.
254
+ */
255
+
256
+ .sp-container {
257
+ border-radius: 0;
258
+ background-color: #ECECEC;
259
+ border: solid 1px #f0c49B;
260
+ padding: 0;
261
+ }
262
+ .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
263
+ font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
264
+ -webkit-box-sizing: border-box;
265
+ -moz-box-sizing: border-box;
266
+ -ms-box-sizing: border-box;
267
+ box-sizing: border-box;
268
+ }
269
+ .sp-top {
270
+ margin-bottom: 3px;
271
+ }
272
+ .sp-color, .sp-hue, .sp-clear {
273
+ border: solid 1px #666;
274
+ }
275
+
276
+ /* Input */
277
+ .sp-input-container {
278
+ float:right;
279
+ width: 100px;
280
+ margin-bottom: 4px;
281
+ }
282
+ .sp-initial-disabled .sp-input-container {
283
+ width: 100%;
284
+ }
285
+ .sp-input {
286
+ font-size: 12px !important;
287
+ border: 1px inset;
288
+ padding: 4px 5px;
289
+ margin: 0;
290
+ width: 100%;
291
+ background:transparent;
292
+ border-radius: 3px;
293
+ color: #222;
294
+ }
295
+ .sp-input:focus {
296
+ border: 1px solid orange;
297
+ }
298
+ .sp-input.sp-validation-error {
299
+ border: 1px solid red;
300
+ background: #fdd;
301
+ }
302
+ .sp-picker-container , .sp-palette-container {
303
+ float:left;
304
+ position: relative;
305
+ padding: 10px;
306
+ padding-bottom: 300px;
307
+ margin-bottom: -290px;
308
+ }
309
+ .sp-picker-container {
310
+ width: 172px;
311
+ border-left: solid 1px #fff;
312
+ }
313
+
314
+ /* Palettes */
315
+ .sp-palette-container {
316
+ border-right: solid 1px #ccc;
317
+ }
318
+
319
+ .sp-palette-only .sp-palette-container {
320
+ border: 0;
321
+ }
322
+
323
+ .sp-palette .sp-thumb-el {
324
+ display: block;
325
+ position:relative;
326
+ float:left;
327
+ width: 24px;
328
+ height: 15px;
329
+ margin: 3px;
330
+ cursor: pointer;
331
+ border:solid 2px transparent;
332
+ }
333
+ .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
334
+ border-color: orange;
335
+ }
336
+ .sp-thumb-el {
337
+ position:relative;
338
+ }
339
+
340
+ /* Initial */
341
+ .sp-initial {
342
+ float: left;
343
+ border: solid 1px #333;
344
+ }
345
+ .sp-initial span {
346
+ width: 30px;
347
+ height: 25px;
348
+ border:none;
349
+ display:block;
350
+ float:left;
351
+ margin:0;
352
+ }
353
+
354
+ .sp-initial .sp-clear-display {
355
+ background-position: center;
356
+ }
357
+
358
+ /* Buttons */
359
+ .sp-palette-button-container,
360
+ .sp-button-container {
361
+ float: right;
362
+ }
363
+
364
+ /* Replacer (the little preview div that shows up instead of the <input>) */
365
+ .sp-replacer {
366
+ margin:0;
367
+ overflow:hidden;
368
+ cursor:pointer;
369
+ padding: 4px;
370
+ display:inline-block;
371
+ *zoom: 1;
372
+ *display: inline;
373
+ border: solid 1px #91765d;
374
+ background: #eee;
375
+ color: #333;
376
+ vertical-align: middle;
377
+ }
378
+ .sp-replacer:hover, .sp-replacer.sp-active {
379
+ border-color: #F0C49B;
380
+ color: #111;
381
+ }
382
+ .sp-replacer.sp-disabled {
383
+ cursor:default;
384
+ border-color: silver;
385
+ color: silver;
386
+ }
387
+ .sp-dd {
388
+ padding: 2px 0;
389
+ height: 16px;
390
+ line-height: 16px;
391
+ float:left;
392
+ font-size:10px;
393
+ }
394
+ .sp-preview {
395
+ position:relative;
396
+ width:25px;
397
+ height: 20px;
398
+ border: solid 1px #222;
399
+ margin-right: 5px;
400
+ float:left;
401
+ z-index: 0;
402
+ }
403
+
404
+ .sp-palette {
405
+ *width: 220px;
406
+ max-width: 220px;
407
+ }
408
+ .sp-palette .sp-thumb-el {
409
+ width:16px;
410
+ height: 16px;
411
+ margin:2px 1px;
412
+ border: solid 1px #d0d0d0;
413
+ }
414
+
415
+ .sp-container {
416
+ padding-bottom:0;
417
+ }
418
+
419
+
420
+ /* Buttons: http://hellohappy.org/css3-buttons/ */
421
+ .sp-container button {
422
+ background-color: #eeeeee;
423
+ background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
424
+ background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
425
+ background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
426
+ background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
427
+ background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
428
+ border: 1px solid #ccc;
429
+ border-bottom: 1px solid #bbb;
430
+ border-radius: 3px;
431
+ color: #333;
432
+ font-size: 14px;
433
+ line-height: 1;
434
+ padding: 5px 4px;
435
+ text-align: center;
436
+ text-shadow: 0 1px 0 #eee;
437
+ vertical-align: middle;
438
+ }
439
+ .sp-container button:hover {
440
+ background-color: #dddddd;
441
+ background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
442
+ background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
443
+ background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
444
+ background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
445
+ background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
446
+ border: 1px solid #bbb;
447
+ border-bottom: 1px solid #999;
448
+ cursor: pointer;
449
+ text-shadow: 0 1px 0 #ddd;
450
+ }
451
+ .sp-container button:active {
452
+ border: 1px solid #aaa;
453
+ border-bottom: 1px solid #888;
454
+ -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
455
+ -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
456
+ -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
457
+ -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
458
+ box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
459
+ }
460
+ .sp-cancel {
461
+ font-size: 11px;
462
+ color: #d93f3f !important;
463
+ margin:0;
464
+ padding:2px;
465
+ margin-right: 5px;
466
+ vertical-align: middle;
467
+ text-decoration:none;
468
+
469
+ }
470
+ .sp-cancel:hover {
471
+ color: #d93f3f !important;
472
+ text-decoration: underline;
473
+ }
474
+
475
+
476
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active {
477
+ border-color: #000;
478
+ }
479
+
480
+ .sp-preview, .sp-alpha, .sp-thumb-el {
481
+ position:relative;
482
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
483
+ }
484
+ .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
485
+ display:block;
486
+ position:absolute;
487
+ top:0;left:0;bottom:0;right:0;
488
+ }
489
+
490
+ .sp-palette .sp-thumb-inner {
491
+ background-position: 50% 50%;
492
+ background-repeat: no-repeat;
493
+ }
494
+
495
+ .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
496
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
497
+ }
498
+
499
+ .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
500
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
501
+ }
502
+
503
+ .sp-clear-display {
504
+ background-repeat:no-repeat;
505
+ background-position: center;
506
+ background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
507
+ }
spectrum/spectrum.js ADDED
@@ -0,0 +1,2323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Spectrum Colorpicker v1.8.0
2
+ // https://github.com/bgrins/spectrum
3
+ // Author: Brian Grinstead
4
+ // License: MIT
5
+
6
+ (function (factory) {
7
+ "use strict";
8
+
9
+ if (typeof define === 'function' && define.amd) { // AMD
10
+ define(['jquery'], factory);
11
+ }
12
+ else if (typeof exports == "object" && typeof module == "object") { // CommonJS
13
+ module.exports = factory(require('jquery'));
14
+ }
15
+ else { // Browser
16
+ factory(jQuery);
17
+ }
18
+ })(function($, undefined) {
19
+ "use strict";
20
+
21
+ var defaultOpts = {
22
+
23
+ // Callbacks
24
+ beforeShow: noop,
25
+ move: noop,
26
+ change: noop,
27
+ show: noop,
28
+ hide: noop,
29
+
30
+ // Options
31
+ color: false,
32
+ flat: false,
33
+ showInput: false,
34
+ allowEmpty: false,
35
+ showButtons: true,
36
+ clickoutFiresChange: true,
37
+ showInitial: false,
38
+ showPalette: false,
39
+ showPaletteOnly: false,
40
+ hideAfterPaletteSelect: false,
41
+ togglePaletteOnly: false,
42
+ showSelectionPalette: true,
43
+ localStorageKey: false,
44
+ appendTo: "body",
45
+ maxSelectionSize: 7,
46
+ cancelText: "cancel",
47
+ chooseText: "choose",
48
+ togglePaletteMoreText: "more",
49
+ togglePaletteLessText: "less",
50
+ clearText: "Clear Color Selection",
51
+ noColorSelectedText: "No Color Selected",
52
+ preferredFormat: false,
53
+ className: "", // Deprecated - use containerClassName and replacerClassName instead.
54
+ containerClassName: "",
55
+ replacerClassName: "",
56
+ showAlpha: false,
57
+ theme: "sp-light",
58
+ palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
59
+ selectionPalette: [],
60
+ disabled: false,
61
+ offset: null
62
+ },
63
+ spectrums = [],
64
+ IE = !!/msie/i.exec( window.navigator.userAgent ),
65
+ rgbaSupport = (function() {
66
+ function contains( str, substr ) {
67
+ return !!~('' + str).indexOf(substr);
68
+ }
69
+
70
+ var elem = document.createElement('div');
71
+ var style = elem.style;
72
+ style.cssText = 'background-color:rgba(0,0,0,.5)';
73
+ return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
74
+ })(),
75
+ replaceInput = [
76
+ "<div class='sp-replacer'>",
77
+ "<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
78
+ "<div class='sp-dd'>&#9660;</div>",
79
+ "</div>"
80
+ ].join(''),
81
+ markup = (function () {
82
+
83
+ // IE does not support gradients with multiple stops, so we need to simulate
84
+ // that for the rainbow slider with 8 divs that each have a single gradient
85
+ var gradientFix = "";
86
+ if (IE) {
87
+ for (var i = 1; i <= 6; i++) {
88
+ gradientFix += "<div class='sp-" + i + "'></div>";
89
+ }
90
+ }
91
+
92
+ return [
93
+ "<div class='sp-container sp-hidden'>",
94
+ "<div class='sp-palette-container'>",
95
+ "<div class='sp-palette sp-thumb sp-cf'></div>",
96
+ "<div class='sp-palette-button-container sp-cf'>",
97
+ "<button type='button' class='sp-palette-toggle'></button>",
98
+ "</div>",
99
+ "</div>",
100
+ "<div class='sp-picker-container'>",
101
+ "<div class='sp-top sp-cf'>",
102
+ "<div class='sp-fill'></div>",
103
+ "<div class='sp-top-inner'>",
104
+ "<div class='sp-color'>",
105
+ "<div class='sp-sat'>",
106
+ "<div class='sp-val'>",
107
+ "<div class='sp-dragger'></div>",
108
+ "</div>",
109
+ "</div>",
110
+ "</div>",
111
+ "<div class='sp-clear sp-clear-display'>",
112
+ "</div>",
113
+ "<div class='sp-hue'>",
114
+ "<div class='sp-slider'></div>",
115
+ gradientFix,
116
+ "</div>",
117
+ "</div>",
118
+ "<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
119
+ "</div>",
120
+ "<div class='sp-input-container sp-cf'>",
121
+ "<input class='sp-input' type='text' spellcheck='false' />",
122
+ "</div>",
123
+ "<div class='sp-initial sp-thumb sp-cf'></div>",
124
+ "<div class='sp-button-container sp-cf'>",
125
+ "<a class='sp-cancel' href='#'></a>",
126
+ "<button type='button' class='sp-choose'></button>",
127
+ "</div>",
128
+ "</div>",
129
+ "</div>"
130
+ ].join("");
131
+ })();
132
+
133
+ function paletteTemplate (p, color, className, opts) {
134
+ var html = [];
135
+ for (var i = 0; i < p.length; i++) {
136
+ var current = p[i];
137
+ if(current) {
138
+ var tiny = tinycolor(current);
139
+ var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
140
+ c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
141
+ var formattedString = tiny.toString(opts.preferredFormat || "rgb");
142
+ var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
143
+ html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
144
+ } else {
145
+ var cls = 'sp-clear-display';
146
+ html.push($('<div />')
147
+ .append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
148
+ .attr('title', opts.noColorSelectedText)
149
+ )
150
+ .html()
151
+ );
152
+ }
153
+ }
154
+ return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
155
+ }
156
+
157
+ function hideAll() {
158
+ for (var i = 0; i < spectrums.length; i++) {
159
+ if (spectrums[i]) {
160
+ spectrums[i].hide();
161
+ }
162
+ }
163
+ }
164
+
165
+ function instanceOptions(o, callbackContext) {
166
+ var opts = $.extend({}, defaultOpts, o);
167
+ opts.callbacks = {
168
+ 'move': bind(opts.move, callbackContext),
169
+ 'change': bind(opts.change, callbackContext),
170
+ 'show': bind(opts.show, callbackContext),
171
+ 'hide': bind(opts.hide, callbackContext),
172
+ 'beforeShow': bind(opts.beforeShow, callbackContext)
173
+ };
174
+
175
+ return opts;
176
+ }
177
+
178
+ function spectrum(element, o) {
179
+
180
+ var opts = instanceOptions(o, element),
181
+ flat = opts.flat,
182
+ showSelectionPalette = opts.showSelectionPalette,
183
+ localStorageKey = opts.localStorageKey,
184
+ theme = opts.theme,
185
+ callbacks = opts.callbacks,
186
+ resize = throttle(reflow, 10),
187
+ visible = false,
188
+ isDragging = false,
189
+ dragWidth = 0,
190
+ dragHeight = 0,
191
+ dragHelperHeight = 0,
192
+ slideHeight = 0,
193
+ slideWidth = 0,
194
+ alphaWidth = 0,
195
+ alphaSlideHelperWidth = 0,
196
+ slideHelperHeight = 0,
197
+ currentHue = 0,
198
+ currentSaturation = 0,
199
+ currentValue = 0,
200
+ currentAlpha = 1,
201
+ palette = [],
202
+ paletteArray = [],
203
+ paletteLookup = {},
204
+ selectionPalette = opts.selectionPalette.slice(0),
205
+ maxSelectionSize = opts.maxSelectionSize,
206
+ draggingClass = "sp-dragging",
207
+ shiftMovementDirection = null;
208
+
209
+ var doc = element.ownerDocument,
210
+ body = doc.body,
211
+ boundElement = $(element),
212
+ disabled = false,
213
+ container = $(markup, doc).addClass(theme),
214
+ pickerContainer = container.find(".sp-picker-container"),
215
+ dragger = container.find(".sp-color"),
216
+ dragHelper = container.find(".sp-dragger"),
217
+ slider = container.find(".sp-hue"),
218
+ slideHelper = container.find(".sp-slider"),
219
+ alphaSliderInner = container.find(".sp-alpha-inner"),
220
+ alphaSlider = container.find(".sp-alpha"),
221
+ alphaSlideHelper = container.find(".sp-alpha-handle"),
222
+ textInput = container.find(".sp-input"),
223
+ paletteContainer = container.find(".sp-palette"),
224
+ initialColorContainer = container.find(".sp-initial"),
225
+ cancelButton = container.find(".sp-cancel"),
226
+ clearButton = container.find(".sp-clear"),
227
+ chooseButton = container.find(".sp-choose"),
228
+ toggleButton = container.find(".sp-palette-toggle"),
229
+ isInput = boundElement.is("input"),
230
+ isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(),
231
+ shouldReplace = isInput && !flat,
232
+ replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
233
+ offsetElement = (shouldReplace) ? replacer : boundElement,
234
+ previewElement = replacer.find(".sp-preview-inner"),
235
+ initialColor = opts.color || (isInput && boundElement.val()),
236
+ colorOnShow = false,
237
+ currentPreferredFormat = opts.preferredFormat,
238
+ clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
239
+ isEmpty = !initialColor,
240
+ allowEmpty = opts.allowEmpty && !isInputTypeColor;
241
+
242
+ function applyOptions() {
243
+
244
+ if (opts.showPaletteOnly) {
245
+ opts.showPalette = true;
246
+ }
247
+
248
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
249
+
250
+ if (opts.palette) {
251
+ palette = opts.palette.slice(0);
252
+ paletteArray = $.isArray(palette[0]) ? palette : [palette];
253
+ paletteLookup = {};
254
+ for (var i = 0; i < paletteArray.length; i++) {
255
+ for (var j = 0; j < paletteArray[i].length; j++) {
256
+ var rgb = tinycolor(paletteArray[i][j]).toRgbString();
257
+ paletteLookup[rgb] = true;
258
+ }
259
+ }
260
+ }
261
+
262
+ container.toggleClass("sp-flat", flat);
263
+ container.toggleClass("sp-input-disabled", !opts.showInput);
264
+ container.toggleClass("sp-alpha-enabled", opts.showAlpha);
265
+ container.toggleClass("sp-clear-enabled", allowEmpty);
266
+ container.toggleClass("sp-buttons-disabled", !opts.showButtons);
267
+ container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);
268
+ container.toggleClass("sp-palette-disabled", !opts.showPalette);
269
+ container.toggleClass("sp-palette-only", opts.showPaletteOnly);
270
+ container.toggleClass("sp-initial-disabled", !opts.showInitial);
271
+ container.addClass(opts.className).addClass(opts.containerClassName);
272
+
273
+ reflow();
274
+ }
275
+
276
+ function initialize() {
277
+
278
+ if (IE) {
279
+ container.find("*:not(input)").attr("unselectable", "on");
280
+ }
281
+
282
+ applyOptions();
283
+
284
+ if (shouldReplace) {
285
+ boundElement.after(replacer).hide();
286
+ }
287
+
288
+ if (!allowEmpty) {
289
+ clearButton.hide();
290
+ }
291
+
292
+ if (flat) {
293
+ boundElement.after(container).hide();
294
+ }
295
+ else {
296
+
297
+ var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
298
+ if (appendTo.length !== 1) {
299
+ appendTo = $("body");
300
+ }
301
+
302
+ appendTo.append(container);
303
+ }
304
+
305
+ updateSelectionPaletteFromStorage();
306
+
307
+ offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
308
+ if (!disabled) {
309
+ toggle();
310
+ }
311
+
312
+ e.stopPropagation();
313
+
314
+ if (!$(e.target).is("input")) {
315
+ e.preventDefault();
316
+ }
317
+ });
318
+
319
+ if(boundElement.is(":disabled") || (opts.disabled === true)) {
320
+ disable();
321
+ }
322
+
323
+ // Prevent clicks from bubbling up to document. This would cause it to be hidden.
324
+ container.click(stopPropagation);
325
+
326
+ // Handle user typed input
327
+ textInput.change(setFromTextInput);
328
+ textInput.bind("paste", function () {
329
+ setTimeout(setFromTextInput, 1);
330
+ });
331
+ textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
332
+
333
+ cancelButton.text(opts.cancelText);
334
+ cancelButton.bind("click.spectrum", function (e) {
335
+ e.stopPropagation();
336
+ e.preventDefault();
337
+ revert();
338
+ hide();
339
+ });
340
+
341
+ clearButton.attr("title", opts.clearText);
342
+ clearButton.bind("click.spectrum", function (e) {
343
+ e.stopPropagation();
344
+ e.preventDefault();
345
+ isEmpty = true;
346
+ move();
347
+
348
+ if(flat) {
349
+ //for the flat style, this is a change event
350
+ updateOriginalInput(true);
351
+ }
352
+ });
353
+
354
+ chooseButton.text(opts.chooseText);
355
+ chooseButton.bind("click.spectrum", function (e) {
356
+ e.stopPropagation();
357
+ e.preventDefault();
358
+
359
+ if (IE && textInput.is(":focus")) {
360
+ textInput.trigger('change');
361
+ }
362
+
363
+ if (isValid()) {
364
+ updateOriginalInput(true);
365
+ hide();
366
+ }
367
+ });
368
+
369
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
370
+ toggleButton.bind("click.spectrum", function (e) {
371
+ e.stopPropagation();
372
+ e.preventDefault();
373
+
374
+ opts.showPaletteOnly = !opts.showPaletteOnly;
375
+
376
+ // To make sure the Picker area is drawn on the right, next to the
377
+ // Palette area (and not below the palette), first move the Palette
378
+ // to the left to make space for the picker, plus 5px extra.
379
+ // The 'applyOptions' function puts the whole container back into place
380
+ // and takes care of the button-text and the sp-palette-only CSS class.
381
+ if (!opts.showPaletteOnly && !flat) {
382
+ container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));
383
+ }
384
+ applyOptions();
385
+ });
386
+
387
+ draggable(alphaSlider, function (dragX, dragY, e) {
388
+ currentAlpha = (dragX / alphaWidth);
389
+ isEmpty = false;
390
+ if (e.shiftKey) {
391
+ currentAlpha = Math.round(currentAlpha * 10) / 10;
392
+ }
393
+
394
+ move();
395
+ }, dragStart, dragStop);
396
+
397
+ draggable(slider, function (dragX, dragY) {
398
+ currentHue = parseFloat(dragY / slideHeight);
399
+ isEmpty = false;
400
+ if (!opts.showAlpha) {
401
+ currentAlpha = 1;
402
+ }
403
+ move();
404
+ }, dragStart, dragStop);
405
+
406
+ draggable(dragger, function (dragX, dragY, e) {
407
+
408
+ // shift+drag should snap the movement to either the x or y axis.
409
+ if (!e.shiftKey) {
410
+ shiftMovementDirection = null;
411
+ }
412
+ else if (!shiftMovementDirection) {
413
+ var oldDragX = currentSaturation * dragWidth;
414
+ var oldDragY = dragHeight - (currentValue * dragHeight);
415
+ var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
416
+
417
+ shiftMovementDirection = furtherFromX ? "x" : "y";
418
+ }
419
+
420
+ var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
421
+ var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
422
+
423
+ if (setSaturation) {
424
+ currentSaturation = parseFloat(dragX / dragWidth);
425
+ }
426
+ if (setValue) {
427
+ currentValue = parseFloat((dragHeight - dragY) / dragHeight);
428
+ }
429
+
430
+ isEmpty = false;
431
+ if (!opts.showAlpha) {
432
+ currentAlpha = 1;
433
+ }
434
+
435
+ move();
436
+
437
+ }, dragStart, dragStop);
438
+
439
+ if (!!initialColor) {
440
+ set(initialColor);
441
+
442
+ // In case color was black - update the preview UI and set the format
443
+ // since the set function will not run (default color is black).
444
+ updateUI();
445
+ currentPreferredFormat = opts.preferredFormat || tinycolor(initialColor).format;
446
+
447
+ addColorToSelectionPalette(initialColor);
448
+ }
449
+ else {
450
+ updateUI();
451
+ }
452
+
453
+ if (flat) {
454
+ show();
455
+ }
456
+
457
+ function paletteElementClick(e) {
458
+ if (e.data && e.data.ignore) {
459
+ set($(e.target).closest(".sp-thumb-el").data("color"));
460
+ move();
461
+ }
462
+ else {
463
+ set($(e.target).closest(".sp-thumb-el").data("color"));
464
+ move();
465
+ updateOriginalInput(true);
466
+ if (opts.hideAfterPaletteSelect) {
467
+ hide();
468
+ }
469
+ }
470
+
471
+ return false;
472
+ }
473
+
474
+ var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
475
+ paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
476
+ initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
477
+ }
478
+
479
+ function updateSelectionPaletteFromStorage() {
480
+
481
+ if (localStorageKey && window.localStorage) {
482
+
483
+ // Migrate old palettes over to new format. May want to remove this eventually.
484
+ try {
485
+ var oldPalette = window.localStorage[localStorageKey].split(",#");
486
+ if (oldPalette.length > 1) {
487
+ delete window.localStorage[localStorageKey];
488
+ $.each(oldPalette, function(i, c) {
489
+ addColorToSelectionPalette(c);
490
+ });
491
+ }
492
+ }
493
+ catch(e) { }
494
+
495
+ try {
496
+ selectionPalette = window.localStorage[localStorageKey].split(";");
497
+ }
498
+ catch (e) { }
499
+ }
500
+ }
501
+
502
+ function addColorToSelectionPalette(color) {
503
+ if (showSelectionPalette) {
504
+ var rgb = tinycolor(color).toRgbString();
505
+ if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
506
+ selectionPalette.push(rgb);
507
+ while(selectionPalette.length > maxSelectionSize) {
508
+ selectionPalette.shift();
509
+ }
510
+ }
511
+
512
+ if (localStorageKey && window.localStorage) {
513
+ try {
514
+ window.localStorage[localStorageKey] = selectionPalette.join(";");
515
+ }
516
+ catch(e) { }
517
+ }
518
+ }
519
+ }
520
+
521
+ function getUniqueSelectionPalette() {
522
+ var unique = [];
523
+ if (opts.showPalette) {
524
+ for (var i = 0; i < selectionPalette.length; i++) {
525
+ var rgb = tinycolor(selectionPalette[i]).toRgbString();
526
+
527
+ if (!paletteLookup[rgb]) {
528
+ unique.push(selectionPalette[i]);
529
+ }
530
+ }
531
+ }
532
+
533
+ return unique.reverse().slice(0, opts.maxSelectionSize);
534
+ }
535
+
536
+ function drawPalette() {
537
+
538
+ var currentColor = get();
539
+
540
+ var html = $.map(paletteArray, function (palette, i) {
541
+ return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
542
+ });
543
+
544
+ updateSelectionPaletteFromStorage();
545
+
546
+ if (selectionPalette) {
547
+ html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
548
+ }
549
+
550
+ paletteContainer.html(html.join(""));
551
+ }
552
+
553
+ function drawInitial() {
554
+ if (opts.showInitial) {
555
+ var initial = colorOnShow;
556
+ var current = get();
557
+ initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
558
+ }
559
+ }
560
+
561
+ function dragStart() {
562
+ if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
563
+ reflow();
564
+ }
565
+ isDragging = true;
566
+ container.addClass(draggingClass);
567
+ shiftMovementDirection = null;
568
+ boundElement.trigger('dragstart.spectrum', [ get() ]);
569
+ }
570
+
571
+ function dragStop() {
572
+ isDragging = false;
573
+ container.removeClass(draggingClass);
574
+ boundElement.trigger('dragstop.spectrum', [ get() ]);
575
+ }
576
+
577
+ function setFromTextInput() {
578
+
579
+ var value = textInput.val();
580
+
581
+ if ((value === null || value === "") && allowEmpty) {
582
+ set(null);
583
+ updateOriginalInput(true);
584
+ }
585
+ else {
586
+ var tiny = tinycolor(value);
587
+ if (tiny.isValid()) {
588
+ set(tiny);
589
+ updateOriginalInput(true);
590
+ }
591
+ else {
592
+ textInput.addClass("sp-validation-error");
593
+ }
594
+ }
595
+ }
596
+
597
+ function toggle() {
598
+ if (visible) {
599
+ hide();
600
+ }
601
+ else {
602
+ show();
603
+ }
604
+ }
605
+
606
+ function show() {
607
+ var event = $.Event('beforeShow.spectrum');
608
+
609
+ if (visible) {
610
+ reflow();
611
+ return;
612
+ }
613
+
614
+ boundElement.trigger(event, [ get() ]);
615
+
616
+ if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
617
+ return;
618
+ }
619
+
620
+ hideAll();
621
+ visible = true;
622
+
623
+ $(doc).bind("keydown.spectrum", onkeydown);
624
+ $(doc).bind("click.spectrum", clickout);
625
+ $(window).bind("resize.spectrum", resize);
626
+ replacer.addClass("sp-active");
627
+ container.removeClass("sp-hidden");
628
+
629
+ reflow();
630
+ updateUI();
631
+
632
+ colorOnShow = get();
633
+
634
+ drawInitial();
635
+ callbacks.show(colorOnShow);
636
+ boundElement.trigger('show.spectrum', [ colorOnShow ]);
637
+ }
638
+
639
+ function onkeydown(e) {
640
+ // Close on ESC
641
+ if (e.keyCode === 27) {
642
+ hide();
643
+ }
644
+ }
645
+
646
+ function clickout(e) {
647
+ // Return on right click.
648
+ if (e.button == 2) { return; }
649
+
650
+ // If a drag event was happening during the mouseup, don't hide
651
+ // on click.
652
+ if (isDragging) { return; }
653
+
654
+ if (clickoutFiresChange) {
655
+ updateOriginalInput(true);
656
+ }
657
+ else {
658
+ revert();
659
+ }
660
+ hide();
661
+ }
662
+
663
+ function hide() {
664
+ // Return if hiding is unnecessary
665
+ if (!visible || flat) { return; }
666
+ visible = false;
667
+
668
+ $(doc).unbind("keydown.spectrum", onkeydown);
669
+ $(doc).unbind("click.spectrum", clickout);
670
+ $(window).unbind("resize.spectrum", resize);
671
+
672
+ replacer.removeClass("sp-active");
673
+ container.addClass("sp-hidden");
674
+
675
+ callbacks.hide(get());
676
+ boundElement.trigger('hide.spectrum', [ get() ]);
677
+ }
678
+
679
+ function revert() {
680
+ set(colorOnShow, true);
681
+ }
682
+
683
+ function set(color, ignoreFormatChange) {
684
+ if (tinycolor.equals(color, get())) {
685
+ // Update UI just in case a validation error needs
686
+ // to be cleared.
687
+ updateUI();
688
+ return;
689
+ }
690
+
691
+ var newColor, newHsv;
692
+ if (!color && allowEmpty) {
693
+ isEmpty = true;
694
+ } else {
695
+ isEmpty = false;
696
+ newColor = tinycolor(color);
697
+ newHsv = newColor.toHsv();
698
+
699
+ currentHue = (newHsv.h % 360) / 360;
700
+ currentSaturation = newHsv.s;
701
+ currentValue = newHsv.v;
702
+ currentAlpha = newHsv.a;
703
+ }
704
+ updateUI();
705
+
706
+ if (newColor && newColor.isValid() && !ignoreFormatChange) {
707
+ currentPreferredFormat = opts.preferredFormat || newColor.getFormat();
708
+ }
709
+ }
710
+
711
+ function get(opts) {
712
+ opts = opts || { };
713
+
714
+ if (allowEmpty && isEmpty) {
715
+ return null;
716
+ }
717
+
718
+ return tinycolor.fromRatio({
719
+ h: currentHue,
720
+ s: currentSaturation,
721
+ v: currentValue,
722
+ a: Math.round(currentAlpha * 100) / 100
723
+ }, { format: opts.format || currentPreferredFormat });
724
+ }
725
+
726
+ function isValid() {
727
+ return !textInput.hasClass("sp-validation-error");
728
+ }
729
+
730
+ function move() {
731
+ updateUI();
732
+
733
+ callbacks.move(get());
734
+ boundElement.trigger('move.spectrum', [ get() ]);
735
+ }
736
+
737
+ function updateUI() {
738
+
739
+ textInput.removeClass("sp-validation-error");
740
+
741
+ updateHelperLocations();
742
+
743
+ // Update dragger background color (gradients take care of saturation and value).
744
+ var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
745
+ dragger.css("background-color", flatColor.toHexString());
746
+
747
+ // Get a format that alpha will be included in (hex and names ignore alpha)
748
+ var format = currentPreferredFormat;
749
+ if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
750
+ if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
751
+ format = "rgb";
752
+ }
753
+ }
754
+
755
+ var realColor = get({ format: format }),
756
+ displayColor = '';
757
+
758
+ //reset background info for preview element
759
+ previewElement.removeClass("sp-clear-display");
760
+ previewElement.css('background-color', 'transparent');
761
+
762
+ if (!realColor && allowEmpty) {
763
+ // Update the replaced elements background with icon indicating no color selection
764
+ previewElement.addClass("sp-clear-display");
765
+ }
766
+ else {
767
+ var realHex = realColor.toHexString(),
768
+ realRgb = realColor.toRgbString();
769
+
770
+ // Update the replaced elements background color (with actual selected color)
771
+ if (rgbaSupport || realColor.alpha === 1) {
772
+ previewElement.css("background-color", realRgb);
773
+ }
774
+ else {
775
+ previewElement.css("background-color", "transparent");
776
+ previewElement.css("filter", realColor.toFilter());
777
+ }
778
+
779
+ if (opts.showAlpha) {
780
+ var rgb = realColor.toRgb();
781
+ rgb.a = 0;
782
+ var realAlpha = tinycolor(rgb).toRgbString();
783
+ var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
784
+
785
+ if (IE) {
786
+ alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
787
+ }
788
+ else {
789
+ alphaSliderInner.css("background", "-webkit-" + gradient);
790
+ alphaSliderInner.css("background", "-moz-" + gradient);
791
+ alphaSliderInner.css("background", "-ms-" + gradient);
792
+ // Use current syntax gradient on unprefixed property.
793
+ alphaSliderInner.css("background",
794
+ "linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
795
+ }
796
+ }
797
+
798
+ displayColor = realColor.toString(format);
799
+ }
800
+
801
+ // Update the text entry input as it changes happen
802
+ if (opts.showInput) {
803
+ textInput.val(displayColor);
804
+ }
805
+
806
+ if (opts.showPalette) {
807
+ drawPalette();
808
+ }
809
+
810
+ drawInitial();
811
+ }
812
+
813
+ function updateHelperLocations() {
814
+ var s = currentSaturation;
815
+ var v = currentValue;
816
+
817
+ if(allowEmpty && isEmpty) {
818
+ //if selected color is empty, hide the helpers
819
+ alphaSlideHelper.hide();
820
+ slideHelper.hide();
821
+ dragHelper.hide();
822
+ }
823
+ else {
824
+ //make sure helpers are visible
825
+ alphaSlideHelper.show();
826
+ slideHelper.show();
827
+ dragHelper.show();
828
+
829
+ // Where to show the little circle in that displays your current selected color
830
+ var dragX = s * dragWidth;
831
+ var dragY = dragHeight - (v * dragHeight);
832
+ dragX = Math.max(
833
+ -dragHelperHeight,
834
+ Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
835
+ );
836
+ dragY = Math.max(
837
+ -dragHelperHeight,
838
+ Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
839
+ );
840
+ dragHelper.css({
841
+ "top": dragY + "px",
842
+ "left": dragX + "px"
843
+ });
844
+
845
+ var alphaX = currentAlpha * alphaWidth;
846
+ alphaSlideHelper.css({
847
+ "left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
848
+ });
849
+
850
+ // Where to show the bar that displays your current selected hue
851
+ var slideY = (currentHue) * slideHeight;
852
+ slideHelper.css({
853
+ "top": (slideY - slideHelperHeight) + "px"
854
+ });
855
+ }
856
+ }
857
+
858
+ function updateOriginalInput(fireCallback) {
859
+ var color = get(),
860
+ displayColor = '',
861
+ hasChanged = !tinycolor.equals(color, colorOnShow);
862
+
863
+ if (color) {
864
+ displayColor = color.toString(currentPreferredFormat);
865
+ // Update the selection palette with the current color
866
+ addColorToSelectionPalette(color);
867
+ }
868
+
869
+ if (isInput) {
870
+ boundElement.val(displayColor);
871
+ }
872
+
873
+ if (fireCallback && hasChanged) {
874
+ callbacks.change(color);
875
+ boundElement.trigger('change', [ color ]);
876
+ }
877
+ }
878
+
879
+ function reflow() {
880
+ if (!visible) {
881
+ return; // Calculations would be useless and wouldn't be reliable anyways
882
+ }
883
+ dragWidth = dragger.width();
884
+ dragHeight = dragger.height();
885
+ dragHelperHeight = dragHelper.height();
886
+ slideWidth = slider.width();
887
+ slideHeight = slider.height();
888
+ slideHelperHeight = slideHelper.height();
889
+ alphaWidth = alphaSlider.width();
890
+ alphaSlideHelperWidth = alphaSlideHelper.width();
891
+
892
+ if (!flat) {
893
+ container.css("position", "absolute");
894
+ if (opts.offset) {
895
+ container.offset(opts.offset);
896
+ } else {
897
+ container.offset(getOffset(container, offsetElement));
898
+ }
899
+ }
900
+
901
+ updateHelperLocations();
902
+
903
+ if (opts.showPalette) {
904
+ drawPalette();
905
+ }
906
+
907
+ boundElement.trigger('reflow.spectrum');
908
+ }
909
+
910
+ function destroy() {
911
+ boundElement.show();
912
+ offsetElement.unbind("click.spectrum touchstart.spectrum");
913
+ container.remove();
914
+ replacer.remove();
915
+ spectrums[spect.id] = null;
916
+ }
917
+
918
+ function option(optionName, optionValue) {
919
+ if (optionName === undefined) {
920
+ return $.extend({}, opts);
921
+ }
922
+ if (optionValue === undefined) {
923
+ return opts[optionName];
924
+ }
925
+
926
+ opts[optionName] = optionValue;
927
+
928
+ if (optionName === "preferredFormat") {
929
+ currentPreferredFormat = opts.preferredFormat;
930
+ }
931
+ applyOptions();
932
+ }
933
+
934
+ function enable() {
935
+ disabled = false;
936
+ boundElement.attr("disabled", false);
937
+ offsetElement.removeClass("sp-disabled");
938
+ }
939
+
940
+ function disable() {
941
+ hide();
942
+ disabled = true;
943
+ boundElement.attr("disabled", true);
944
+ offsetElement.addClass("sp-disabled");
945
+ }
946
+
947
+ function setOffset(coord) {
948
+ opts.offset = coord;
949
+ reflow();
950
+ }
951
+
952
+ initialize();
953
+
954
+ var spect = {
955
+ show: show,
956
+ hide: hide,
957
+ toggle: toggle,
958
+ reflow: reflow,
959
+ option: option,
960
+ enable: enable,
961
+ disable: disable,
962
+ offset: setOffset,
963
+ set: function (c) {
964
+ set(c);
965
+ updateOriginalInput();
966
+ },
967
+ get: get,
968
+ destroy: destroy,
969
+ container: container
970
+ };
971
+
972
+ spect.id = spectrums.push(spect) - 1;
973
+
974
+ return spect;
975
+ }
976
+
977
+ /**
978
+ * checkOffset - get the offset below/above and left/right element depending on screen position
979
+ * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
980
+ */
981
+ function getOffset(picker, input) {
982
+ var extraY = 0;
983
+ var dpWidth = picker.outerWidth();
984
+ var dpHeight = picker.outerHeight();
985
+ var inputHeight = input.outerHeight();
986
+ var doc = picker[0].ownerDocument;
987
+ var docElem = doc.documentElement;
988
+ var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
989
+ var viewHeight = docElem.clientHeight + $(doc).scrollTop();
990
+ var offset = input.offset();
991
+ offset.top += inputHeight;
992
+
993
+ offset.left -=
994
+ Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
995
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
996
+
997
+ offset.top -=
998
+ Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
999
+ Math.abs(dpHeight + inputHeight - extraY) : extraY));
1000
+
1001
+ return offset;
1002
+ }
1003
+
1004
+ /**
1005
+ * noop - do nothing
1006
+ */
1007
+ function noop() {
1008
+
1009
+ }
1010
+
1011
+ /**
1012
+ * stopPropagation - makes the code only doing this a little easier to read in line
1013
+ */
1014
+ function stopPropagation(e) {
1015
+ e.stopPropagation();
1016
+ }
1017
+
1018
+ /**
1019
+ * Create a function bound to a given object
1020
+ * Thanks to underscore.js
1021
+ */
1022
+ function bind(func, obj) {
1023
+ var slice = Array.prototype.slice;
1024
+ var args = slice.call(arguments, 2);
1025
+ return function () {
1026
+ return func.apply(obj, args.concat(slice.call(arguments)));
1027
+ };
1028
+ }
1029
+
1030
+ /**
1031
+ * Lightweight drag helper. Handles containment within the element, so that
1032
+ * when dragging, the x is within [0,element.width] and y is within [0,element.height]
1033
+ */
1034
+ function draggable(element, onmove, onstart, onstop) {
1035
+ onmove = onmove || function () { };
1036
+ onstart = onstart || function () { };
1037
+ onstop = onstop || function () { };
1038
+ var doc = document;
1039
+ var dragging = false;
1040
+ var offset = {};
1041
+ var maxHeight = 0;
1042
+ var maxWidth = 0;
1043
+ var hasTouch = ('ontouchstart' in window);
1044
+
1045
+ var duringDragEvents = {};
1046
+ duringDragEvents["selectstart"] = prevent;
1047
+ duringDragEvents["dragstart"] = prevent;
1048
+ duringDragEvents["touchmove mousemove"] = move;
1049
+ duringDragEvents["touchend mouseup"] = stop;
1050
+
1051
+ function prevent(e) {
1052
+ if (e.stopPropagation) {
1053
+ e.stopPropagation();
1054
+ }
1055
+ if (e.preventDefault) {
1056
+ e.preventDefault();
1057
+ }
1058
+ e.returnValue = false;
1059
+ }
1060
+
1061
+ function move(e) {
1062
+ if (dragging) {
1063
+ // Mouseup happened outside of window
1064
+ if (IE && doc.documentMode < 9 && !e.button) {
1065
+ return stop();
1066
+ }
1067
+
1068
+ var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];
1069
+ var pageX = t0 && t0.pageX || e.pageX;
1070
+ var pageY = t0 && t0.pageY || e.pageY;
1071
+
1072
+ var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
1073
+ var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
1074
+
1075
+ if (hasTouch) {
1076
+ // Stop scrolling in iOS
1077
+ prevent(e);
1078
+ }
1079
+
1080
+ onmove.apply(element, [dragX, dragY, e]);
1081
+ }
1082
+ }
1083
+
1084
+ function start(e) {
1085
+ var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
1086
+
1087
+ if (!rightclick && !dragging) {
1088
+ if (onstart.apply(element, arguments) !== false) {
1089
+ dragging = true;
1090
+ maxHeight = $(element).height();
1091
+ maxWidth = $(element).width();
1092
+ offset = $(element).offset();
1093
+
1094
+ $(doc).bind(duringDragEvents);
1095
+ $(doc.body).addClass("sp-dragging");
1096
+
1097
+ move(e);
1098
+
1099
+ prevent(e);
1100
+ }
1101
+ }
1102
+ }
1103
+
1104
+ function stop() {
1105
+ if (dragging) {
1106
+ $(doc).unbind(duringDragEvents);
1107
+ $(doc.body).removeClass("sp-dragging");
1108
+
1109
+ // Wait a tick before notifying observers to allow the click event
1110
+ // to fire in Chrome.
1111
+ setTimeout(function() {
1112
+ onstop.apply(element, arguments);
1113
+ }, 0);
1114
+ }
1115
+ dragging = false;
1116
+ }
1117
+
1118
+ $(element).bind("touchstart mousedown", start);
1119
+ }
1120
+
1121
+ function throttle(func, wait, debounce) {
1122
+ var timeout;
1123
+ return function () {
1124
+ var context = this, args = arguments;
1125
+ var throttler = function () {
1126
+ timeout = null;
1127
+ func.apply(context, args);
1128
+ };
1129
+ if (debounce) clearTimeout(timeout);
1130
+ if (debounce || !timeout) timeout = setTimeout(throttler, wait);
1131
+ };
1132
+ }
1133
+
1134
+ function inputTypeColorSupport() {
1135
+ return $.fn.spectrum.inputTypeColorSupport();
1136
+ }
1137
+
1138
+ /**
1139
+ * Define a jQuery plugin
1140
+ */
1141
+ var dataID = "spectrum.id";
1142
+ $.fn.spectrum = function (opts, extra) {
1143
+
1144
+ if (typeof opts == "string") {
1145
+
1146
+ var returnValue = this;
1147
+ var args = Array.prototype.slice.call( arguments, 1 );
1148
+
1149
+ this.each(function () {
1150
+ var spect = spectrums[$(this).data(dataID)];
1151
+ if (spect) {
1152
+ var method = spect[opts];
1153
+ if (!method) {
1154
+ throw new Error( "Spectrum: no such method: '" + opts + "'" );
1155
+ }
1156
+
1157
+ if (opts == "get") {
1158
+ returnValue = spect.get();
1159
+ }
1160
+ else if (opts == "container") {
1161
+ returnValue = spect.container;
1162
+ }
1163
+ else if (opts == "option") {
1164
+ returnValue = spect.option.apply(spect, args);
1165
+ }
1166
+ else if (opts == "destroy") {
1167
+ spect.destroy();
1168
+ $(this).removeData(dataID);
1169
+ }
1170
+ else {
1171
+ method.apply(spect, args);
1172
+ }
1173
+ }
1174
+ });
1175
+
1176
+ return returnValue;
1177
+ }
1178
+
1179
+ // Initializing a new instance of spectrum
1180
+ return this.spectrum("destroy").each(function () {
1181
+ var options = $.extend({}, opts, $(this).data());
1182
+ var spect = spectrum(this, options);
1183
+ $(this).data(dataID, spect.id);
1184
+ });
1185
+ };
1186
+
1187
+ $.fn.spectrum.load = true;
1188
+ $.fn.spectrum.loadOpts = {};
1189
+ $.fn.spectrum.draggable = draggable;
1190
+ $.fn.spectrum.defaults = defaultOpts;
1191
+ $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {
1192
+ if (typeof inputTypeColorSupport._cachedResult === "undefined") {
1193
+ var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null
1194
+ inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "";
1195
+ }
1196
+ return inputTypeColorSupport._cachedResult;
1197
+ };
1198
+
1199
+ $.spectrum = { };
1200
+ $.spectrum.localization = { };
1201
+ $.spectrum.palettes = { };
1202
+
1203
+ $.fn.spectrum.processNativeColorInputs = function () {
1204
+ var colorInputs = $("input[type=color]");
1205
+ if (colorInputs.length && !inputTypeColorSupport()) {
1206
+ colorInputs.spectrum({
1207
+ preferredFormat: "hex6"
1208
+ });
1209
+ }
1210
+ };
1211
+
1212
+ // TinyColor v1.1.2
1213
+ // https://github.com/bgrins/TinyColor
1214
+ // Brian Grinstead, MIT License
1215
+
1216
+ (function() {
1217
+
1218
+ var trimLeft = /^[\s,#]+/,
1219
+ trimRight = /\s+$/,
1220
+ tinyCounter = 0,
1221
+ math = Math,
1222
+ mathRound = math.round,
1223
+ mathMin = math.min,
1224
+ mathMax = math.max,
1225
+ mathRandom = math.random;
1226
+
1227
+ var tinycolor = function(color, opts) {
1228
+
1229
+ color = (color) ? color : '';
1230
+ opts = opts || { };
1231
+
1232
+ // If input is already a tinycolor, return itself
1233
+ if (color instanceof tinycolor) {
1234
+ return color;
1235
+ }
1236
+ // If we are called as a function, call using new instead
1237
+ if (!(this instanceof tinycolor)) {
1238
+ return new tinycolor(color, opts);
1239
+ }
1240
+
1241
+ var rgb = inputToRGB(color);
1242
+ this._originalInput = color,
1243
+ this._r = rgb.r,
1244
+ this._g = rgb.g,
1245
+ this._b = rgb.b,
1246
+ this._a = rgb.a,
1247
+ this._roundA = mathRound(100*this._a) / 100,
1248
+ this._format = opts.format || rgb.format;
1249
+ this._gradientType = opts.gradientType;
1250
+
1251
+ // Don't let the range of [0,255] come back in [0,1].
1252
+ // Potentially lose a little bit of precision here, but will fix issues where
1253
+ // .5 gets interpreted as half of the total, instead of half of 1
1254
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
1255
+ if (this._r < 1) { this._r = mathRound(this._r); }
1256
+ if (this._g < 1) { this._g = mathRound(this._g); }
1257
+ if (this._b < 1) { this._b = mathRound(this._b); }
1258
+
1259
+ this._ok = rgb.ok;
1260
+ this._tc_id = tinyCounter++;
1261
+ };
1262
+
1263
+ tinycolor.prototype = {
1264
+ isDark: function() {
1265
+ return this.getBrightness() < 128;
1266
+ },
1267
+ isLight: function() {
1268
+ return !this.isDark();
1269
+ },
1270
+ isValid: function() {
1271
+ return this._ok;
1272
+ },
1273
+ getOriginalInput: function() {
1274
+ return this._originalInput;
1275
+ },
1276
+ getFormat: function() {
1277
+ return this._format;
1278
+ },
1279
+ getAlpha: function() {
1280
+ return this._a;
1281
+ },
1282
+ getBrightness: function() {
1283
+ var rgb = this.toRgb();
1284
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
1285
+ },
1286
+ setAlpha: function(value) {
1287
+ this._a = boundAlpha(value);
1288
+ this._roundA = mathRound(100*this._a) / 100;
1289
+ return this;
1290
+ },
1291
+ toHsv: function() {
1292
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1293
+ return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
1294
+ },
1295
+ toHsvString: function() {
1296
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1297
+ var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
1298
+ return (this._a == 1) ?
1299
+ "hsv(" + h + ", " + s + "%, " + v + "%)" :
1300
+ "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
1301
+ },
1302
+ toHsl: function() {
1303
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1304
+ return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
1305
+ },
1306
+ toHslString: function() {
1307
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1308
+ var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
1309
+ return (this._a == 1) ?
1310
+ "hsl(" + h + ", " + s + "%, " + l + "%)" :
1311
+ "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
1312
+ },
1313
+ toHex: function(allow3Char) {
1314
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
1315
+ },
1316
+ toHexString: function(allow3Char) {
1317
+ return '#' + this.toHex(allow3Char);
1318
+ },
1319
+ toHex8: function() {
1320
+ return rgbaToHex(this._r, this._g, this._b, this._a);
1321
+ },
1322
+ toHex8String: function() {
1323
+ return '#' + this.toHex8();
1324
+ },
1325
+ toRgb: function() {
1326
+ return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
1327
+ },
1328
+ toRgbString: function() {
1329
+ return (this._a == 1) ?
1330
+ "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
1331
+ "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
1332
+ },
1333
+ toPercentageRgb: function() {
1334
+ return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
1335
+ },
1336
+ toPercentageRgbString: function() {
1337
+ return (this._a == 1) ?
1338
+ "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
1339
+ "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
1340
+ },
1341
+ toName: function() {
1342
+ if (this._a === 0) {
1343
+ return "transparent";
1344
+ }
1345
+
1346
+ if (this._a < 1) {
1347
+ return false;
1348
+ }
1349
+
1350
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
1351
+ },
1352
+ toFilter: function(secondColor) {
1353
+ var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
1354
+ var secondHex8String = hex8String;
1355
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
1356
+
1357
+ if (secondColor) {
1358
+ var s = tinycolor(secondColor);
1359
+ secondHex8String = s.toHex8String();
1360
+ }
1361
+
1362
+ return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
1363
+ },
1364
+ toString: function(format) {
1365
+ var formatSet = !!format;
1366
+ format = format || this._format;
1367
+
1368
+ var formattedString = false;
1369
+ var hasAlpha = this._a < 1 && this._a >= 0;
1370
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
1371
+
1372
+ if (needsAlphaFormat) {
1373
+ // Special case for "transparent", all other non-alpha formats
1374
+ // will return rgba when there is transparency.
1375
+ if (format === "name" && this._a === 0) {
1376
+ return this.toName();
1377
+ }
1378
+ return this.toRgbString();
1379
+ }
1380
+ if (format === "rgb") {
1381
+ formattedString = this.toRgbString();
1382
+ }
1383
+ if (format === "prgb") {
1384
+ formattedString = this.toPercentageRgbString();
1385
+ }
1386
+ if (format === "hex" || format === "hex6") {
1387
+ formattedString = this.toHexString();
1388
+ }
1389
+ if (format === "hex3") {
1390
+ formattedString = this.toHexString(true);
1391
+ }
1392
+ if (format === "hex8") {
1393
+ formattedString = this.toHex8String();
1394
+ }
1395
+ if (format === "name") {
1396
+ formattedString = this.toName();
1397
+ }
1398
+ if (format === "hsl") {
1399
+ formattedString = this.toHslString();
1400
+ }
1401
+ if (format === "hsv") {
1402
+ formattedString = this.toHsvString();
1403
+ }
1404
+
1405
+ return formattedString || this.toHexString();
1406
+ },
1407
+
1408
+ _applyModification: function(fn, args) {
1409
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
1410
+ this._r = color._r;
1411
+ this._g = color._g;
1412
+ this._b = color._b;
1413
+ this.setAlpha(color._a);
1414
+ return this;
1415
+ },
1416
+ lighten: function() {
1417
+ return this._applyModification(lighten, arguments);
1418
+ },
1419
+ brighten: function() {
1420
+ return this._applyModification(brighten, arguments);
1421
+ },
1422
+ darken: function() {
1423
+ return this._applyModification(darken, arguments);
1424
+ },
1425
+ desaturate: function() {
1426
+ return this._applyModification(desaturate, arguments);
1427
+ },
1428
+ saturate: function() {
1429
+ return this._applyModification(saturate, arguments);
1430
+ },
1431
+ greyscale: function() {
1432
+ return this._applyModification(greyscale, arguments);
1433
+ },
1434
+ spin: function() {
1435
+ return this._applyModification(spin, arguments);
1436
+ },
1437
+
1438
+ _applyCombination: function(fn, args) {
1439
+ return fn.apply(null, [this].concat([].slice.call(args)));
1440
+ },
1441
+ analogous: function() {
1442
+ return this._applyCombination(analogous, arguments);
1443
+ },
1444
+ complement: function() {
1445
+ return this._applyCombination(complement, arguments);
1446
+ },
1447
+ monochromatic: function() {
1448
+ return this._applyCombination(monochromatic, arguments);
1449
+ },
1450
+ splitcomplement: function() {
1451
+ return this._applyCombination(splitcomplement, arguments);
1452
+ },
1453
+ triad: function() {
1454
+ return this._applyCombination(triad, arguments);
1455
+ },
1456
+ tetrad: function() {
1457
+ return this._applyCombination(tetrad, arguments);
1458
+ }
1459
+ };
1460
+
1461
+ // If input is an object, force 1 into "1.0" to handle ratios properly
1462
+ // String input requires "1.0" as input, so 1 will be treated as 1
1463
+ tinycolor.fromRatio = function(color, opts) {
1464
+ if (typeof color == "object") {
1465
+ var newColor = {};
1466
+ for (var i in color) {
1467
+ if (color.hasOwnProperty(i)) {
1468
+ if (i === "a") {
1469
+ newColor[i] = color[i];
1470
+ }
1471
+ else {
1472
+ newColor[i] = convertToPercentage(color[i]);
1473
+ }
1474
+ }
1475
+ }
1476
+ color = newColor;
1477
+ }
1478
+
1479
+ return tinycolor(color, opts);
1480
+ };
1481
+
1482
+ // Given a string or object, convert that input to RGB
1483
+ // Possible string inputs:
1484
+ //
1485
+ // "red"
1486
+ // "#f00" or "f00"
1487
+ // "#ff0000" or "ff0000"
1488
+ // "#ff000000" or "ff000000"
1489
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
1490
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
1491
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
1492
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
1493
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
1494
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
1495
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
1496
+ //
1497
+ function inputToRGB(color) {
1498
+
1499
+ var rgb = { r: 0, g: 0, b: 0 };
1500
+ var a = 1;
1501
+ var ok = false;
1502
+ var format = false;
1503
+
1504
+ if (typeof color == "string") {
1505
+ color = stringInputToObject(color);
1506
+ }
1507
+
1508
+ if (typeof color == "object") {
1509
+ if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
1510
+ rgb = rgbToRgb(color.r, color.g, color.b);
1511
+ ok = true;
1512
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
1513
+ }
1514
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
1515
+ color.s = convertToPercentage(color.s);
1516
+ color.v = convertToPercentage(color.v);
1517
+ rgb = hsvToRgb(color.h, color.s, color.v);
1518
+ ok = true;
1519
+ format = "hsv";
1520
+ }
1521
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
1522
+ color.s = convertToPercentage(color.s);
1523
+ color.l = convertToPercentage(color.l);
1524
+ rgb = hslToRgb(color.h, color.s, color.l);
1525
+ ok = true;
1526
+ format = "hsl";
1527
+ }
1528
+
1529
+ if (color.hasOwnProperty("a")) {
1530
+ a = color.a;
1531
+ }
1532
+ }
1533
+
1534
+ a = boundAlpha(a);
1535
+
1536
+ return {
1537
+ ok: ok,
1538
+ format: color.format || format,
1539
+ r: mathMin(255, mathMax(rgb.r, 0)),
1540
+ g: mathMin(255, mathMax(rgb.g, 0)),
1541
+ b: mathMin(255, mathMax(rgb.b, 0)),
1542
+ a: a
1543
+ };
1544
+ }
1545
+
1546
+
1547
+ // Conversion Functions
1548
+ // --------------------
1549
+
1550
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
1551
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
1552
+
1553
+ // `rgbToRgb`
1554
+ // Handle bounds / percentage checking to conform to CSS color spec
1555
+ // <http://www.w3.org/TR/css3-color/>
1556
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
1557
+ // *Returns:* { r, g, b } in [0, 255]
1558
+ function rgbToRgb(r, g, b){
1559
+ return {
1560
+ r: bound01(r, 255) * 255,
1561
+ g: bound01(g, 255) * 255,
1562
+ b: bound01(b, 255) * 255
1563
+ };
1564
+ }
1565
+
1566
+ // `rgbToHsl`
1567
+ // Converts an RGB color value to HSL.
1568
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
1569
+ // *Returns:* { h, s, l } in [0,1]
1570
+ function rgbToHsl(r, g, b) {
1571
+
1572
+ r = bound01(r, 255);
1573
+ g = bound01(g, 255);
1574
+ b = bound01(b, 255);
1575
+
1576
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1577
+ var h, s, l = (max + min) / 2;
1578
+
1579
+ if(max == min) {
1580
+ h = s = 0; // achromatic
1581
+ }
1582
+ else {
1583
+ var d = max - min;
1584
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1585
+ switch(max) {
1586
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1587
+ case g: h = (b - r) / d + 2; break;
1588
+ case b: h = (r - g) / d + 4; break;
1589
+ }
1590
+
1591
+ h /= 6;
1592
+ }
1593
+
1594
+ return { h: h, s: s, l: l };
1595
+ }
1596
+
1597
+ // `hslToRgb`
1598
+ // Converts an HSL color value to RGB.
1599
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
1600
+ // *Returns:* { r, g, b } in the set [0, 255]
1601
+ function hslToRgb(h, s, l) {
1602
+ var r, g, b;
1603
+
1604
+ h = bound01(h, 360);
1605
+ s = bound01(s, 100);
1606
+ l = bound01(l, 100);
1607
+
1608
+ function hue2rgb(p, q, t) {
1609
+ if(t < 0) t += 1;
1610
+ if(t > 1) t -= 1;
1611
+ if(t < 1/6) return p + (q - p) * 6 * t;
1612
+ if(t < 1/2) return q;
1613
+ if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
1614
+ return p;
1615
+ }
1616
+
1617
+ if(s === 0) {
1618
+ r = g = b = l; // achromatic
1619
+ }
1620
+ else {
1621
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1622
+ var p = 2 * l - q;
1623
+ r = hue2rgb(p, q, h + 1/3);
1624
+ g = hue2rgb(p, q, h);
1625
+ b = hue2rgb(p, q, h - 1/3);
1626
+ }
1627
+
1628
+ return { r: r * 255, g: g * 255, b: b * 255 };
1629
+ }
1630
+
1631
+ // `rgbToHsv`
1632
+ // Converts an RGB color value to HSV
1633
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
1634
+ // *Returns:* { h, s, v } in [0,1]
1635
+ function rgbToHsv(r, g, b) {
1636
+
1637
+ r = bound01(r, 255);
1638
+ g = bound01(g, 255);
1639
+ b = bound01(b, 255);
1640
+
1641
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1642
+ var h, s, v = max;
1643
+
1644
+ var d = max - min;
1645
+ s = max === 0 ? 0 : d / max;
1646
+
1647
+ if(max == min) {
1648
+ h = 0; // achromatic
1649
+ }
1650
+ else {
1651
+ switch(max) {
1652
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1653
+ case g: h = (b - r) / d + 2; break;
1654
+ case b: h = (r - g) / d + 4; break;
1655
+ }
1656
+ h /= 6;
1657
+ }
1658
+ return { h: h, s: s, v: v };
1659
+ }
1660
+
1661
+ // `hsvToRgb`
1662
+ // Converts an HSV color value to RGB.
1663
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
1664
+ // *Returns:* { r, g, b } in the set [0, 255]
1665
+ function hsvToRgb(h, s, v) {
1666
+
1667
+ h = bound01(h, 360) * 6;
1668
+ s = bound01(s, 100);
1669
+ v = bound01(v, 100);
1670
+
1671
+ var i = math.floor(h),
1672
+ f = h - i,
1673
+ p = v * (1 - s),
1674
+ q = v * (1 - f * s),
1675
+ t = v * (1 - (1 - f) * s),
1676
+ mod = i % 6,
1677
+ r = [v, q, p, p, t, v][mod],
1678
+ g = [t, v, v, q, p, p][mod],
1679
+ b = [p, p, t, v, v, q][mod];
1680
+
1681
+ return { r: r * 255, g: g * 255, b: b * 255 };
1682
+ }
1683
+
1684
+ // `rgbToHex`
1685
+ // Converts an RGB color to hex
1686
+ // Assumes r, g, and b are contained in the set [0, 255]
1687
+ // Returns a 3 or 6 character hex
1688
+ function rgbToHex(r, g, b, allow3Char) {
1689
+
1690
+ var hex = [
1691
+ pad2(mathRound(r).toString(16)),
1692
+ pad2(mathRound(g).toString(16)),
1693
+ pad2(mathRound(b).toString(16))
1694
+ ];
1695
+
1696
+ // Return a 3 character hex if possible
1697
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
1698
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
1699
+ }
1700
+
1701
+ return hex.join("");
1702
+ }
1703
+ // `rgbaToHex`
1704
+ // Converts an RGBA color plus alpha transparency to hex
1705
+ // Assumes r, g, b and a are contained in the set [0, 255]
1706
+ // Returns an 8 character hex
1707
+ function rgbaToHex(r, g, b, a) {
1708
+
1709
+ var hex = [
1710
+ pad2(convertDecimalToHex(a)),
1711
+ pad2(mathRound(r).toString(16)),
1712
+ pad2(mathRound(g).toString(16)),
1713
+ pad2(mathRound(b).toString(16))
1714
+ ];
1715
+
1716
+ return hex.join("");
1717
+ }
1718
+
1719
+ // `equals`
1720
+ // Can be called with any tinycolor input
1721
+ tinycolor.equals = function (color1, color2) {
1722
+ if (!color1 || !color2) { return false; }
1723
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
1724
+ };
1725
+ tinycolor.random = function() {
1726
+ return tinycolor.fromRatio({
1727
+ r: mathRandom(),
1728
+ g: mathRandom(),
1729
+ b: mathRandom()
1730
+ });
1731
+ };
1732
+
1733
+
1734
+ // Modification Functions
1735
+ // ----------------------
1736
+ // Thanks to less.js for some of the basics here
1737
+ // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
1738
+
1739
+ function desaturate(color, amount) {
1740
+ amount = (amount === 0) ? 0 : (amount || 10);
1741
+ var hsl = tinycolor(color).toHsl();
1742
+ hsl.s -= amount / 100;
1743
+ hsl.s = clamp01(hsl.s);
1744
+ return tinycolor(hsl);
1745
+ }
1746
+
1747
+ function saturate(color, amount) {
1748
+ amount = (amount === 0) ? 0 : (amount || 10);
1749
+ var hsl = tinycolor(color).toHsl();
1750
+ hsl.s += amount / 100;
1751
+ hsl.s = clamp01(hsl.s);
1752
+ return tinycolor(hsl);
1753
+ }
1754
+
1755
+ function greyscale(color) {
1756
+ return tinycolor(color).desaturate(100);
1757
+ }
1758
+
1759
+ function lighten (color, amount) {
1760
+ amount = (amount === 0) ? 0 : (amount || 10);
1761
+ var hsl = tinycolor(color).toHsl();
1762
+ hsl.l += amount / 100;
1763
+ hsl.l = clamp01(hsl.l);
1764
+ return tinycolor(hsl);
1765
+ }
1766
+
1767
+ function brighten(color, amount) {
1768
+ amount = (amount === 0) ? 0 : (amount || 10);
1769
+ var rgb = tinycolor(color).toRgb();
1770
+ rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
1771
+ rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
1772
+ rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
1773
+ return tinycolor(rgb);
1774
+ }
1775
+
1776
+ function darken (color, amount) {
1777
+ amount = (amount === 0) ? 0 : (amount || 10);
1778
+ var hsl = tinycolor(color).toHsl();
1779
+ hsl.l -= amount / 100;
1780
+ hsl.l = clamp01(hsl.l);
1781
+ return tinycolor(hsl);
1782
+ }
1783
+
1784
+ // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
1785
+ // Values outside of this range will be wrapped into this range.
1786
+ function spin(color, amount) {
1787
+ var hsl = tinycolor(color).toHsl();
1788
+ var hue = (mathRound(hsl.h) + amount) % 360;
1789
+ hsl.h = hue < 0 ? 360 + hue : hue;
1790
+ return tinycolor(hsl);
1791
+ }
1792
+
1793
+ // Combination Functions
1794
+ // ---------------------
1795
+ // Thanks to jQuery xColor for some of the ideas behind these
1796
+ // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
1797
+
1798
+ function complement(color) {
1799
+ var hsl = tinycolor(color).toHsl();
1800
+ hsl.h = (hsl.h + 180) % 360;
1801
+ return tinycolor(hsl);
1802
+ }
1803
+
1804
+ function triad(color) {
1805
+ var hsl = tinycolor(color).toHsl();
1806
+ var h = hsl.h;
1807
+ return [
1808
+ tinycolor(color),
1809
+ tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
1810
+ tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
1811
+ ];
1812
+ }
1813
+
1814
+ function tetrad(color) {
1815
+ var hsl = tinycolor(color).toHsl();
1816
+ var h = hsl.h;
1817
+ return [
1818
+ tinycolor(color),
1819
+ tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
1820
+ tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
1821
+ tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
1822
+ ];
1823
+ }
1824
+
1825
+ function splitcomplement(color) {
1826
+ var hsl = tinycolor(color).toHsl();
1827
+ var h = hsl.h;
1828
+ return [
1829
+ tinycolor(color),
1830
+ tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
1831
+ tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
1832
+ ];
1833
+ }
1834
+
1835
+ function analogous(color, results, slices) {
1836
+ results = results || 6;
1837
+ slices = slices || 30;
1838
+
1839
+ var hsl = tinycolor(color).toHsl();
1840
+ var part = 360 / slices;
1841
+ var ret = [tinycolor(color)];
1842
+
1843
+ for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
1844
+ hsl.h = (hsl.h + part) % 360;
1845
+ ret.push(tinycolor(hsl));
1846
+ }
1847
+ return ret;
1848
+ }
1849
+
1850
+ function monochromatic(color, results) {
1851
+ results = results || 6;
1852
+ var hsv = tinycolor(color).toHsv();
1853
+ var h = hsv.h, s = hsv.s, v = hsv.v;
1854
+ var ret = [];
1855
+ var modification = 1 / results;
1856
+
1857
+ while (results--) {
1858
+ ret.push(tinycolor({ h: h, s: s, v: v}));
1859
+ v = (v + modification) % 1;
1860
+ }
1861
+
1862
+ return ret;
1863
+ }
1864
+
1865
+ // Utility Functions
1866
+ // ---------------------
1867
+
1868
+ tinycolor.mix = function(color1, color2, amount) {
1869
+ amount = (amount === 0) ? 0 : (amount || 50);
1870
+
1871
+ var rgb1 = tinycolor(color1).toRgb();
1872
+ var rgb2 = tinycolor(color2).toRgb();
1873
+
1874
+ var p = amount / 100;
1875
+ var w = p * 2 - 1;
1876
+ var a = rgb2.a - rgb1.a;
1877
+
1878
+ var w1;
1879
+
1880
+ if (w * a == -1) {
1881
+ w1 = w;
1882
+ } else {
1883
+ w1 = (w + a) / (1 + w * a);
1884
+ }
1885
+
1886
+ w1 = (w1 + 1) / 2;
1887
+
1888
+ var w2 = 1 - w1;
1889
+
1890
+ var rgba = {
1891
+ r: rgb2.r * w1 + rgb1.r * w2,
1892
+ g: rgb2.g * w1 + rgb1.g * w2,
1893
+ b: rgb2.b * w1 + rgb1.b * w2,
1894
+ a: rgb2.a * p + rgb1.a * (1 - p)
1895
+ };
1896
+
1897
+ return tinycolor(rgba);
1898
+ };
1899
+
1900
+
1901
+ // Readability Functions
1902
+ // ---------------------
1903
+ // <http://www.w3.org/TR/AERT#color-contrast>
1904
+
1905
+ // `readability`
1906
+ // Analyze the 2 colors and returns an object with the following properties:
1907
+ // `brightness`: difference in brightness between the two colors
1908
+ // `color`: difference in color/hue between the two colors
1909
+ tinycolor.readability = function(color1, color2) {
1910
+ var c1 = tinycolor(color1);
1911
+ var c2 = tinycolor(color2);
1912
+ var rgb1 = c1.toRgb();
1913
+ var rgb2 = c2.toRgb();
1914
+ var brightnessA = c1.getBrightness();
1915
+ var brightnessB = c2.getBrightness();
1916
+ var colorDiff = (
1917
+ Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) +
1918
+ Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) +
1919
+ Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b)
1920
+ );
1921
+
1922
+ return {
1923
+ brightness: Math.abs(brightnessA - brightnessB),
1924
+ color: colorDiff
1925
+ };
1926
+ };
1927
+
1928
+ // `readable`
1929
+ // http://www.w3.org/TR/AERT#color-contrast
1930
+ // Ensure that foreground and background color combinations provide sufficient contrast.
1931
+ // *Example*
1932
+ // tinycolor.isReadable("#000", "#111") => false
1933
+ tinycolor.isReadable = function(color1, color2) {
1934
+ var readability = tinycolor.readability(color1, color2);
1935
+ return readability.brightness > 125 && readability.color > 500;
1936
+ };
1937
+
1938
+ // `mostReadable`
1939
+ // Given a base color and a list of possible foreground or background
1940
+ // colors for that base, returns the most readable color.
1941
+ // *Example*
1942
+ // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
1943
+ tinycolor.mostReadable = function(baseColor, colorList) {
1944
+ var bestColor = null;
1945
+ var bestScore = 0;
1946
+ var bestIsReadable = false;
1947
+ for (var i=0; i < colorList.length; i++) {
1948
+
1949
+ // We normalize both around the "acceptable" breaking point,
1950
+ // but rank brightness constrast higher than hue.
1951
+
1952
+ var readability = tinycolor.readability(baseColor, colorList[i]);
1953
+ var readable = readability.brightness > 125 && readability.color > 500;
1954
+ var score = 3 * (readability.brightness / 125) + (readability.color / 500);
1955
+
1956
+ if ((readable && ! bestIsReadable) ||
1957
+ (readable && bestIsReadable && score > bestScore) ||
1958
+ ((! readable) && (! bestIsReadable) && score > bestScore)) {
1959
+ bestIsReadable = readable;
1960
+ bestScore = score;
1961
+ bestColor = tinycolor(colorList[i]);
1962
+ }
1963
+ }
1964
+ return bestColor;
1965
+ };
1966
+
1967
+
1968
+ // Big List of Colors
1969
+ // ------------------
1970
+ // <http://www.w3.org/TR/css3-color/#svg-color>
1971
+ var names = tinycolor.names = {
1972
+ aliceblue: "f0f8ff",
1973
+ antiquewhite: "faebd7",
1974
+ aqua: "0ff",
1975
+ aquamarine: "7fffd4",
1976
+ azure: "f0ffff",
1977
+ beige: "f5f5dc",
1978
+ bisque: "ffe4c4",
1979
+ black: "000",
1980
+ blanchedalmond: "ffebcd",
1981
+ blue: "00f",
1982
+ blueviolet: "8a2be2",
1983
+ brown: "a52a2a",
1984
+ burlywood: "deb887",
1985
+ burntsienna: "ea7e5d",
1986
+ cadetblue: "5f9ea0",
1987
+ chartreuse: "7fff00",
1988
+ chocolate: "d2691e",
1989
+ coral: "ff7f50",
1990
+ cornflowerblue: "6495ed",
1991
+ cornsilk: "fff8dc",
1992
+ crimson: "dc143c",
1993
+ cyan: "0ff",
1994
+ darkblue: "00008b",
1995
+ darkcyan: "008b8b",
1996
+ darkgoldenrod: "b8860b",
1997
+ darkgray: "a9a9a9",
1998
+ darkgreen: "006400",
1999
+ darkgrey: "a9a9a9",
2000
+ darkkhaki: "bdb76b",
2001
+ darkmagenta: "8b008b",
2002
+ darkolivegreen: "556b2f",
2003
+ darkorange: "ff8c00",
2004
+ darkorchid: "9932cc",
2005
+ darkred: "8b0000",
2006
+ darksalmon: "e9967a",
2007
+ darkseagreen: "8fbc8f",
2008
+ darkslateblue: "483d8b",
2009
+ darkslategray: "2f4f4f",
2010
+ darkslategrey: "2f4f4f",
2011
+ darkturquoise: "00ced1",
2012
+ darkviolet: "9400d3",
2013
+ deeppink: "ff1493",
2014
+ deepskyblue: "00bfff",
2015
+ dimgray: "696969",
2016
+ dimgrey: "696969",
2017
+ dodgerblue: "1e90ff",
2018
+ firebrick: "b22222",
2019
+ floralwhite: "fffaf0",
2020
+ forestgreen: "228b22",
2021
+ fuchsia: "f0f",
2022
+ gainsboro: "dcdcdc",
2023
+ ghostwhite: "f8f8ff",
2024
+ gold: "ffd700",
2025
+ goldenrod: "daa520",
2026
+ gray: "808080",
2027
+ green: "008000",
2028
+ greenyellow: "adff2f",
2029
+ grey: "808080",
2030
+ honeydew: "f0fff0",
2031
+ hotpink: "ff69b4",
2032
+ indianred: "cd5c5c",
2033
+ indigo: "4b0082",
2034
+ ivory: "fffff0",
2035
+ khaki: "f0e68c",
2036
+ lavender: "e6e6fa",
2037
+ lavenderblush: "fff0f5",
2038
+ lawngreen: "7cfc00",
2039
+ lemonchiffon: "fffacd",
2040
+ lightblue: "add8e6",
2041
+ lightcoral: "f08080",
2042
+ lightcyan: "e0ffff",
2043
+ lightgoldenrodyellow: "fafad2",
2044
+ lightgray: "d3d3d3",
2045
+ lightgreen: "90ee90",
2046
+ lightgrey: "d3d3d3",
2047
+ lightpink: "ffb6c1",
2048
+ lightsalmon: "ffa07a",
2049
+ lightseagreen: "20b2aa",
2050
+ lightskyblue: "87cefa",
2051
+ lightslategray: "789",
2052
+ lightslategrey: "789",
2053
+ lightsteelblue: "b0c4de",
2054
+ lightyellow: "ffffe0",
2055
+ lime: "0f0",
2056
+ limegreen: "32cd32",
2057
+ linen: "faf0e6",
2058
+ magenta: "f0f",
2059
+ maroon: "800000",
2060
+ mediumaquamarine: "66cdaa",
2061
+ mediumblue: "0000cd",
2062
+ mediumorchid: "ba55d3",
2063
+ mediumpurple: "9370db",
2064
+ mediumseagreen: "3cb371",
2065
+ mediumslateblue: "7b68ee",
2066
+ mediumspringgreen: "00fa9a",
2067
+ mediumturquoise: "48d1cc",
2068
+ mediumvioletred: "c71585",
2069
+ midnightblue: "191970",
2070
+ mintcream: "f5fffa",
2071
+ mistyrose: "ffe4e1",
2072
+ moccasin: "ffe4b5",
2073
+ navajowhite: "ffdead",
2074
+ navy: "000080",
2075
+ oldlace: "fdf5e6",
2076
+ olive: "808000",
2077
+ olivedrab: "6b8e23",
2078
+ orange: "ffa500",
2079
+ orangered: "ff4500",
2080
+ orchid: "da70d6",
2081
+ palegoldenrod: "eee8aa",
2082
+ palegreen: "98fb98",
2083
+ paleturquoise: "afeeee",
2084
+ palevioletred: "db7093",
2085
+ papayawhip: "ffefd5",
2086
+ peachpuff: "ffdab9",
2087
+ peru: "cd853f",
2088
+ pink: "ffc0cb",
2089
+ plum: "dda0dd",
2090
+ powderblue: "b0e0e6",
2091
+ purple: "800080",
2092
+ rebeccapurple: "663399",
2093
+ red: "f00",
2094
+ rosybrown: "bc8f8f",
2095
+ royalblue: "4169e1",
2096
+ saddlebrown: "8b4513",
2097
+ salmon: "fa8072",
2098
+ sandybrown: "f4a460",
2099
+ seagreen: "2e8b57",
2100
+ seashell: "fff5ee",
2101
+ sienna: "a0522d",
2102
+ silver: "c0c0c0",
2103
+ skyblue: "87ceeb",
2104
+ slateblue: "6a5acd",
2105
+ slategray: "708090",
2106
+ slategrey: "708090",
2107
+ snow: "fffafa",
2108
+ springgreen: "00ff7f",
2109
+ steelblue: "4682b4",
2110
+ tan: "d2b48c",
2111
+ teal: "008080",
2112
+ thistle: "d8bfd8",
2113
+ tomato: "ff6347",
2114
+ turquoise: "40e0d0",
2115
+ violet: "ee82ee",
2116
+ wheat: "f5deb3",
2117
+ white: "fff",
2118
+ whitesmoke: "f5f5f5",
2119
+ yellow: "ff0",
2120
+ yellowgreen: "9acd32"
2121
+ };
2122
+
2123
+ // Make it easy to access colors via `hexNames[hex]`
2124
+ var hexNames = tinycolor.hexNames = flip(names);
2125
+
2126
+
2127
+ // Utilities
2128
+ // ---------
2129
+
2130
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
2131
+ function flip(o) {
2132
+ var flipped = { };
2133
+ for (var i in o) {
2134
+ if (o.hasOwnProperty(i)) {
2135
+ flipped[o[i]] = i;
2136
+ }
2137
+ }
2138
+ return flipped;
2139
+ }
2140
+
2141
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
2142
+ function boundAlpha(a) {
2143
+ a = parseFloat(a);
2144
+
2145
+ if (isNaN(a) || a < 0 || a > 1) {
2146
+ a = 1;
2147
+ }
2148
+
2149
+ return a;
2150
+ }
2151
+
2152
+ // Take input from [0, n] and return it as [0, 1]
2153
+ function bound01(n, max) {
2154
+ if (isOnePointZero(n)) { n = "100%"; }
2155
+
2156
+ var processPercent = isPercentage(n);
2157
+ n = mathMin(max, mathMax(0, parseFloat(n)));
2158
+
2159
+ // Automatically convert percentage into number
2160
+ if (processPercent) {
2161
+ n = parseInt(n * max, 10) / 100;
2162
+ }
2163
+
2164
+ // Handle floating point rounding errors
2165
+ if ((math.abs(n - max) < 0.000001)) {
2166
+ return 1;
2167
+ }
2168
+
2169
+ // Convert into [0, 1] range if it isn't already
2170
+ return (n % max) / parseFloat(max);
2171
+ }
2172
+
2173
+ // Force a number between 0 and 1
2174
+ function clamp01(val) {
2175
+ return mathMin(1, mathMax(0, val));
2176
+ }
2177
+
2178
+ // Parse a base-16 hex value into a base-10 integer
2179
+ function parseIntFromHex(val) {
2180
+ return parseInt(val, 16);
2181
+ }
2182
+
2183
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
2184
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
2185
+ function isOnePointZero(n) {
2186
+ return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
2187
+ }
2188
+
2189
+ // Check to see if string passed in is a percentage
2190
+ function isPercentage(n) {
2191
+ return typeof n === "string" && n.indexOf('%') != -1;
2192
+ }
2193
+
2194
+ // Force a hex value to have 2 characters
2195
+ function pad2(c) {
2196
+ return c.length == 1 ? '0' + c : '' + c;
2197
+ }
2198
+
2199
+ // Replace a decimal with it's percentage value
2200
+ function convertToPercentage(n) {
2201
+ if (n <= 1) {
2202
+ n = (n * 100) + "%";
2203
+ }
2204
+
2205
+ return n;
2206
+ }
2207
+
2208
+ // Converts a decimal to a hex value
2209
+ function convertDecimalToHex(d) {
2210
+ return Math.round(parseFloat(d) * 255).toString(16);
2211
+ }
2212
+ // Converts a hex value to a decimal
2213
+ function convertHexToDecimal(h) {
2214
+ return (parseIntFromHex(h) / 255);
2215
+ }
2216
+
2217
+ var matchers = (function() {
2218
+
2219
+ // <http://www.w3.org/TR/css3-values/#integers>
2220
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
2221
+
2222
+ // <http://www.w3.org/TR/css3-values/#number-value>
2223
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
2224
+
2225
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
2226
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
2227
+
2228
+ // Actual matching.
2229
+ // Parentheses and commas are optional, but not required.
2230
+ // Whitespace can take the place of commas or opening paren
2231
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2232
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2233
+
2234
+ return {
2235
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
2236
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
2237
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
2238
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
2239
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
2240
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
2241
+ hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2242
+ hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
2243
+ hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
2244
+ };
2245
+ })();
2246
+
2247
+ // `stringInputToObject`
2248
+ // Permissive string parsing. Take in a number of formats, and output an object
2249
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
2250
+ function stringInputToObject(color) {
2251
+
2252
+ color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
2253
+ var named = false;
2254
+ if (names[color]) {
2255
+ color = names[color];
2256
+ named = true;
2257
+ }
2258
+ else if (color == 'transparent') {
2259
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
2260
+ }
2261
+
2262
+ // Try to match string input using regular expressions.
2263
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
2264
+ // Just return an object and let the conversion functions handle that.
2265
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
2266
+ var match;
2267
+ if ((match = matchers.rgb.exec(color))) {
2268
+ return { r: match[1], g: match[2], b: match[3] };
2269
+ }
2270
+ if ((match = matchers.rgba.exec(color))) {
2271
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
2272
+ }
2273
+ if ((match = matchers.hsl.exec(color))) {
2274
+ return { h: match[1], s: match[2], l: match[3] };
2275
+ }
2276
+ if ((match = matchers.hsla.exec(color))) {
2277
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
2278
+ }
2279
+ if ((match = matchers.hsv.exec(color))) {
2280
+ return { h: match[1], s: match[2], v: match[3] };
2281
+ }
2282
+ if ((match = matchers.hsva.exec(color))) {
2283
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
2284
+ }
2285
+ if ((match = matchers.hex8.exec(color))) {
2286
+ return {
2287
+ a: convertHexToDecimal(match[1]),
2288
+ r: parseIntFromHex(match[2]),
2289
+ g: parseIntFromHex(match[3]),
2290
+ b: parseIntFromHex(match[4]),
2291
+ format: named ? "name" : "hex8"
2292
+ };
2293
+ }
2294
+ if ((match = matchers.hex6.exec(color))) {
2295
+ return {
2296
+ r: parseIntFromHex(match[1]),
2297
+ g: parseIntFromHex(match[2]),
2298
+ b: parseIntFromHex(match[3]),
2299
+ format: named ? "name" : "hex"
2300
+ };
2301
+ }
2302
+ if ((match = matchers.hex3.exec(color))) {
2303
+ return {
2304
+ r: parseIntFromHex(match[1] + '' + match[1]),
2305
+ g: parseIntFromHex(match[2] + '' + match[2]),
2306
+ b: parseIntFromHex(match[3] + '' + match[3]),
2307
+ format: named ? "name" : "hex"
2308
+ };
2309
+ }
2310
+
2311
+ return false;
2312
+ }
2313
+
2314
+ window.tinycolor = tinycolor;
2315
+ })();
2316
+
2317
+ $(function () {
2318
+ if ($.fn.spectrum.load) {
2319
+ $.fn.spectrum.processNativeColorInputs();
2320
+ }
2321
+ });
2322
+
2323
+ });
trunk/css/admin-user-interface.min.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ /*! jQuery UI - v1.11.4 - 2015-12-12
2
+ * http://jqueryui.com
3
+ * Includes: core.css, draggable.css, resizable.css, selectable.css, sortable.css, accordion.css, button.css, dialog.css, slider.css, spinner.css, tooltip.css, theme.css
4
+ * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Arial%2CHelvetica%2Csans-serif&fsDefault=1em&fwDefault=normal&cornerRadius=3px&bgColorHeader=e9e9e9&bgTextureHeader=flat&borderColorHeader=dddddd&fcHeader=333333&iconColorHeader=444444&bgColorContent=ffffff&bgTextureContent=flat&borderColorContent=dddddd&fcContent=333333&iconColorContent=444444&bgColorDefault=f6f6f6&bgTextureDefault=flat&borderColorDefault=c5c5c5&fcDefault=454545&iconColorDefault=777777&bgColorHover=ededed&bgTextureHover=flat&borderColorHover=cccccc&fcHover=2b2b2b&iconColorHover=555555&bgColorActive=007fff&bgTextureActive=flat&borderColorActive=003eff&fcActive=ffffff&iconColorActive=ffffff&bgColorHighlight=fffa90&bgTextureHighlight=flat&borderColorHighlight=dad55e&fcHighlight=777620&iconColorHighlight=777620&bgColorError=fddfdf&bgTextureError=flat&borderColorError=f1a899&fcError=5f3f3f&iconColorError=cc0000&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=666666&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=5px&offsetTopShadow=0px&offsetLeftShadow=0px&cornerRadiusShadow=8px
5
+ * Copyright jQuery Foundation and other contributors; Licensed MIT */
6
+
7
+ .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-draggable-handle{-ms-touch-action:none;touch-action:none}.ui-resizable{position:relative}.ui-resizable-handle{position:absolute;font-size:0.1px;display:block;-ms-touch-action:none;touch-action:none}.ui-resizable-disabled .ui-resizable-handle,.ui-resizable-autohide .ui-resizable-handle{display:none}.ui-resizable-n{cursor:n-resize;height:7px;width:100%;top:-5px;left:0}.ui-resizable-s{cursor:s-resize;height:7px;width:100%;bottom:-5px;left:0}.ui-resizable-e{cursor:e-resize;width:7px;right:-5px;top:0;height:100%}.ui-resizable-w{cursor:w-resize;width:7px;left:-5px;top:0;height:100%}.ui-resizable-se{cursor:se-resize;width:12px;height:12px;right:1px;bottom:1px}.ui-resizable-sw{cursor:sw-resize;width:9px;height:9px;left:-5px;bottom:-5px}.ui-resizable-nw{cursor:nw-resize;width:9px;height:9px;left:-5px;top:-5px}.ui-resizable-ne{cursor:ne-resize;width:9px;height:9px;right:-5px;top:-5px}.ui-selectable{-ms-touch-action:none;touch-action:none}.ui-selectable-helper{position:absolute;z-index:100;border:1px dotted black}.ui-sortable-handle{-ms-touch-action:none;touch-action:none}.ui-accordion .ui-accordion-header{display:block;cursor:pointer;position:relative;margin:2px 0 0 0;padding:.5em .5em .5em .7em;min-height:0;font-size:100%}.ui-accordion .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-icons .ui-accordion-icons{padding-left:2.2em}.ui-accordion .ui-accordion-header .ui-accordion-header-icon{position:absolute;left:.5em;top:50%;margin-top:-8px}.ui-accordion .ui-accordion-content{padding:1em 2.2em;border-top:0;overflow:auto}.ui-button{display:inline-block;position:relative;padding:0;line-height:normal;margin-right:.1em;cursor:pointer;vertical-align:middle;text-align:center;overflow:visible}.ui-button,.ui-button:link,.ui-button:visited,.ui-button:hover,.ui-button:active{text-decoration:none}.ui-button-icon-only{width:2.2em}button.ui-button-icon-only{width:2.4em}.ui-button-icons-only{width:3.4em}button.ui-button-icons-only{width:3.7em}.ui-button .ui-button-text{display:block;line-height:normal}.ui-button-text-only .ui-button-text{padding:.4em 1em}.ui-button-icon-only .ui-button-text,.ui-button-icons-only .ui-button-text{padding:.4em;text-indent:-9999999px}.ui-button-text-icon-primary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 1em .4em 2.1em}.ui-button-text-icon-secondary .ui-button-text,.ui-button-text-icons .ui-button-text{padding:.4em 2.1em .4em 1em}.ui-button-text-icons .ui-button-text{padding-left:2.1em;padding-right:2.1em}input.ui-button{padding:.4em 1em}.ui-button-icon-only .ui-icon,.ui-button-text-icon-primary .ui-icon,.ui-button-text-icon-secondary .ui-icon,.ui-button-text-icons .ui-icon,.ui-button-icons-only .ui-icon{position:absolute;top:50%;margin-top:-8px}.ui-button-icon-only .ui-icon{left:50%;margin-left:-8px}.ui-button-text-icon-primary .ui-button-icon-primary,.ui-button-text-icons .ui-button-icon-primary,.ui-button-icons-only .ui-button-icon-primary{left:.5em}.ui-button-text-icon-secondary .ui-button-icon-secondary,.ui-button-text-icons .ui-button-icon-secondary,.ui-button-icons-only .ui-button-icon-secondary{right:.5em}.ui-buttonset{margin-right:7px}.ui-buttonset .ui-button{margin-left:0;margin-right:-.3em}input.ui-button::-moz-focus-inner,button.ui-button::-moz-focus-inner{border:0;padding:0}.ui-dialog{overflow:hidden;position:absolute;top:0;left:0;padding:.2em;outline:0}.ui-dialog .ui-dialog-titlebar{padding:.4em 1em;position:relative}.ui-dialog .ui-dialog-title{float:left;margin:.1em 0;white-space:nowrap;width:90%;overflow:hidden;text-overflow:ellipsis}.ui-dialog .ui-dialog-titlebar-close{position:absolute;right:.3em;top:50%;width:20px;margin:-10px 0 0 0;padding:1px;height:20px}.ui-dialog .ui-dialog-content{position:relative;border:0;padding:.5em 1em;background:none;overflow:auto}.ui-dialog .ui-dialog-buttonpane{text-align:left;border-width:1px 0 0 0;background-image:none;margin-top:.5em;padding:.3em 1em .5em .4em}.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset{float:right}.ui-dialog .ui-dialog-buttonpane button{margin:.5em .4em .5em 0;cursor:pointer}.ui-dialog .ui-resizable-se{width:12px;height:12px;right:-5px;bottom:-5px;background-position:16px 16px}.ui-draggable .ui-dialog-titlebar{cursor:move}.ui-slider{position:relative;text-align:left}.ui-slider .ui-slider-handle{position:absolute;z-index:2;width:1.2em;height:1.2em;cursor:default;-ms-touch-action:none;touch-action:none}.ui-slider .ui-slider-range{position:absolute;z-index:1;font-size:.7em;display:block;border:0;background-position:0 0}.ui-slider.ui-state-disabled .ui-slider-handle,.ui-slider.ui-state-disabled .ui-slider-range{filter:inherit}.ui-slider-horizontal{height:.8em}.ui-slider-horizontal .ui-slider-handle{top:-.3em;margin-left:-.6em}.ui-slider-horizontal .ui-slider-range{top:0;height:100%}.ui-slider-horizontal .ui-slider-range-min{left:0}.ui-slider-horizontal .ui-slider-range-max{right:0}.ui-slider-vertical{width:.8em;height:100px}.ui-slider-vertical .ui-slider-handle{left:-.3em;margin-left:0;margin-bottom:-.6em}.ui-slider-vertical .ui-slider-range{left:0;width:100%}.ui-slider-vertical .ui-slider-range-min{bottom:0}.ui-slider-vertical .ui-slider-range-max{top:0}.ui-spinner{position:relative;display:inline-block;overflow:hidden;padding:0;vertical-align:middle}.ui-spinner-input{border:none;background:none;color:inherit;padding:0;margin:.2em 0;vertical-align:middle;margin-left:.4em;margin-right:22px}.ui-spinner-button{width:16px;height:50%;font-size:.5em;padding:0;margin:0;text-align:center;position:absolute;cursor:default;display:block;overflow:hidden;right:0}.ui-spinner a.ui-spinner-button{border-top:none;border-bottom:none;border-right:none}.ui-spinner .ui-icon{position:absolute;margin-top:-8px;top:50%;left:0}.ui-spinner-up{top:0}.ui-spinner-down{bottom:0}.ui-spinner .ui-icon-triangle-1-s{background-position:-65px -16px}.ui-tooltip{padding:8px;position:absolute;z-index:9999;max-width:300px;-webkit-box-shadow:0 0 5px #aaa;box-shadow:0 0 5px #aaa}body .ui-tooltip{border-width:2px}.ui-widget{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Arial,Helvetica,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #ddd;background:#fff;color:#333}.ui-widget-content a{color:#333}.ui-widget-header{border:1px solid #ddd;background:#e9e9e9;color:#333;font-weight:bold}.ui-widget-header a{color:#333}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #c5c5c5;background:#f6f6f6;font-weight:normal;color:#454545}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#454545;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #ccc;background:#ededed;font-weight:normal;color:#2b2b2b}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#2b2b2b;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #003eff;background:#007fff;font-weight:normal;color:#fff}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#fff;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #dad55e;background:#fffa90;color:#777620}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#777620}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #f1a899;background:#fddfdf;color:#5f3f3f}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#5f3f3f}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#5f3f3f}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_444444_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_777777_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_555555_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_ffffff_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_777620_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cc0000_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:3px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:3px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:3px}.ui-widget-overlay{background:#aaa;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:0 0 0 0;padding:5px;background:#666;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
trunk/css/slide-anything-admin.css ADDED
@@ -0,0 +1,504 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ##################################################################
3
+ ### SLIDE ANYTHING PLUGIN - JAVASCRIPT FOR WORDPRESS DASHBOARD ###
4
+ ##################################################################
5
+ */
6
+
7
+ /* ### GENERAL STYLE ### */
8
+ .postbox-container .meta-box-sortables .postbox h3 span {
9
+ font-family:'Open Sans', sans-serif !important;
10
+ font-weight:600 !important;
11
+ font-size:20px !important;
12
+ line-height:26px !important;
13
+ }
14
+ .sa_hidden {
15
+ display:none !important;
16
+ }
17
+
18
+ /* ### METABOX 'Slider Settings' ### */
19
+ #sa_slider_settings {
20
+ padding:10px 0px 0px;
21
+ }
22
+ #sa_slider_settings hr {
23
+ margin:20px 0px !important;
24
+ border-top-style:none !important;
25
+ border-bottom:solid 1px #e8e8e8 !important;
26
+ }
27
+ #sa_slider_settings .sa_slider_value {
28
+ position:relative;
29
+ margin:0px 5px 15px;
30
+ }
31
+ #sa_slider_settings .sa_slider_value span {
32
+ display:inline-block;
33
+ padding-right:10px;
34
+ color:#303030;
35
+ font-family:'Open Sans', sans-serif;
36
+ font-size:14px;
37
+ line-height:20px;
38
+ }
39
+ #sa_slider_settings .sa_slider_value .sa_tooltip {
40
+ position:absolute;
41
+ top:4px;
42
+ margin-left:5px !important;
43
+ cursor:help;
44
+ }
45
+ #sa_slider_settings .sa_slider_value input {
46
+ width:40px !important;
47
+ margin:0px !important;
48
+ border-style:none !important;
49
+ border-radius:3px !important;
50
+ outline-color:transparent !important;
51
+ box-shadow:none !important;
52
+ -webkit-box-shadow:none !important;
53
+ background-color:#f0f0f0 !important;
54
+ }
55
+ #sa_slider_settings .sa_slider_value em {
56
+ display:inline-block;
57
+ padding-left:5px;
58
+ color:#a0a0a0;
59
+ font-family:'Open Sans', sans-serif;
60
+ font-size:14px;
61
+ line-height:20px;
62
+ }
63
+ #sa_slider_settings .jquery_ui_slider {
64
+ margin:0px 5px 5px !important;
65
+ background-color:#007fff !important;
66
+ border-radius:0px !important;
67
+ }
68
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle {
69
+ outline-color:transparent !important;
70
+ background-color:#f0f0f0 !important;
71
+ border-color:#c0c0c0 !important;
72
+ transition:background .3s ease-in-out;
73
+ -webkit-transition:background .3s ease-in-out;
74
+ -moz-transition:background .3s ease-in-out;
75
+ -o-transition:background .3s ease-in-out;
76
+ }
77
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle:hover,
78
+ #sa_slider_settings .jquery_ui_slider .ui-slider-handle:focus {
79
+ background-color:#d0d0d0 !important;
80
+ }
81
+ #sa_slider_settings .jquery_ui_slider .ui-slider-range {
82
+ border-radius:0px !important;
83
+ }
84
+ .half_width_column {
85
+ float:left;
86
+ width:50%;
87
+ }
88
+ .half_width_column .sa_setting_checkbox {
89
+ position:relative;
90
+ padding:0px 5px 10px 5px;
91
+ }
92
+ .half_width_column .sa_setting_checkbox span {
93
+ display:inline-block;
94
+ width:125px;
95
+ color:#303030;
96
+ font-family:'Open Sans', sans-serif;
97
+ font-size:14px;
98
+ line-height:20px;
99
+ }
100
+ .half_width_column .sa_setting_checkbox .sa_tooltip {
101
+ position:absolute;
102
+ top:2px;
103
+ margin-left:5px !important;
104
+ cursor:help;
105
+ }
106
+ @media only screen and (max-width:479px) {
107
+ .half_width_column { float:none; width:100%; }
108
+ }
109
+
110
+ /* ### METABOX 'Slides' - DISABLE VISUAL EDITOR CHECKBOX ### */
111
+ #sa_visual_editor_checkbox {
112
+ padding:10px 5px 0px;
113
+ }
114
+ #sa_visual_editor_checkbox span {
115
+ display:inline-block;
116
+ padding-right:10px;
117
+ color:#303030;
118
+ font-family:'Open Sans', sans-serif;
119
+ font-size:14px;
120
+ line-height:20px;
121
+ }
122
+ /* ### METABOX 'Slides' - ACCORDION CONTAINING SLIDE CONTENT ### */
123
+ #slider_accordion {
124
+ margin:20px 0px 10px !important;
125
+ }
126
+ #slider_accordion > h3 {
127
+ margin-top:3px !important;
128
+ padding:6px 10px !important;
129
+ font-family:Arial, Helvetica, sans-serif !important;
130
+ font-weight:normal !important;
131
+ font-size:15px !important;
132
+ line-height:20px !important;
133
+ text-transform:uppercase !important;
134
+ }
135
+ #slider_accordion > h3 .ui-accordion-header-icon {
136
+ display:none !important;
137
+ }
138
+ #slider_accordion > div {
139
+ padding:15px 15px !important;
140
+ }
141
+ /* slide backround image/color */
142
+ .sa_slide_bg_wrapper {
143
+ position:relative;
144
+ margin-top:15px;
145
+ border:solid 1px #e0e0e0;
146
+ padding:20px 15px 14px;
147
+ background-color:#f8f8f8;
148
+ }
149
+ .sa_slide_bg_wrapper h4 {
150
+ position:absolute;
151
+ display:inline-block;
152
+ top:-10px;
153
+ left:10px;
154
+ margin:0px;
155
+ padding:0px 5px;
156
+ background-color:#ffffff;
157
+ color:#303030;
158
+ font-family:'Open Sans', sans-serif;
159
+ font-size:14px;
160
+ font-weight:600;
161
+ line-height:20px;
162
+ }
163
+ .sa_slide_bg_wrapper .sa_slide_thumb {
164
+ position:relative;
165
+ float:left;
166
+ margin-right:15px;
167
+ border:solid 1px #e0e0e0;
168
+ padding:5px;
169
+ background-color:#f3f3f3;
170
+ }
171
+ .sa_slide_bg_wrapper .sa_slide_thumb > div {
172
+ height:150px;
173
+ width:150px;
174
+ background-repeat:no-repeat;
175
+ background-position:top left;
176
+ background-size:100% auto;
177
+ }
178
+ .sa_slide_bg_wrapper .sa_slide_thumb > span {
179
+ display:inline-block;
180
+ position:absolute;
181
+ top:0px;
182
+ right:0px;
183
+ font-family:Arial, Helvetica, sans-serif;
184
+ font-size:14px;
185
+ line-height:14px;
186
+ padding:3px 3px;
187
+ background-color:rgba(0,0,0,0.5);
188
+ color:#ffffff;
189
+ cursor:pointer;
190
+ transition:all .3s ease-in-out;
191
+ -webkit-transition:all .3s ease-in-out;
192
+ -moz-transition:all .3s ease-in-out;
193
+ -o-transition:all .3s ease-in-out;
194
+ }
195
+ .sa_slide_bg_wrapper .sa_slide_thumb > span:hover {
196
+ background-color:crimson;
197
+ }
198
+ .sa_slide_bg_wrapper .slide_image_add {
199
+ margin:5px 0px 0px !important;
200
+ }
201
+ .sa_slide_bg_wrapper .slide_image_settings_line {
202
+ margin:10px 0px 0px 177px;
203
+ }
204
+ .sa_slide_bg_wrapper .slide_image_settings_line span {
205
+ display:inline-block;
206
+ width:130px;
207
+ color:#303030;
208
+ font-family:'Open Sans', sans-serif;
209
+ font-weight:400;
210
+ font-size:13px;
211
+ }
212
+ .sa_slide_bg_wrapper .slide_image_settings_line select {
213
+ min-width:110px;
214
+ }
215
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer { /* spectrum color picker */
216
+ background-color:#f0f0f0 !important;
217
+ border:solid 1px #e0e0e0 !important;
218
+ margin:2px 1px !important;
219
+ padding:2px !important;
220
+ border-radius:3px !important;
221
+ }
222
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer .sp-preview { /* spectrum color picker */
223
+ width:87px !important;
224
+ height:18px !important;
225
+ border:solid 1px #c0c0c0 !important;
226
+ margin-right:3px !important;
227
+ }
228
+ .sa_slide_bg_wrapper .slide_image_settings_line .sp-replacer .sp-dd { /* spectrum color picker */
229
+ height:18px !important;
230
+ padding:0px !important;
231
+ margin-right:2px !important;
232
+ }
233
+
234
+ /* SLIDE BUTTONS (DELETE SLIDE, DUPLICATE SLIDE) */
235
+ #slider_accordion > div .button-secondary {
236
+ margin:10px 0px 0px;
237
+ }
238
+
239
+ /* ### METABOX 'Slider Shortcode' ### */
240
+ #sa_slider_shortcode {
241
+ display:block;
242
+ margin:10px 0px 0px;
243
+ padding:7px 10px;
244
+ background-color:#f0f0f0;
245
+ color:firebrick;
246
+ font-family:'Open Sans', sans-serif;
247
+ font-weight:normal;
248
+ font-size:14px;
249
+ line-height:20px;
250
+ border-radius:3px;
251
+ text-align:center;
252
+ cursor:default;
253
+ }
254
+ #sa_shortcode_copy {
255
+ float:right;
256
+ margin:10px 0px 0px;
257
+ }
258
+
259
+ /* ### METABOX 'Items Displayed' ### */
260
+ #items_displayed_metabox > h4 {
261
+ color:#303030;
262
+ margin:10px 0px 5px;
263
+ font-family:'Open Sans', sans-serif;
264
+ font-size:14px;
265
+ font-weight:600;
266
+ line-height:20px;
267
+ }
268
+ #items_displayed_metabox > div {
269
+ clear:both;
270
+ }
271
+ #items_displayed_metabox > div em {
272
+ display:block;
273
+ float:left;
274
+ margin-left:10px;
275
+ line-height:30px !important;
276
+ height:32px !important;
277
+ background-position:0px 8px !important;
278
+ cursor:help;
279
+ }
280
+ #items_displayed_metabox > div span {
281
+ display:block;
282
+ float:left;
283
+ padding-left:5px;
284
+ color:#303030;
285
+ width:120px;
286
+ font-family:'Open Sans', sans-serif;
287
+ font-weight:400;
288
+ font-size:13px;
289
+ line-height:32px;
290
+ height:32px !important;
291
+ }
292
+ #items_displayed_metabox > div select {
293
+ margin:1px 1px 3px !important;
294
+ }
295
+
296
+ /* ### METABOX 'Slider Style' ### */
297
+ #slider_style_metabox h4 {
298
+ position:relative;
299
+ color:#303030;
300
+ margin:15px 0px 10px;
301
+ font-family:'Open Sans', sans-serif;
302
+ font-size:14px;
303
+ font-weight:600;
304
+ line-height:20px;
305
+ }
306
+ #slider_style_metabox h4 span {
307
+ color:#909090 !important;
308
+ font-weight:400;
309
+ }
310
+ #slider_style_metabox h4 span {
311
+ color:firebrick;
312
+ }
313
+ #slider_style_metabox h4 em {
314
+ display:inline-block;
315
+ position:absolute;
316
+ top:1px;
317
+ width:16px;
318
+ height:16px;
319
+ background-position:0px 0px !important;
320
+ cursor:help;
321
+ margin-left:5px;
322
+ }
323
+ #slider_style_metabox #sa_css_id {
324
+ width:100%;
325
+ margin-bottom:15px;
326
+ font-size:14px !important;
327
+ line-height:20px !important;
328
+ padding:5px 7px !important;
329
+ }
330
+ #slider_style_metabox #css_note_text {
331
+ padding-left:3px;
332
+ padding-bottom:5px;
333
+ }
334
+ #slider_style_metabox #css_note_value {
335
+ margin-left:3px;
336
+ margin-bottom:25px !important;
337
+ padding:4px 5px 4px 32px;
338
+ background:#f0f0f0 url('../images/icon_copy.png') no-repeat 2px 2px;
339
+ font-size:13px;
340
+ line-height:20px;
341
+ height:20px;
342
+ color:firebrick;
343
+ cursor:pointer;
344
+ }
345
+ #slider_style_metabox .ca_style_hr {
346
+ border-top:solid 1px #e0e0e0;
347
+ width:80%;
348
+ margin:0px 10%;
349
+ }
350
+ /* slider padding*/
351
+ #slider_style_metabox .ca_style_padding > div {
352
+ float:left;
353
+ display:inline-block;
354
+ background-color:transparent;
355
+ background-repeat:no-repeat;
356
+ background-position:0px 2px;
357
+ width:45px;
358
+ height:23px;
359
+ padding:0px 0px 3px 19px;
360
+ }
361
+ #slider_style_metabox .ca_style_padding #padd_top { background-image:url('../images/padding_top.png'); }
362
+ #slider_style_metabox .ca_style_padding #padd_right { background-image:url('../images/padding_right.png'); }
363
+ #slider_style_metabox .ca_style_padding #padd_bottom { background-image:url('../images/padding_bottom.png'); }
364
+ #slider_style_metabox .ca_style_padding #padd_left { background-image:url('../images/padding_left.png'); width:38px !important; }
365
+
366
+ #slider_style_metabox .ca_style_padding div input {
367
+ width:33px !important;
368
+ margin:3px 2px !important;
369
+ outline-style:none !important;
370
+ border-style:none !important;
371
+ box-shadow:none !important;
372
+ -webkit-box-shadow:none !important;
373
+ color:#303030 !important;
374
+ font-size:13px !important;
375
+ }
376
+ /* slide style & Style for Slides */
377
+ #slider_style_metabox .ca_style_setting_line {
378
+ padding-left:5px;
379
+ padding-bottom:10px;
380
+ }
381
+ #slider_style_metabox .ca_style_setting_line span {
382
+ display:inline-block;
383
+ width:100px;
384
+ font-family:'Open Sans', sans-serif;
385
+ font-size:13px;
386
+ line-height:18px;
387
+ }
388
+ #slider_style_metabox .ca_style_setting_line .ui-spinner {
389
+ width:auto !important;
390
+ }
391
+ #slider_style_metabox .ca_style_setting_line input {
392
+ width:50px !important;
393
+ margin:3px 5px !important;
394
+ outline-style:none !important;
395
+ border-style:none !important;
396
+ box-shadow:none !important;
397
+ -webkit-box-shadow:none !important;
398
+ color:#303030 !important;
399
+ font-size:13px !important;
400
+ }
401
+ #slider_style_metabox .ca_style_setting_line em {
402
+ display:inline-block;
403
+ padding:0px 10px 0px 5px;
404
+ font-style:normal;
405
+ color:#a0a0a0;
406
+ font-family:'Open Sans', sans-serif;
407
+ font-size:14px;
408
+ line-height:18px;
409
+ }
410
+ #slider_style_metabox .ca_style_setting_line .sp-replacer { /* spectrum color picker */
411
+ background-color:#f0f0f0 !important;
412
+ border:solid 1px #e0e0e0 !important;
413
+ padding:2px !important;
414
+ border-radius:3px !important;
415
+ }
416
+ #slider_style_metabox .ca_style_setting_line .sp-replacer .sp-preview { /* spectrum color picker */
417
+ width:38px !important;
418
+ height:16px !important;
419
+ border:solid 1px #c0c0c0 !important;
420
+ margin-right:3px !important;
421
+ }
422
+ #slider_style_metabox .ca_style_setting_line .sp-replacer .sp-dd { /* spectrum color picker */
423
+ height:16px !important;
424
+ padding:0px !important;
425
+ margin-right:2px !important;
426
+ }
427
+ #slider_style_metabox #sa_border_width,
428
+ #slider_style_metabox #sa_border_radius {
429
+ width:35px !important;
430
+ }
431
+ #slider_style_metabox #ca_style_padding_top_bottom {
432
+ background:transparent url('../images/padding_top_bottom.png') no-repeat 5px 0px !important;
433
+ padding-left:28px !important;
434
+ }
435
+ #slider_style_metabox #ca_style_padding_left_right {
436
+ background:transparent url('../images/padding_left_right.png') no-repeat 5px 0px !important;
437
+ padding-left:28px !important;
438
+ }
439
+ #slider_style_metabox #ca_style_padding_top_bottom > span,
440
+ #slider_style_metabox #ca_style_padding_left_right > span {
441
+ width:77px;
442
+ background-position:57px 2px !important;
443
+ height:20px !important;
444
+ cursor:help;
445
+ }
446
+
447
+ /* ### METABOX 'Information' - 'SLIDE ADDED', 'SLIDE DELETED', 'SLIDE DUPLICATED' & 'SLIDE MOVED' INFO MESSAGES ### */
448
+ #sa_slide_added_mess,
449
+ #sa_slide_duplicated_mess,
450
+ #sa_slide_moved_mess {
451
+ margin:0px !important;
452
+ color:#4285F4;
453
+ font-family:'Open Sans', sans-serif;
454
+ font-weight:normal;
455
+ font-size:20px !important;
456
+ line-height:26px !important;
457
+ }
458
+ #sa_slide_deleted_mess {
459
+ margin:0px !important;
460
+ color:crimson;
461
+ font-family:'Open Sans', sans-serif;
462
+ font-weight:normal;
463
+ font-size:20px !important;
464
+ line-height:26px !important;
465
+ }
466
+
467
+ /* ### JQUERY UI - TOOLTIPS ### */
468
+ .sa_tooltip {
469
+ display:inline-block;
470
+ width:16px;
471
+ height:16px;
472
+ background:transparent url('../images/icon_info.png') no-repeat top left;
473
+ }
474
+
475
+ /* ### JQUERY UI - DIALOG BOX ### */
476
+ .ui-dialog .ui-dialog-titlebar {
477
+ padding:7px 12px !important;
478
+ line-height:22px !important;
479
+ height:22px !important;
480
+ }
481
+ .ui-dialog .ui-dialog-titlebar .ui-dialog-title {
482
+ color:#333333 !important;
483
+ font-family:Arial, Helvetica, sans-serif !important;
484
+ font-weight:bold !important;
485
+ font-size:16px !important;
486
+ line-height:22px !important;
487
+ }
488
+ .ui-dialog .ui-dialog-titlebar button:before {
489
+ font-size:16px !important;
490
+ line-height:16px !important;
491
+ height:16px !important;
492
+ width:16px !important;
493
+ }
494
+ .ui-dialog #sa_dialog_box {
495
+ padding:15px 10px 10px !important;
496
+ }
497
+
498
+ /* ### JQUERY UI - SPINNER ### */
499
+ .ui-state-default .ui-icon {
500
+ background-image:url('../images/ui-icons_777777_256x240.png') !important;
501
+ }
502
+ .ui-state-hover .ui-icon {
503
+ background-image:url('../images/ui-icons_444444_256x240.png') !important;
504
+ }
trunk/images/icon_copy.png ADDED
Binary file
trunk/images/icon_info.png ADDED
Binary file
trunk/images/icon_next.png ADDED
Binary file
trunk/images/icon_prev.png ADDED
Binary file
trunk/images/padding_bottom.png ADDED
Binary file
trunk/images/padding_left.png ADDED
Binary file
trunk/images/padding_left_right.png ADDED
Binary file
trunk/images/padding_right.png ADDED
Binary file
trunk/images/padding_top.png ADDED
Binary file
trunk/images/padding_top_bottom.png ADDED
Binary file
trunk/images/sample_logo1.png ADDED
Binary file
trunk/images/sample_logo2.png ADDED
Binary file
trunk/images/sample_logo3.png ADDED
Binary file
trunk/images/sample_logo4.png ADDED
Binary file
trunk/images/sample_logo5.png ADDED
Binary file
trunk/images/sample_logo6.png ADDED
Binary file
trunk/images/sample_logo7.png ADDED
Binary file
trunk/images/sample_logo8.png ADDED
Binary file
trunk/images/ui-icons_444444_256x240.png ADDED
Binary file
trunk/images/ui-icons_555555_256x240.png ADDED
Binary file
trunk/images/ui-icons_777620_256x240.png ADDED
Binary file
trunk/images/ui-icons_777777_256x240.png ADDED
Binary file
trunk/images/ui-icons_cc0000_256x240.png ADDED
Binary file
trunk/images/ui-icons_ffffff_256x240.png ADDED
Binary file
trunk/js/slide-anything-admin.js ADDED
@@ -0,0 +1,519 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // ##################################################################
2
+ // ### SLIDE ANYTHING PLUGIN - JAVASCRIPT FOR WORDPRESS DASHBOARD ###
3
+ // ##################################################################
4
+
5
+ jQuery(function() {
6
+ // ##### JQUERY-UI TOOLTIPS #####
7
+ jQuery(".sa_tooltip").tooltip();
8
+
9
+ // ##### JQUERY-UI - SLIDE DURATION SLIDER/INPUT #####
10
+ var init_value = jQuery("#sa_slide_duration").val();
11
+ jQuery("#jq_slider_duration").slider({
12
+ range:"max",
13
+ min:0,
14
+ max:30,
15
+ step:0.1,
16
+ value:init_value,
17
+ slide:function(event, ui) {
18
+ jQuery("#sa_slide_duration").val(ui.value);
19
+ }
20
+ });
21
+ jQuery("#sa_slide_duration").val(jQuery("#jq_slider_duration").slider("value"));
22
+
23
+ // ##### JQUERY-UI - SLIDE TRANSITION SLIDER/INPUT #####
24
+ var init_value = jQuery("#sa_slide_transition").val();
25
+ jQuery("#jq_slider_transition").slider({
26
+ range:"max",
27
+ min:0,
28
+ max:3,
29
+ step:0.1,
30
+ value:init_value,
31
+ slide:function(event, ui) {
32
+ jQuery("#sa_slide_transition").val(ui.value);
33
+ }
34
+ });
35
+ jQuery("#sa_slide_transition").val(jQuery("#jq_slider_transition").slider("value"));
36
+
37
+ // ##### CHANGE EVENT HANDLER FOR 'Disable Visual Editor' CHECKBOX #####
38
+ jQuery('#sa_disable_visual_editor').change(function() {
39
+ // save the custom post type
40
+ jQuery('#sa_disable_visual_editor').css('cursor', 'wait');
41
+ jQuery('body').css('cursor', 'wait');
42
+ jQuery('#publish').click();
43
+ })
44
+
45
+ // ##### JQUERY-UI ACCORDION CONTAINING CONTENT FOR ALL SLIDES #####
46
+ jQuery("#slider_accordion").accordion({
47
+ heightStyle: "content"
48
+ });
49
+
50
+ // ##### CLICK EVENT HANDLER FOR THE 'Add Slide' BUTTON #####
51
+ // increment the hidden 'number of slides' input field and save the custom post type
52
+ jQuery('#sa_add_slide').click(function() {
53
+ var num = + jQuery("#num_slides_id").val() + 1;
54
+ jQuery("#num_slides_id").val(num);
55
+ // set hidden input field to notify that a status message must be displayed
56
+ var info_added = document.getElementById('sa_info_added');
57
+ info_added.value = "1";
58
+ // save the custom post type
59
+ jQuery('#sa_add_slide').css('cursor', 'wait');
60
+ jQuery('body').css('cursor', 'wait');
61
+ jQuery('#publish').click();
62
+ });
63
+
64
+ // ##### CLICK EVENT HANDLER FOR THE SHORTCODE 'Copy to Clipboard' BUTTON #####
65
+ jQuery('#sa_shortcode_copy').click(function() {
66
+ var shortcode = document.getElementById('sa_slider_shortcode').innerHTML;
67
+ var aux = document.createElement("input"); // Create a "hidden" input
68
+ aux.setAttribute("value", shortcode); // Assign it the value of the specified element
69
+ document.body.appendChild(aux); // Append it to the body
70
+ aux.select(); // Highlight its content
71
+ document.execCommand("copy"); // Copy the highlighted text
72
+ document.body.removeChild(aux); // Remove it from the body
73
+ // DISPLAY 'Shortcode Copied' message
74
+ document.getElementById('sa_slider_shortcode').innerHTML = "Copied!";
75
+ setTimeout(function(){ document.getElementById('sa_slider_shortcode').innerHTML = shortcode; }, 1000);
76
+ });
77
+
78
+ // ##### CHANGE EVENT HANDLER FOR CSS ID INPUT BOX #####
79
+ jQuery('#sa_css_id').change(function() {
80
+ var css_id = document.getElementById('sa_css_id').value;
81
+ document.getElementById('css_note_value').innerHTML = '#' + css_id + ' .owl-item';
82
+ });
83
+
84
+ // ##### CLICK EVENT HANDLER FOR THE CSS SELECTOR 'Copy to Clipboard' BUTTON #####
85
+ jQuery('#css_note_value').click(function() {
86
+ var css_selector = document.getElementById('css_note_value').innerHTML;
87
+ var aux = document.createElement("input"); // Create a "hidden" input
88
+ aux.setAttribute("value", css_selector); // Assign it the value of the specified element
89
+ document.body.appendChild(aux); // Append it to the body
90
+ aux.select(); // Highlight its content
91
+ document.execCommand("copy"); // Copy the highlighted text
92
+ document.body.removeChild(aux); // Remove it from the body
93
+ // DISPLAY 'Shortcode Copied' message
94
+ document.getElementById('css_note_value').innerHTML = "Copied!";
95
+ setTimeout(function(){ document.getElementById('css_note_value').innerHTML = css_selector; }, 1000);
96
+ });
97
+
98
+ // ##### SPECTRUM COLOR PICKER - SLIDER BACKGROUND COLOR #####
99
+ var background_color = document.getElementById('sa_background_color').value;
100
+ jQuery("#sa_background_color").spectrum({
101
+ showPaletteOnly: true,
102
+ togglePaletteOnly: true,
103
+ togglePaletteMoreText: 'more',
104
+ togglePaletteLessText: 'less',
105
+ showInput: true,
106
+ allowEmpty:true,
107
+ preferredFormat: "rgb",
108
+ showAlpha: true,
109
+ color: background_color,
110
+ palette: [
111
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
112
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
113
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
114
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
115
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
116
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
117
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
118
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
119
+ ]
120
+ });
121
+
122
+ // ##### JQUERY-UI SPINNER - SLIDER BORDER WIDTH #####
123
+ jQuery("#sa_border_width").spinner({
124
+ step: 1,
125
+ min: 0,
126
+ max: 10,
127
+ numberFormat: "n"
128
+ });
129
+ // ##### CHANGE EVENT HANDLER - SLIDER BORDER WIDTH #####
130
+ jQuery('#sa_border_width').change(function() {
131
+ var border_width = document.getElementById('sa_border_width').value;
132
+ if (jQuery.isNumeric(border_width)) {
133
+ if ((border_width >= 0) && (border_width <= 10)) {
134
+ // valid number
135
+ } else {
136
+ document.getElementById('sa_border_width').value = '0'; // number out of range
137
+ }
138
+ } else {
139
+ document.getElementById('sa_border_width').value = '0'; // not a valid number
140
+ }
141
+ });
142
+ // ##### SPECTRUM COLOR PICKER - SLIDER BORDER COLOR #####
143
+ var border_color = document.getElementById('sa_border_color').value;
144
+ jQuery("#sa_border_color").spectrum({
145
+ showPaletteOnly: true,
146
+ togglePaletteOnly: true,
147
+ togglePaletteMoreText: 'more',
148
+ togglePaletteLessText: 'less',
149
+ showInput: true,
150
+ allowEmpty:true,
151
+ preferredFormat: "rgb",
152
+ showAlpha: true,
153
+ color: border_color,
154
+ palette: [
155
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
156
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
157
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
158
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
159
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
160
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
161
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
162
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
163
+ ]
164
+ });
165
+
166
+ // ##### JQUERY-UI SPINNER - SLIDER BORDER RADIUS #####
167
+ jQuery("#sa_border_radius").spinner({
168
+ step: 1,
169
+ min: 0,
170
+ max: 20,
171
+ numberFormat: "n"
172
+ });
173
+ // ##### CHANGE EVENT HANDLER - SLIDER BORDER RADIUS #####
174
+ jQuery('#sa_border_radius').change(function() {
175
+ var border_radius = document.getElementById('sa_border_radius').value;
176
+ if (jQuery.isNumeric(border_radius)) {
177
+ if ((border_radius >= 0) && (border_radius <= 20)) {
178
+ // valid number
179
+ } else {
180
+ document.getElementById('sa_border_radius').value = '0'; // number out of range
181
+ }
182
+ } else {
183
+ document.getElementById('sa_border_radius').value = '0'; // not a valid number
184
+ }
185
+ });
186
+
187
+ // ##### JQUERY-UI SPINNERS - WRAPPER PADDING (TOP, RIGHT, BOTTOM, LEFT) #####
188
+ jQuery("#sa_wrapper_padd_top").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
189
+ jQuery("#sa_wrapper_padd_right").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
190
+ jQuery("#sa_wrapper_padd_bottom").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
191
+ jQuery("#sa_wrapper_padd_left").spinner({ step: 1, min: 0, max: 99, numberFormat: "n" });
192
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING TOP #####
193
+ jQuery('#sa_wrapper_padd_top').change(function() {
194
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_top').value;
195
+ if (jQuery.isNumeric(wrapper_padding)) {
196
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
197
+ // valid number
198
+ } else {
199
+ document.getElementById('sa_wrapper_padd_top').value = '0'; // number out of range
200
+ }
201
+ } else {
202
+ document.getElementById('sa_wrapper_padd_top').value = '0'; // not a valid number
203
+ }
204
+ });
205
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING RIGHT #####
206
+ jQuery('#sa_wrapper_padd_right').change(function() {
207
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_right').value;
208
+ if (jQuery.isNumeric(wrapper_padding)) {
209
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
210
+ // valid number
211
+ } else {
212
+ document.getElementById('sa_wrapper_padd_right').value = '0'; // number out of range
213
+ }
214
+ } else {
215
+ document.getElementById('sa_wrapper_padd_right').value = '0'; // not a valid number
216
+ }
217
+ });
218
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING BOTTOM #####
219
+ jQuery('#sa_wrapper_padd_bottom').change(function() {
220
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_bottom').value;
221
+ if (jQuery.isNumeric(wrapper_padding)) {
222
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
223
+ // valid number
224
+ } else {
225
+ document.getElementById('sa_wrapper_padd_bottom').value = '0'; // number out of range
226
+ }
227
+ } else {
228
+ document.getElementById('sa_wrapper_padd_bottom').value = '0'; // not a valid number
229
+ }
230
+ });
231
+ // ##### CHANGE EVENT HANDLER - WRAPPER PADDING LEFT #####
232
+ jQuery('#sa_wrapper_padd_left').change(function() {
233
+ var wrapper_padding = document.getElementById('sa_wrapper_padd_left').value;
234
+ if (jQuery.isNumeric(wrapper_padding)) {
235
+ if ((wrapper_padding >= 0) && (wrapper_padding <= 30)) {
236
+ // valid number
237
+ } else {
238
+ document.getElementById('sa_wrapper_padd_left').value = '0'; // number out of range
239
+ }
240
+ } else {
241
+ document.getElementById('sa_wrapper_padd_left').value = '0'; // not a valid number
242
+ }
243
+ });
244
+
245
+ // ##### JQUERY-UI SPINNER FOR SLIDE MINIMUM HEIGHT #####
246
+ jQuery("#sa_slide_min_height").spinner({
247
+ step: 1,
248
+ min: 0,
249
+ max: 999,
250
+ numberFormat: "n"
251
+ });
252
+ // ##### CHANGE EVENT HANDLER FOR SLIDE MINIMUM HEIGHT #####
253
+ jQuery('#sa_slide_min_height').change(function() {
254
+ var slide_min_height = document.getElementById('sa_slide_min_height').value;
255
+ if (jQuery.isNumeric(slide_min_height)) {
256
+ if ((slide_min_height >= 0) && (slide_min_height <= 999)) {
257
+ // valid number
258
+ } else {
259
+ document.getElementById('sa_slide_min_height').value = '0'; // number out of range
260
+ }
261
+ } else {
262
+ document.getElementById('sa_slide_min_height').value = '0'; // not a valid number
263
+ }
264
+ });
265
+
266
+ // ##### JQUERY-UI SPINNER FOR SLIDE PADDING TOP/BOTTOM #####
267
+ jQuery("#sa_slide_padding_tb").spinner({
268
+ step: 0.1,
269
+ min: 0,
270
+ max: 30,
271
+ numberFormat: "n"
272
+ });
273
+ // ##### CHANGE EVENT HANDLER FOR SLIDE PADDING TOP/BOTTOM #####
274
+ jQuery('#sa_slide_padding_tb').change(function() {
275
+ var slide_padding_tb = document.getElementById('sa_slide_padding_tb').value;
276
+ if (jQuery.isNumeric(slide_padding_tb)) {
277
+ if ((slide_padding_tb >= 0) && (slide_padding_tb <= 30)) {
278
+ // valid number
279
+ } else {
280
+ document.getElementById('sa_slide_padding_tb').value = '0'; // number out of range
281
+ }
282
+ } else {
283
+ document.getElementById('sa_slide_padding_tb').value = '0'; // not a valid number
284
+ }
285
+ });
286
+
287
+ // ##### JQUERY-UI SPINNER FOR SLIDE PADDING LEFT/RIGHT #####
288
+ jQuery("#sa_slide_padding_lr").spinner({
289
+ step: 0.1,
290
+ min: 0,
291
+ max: 30,
292
+ numberFormat: "n"
293
+ });
294
+ // ##### CHANGE EVENT HANDLER FOR SLIDE PADDING LEFT/RIGHT #####
295
+ jQuery('#sa_slide_padding_lr').change(function() {
296
+ var slide_padding_lr = document.getElementById('sa_slide_padding_lr').value;
297
+ if (jQuery.isNumeric(slide_padding_lr)) {
298
+ if ((slide_padding_lr >= 0) && (slide_padding_lr <= 30)) {
299
+ // valid number
300
+ } else {
301
+ document.getElementById('sa_slide_padding_lr').value = '0'; // number out of range
302
+ }
303
+ } else {
304
+ document.getElementById('sa_slide_padding_lr').value = '0'; // not a valid number
305
+ }
306
+ });
307
+ })
308
+
309
+
310
+
311
+ jQuery(function() {
312
+ // THE VAIRABLE THAT HOLDS THE IFRAME FOR WORDPRESS MEDIA UPLOADS
313
+ var frame;
314
+
315
+ // ##### CLICK EVENT HANDLER - 'Set Background Image' LINK (BUTTON) FOR ALL SLIDES #####
316
+ jQuery('.slide_image_add').click(function(event) {
317
+ // GET THE SLIDE NUMBER (GET parameter within anchor 'href' attribute)
318
+ var anchor_element = event.target;
319
+ var upload_url = anchor_element.getAttribute('href');
320
+ var split_arr = upload_url.split("&slide=");
321
+ var slide_no = split_arr[1];
322
+
323
+ // PREVENT THE ANCHOR LINK FROM OPENING HREF TARGET PAGE
324
+ event.preventDefault();
325
+
326
+ // SET THE HTML ELEMENTS TO BE USED WITHIN THIS FUNCTION
327
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
328
+ var image_id = "#sa_slide" + slide_no + "_image_id";
329
+ var del_img_but = "#slide" + slide_no + "_image_del";
330
+
331
+ // CREATE A NEW MEDIA UPLOAD FRAME
332
+ frame = wp.media({
333
+ title: 'Select the background image for your slide',
334
+ button: {
335
+ text: 'Use selected image'
336
+ },
337
+ multiple: false // only a single file may be selected
338
+ });
339
+
340
+ // AN IMAGE HAS BEEN SELECTED WITHIN THE MEDIA UPLOAD FRAME...
341
+ frame.on('select', function() {
342
+ // Get media attachment details from the frame state
343
+ var attachment = frame.state().get('selection').first().toJSON();
344
+ // Set the background image of the thumbnail preview DIV to the attachment URL
345
+ jQuery(thumb_preview).css('background-image', 'url(' + attachment.url + ')');
346
+ // Send the attachment id to our hidden input box
347
+ jQuery(image_id).val(attachment.id);
348
+ // Unhide the delete image button
349
+ jQuery(del_img_but).removeClass('sa_hidden');
350
+ });
351
+ // Finally, open the modal on click
352
+ frame.open();
353
+ });
354
+ })
355
+
356
+
357
+
358
+ // ##### CLICK EVENT HANDLER - 'Remove Background Image' BUTTON FOR ALL SLIDES #####
359
+ function remove_slide_bg_image(slide_no) {
360
+ // SET THE HTML ELEMENTS TO BE USED WITHIN THIS FUNCTION
361
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
362
+ var image_id = "#sa_slide" + slide_no + "_image_id";
363
+ var del_img_but = "#slide" + slide_no + "_image_del";
364
+
365
+ // Reset the background image of the thumbnail preview div
366
+ jQuery(thumb_preview).css('background-image', '');
367
+ // Delete the image id from the hidden input
368
+ jQuery(image_id).val('');
369
+ // Hide the delete image button
370
+ jQuery(del_img_but).addClass('sa_hidden');
371
+ }
372
+
373
+
374
+
375
+ // ##### CHANGE EVENT HANDLER - BACKGROUND SIZE DROPDOWN FOR ALL SLIDES #####
376
+ function change_slide_image_size(slide_no) {
377
+ var background_size = document.getElementById("sa_slide" + slide_no + "_image_size").value;
378
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
379
+ jQuery(thumb_preview).css('background-size', background_size);
380
+ }
381
+
382
+
383
+
384
+ // ##### CHANGE EVENT HANDLER - BACKGROUND SIZE DROPDOWN FOR ALL SLIDES #####
385
+ function change_slide_image_repeat(slide_no) {
386
+ var background_repeat = document.getElementById("sa_slide" + slide_no + "_image_repeat").value;
387
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
388
+ jQuery(thumb_preview).css('background-repeat', background_repeat);
389
+ }
390
+
391
+
392
+
393
+ jQuery(function() {
394
+ var num_slides = parseInt(document.getElementById('num_slides_id').value);
395
+ // ##### LOOP THRU EACH SLIDE #####
396
+ for (i = 1; i <= num_slides; i++) {
397
+ // ##### SPECTRUM COLOR PICKER - SLIDE BACKGROUND COLOR #####
398
+ var color_picker_id = 'sa_slide' + i + '_image_color';
399
+ var background_color = document.getElementById(color_picker_id).value;
400
+ jQuery('#' + color_picker_id).spectrum({
401
+ showPaletteOnly: true,
402
+ togglePaletteOnly: true,
403
+ togglePaletteMoreText: 'more',
404
+ togglePaletteLessText: 'less',
405
+ showInput: true,
406
+ allowEmpty: true,
407
+ preferredFormat: "rgb",
408
+ showAlpha: true,
409
+ color: background_color,
410
+ palette: [
411
+ ["#000","#444","#666","#999","#ccc","#eee","#f3f3f3","#fff"],
412
+ ["#f00","#f90","#ff0","#0f0","#0ff","#00f","#90f","#f0f"],
413
+ ["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],
414
+ ["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],
415
+ ["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],
416
+ ["#c00","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],
417
+ ["#900","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],
418
+ ["#600","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]
419
+ ]
420
+ });
421
+ }
422
+ })
423
+ // ##### CHANGE EVENT HANDLER - SLIDE BACKGROUND COLOR PICKER #####
424
+ function change_slide_image_color(slide_no) {
425
+ var background_color = document.getElementById("sa_slide" + slide_no + "_image_color").value;
426
+ var thumb_preview = "#slide" + slide_no + "_thumb div";
427
+ jQuery(thumb_preview).css('background-color', background_color);
428
+ }
429
+
430
+
431
+
432
+ // ##### CLICK EVENT HANDLER FOR THE 'Delete Slide' BUTTON (FOR EACH SLIDE) #####
433
+ // Set the hidden 'delete status' input field to zero and save the custom post type
434
+ function delete_sa_slide(delete_id) {
435
+ jQuery(function() {
436
+ var dialog_box = document.getElementById('sa_dialog_box');
437
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to delete this slide.";
438
+ jQuery("#sa_dialog_box").dialog({ title: 'DELETE SLIDE' });
439
+ jQuery("#sa_dialog_box").dialog({
440
+ buttons: {
441
+ OK: function() {
442
+ var del_status = document.getElementById(delete_id);
443
+ del_status.value = "0";
444
+ // set hidden input field to notify that a status message must be displayed
445
+ var info_deleted = document.getElementById('sa_info_deleted');
446
+ info_deleted.value = "1";
447
+ // save the custom post type
448
+ jQuery('body').css('cursor', 'wait');
449
+ jQuery('.ui-button').css('cursor', 'wait');
450
+ jQuery('#publish').click();
451
+ },
452
+ Cancel: function() {
453
+ jQuery(this).dialog("close");
454
+ }
455
+ }
456
+ });
457
+ jQuery("#sa_dialog_box").dialog("open");
458
+ })
459
+ }
460
+
461
+ // ##### CLICK EVENT HANDLER FOR THE 'Duplicate Slide' BUTTON (FOR EACH SLIDE) #####
462
+ // Set the hidden 'duplicate slide' input field to the slide number to be duplicated and save the custom post type
463
+ function duplicate_slide(slide_no) {
464
+ jQuery(function() {
465
+ var dialog_box = document.getElementById('sa_dialog_box');
466
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to make a duplicate (copy) of this slide.";
467
+ jQuery("#sa_dialog_box").dialog({ title: 'DUPLICATE SLIDE' });
468
+ jQuery("#sa_dialog_box").dialog({
469
+ buttons: {
470
+ OK: function() {
471
+ // set hidden 'duplicate slide' input field to the slide number to be duplicated
472
+ var duplicate_slide = document.getElementById('sa_duplicate_slide');
473
+ duplicate_slide.value = slide_no;
474
+ // set hidden input field to notify that a status message must be displayed
475
+ var info_duplicated = document.getElementById('sa_info_duplicated');
476
+ info_duplicated.value = "1";
477
+ // save the custom post type
478
+ jQuery('body').css('cursor', 'wait');
479
+ jQuery('.ui-button').css('cursor', 'wait');
480
+ jQuery('#publish').click();
481
+ },
482
+ Cancel: function() {
483
+ jQuery(this).dialog("close");
484
+ }
485
+ }
486
+ });
487
+ jQuery("#sa_dialog_box").dialog("open");
488
+ })
489
+ }
490
+
491
+ // ##### CLICK EVENT HANDLER FOR THE 'Move Slide Up' BUTTON (FOR EACH SLIDE) #####
492
+ // Set the hidden 'move slide up' input field to the slide number to be moved up and save the custom post type
493
+ function move_slide_up(slide_no) {
494
+ jQuery(function() {
495
+ var dialog_box = document.getElementById('sa_dialog_box');
496
+ dialog_box.innerHTML = "Click the <strong>OK</strong> button to move this slide up within the slide order.";
497
+ jQuery("#sa_dialog_box").dialog({ title: 'MOVE SLIDE UP' });
498
+ jQuery("#sa_dialog_box").dialog({
499
+ buttons: {
500
+ OK: function() {
501
+ // set hidden 'move slide up' input field to the slide number to be moved
502
+ var move_slide_up = document.getElementById('sa_move_slide_up');
503
+ move_slide_up.value = slide_no;
504
+ // set hidden input field to notify that a status message must be displayed
505
+ var info_moved = document.getElementById('sa_info_moved');
506
+ info_moved.value = "1";
507
+ // save the custom post type
508
+ jQuery('body').css('cursor', 'wait');
509
+ jQuery('.ui-button').css('cursor', 'wait');
510
+ jQuery('#publish').click();
511
+ },
512
+ Cancel: function() {
513
+ jQuery(this).dialog("close");
514
+ }
515
+ }
516
+ });
517
+ jQuery("#sa_dialog_box").dialog("open");
518
+ })
519
+ }
trunk/owl-carousel/owl-theme.css ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ##############################################################
3
+ ### OWL CAROUSEL THEME (CSS) FOR THE SLIDE ANYTHING PLUGIN ###
4
+ ##############################################################
5
+ */
6
+
7
+ /* ### PAGINATION BUTTONS ### */
8
+ .owl-theme .owl-controls .owl-pagination {
9
+ position:absolute;
10
+ width:100%;
11
+ padding:10px 0px 0px !important;
12
+ bottom:-22px !important;
13
+ text-align:center !important;
14
+ font-size:12px !important;
15
+ line-height:12px !important;
16
+ }
17
+ .owl-theme .owl-controls .owl-pagination .owl-page {
18
+ display: inline-block !important;
19
+ }
20
+ .owl-theme .owl-controls .owl-pagination .owl-page span {
21
+ display:inline-block !important;
22
+ border-style:none !important;
23
+ background-color:rgba(0,0,0,0.2) !important;
24
+ width:10px !important;
25
+ height:10px !important;
26
+ border-radius:50% !important;
27
+ margin:0px 3px !important;
28
+ transition:all .3s ease-in-out !important;
29
+ -webkit-transition:all .3s ease-in-out !important;
30
+ -moz-transition:all .3s ease-in-out !important;
31
+ -o-transition:all .3s ease-in-out !important;
32
+ }
33
+ .owl-theme .owl-controls .owl-pagination .active span {
34
+ background-color:rgba(0,0,0,0.5) !important;
35
+ }
36
+ .owl-theme .owl-controls .owl-pagination .owl-page span:hover {
37
+ background-color:rgba(0,0,0,0.5) !important;
38
+ }
39
+ .owl-pagination-true {
40
+ margin-bottom:22px !important;
41
+ }
42
+
43
+ /* ### PREVIOUS AND NEXT ARROW BUTTONS ### */
44
+ .owl-theme .owl-controls .owl-buttons {
45
+ display:none !important;
46
+ }
47
+ .owl-theme:hover .owl-controls .owl-buttons {
48
+ display:block !important;
49
+ }
50
+ .owl-theme .owl-controls .owl-buttons div {
51
+ position:absolute;
52
+ top:50%;
53
+ padding:2px 0px !important;
54
+ display:inline-block !important;
55
+ margin-top:-15px !important;
56
+ line-height:30px !important;
57
+ height:30px !important;
58
+ width:18px !important;
59
+ transition:all .3s ease-in-out !important;
60
+ -webkit-transition:all .3s ease-in-out !important;
61
+ -moz-transition:all .3s ease-in-out !important;
62
+ -o-transition:all .3s ease-in-out !important;
63
+ }
64
+ .owl-theme .owl-controls .owl-buttons .owl-prev {
65
+ left:5px;
66
+ background:transparent url('../images/icon_prev.png') no-repeat 1px 3px !important;
67
+ padding:2px 7px 2px 5px !important;
68
+ }
69
+ .owl-theme .owl-controls .owl-buttons .owl-next {
70
+ right:5px;
71
+ background:transparent url('../images/icon_next.png') no-repeat 1px 3px !important;
72
+ padding:2px 5px 2px 7px !important;
73
+ }
trunk/owl-carousel/owl.carousel.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Core Owl Carousel CSS File
3
+ * v1.3.3
4
+ */
5
+
6
+ /* clearfix */
7
+ .owl-carousel .owl-wrapper:after {
8
+ content: ".";
9
+ display: block;
10
+ clear: both;
11
+ visibility: hidden;
12
+ line-height: 0;
13
+ height: 0;
14
+ }
15
+ /* display none until init */
16
+ .owl-carousel{
17
+ display: none;
18
+ position: relative;
19
+ width: 100%;
20
+ -ms-touch-action: pan-y;
21
+ }
22
+ .owl-carousel .owl-wrapper{
23
+ display: none;
24
+ position: relative;
25
+ -webkit-transform: translate3d(0px, 0px, 0px);
26
+ }
27
+ .owl-carousel .owl-wrapper-outer{
28
+ overflow: hidden;
29
+ position: relative;
30
+ width: 100%;
31
+ }
32
+ .owl-carousel .owl-wrapper-outer.autoHeight{
33
+ -webkit-transition: height 500ms ease-in-out;
34
+ -moz-transition: height 500ms ease-in-out;
35
+ -ms-transition: height 500ms ease-in-out;
36
+ -o-transition: height 500ms ease-in-out;
37
+ transition: height 500ms ease-in-out;
38
+ }
39
+
40
+ .owl-carousel .owl-item{
41
+ float: left;
42
+ }
43
+ .owl-controls .owl-page,
44
+ .owl-controls .owl-buttons div{
45
+ cursor: pointer;
46
+ }
47
+ .owl-controls {
48
+ -webkit-user-select: none;
49
+ -khtml-user-select: none;
50
+ -moz-user-select: none;
51
+ -ms-user-select: none;
52
+ user-select: none;
53
+ -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
54
+ }
55
+
56
+ /* mouse grab icon */
57
+ .grabbing {
58
+ cursor:url(grabbing.png) 8 8, move;
59
+ }
60
+
61
+ /* fix */
62
+ .owl-carousel .owl-wrapper,
63
+ .owl-carousel .owl-item{
64
+ -webkit-backface-visibility: hidden;
65
+ -moz-backface-visibility: hidden;
66
+ -ms-backface-visibility: hidden;
67
+ -webkit-transform: translate3d(0,0,0);
68
+ -moz-transform: translate3d(0,0,0);
69
+ -ms-transform: translate3d(0,0,0);
70
+ }
71
+
trunk/owl-carousel/owl.carousel.min.js ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "function"!==typeof Object.create&&(Object.create=function(f){function g(){}g.prototype=f;return new g});
2
+ (function(f,g,k){var l={init:function(a,b){this.$elem=f(b);this.options=f.extend({},f.fn.owlCarousel.options,this.$elem.data(),a);this.userOptions=a;this.loadContent()},loadContent:function(){function a(a){var d,e="";if("function"===typeof b.options.jsonSuccess)b.options.jsonSuccess.apply(this,[a]);else{for(d in a.owl)a.owl.hasOwnProperty(d)&&(e+=a.owl[d].item);b.$elem.html(e)}b.logIn()}var b=this,e;"function"===typeof b.options.beforeInit&&b.options.beforeInit.apply(this,[b.$elem]);"string"===typeof b.options.jsonPath?
3
+ (e=b.options.jsonPath,f.getJSON(e,a)):b.logIn()},logIn:function(){this.$elem.data("owl-originalStyles",this.$elem.attr("style"));this.$elem.data("owl-originalClasses",this.$elem.attr("class"));this.$elem.css({opacity:0});this.orignalItems=this.options.items;this.checkBrowser();this.wrapperWidth=0;this.checkVisible=null;this.setVars()},setVars:function(){if(0===this.$elem.children().length)return!1;this.baseClass();this.eventTypes();this.$userItems=this.$elem.children();this.itemsAmount=this.$userItems.length;
4
+ this.wrapItems();this.$owlItems=this.$elem.find(".owl-item");this.$owlWrapper=this.$elem.find(".owl-wrapper");this.playDirection="next";this.prevItem=0;this.prevArr=[0];this.currentItem=0;this.customEvents();this.onStartup()},onStartup:function(){this.updateItems();this.calculateAll();this.buildControls();this.updateControls();this.response();this.moveEvents();this.stopOnHover();this.owlStatus();!1!==this.options.transitionStyle&&this.transitionTypes(this.options.transitionStyle);!0===this.options.autoPlay&&
5
+ (this.options.autoPlay=5E3);this.play();this.$elem.find(".owl-wrapper").css("display","block");this.$elem.is(":visible")?this.$elem.css("opacity",1):this.watchVisibility();this.onstartup=!1;this.eachMoveUpdate();"function"===typeof this.options.afterInit&&this.options.afterInit.apply(this,[this.$elem])},eachMoveUpdate:function(){!0===this.options.lazyLoad&&this.lazyLoad();!0===this.options.autoHeight&&this.autoHeight();this.onVisibleItems();"function"===typeof this.options.afterAction&&this.options.afterAction.apply(this,
6
+ [this.$elem])},updateVars:function(){"function"===typeof this.options.beforeUpdate&&this.options.beforeUpdate.apply(this,[this.$elem]);this.watchVisibility();this.updateItems();this.calculateAll();this.updatePosition();this.updateControls();this.eachMoveUpdate();"function"===typeof this.options.afterUpdate&&this.options.afterUpdate.apply(this,[this.$elem])},reload:function(){var a=this;g.setTimeout(function(){a.updateVars()},0)},watchVisibility:function(){var a=this;if(!1===a.$elem.is(":visible"))a.$elem.css({opacity:0}),
7
+ g.clearInterval(a.autoPlayInterval),g.clearInterval(a.checkVisible);else return!1;a.checkVisible=g.setInterval(function(){a.$elem.is(":visible")&&(a.reload(),a.$elem.animate({opacity:1},200),g.clearInterval(a.checkVisible))},500)},wrapItems:function(){this.$userItems.wrapAll('<div class="owl-wrapper">').wrap('<div class="owl-item"></div>');this.$elem.find(".owl-wrapper").wrap('<div class="owl-wrapper-outer">');this.wrapperOuter=this.$elem.find(".owl-wrapper-outer");this.$elem.css("display","block")},
8
+ baseClass:function(){var a=this.$elem.hasClass(this.options.baseClass),b=this.$elem.hasClass(this.options.theme);a||this.$elem.addClass(this.options.baseClass);b||this.$elem.addClass(this.options.theme)},updateItems:function(){var a,b;if(!1===this.options.responsive)return!1;if(!0===this.options.singleItem)return this.options.items=this.orignalItems=1,this.options.itemsCustom=!1,this.options.itemsDesktop=!1,this.options.itemsDesktopSmall=!1,this.options.itemsTablet=!1,this.options.itemsTabletSmall=
9
+ !1,this.options.itemsMobile=!1;a=f(this.options.responsiveBaseWidth).width();a>(this.options.itemsDesktop[0]||this.orignalItems)&&(this.options.items=this.orignalItems);if(!1!==this.options.itemsCustom)for(this.options.itemsCustom.sort(function(a,b){return a[0]-b[0]}),b=0;b<this.options.itemsCustom.length;b+=1)this.options.itemsCustom[b][0]<=a&&(this.options.items=this.options.itemsCustom[b][1]);else a<=this.options.itemsDesktop[0]&&!1!==this.options.itemsDesktop&&(this.options.items=this.options.itemsDesktop[1]),
10
+ a<=this.options.itemsDesktopSmall[0]&&!1!==this.options.itemsDesktopSmall&&(this.options.items=this.options.itemsDesktopSmall[1]),a<=this.options.itemsTablet[0]&&!1!==this.options.itemsTablet&&(this.options.items=this.options.itemsTablet[1]),a<=this.options.itemsTabletSmall[0]&&!1!==this.options.itemsTabletSmall&&(this.options.items=this.options.itemsTabletSmall[1]),a<=this.options.itemsMobile[0]&&!1!==this.options.itemsMobile&&(this.options.items=this.options.itemsMobile[1]);this.options.items>this.itemsAmount&&
11
+ !0===this.options.itemsScaleUp&&(this.options.items=this.itemsAmount)},response:function(){var a=this,b,e;if(!0!==a.options.responsive)return!1;e=f(g).width();a.resizer=function(){f(g).width()!==e&&(!1!==a.options.autoPlay&&g.clearInterval(a.autoPlayInterval),g.clearTimeout(b),b=g.setTimeout(function(){e=f(g).width();a.updateVars()},a.options.responsiveRefreshRate))};f(g).resize(a.resizer)},updatePosition:function(){this.jumpTo(this.currentItem);!1!==this.options.autoPlay&&this.checkAp()},appendItemsSizes:function(){var a=
12
+ this,b=0,e=a.itemsAmount-a.options.items;a.$owlItems.each(function(c){var d=f(this);d.css({width:a.itemWidth}).data("owl-item",Number(c));if(0===c%a.options.items||c===e)c>e||(b+=1);d.data("owl-roundPages",b)})},appendWrapperSizes:function(){this.$owlWrapper.css({width:this.$owlItems.length*this.itemWidth*2,left:0});this.appendItemsSizes()},calculateAll:function(){this.calculateWidth();this.appendWrapperSizes();this.loops();this.max()},calculateWidth:function(){this.itemWidth=Math.round(this.$elem.width()/
13
+ this.options.items)},max:function(){var a=-1*(this.itemsAmount*this.itemWidth-this.options.items*this.itemWidth);this.options.items>this.itemsAmount?this.maximumPixels=a=this.maximumItem=0:(this.maximumItem=this.itemsAmount-this.options.items,this.maximumPixels=a);return a},min:function(){return 0},loops:function(){var a=0,b=0,e,c;this.positionsInArray=[0];this.pagesInArray=[];for(e=0;e<this.itemsAmount;e+=1)b+=this.itemWidth,this.positionsInArray.push(-b),!0===this.options.scrollPerPage&&(c=f(this.$owlItems[e]),
14
+ c=c.data("owl-roundPages"),c!==a&&(this.pagesInArray[a]=this.positionsInArray[e],a=c))},buildControls:function(){if(!0===this.options.navigation||!0===this.options.pagination)this.owlControls=f('<div class="owl-controls"/>').toggleClass("clickable",!this.browser.isTouch).appendTo(this.$elem);!0===this.options.pagination&&this.buildPagination();!0===this.options.navigation&&this.buildButtons()},buildButtons:function(){var a=this,b=f('<div class="owl-buttons"/>');a.owlControls.append(b);a.buttonPrev=
15
+ f("<div/>",{"class":"owl-prev",html:a.options.navigationText[0]||""});a.buttonNext=f("<div/>",{"class":"owl-next",html:a.options.navigationText[1]||""});b.append(a.buttonPrev).append(a.buttonNext);b.on("touchstart.owlControls mousedown.owlControls",'div[class^="owl"]',function(a){a.preventDefault()});b.on("touchend.owlControls mouseup.owlControls",'div[class^="owl"]',function(b){b.preventDefault();f(this).hasClass("owl-next")?a.next():a.prev()})},buildPagination:function(){var a=this;a.paginationWrapper=
16
+ f('<div class="owl-pagination"/>');a.owlControls.append(a.paginationWrapper);a.paginationWrapper.on("touchend.owlControls mouseup.owlControls",".owl-page",function(b){b.preventDefault();Number(f(this).data("owl-page"))!==a.currentItem&&a.goTo(Number(f(this).data("owl-page")),!0)})},updatePagination:function(){var a,b,e,c,d,g;if(!1===this.options.pagination)return!1;this.paginationWrapper.html("");a=0;b=this.itemsAmount-this.itemsAmount%this.options.items;for(c=0;c<this.itemsAmount;c+=1)0===c%this.options.items&&
17
+ (a+=1,b===c&&(e=this.itemsAmount-this.options.items),d=f("<div/>",{"class":"owl-page"}),g=f("<span></span>",{text:!0===this.options.paginationNumbers?a:"","class":!0===this.options.paginationNumbers?"owl-numbers":""}),d.append(g),d.data("owl-page",b===c?e:c),d.data("owl-roundPages",a),this.paginationWrapper.append(d));this.checkPagination()},checkPagination:function(){var a=this;if(!1===a.options.pagination)return!1;a.paginationWrapper.find(".owl-page").each(function(){f(this).data("owl-roundPages")===
18
+ f(a.$owlItems[a.currentItem]).data("owl-roundPages")&&(a.paginationWrapper.find(".owl-page").removeClass("active"),f(this).addClass("active"))})},checkNavigation:function(){if(!1===this.options.navigation)return!1;!1===this.options.rewindNav&&(0===this.currentItem&&0===this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.addClass("disabled")):0===this.currentItem&&0!==this.maximumItem?(this.buttonPrev.addClass("disabled"),this.buttonNext.removeClass("disabled")):this.currentItem===
19
+ this.maximumItem?(this.buttonPrev.removeClass("disabled"),this.buttonNext.addClass("disabled")):0!==this.currentItem&&this.currentItem!==this.maximumItem&&(this.buttonPrev.removeClass("disabled"),this.buttonNext.removeClass("disabled")))},updateControls:function(){this.updatePagination();this.checkNavigation();this.owlControls&&(this.options.items>=this.itemsAmount?this.owlControls.hide():this.owlControls.show())},destroyControls:function(){this.owlControls&&this.owlControls.remove()},next:function(a){if(this.isTransition)return!1;
20
+ this.currentItem+=!0===this.options.scrollPerPage?this.options.items:1;if(this.currentItem>this.maximumItem+(!0===this.options.scrollPerPage?this.options.items-1:0))if(!0===this.options.rewindNav)this.currentItem=0,a="rewind";else return this.currentItem=this.maximumItem,!1;this.goTo(this.currentItem,a)},prev:function(a){if(this.isTransition)return!1;this.currentItem=!0===this.options.scrollPerPage&&0<this.currentItem&&this.currentItem<this.options.items?0:this.currentItem-(!0===this.options.scrollPerPage?
21
+ this.options.items:1);if(0>this.currentItem)if(!0===this.options.rewindNav)this.currentItem=this.maximumItem,a="rewind";else return this.currentItem=0,!1;this.goTo(this.currentItem,a)},goTo:function(a,b,e){var c=this;if(c.isTransition)return!1;"function"===typeof c.options.beforeMove&&c.options.beforeMove.apply(this,[c.$elem]);a>=c.maximumItem?a=c.maximumItem:0>=a&&(a=0);c.currentItem=c.owl.currentItem=a;if(!1!==c.options.transitionStyle&&"drag"!==e&&1===c.options.items&&!0===c.browser.support3d)return c.swapSpeed(0),
22
+ !0===c.browser.support3d?c.transition3d(c.positionsInArray[a]):c.css2slide(c.positionsInArray[a],1),c.afterGo(),c.singleItemTransition(),!1;a=c.positionsInArray[a];!0===c.browser.support3d?(c.isCss3Finish=!1,!0===b?(c.swapSpeed("paginationSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},c.options.paginationSpeed)):"rewind"===b?(c.swapSpeed(c.options.rewindSpeed),g.setTimeout(function(){c.isCss3Finish=!0},c.options.rewindSpeed)):(c.swapSpeed("slideSpeed"),g.setTimeout(function(){c.isCss3Finish=!0},
23
+ c.options.slideSpeed)),c.transition3d(a)):!0===b?c.css2slide(a,c.options.paginationSpeed):"rewind"===b?c.css2slide(a,c.options.rewindSpeed):c.css2slide(a,c.options.slideSpeed);c.afterGo()},jumpTo:function(a){"function"===typeof this.options.beforeMove&&this.options.beforeMove.apply(this,[this.$elem]);a>=this.maximumItem||-1===a?a=this.maximumItem:0>=a&&(a=0);this.swapSpeed(0);!0===this.browser.support3d?this.transition3d(this.positionsInArray[a]):this.css2slide(this.positionsInArray[a],1);this.currentItem=
24
+ this.owl.currentItem=a;this.afterGo()},afterGo:function(){this.prevArr.push(this.currentItem);this.prevItem=this.owl.prevItem=this.prevArr[this.prevArr.length-2];this.prevArr.shift(0);this.prevItem!==this.currentItem&&(this.checkPagination(),this.checkNavigation(),this.eachMoveUpdate(),!1!==this.options.autoPlay&&this.checkAp());"function"===typeof this.options.afterMove&&this.prevItem!==this.currentItem&&this.options.afterMove.apply(this,[this.$elem])},stop:function(){this.apStatus="stop";g.clearInterval(this.autoPlayInterval)},
25
+ checkAp:function(){"stop"!==this.apStatus&&this.play()},play:function(){var a=this;a.apStatus="play";if(!1===a.options.autoPlay)return!1;g.clearInterval(a.autoPlayInterval);a.autoPlayInterval=g.setInterval(function(){a.next(!0)},a.options.autoPlay)},swapSpeed:function(a){"slideSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.slideSpeed)):"paginationSpeed"===a?this.$owlWrapper.css(this.addCssSpeed(this.options.paginationSpeed)):"string"!==typeof a&&this.$owlWrapper.css(this.addCssSpeed(a))},
26
+ addCssSpeed:function(a){return{"-webkit-transition":"all "+a+"ms ease","-moz-transition":"all "+a+"ms ease","-o-transition":"all "+a+"ms ease",transition:"all "+a+"ms ease"}},removeTransition:function(){return{"-webkit-transition":"","-moz-transition":"","-o-transition":"",transition:""}},doTranslate:function(a){return{"-webkit-transform":"translate3d("+a+"px, 0px, 0px)","-moz-transform":"translate3d("+a+"px, 0px, 0px)","-o-transform":"translate3d("+a+"px, 0px, 0px)","-ms-transform":"translate3d("+
27
+ a+"px, 0px, 0px)",transform:"translate3d("+a+"px, 0px,0px)"}},transition3d:function(a){this.$owlWrapper.css(this.doTranslate(a))},css2move:function(a){this.$owlWrapper.css({left:a})},css2slide:function(a,b){var e=this;e.isCssFinish=!1;e.$owlWrapper.stop(!0,!0).animate({left:a},{duration:b||e.options.slideSpeed,complete:function(){e.isCssFinish=!0}})},checkBrowser:function(){var a=k.createElement("div");a.style.cssText=" -moz-transform:translate3d(0px, 0px, 0px); -ms-transform:translate3d(0px, 0px, 0px); -o-transform:translate3d(0px, 0px, 0px); -webkit-transform:translate3d(0px, 0px, 0px); transform:translate3d(0px, 0px, 0px)";
28
+ a=a.style.cssText.match(/translate3d\(0px, 0px, 0px\)/g);this.browser={support3d:null!==a&&1===a.length,isTouch:"ontouchstart"in g||g.navigator.msMaxTouchPoints}},moveEvents:function(){if(!1!==this.options.mouseDrag||!1!==this.options.touchDrag)this.gestures(),this.disabledEvents()},eventTypes:function(){var a=["s","e","x"];this.ev_types={};!0===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl mousedown.owl","touchmove.owl mousemove.owl","touchend.owl touchcancel.owl mouseup.owl"]:
29
+ !1===this.options.mouseDrag&&!0===this.options.touchDrag?a=["touchstart.owl","touchmove.owl","touchend.owl touchcancel.owl"]:!0===this.options.mouseDrag&&!1===this.options.touchDrag&&(a=["mousedown.owl","mousemove.owl","mouseup.owl"]);this.ev_types.start=a[0];this.ev_types.move=a[1];this.ev_types.end=a[2]},disabledEvents:function(){this.$elem.on("dragstart.owl",function(a){a.preventDefault()});this.$elem.on("mousedown.disableTextSelect",function(a){return f(a.target).is("input, textarea, select, option")})},
30
+ gestures:function(){function a(a){if(void 0!==a.touches)return{x:a.touches[0].pageX,y:a.touches[0].pageY};if(void 0===a.touches){if(void 0!==a.pageX)return{x:a.pageX,y:a.pageY};if(void 0===a.pageX)return{x:a.clientX,y:a.clientY}}}function b(a){"on"===a?(f(k).on(d.ev_types.move,e),f(k).on(d.ev_types.end,c)):"off"===a&&(f(k).off(d.ev_types.move),f(k).off(d.ev_types.end))}function e(b){b=b.originalEvent||b||g.event;d.newPosX=a(b).x-h.offsetX;d.newPosY=a(b).y-h.offsetY;d.newRelativeX=d.newPosX-h.relativePos;
31
+ "function"===typeof d.options.startDragging&&!0!==h.dragging&&0!==d.newRelativeX&&(h.dragging=!0,d.options.startDragging.apply(d,[d.$elem]));(8<d.newRelativeX||-8>d.newRelativeX)&&!0===d.browser.isTouch&&(void 0!==b.preventDefault?b.preventDefault():b.returnValue=!1,h.sliding=!0);(10<d.newPosY||-10>d.newPosY)&&!1===h.sliding&&f(k).off("touchmove.owl");d.newPosX=Math.max(Math.min(d.newPosX,d.newRelativeX/5),d.maximumPixels+d.newRelativeX/5);!0===d.browser.support3d?d.transition3d(d.newPosX):d.css2move(d.newPosX)}
32
+ function c(a){a=a.originalEvent||a||g.event;var c;a.target=a.target||a.srcElement;h.dragging=!1;!0!==d.browser.isTouch&&d.$owlWrapper.removeClass("grabbing");d.dragDirection=0>d.newRelativeX?d.owl.dragDirection="left":d.owl.dragDirection="right";0!==d.newRelativeX&&(c=d.getNewPosition(),d.goTo(c,!1,"drag"),h.targetElement===a.target&&!0!==d.browser.isTouch&&(f(a.target).on("click.disable",function(a){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();f(a.target).off("click.disable")}),
33
+ a=f._data(a.target,"events").click,c=a.pop(),a.splice(0,0,c)));b("off")}var d=this,h={offsetX:0,offsetY:0,baseElWidth:0,relativePos:0,position:null,minSwipe:null,maxSwipe:null,sliding:null,dargging:null,targetElement:null};d.isCssFinish=!0;d.$elem.on(d.ev_types.start,".owl-wrapper",function(c){c=c.originalEvent||c||g.event;var e;if(3===c.which)return!1;if(!(d.itemsAmount<=d.options.items)){if(!1===d.isCssFinish&&!d.options.dragBeforeAnimFinish||!1===d.isCss3Finish&&!d.options.dragBeforeAnimFinish)return!1;
34
+ !1!==d.options.autoPlay&&g.clearInterval(d.autoPlayInterval);!0===d.browser.isTouch||d.$owlWrapper.hasClass("grabbing")||d.$owlWrapper.addClass("grabbing");d.newPosX=0;d.newRelativeX=0;f(this).css(d.removeTransition());e=f(this).position();h.relativePos=e.left;h.offsetX=a(c).x-e.left;h.offsetY=a(c).y-e.top;b("on");h.sliding=!1;h.targetElement=c.target||c.srcElement}})},getNewPosition:function(){var a=this.closestItem();a>this.maximumItem?a=this.currentItem=this.maximumItem:0<=this.newPosX&&(this.currentItem=
35
+ a=0);return a},closestItem:function(){var a=this,b=!0===a.options.scrollPerPage?a.pagesInArray:a.positionsInArray,e=a.newPosX,c=null;f.each(b,function(d,g){e-a.itemWidth/20>b[d+1]&&e-a.itemWidth/20<g&&"left"===a.moveDirection()?(c=g,a.currentItem=!0===a.options.scrollPerPage?f.inArray(c,a.positionsInArray):d):e+a.itemWidth/20<g&&e+a.itemWidth/20>(b[d+1]||b[d]-a.itemWidth)&&"right"===a.moveDirection()&&(!0===a.options.scrollPerPage?(c=b[d+1]||b[b.length-1],a.currentItem=f.inArray(c,a.positionsInArray)):
36
+ (c=b[d+1],a.currentItem=d+1))});return a.currentItem},moveDirection:function(){var a;0>this.newRelativeX?(a="right",this.playDirection="next"):(a="left",this.playDirection="prev");return a},customEvents:function(){var a=this;a.$elem.on("owl.next",function(){a.next()});a.$elem.on("owl.prev",function(){a.prev()});a.$elem.on("owl.play",function(b,e){a.options.autoPlay=e;a.play();a.hoverStatus="play"});a.$elem.on("owl.stop",function(){a.stop();a.hoverStatus="stop"});a.$elem.on("owl.goTo",function(b,e){a.goTo(e)});
37
+ a.$elem.on("owl.jumpTo",function(b,e){a.jumpTo(e)})},stopOnHover:function(){var a=this;!0===a.options.stopOnHover&&!0!==a.browser.isTouch&&!1!==a.options.autoPlay&&(a.$elem.on("mouseover",function(){a.stop()}),a.$elem.on("mouseout",function(){"stop"!==a.hoverStatus&&a.play()}))},lazyLoad:function(){var a,b,e,c,d;if(!1===this.options.lazyLoad)return!1;for(a=0;a<this.itemsAmount;a+=1)b=f(this.$owlItems[a]),"loaded"!==b.data("owl-loaded")&&(e=b.data("owl-item"),c=b.find(".lazyOwl"),"string"!==typeof c.data("src")?
38
+ b.data("owl-loaded","loaded"):(void 0===b.data("owl-loaded")&&(c.hide(),b.addClass("loading").data("owl-loaded","checked")),(d=!0===this.options.lazyFollow?e>=this.currentItem:!0)&&e<this.currentItem+this.options.items&&c.length&&this.lazyPreload(b,c)))},lazyPreload:function(a,b){function e(){a.data("owl-loaded","loaded").removeClass("loading");b.removeAttr("data-src");"fade"===d.options.lazyEffect?b.fadeIn(400):b.show();"function"===typeof d.options.afterLazyLoad&&d.options.afterLazyLoad.apply(this,
39
+ [d.$elem])}function c(){f+=1;d.completeImg(b.get(0))||!0===k?e():100>=f?g.setTimeout(c,100):e()}var d=this,f=0,k;"DIV"===b.prop("tagName")?(b.css("background-image","url("+b.data("src")+")"),k=!0):b[0].src=b.data("src");c()},autoHeight:function(){function a(){var a=f(e.$owlItems[e.currentItem]).height();e.wrapperOuter.css("height",a+"px");e.wrapperOuter.hasClass("autoHeight")||g.setTimeout(function(){e.wrapperOuter.addClass("autoHeight")},0)}function b(){d+=1;e.completeImg(c.get(0))?a():100>=d?g.setTimeout(b,
40
+ 100):e.wrapperOuter.css("height","")}var e=this,c=f(e.$owlItems[e.currentItem]).find("img"),d;void 0!==c.get(0)?(d=0,b()):a()},completeImg:function(a){return!a.complete||"undefined"!==typeof a.naturalWidth&&0===a.naturalWidth?!1:!0},onVisibleItems:function(){var a;!0===this.options.addClassActive&&this.$owlItems.removeClass("active");this.visibleItems=[];for(a=this.currentItem;a<this.currentItem+this.options.items;a+=1)this.visibleItems.push(a),!0===this.options.addClassActive&&f(this.$owlItems[a]).addClass("active");
41
+ this.owl.visibleItems=this.visibleItems},transitionTypes:function(a){this.outClass="owl-"+a+"-out";this.inClass="owl-"+a+"-in"},singleItemTransition:function(){var a=this,b=a.outClass,e=a.inClass,c=a.$owlItems.eq(a.currentItem),d=a.$owlItems.eq(a.prevItem),f=Math.abs(a.positionsInArray[a.currentItem])+a.positionsInArray[a.prevItem],g=Math.abs(a.positionsInArray[a.currentItem])+a.itemWidth/2;a.isTransition=!0;a.$owlWrapper.addClass("owl-origin").css({"-webkit-transform-origin":g+"px","-moz-perspective-origin":g+
42
+ "px","perspective-origin":g+"px"});d.css({position:"relative",left:f+"px"}).addClass(b).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endPrev=!0;d.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(d,b)});c.addClass(e).on("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend",function(){a.endCurrent=!0;c.off("webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend");a.clearTransStyle(c,e)})},clearTransStyle:function(a,
43
+ b){a.css({position:"",left:""}).removeClass(b);this.endPrev&&this.endCurrent&&(this.$owlWrapper.removeClass("owl-origin"),this.isTransition=this.endCurrent=this.endPrev=!1)},owlStatus:function(){this.owl={userOptions:this.userOptions,baseElement:this.$elem,userItems:this.$userItems,owlItems:this.$owlItems,currentItem:this.currentItem,prevItem:this.prevItem,visibleItems:this.visibleItems,isTouch:this.browser.isTouch,browser:this.browser,dragDirection:this.dragDirection}},clearEvents:function(){this.$elem.off(".owl owl mousedown.disableTextSelect");
44
+ f(k).off(".owl owl");f(g).off("resize",this.resizer)},unWrap:function(){0!==this.$elem.children().length&&(this.$owlWrapper.unwrap(),this.$userItems.unwrap().unwrap(),this.owlControls&&this.owlControls.remove());this.clearEvents();this.$elem.attr("style",this.$elem.data("owl-originalStyles")||"").attr("class",this.$elem.data("owl-originalClasses"))},destroy:function(){this.stop();g.clearInterval(this.checkVisible);this.unWrap();this.$elem.removeData()},reinit:function(a){a=f.extend({},this.userOptions,
45
+ a);this.unWrap();this.init(a,this.$elem)},addItem:function(a,b){var e;if(!a)return!1;if(0===this.$elem.children().length)return this.$elem.append(a),this.setVars(),!1;this.unWrap();e=void 0===b||-1===b?-1:b;e>=this.$userItems.length||-1===e?this.$userItems.eq(-1).after(a):this.$userItems.eq(e).before(a);this.setVars()},removeItem:function(a){if(0===this.$elem.children().length)return!1;a=void 0===a||-1===a?-1:a;this.unWrap();this.$userItems.eq(a).remove();this.setVars()}};f.fn.owlCarousel=function(a){return this.each(function(){if(!0===
46
+ f(this).data("owl-init"))return!1;f(this).data("owl-init",!0);var b=Object.create(l);b.init(a,this);f.data(this,"owlCarousel",b)})};f.fn.owlCarousel.options={items:5,itemsCustom:!1,itemsDesktop:[1199,4],itemsDesktopSmall:[979,3],itemsTablet:[768,2],itemsTabletSmall:!1,itemsMobile:[479,1],singleItem:!1,itemsScaleUp:!1,slideSpeed:200,paginationSpeed:800,rewindSpeed:1E3,autoPlay:!1,stopOnHover:!1,navigation:!1,navigationText:["prev","next"],rewindNav:!0,scrollPerPage:!1,pagination:!0,paginationNumbers:!1,
47
+ responsive:!0,responsiveRefreshRate:200,responsiveBaseWidth:g,baseClass:"owl-carousel",theme:"owl-theme",lazyLoad:!1,lazyFollow:!0,lazyEffect:"fade",autoHeight:!1,jsonPath:!1,jsonSuccess:!1,dragBeforeAnimFinish:!0,mouseDrag:!0,touchDrag:!0,addClassActive:!1,transitionStyle:!1,beforeUpdate:!1,afterUpdate:!1,beforeInit:!1,afterInit:!1,beforeMove:!1,afterMove:!1,afterAction:!1,startDragging:!1,afterLazyLoad:!1}})(jQuery,window,document);
trunk/owl-carousel/owl.transitions.css ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * Owl Carousel CSS3 Transitions
3
+ * v1.3.2
4
+ */
5
+
6
+ .owl-origin {
7
+ -webkit-perspective: 1200px;
8
+ -webkit-perspective-origin-x : 50%;
9
+ -webkit-perspective-origin-y : 50%;
10
+ -moz-perspective : 1200px;
11
+ -moz-perspective-origin-x : 50%;
12
+ -moz-perspective-origin-y : 50%;
13
+ perspective : 1200px;
14
+ }
15
+ /* fade */
16
+ .owl-fade-out {
17
+ z-index: 10;
18
+ -webkit-animation: fadeOut .7s both ease;
19
+ -moz-animation: fadeOut .7s both ease;
20
+ animation: fadeOut .7s both ease;
21
+ }
22
+ .owl-fade-in {
23
+ -webkit-animation: fadeIn .7s both ease;
24
+ -moz-animation: fadeIn .7s both ease;
25
+ animation: fadeIn .7s both ease;
26
+ }
27
+ /* backSlide */
28
+ .owl-backSlide-out {
29
+ -webkit-animation: backSlideOut 1s both ease;
30
+ -moz-animation: backSlideOut 1s both ease;
31
+ animation: backSlideOut 1s both ease;
32
+ }
33
+ .owl-backSlide-in {
34
+ -webkit-animation: backSlideIn 1s both ease;
35
+ -moz-animation: backSlideIn 1s both ease;
36
+ animation: backSlideIn 1s both ease;
37
+ }
38
+ /* goDown */
39
+ .owl-goDown-out {
40
+ -webkit-animation: scaleToFade .7s ease both;
41
+ -moz-animation: scaleToFade .7s ease both;
42
+ animation: scaleToFade .7s ease both;
43
+ }
44
+ .owl-goDown-in {
45
+ -webkit-animation: goDown .6s ease both;
46
+ -moz-animation: goDown .6s ease both;
47
+ animation: goDown .6s ease both;
48
+ }
49
+ /* scaleUp */
50
+ .owl-fadeUp-in {
51
+ -webkit-animation: scaleUpFrom .5s ease both;
52
+ -moz-animation: scaleUpFrom .5s ease both;
53
+ animation: scaleUpFrom .5s ease both;
54
+ }
55
+
56
+ .owl-fadeUp-out {
57
+ -webkit-animation: scaleUpTo .5s ease both;
58
+ -moz-animation: scaleUpTo .5s ease both;
59
+ animation: scaleUpTo .5s ease both;
60
+ }
61
+ /* Keyframes */
62
+ /*empty*/
63
+ @-webkit-keyframes empty {
64
+ 0% {opacity: 1}
65
+ }
66
+ @-moz-keyframes empty {
67
+ 0% {opacity: 1}
68
+ }
69
+ @keyframes empty {
70
+ 0% {opacity: 1}
71
+ }
72
+ @-webkit-keyframes fadeIn {
73
+ 0% { opacity:0; }
74
+ 100% { opacity:1; }
75
+ }
76
+ @-moz-keyframes fadeIn {
77
+ 0% { opacity:0; }
78
+ 100% { opacity:1; }
79
+ }
80
+ @keyframes fadeIn {
81
+ 0% { opacity:0; }
82
+ 100% { opacity:1; }
83
+ }
84
+ @-webkit-keyframes fadeOut {
85
+ 0% { opacity:1; }
86
+ 100% { opacity:0; }
87
+ }
88
+ @-moz-keyframes fadeOut {
89
+ 0% { opacity:1; }
90
+ 100% { opacity:0; }
91
+ }
92
+ @keyframes fadeOut {
93
+ 0% { opacity:1; }
94
+ 100% { opacity:0; }
95
+ }
96
+ @-webkit-keyframes backSlideOut {
97
+ 25% { opacity: .5; -webkit-transform: translateZ(-500px); }
98
+ 75% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
99
+ 100% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(-200%); }
100
+ }
101
+ @-moz-keyframes backSlideOut {
102
+ 25% { opacity: .5; -moz-transform: translateZ(-500px); }
103
+ 75% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
104
+ 100% { opacity: .5; -moz-transform: translateZ(-500px) translateX(-200%); }
105
+ }
106
+ @keyframes backSlideOut {
107
+ 25% { opacity: .5; transform: translateZ(-500px); }
108
+ 75% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
109
+ 100% { opacity: .5; transform: translateZ(-500px) translateX(-200%); }
110
+ }
111
+ @-webkit-keyframes backSlideIn {
112
+ 0%, 25% { opacity: .5; -webkit-transform: translateZ(-500px) translateX(200%); }
113
+ 75% { opacity: .5; -webkit-transform: translateZ(-500px); }
114
+ 100% { opacity: 1; -webkit-transform: translateZ(0) translateX(0); }
115
+ }
116
+ @-moz-keyframes backSlideIn {
117
+ 0%, 25% { opacity: .5; -moz-transform: translateZ(-500px) translateX(200%); }
118
+ 75% { opacity: .5; -moz-transform: translateZ(-500px); }
119
+ 100% { opacity: 1; -moz-transform: translateZ(0) translateX(0); }
120
+ }
121
+ @keyframes backSlideIn {
122
+ 0%, 25% { opacity: .5; transform: translateZ(-500px) translateX(200%); }
123
+ 75% { opacity: .5; transform: translateZ(-500px); }
124
+ 100% { opacity: 1; transform: translateZ(0) translateX(0); }
125
+ }
126
+ @-webkit-keyframes scaleToFade {
127
+ to { opacity: 0; -webkit-transform: scale(.8); }
128
+ }
129
+ @-moz-keyframes scaleToFade {
130
+ to { opacity: 0; -moz-transform: scale(.8); }
131
+ }
132
+ @keyframes scaleToFade {
133
+ to { opacity: 0; transform: scale(.8); }
134
+ }
135
+ @-webkit-keyframes goDown {
136
+ from { -webkit-transform: translateY(-100%); }
137
+ }
138
+ @-moz-keyframes goDown {
139
+ from { -moz-transform: translateY(-100%); }
140
+ }
141
+ @keyframes goDown {
142
+ from { transform: translateY(-100%); }
143
+ }
144
+
145
+ @-webkit-keyframes scaleUpFrom {
146
+ from { opacity: 0; -webkit-transform: scale(1.5); }
147
+ }
148
+ @-moz-keyframes scaleUpFrom {
149
+ from { opacity: 0; -moz-transform: scale(1.5); }
150
+ }
151
+ @keyframes scaleUpFrom {
152
+ from { opacity: 0; transform: scale(1.5); }
153
+ }
154
+
155
+ @-webkit-keyframes scaleUpTo {
156
+ to { opacity: 0; -webkit-transform: scale(1.5); }
157
+ }
158
+ @-moz-keyframes scaleUpTo {
159
+ to { opacity: 0; -moz-transform: scale(1.5); }
160
+ }
161
+ @keyframes scaleUpTo {
162
+ to { opacity: 0; transform: scale(1.5); }
163
+ }
trunk/php/slide-anything-admin.php ADDED
@@ -0,0 +1,927 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // #####################################################################
3
+ // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS DASHBOARD ###
4
+ // #####################################################################
5
+
6
+ // ##### PLUGIN REGISTRATION HOOK - RUN WHEN THE PLUGIN IS ACTIVATED #####
7
+ function cpt_slider_plugin_activation() {
8
+ // INSERT A 'SAMPLE SLIDER' CUSTOM POST INTO THE DATABASE
9
+ $sample_post_title = 'Sample Slider';
10
+
11
+ // check if the 'sample slider' already exists (plugin has been activated before)
12
+ $cpt_post = get_page_by_title($sample_post_title, 'OBJECT', 'sa_slider');
13
+
14
+ if (is_null($cpt_post)) {
15
+ // create the post object
16
+ $sample_post = array(
17
+ 'post_title' => $sample_post_title,
18
+ 'post_content' => '',
19
+ 'post_status' => 'publish',
20
+ 'post_type' => 'sa_slider'
21
+ );
22
+ // insert the post into the database
23
+ $cpt_id = wp_insert_post($sample_post);
24
+
25
+ // insert meta data for the 'sample slider' slides
26
+ for ($i = 1; $i <= 8; $i++) {
27
+ if ($i == 1) {
28
+ $color = "#f4cccc"; $image = "sample_logo1.png";
29
+ } elseif ($i == 2) {
30
+ $color = "#d9ead3"; $image = "sample_logo2.png";
31
+ } elseif ($i == 3) {
32
+ $color = "#fce5cd"; $image = "sample_logo3.png";
33
+ } elseif ($i == 4) {
34
+ $color = "#d0e0e3"; $image = "sample_logo4.png";
35
+ } elseif ($i == 5) {
36
+ $color = "#fff2cc"; $image = "sample_logo5.png";
37
+ } elseif ($i == 6) {
38
+ $color = "#cfe2f3"; $image = "sample_logo6.png";
39
+ } elseif ($i == 7) {
40
+ $color = "#d9d2e9"; $image = "sample_logo7.png";
41
+ } elseif ($i == 8) {
42
+ $color = "#ead1dc"; $image = "sample_logo8.png";
43
+ }
44
+ $content = "<div style='text-align: center; padding-bottom: 10px;'>\n";
45
+ $content .= "<div><img src='".plugins_url()."/slide-anything/images/".$image."' alt='Logo ".$i."' /></div>\n";
46
+ $content .= "<h3>Company Name</h3>\n";
47
+ $content .= "<p>Lorem ipsum dolor sit amet, cu usu cibo vituperata, id ius probo maiestatis inciderint, sit eu vide volutpat.</p>\n";
48
+ $content .= "</div>\n";
49
+ update_post_meta($cpt_id, "sa_slide".$i."_content", $content);
50
+ update_post_meta($cpt_id, "sa_slide".$i."_image_id", "");
51
+ update_post_meta($cpt_id, "sa_slide".$i."_image_size", "contain");
52
+ update_post_meta($cpt_id, "sa_slide".$i."_image_repeat", "no-repeat");
53
+ update_post_meta($cpt_id, "sa_slide".$i."_image_color", $color);
54
+
55
+ }
56
+ // insert meta data for the 'sample slider' configuration
57
+ update_post_meta($cpt_id, 'sa_disable_visual_editor', '');
58
+ update_post_meta($cpt_id, 'sa_num_slides', 8);
59
+ update_post_meta($cpt_id, 'sa_slide_duration', 4);
60
+ update_post_meta($cpt_id, 'sa_slide_transition', 0.3);
61
+ update_post_meta($cpt_id, 'sa_loop_slider', '1');
62
+ update_post_meta($cpt_id, 'sa_stop_hover', '1');
63
+ update_post_meta($cpt_id, 'sa_nav_arrows', '1');
64
+ update_post_meta($cpt_id, 'sa_pagination', '1');
65
+ update_post_meta($cpt_id, 'sa_items_width1', 1);
66
+ update_post_meta($cpt_id, 'sa_items_width2', 2);
67
+ update_post_meta($cpt_id, 'sa_items_width3', 3);
68
+ update_post_meta($cpt_id, 'sa_items_width4', 4);
69
+ update_post_meta($cpt_id, 'sa_items_width5', 4);
70
+ update_post_meta($cpt_id, 'sa_css_id', 'sample_slider');
71
+ update_post_meta($cpt_id, 'sa_background_color', '#fafafa');
72
+ update_post_meta($cpt_id, 'sa_border_width', 1);
73
+ update_post_meta($cpt_id, 'sa_border_color', '#f0f0f0');
74
+ update_post_meta($cpt_id, 'sa_border_radius', 5);
75
+ update_post_meta($cpt_id, 'sa_wrapper_padd_top', 8);
76
+ update_post_meta($cpt_id, 'sa_wrapper_padd_right', 8);
77
+ update_post_meta($cpt_id, 'sa_wrapper_padd_bottom', 8);
78
+ update_post_meta($cpt_id, 'sa_wrapper_padd_left', 8);
79
+ update_post_meta($cpt_id, 'sa_slide_min_height', 100);
80
+ update_post_meta($cpt_id, 'sa_slide_padding_tb', 5);
81
+ update_post_meta($cpt_id, 'sa_slide_padding_lr', 5);
82
+ }
83
+ }
84
+
85
+ /* ##### ACTION HOOK - REGISTER SCRIPTS (JS AND CSS) FOR WORDPRESS DASHBOARD ONLY ##### */
86
+ function cpt_register_admin_scripts() {
87
+ $screen = get_current_screen();
88
+ if ($screen->post_type == 'sa_slider') {
89
+ // ONLY LOAD SCRIPTS (JS & CSS) WITHIN 'Slider Anywhere' SCREENS IN WORDPRESS DASHBOARD
90
+ // load 'wordpress jquery-ui' scripts
91
+ wp_enqueue_script( 'jquery-ui-core' );
92
+ wp_enqueue_script( 'jquery-ui-accordion' );
93
+ wp_enqueue_script( 'jquery-ui-slider' );
94
+ wp_enqueue_script( 'jquery-ui-sortable' );
95
+ wp_enqueue_script( 'jquery-ui-draggable' );
96
+ wp_enqueue_script( 'jquery-ui-droppable' );
97
+ wp_enqueue_script( 'jquery-ui-resize' );
98
+ wp_enqueue_script( 'jquery-ui-dialog' );
99
+ wp_enqueue_script( 'jquery-ui-button' );
100
+ wp_enqueue_script( 'jquery-ui-tooltip' );
101
+ wp_enqueue_script( 'jquery-ui-spinner' );
102
+ // load 'spectrum colorpicker' script and css
103
+ wp_register_script('spectrum_js', PLUGIN_PATH.'spectrum/spectrum.js', array('jquery'));
104
+ wp_enqueue_script('spectrum_js');
105
+ wp_register_style('spectrum_css', PLUGIN_PATH.'spectrum/spectrum.css');
106
+ wp_enqueue_style('spectrum_css');
107
+ // load 'jquery-ui' css
108
+ wp_register_style('admin_ui_css', PLUGIN_PATH.'css/admin-user-interface.min.css');
109
+ wp_enqueue_style('admin_ui_css');
110
+ // load 'slide-anywhere' custom javasript and css for wordpress admin
111
+ wp_register_script('sa-slider-admin-script', PLUGIN_PATH.'js/slide-anything-admin.js', array( 'jquery' ));
112
+ wp_enqueue_script('sa-slider-admin-script');
113
+ wp_register_style('sa-slider-admin-css', PLUGIN_PATH.'css/slide-anything-admin.css');
114
+ wp_enqueue_style('sa-slider-admin-css');
115
+ }
116
+ }
117
+
118
+ // ##### ACTION HOOK - REGISTER THE 'Slider Anywhere' CUSTOM POST TYPE #####
119
+ function cpt_slider_register() {
120
+ $labels = array(
121
+ 'name' => _x('Sliders', 'post type general name', 'sa_slider_textdomain'),
122
+ 'singular_name' => _x('Slider', 'post type singular name', 'sa_slider_textdomain'),
123
+ 'menu_name' => __('Sliders', 'sa_slider_textdomain'),
124
+ 'add_new' => __('Add New Slider', 'sa_slider_textdomain'),
125
+ 'add_new_item' => __('Add New Slider', 'sa_slider_textdomain'),
126
+ 'edit_item' => __('Edit Slider', 'sa_slider_textdomain'),
127
+ 'new_item' => __('New Slider', 'sa_slider_textdomain'),
128
+ 'view_item' => __('View Slider', 'sa_slider_textdomain'),
129
+ 'not_found' => __('No sliders found', 'sa_slider_textdomain'),
130
+ 'not_found_in_trash' => __('No sliders found in Trash', 'sa_slider_textdomain'),
131
+ );
132
+ $args = array(
133
+ 'labels' => $labels,
134
+ 'description' => __('Slide Anything carousel/slider', 'sa_slider_textdomain'),
135
+ 'public' => false,
136
+ 'exclude_from_search' => true,
137
+ 'publicly_queryable' => false,
138
+ 'show_ui' => true,
139
+ 'show_in_nav_menus' => false,
140
+ 'show_in_menu' => true,
141
+ 'menu_position' => 10,
142
+ 'menu_icon' => 'dashicons-images-alt2',
143
+ 'hierarchical' => false,
144
+ 'supports' => array('title'),
145
+ 'has_archive' => false,
146
+ 'query_var' => false,
147
+ 'can_export' => true,
148
+ 'rewrite' => true,
149
+ 'capability_type' => 'post'
150
+ );
151
+ register_post_type('sa_slider', $args);
152
+ }
153
+
154
+
155
+
156
+ // ##### ACTION HOOK - ADD/REMOVE (HOVER-OVER) ROW ACTIONS WHEN THIS CUSTOM POST TYPE IS LISTED IN DASHBOARD #####
157
+ function cpt_slider_row_actions($actions, $post) {
158
+ if ($post->post_type == 'sa_slider') {
159
+ // REMOVE 'Quick Edit' ROW ACTION
160
+ unset($actions['inline hide-if-no-js']);
161
+ }
162
+ return $actions;
163
+ }
164
+
165
+
166
+
167
+ // ##### FILTER TO ADD/REMOVE COLUMNS DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD #####
168
+ function cpt_slider_modify_columns($columns) {
169
+ // new columns to be added
170
+ $new_columns = array(
171
+ 'slides' => 'Slides',
172
+ 'shortcode' => 'Shortcode',
173
+ 'css-id' => 'CSS ID'
174
+ );
175
+ $columns = array_slice($columns, 0, 2, true) + $new_columns + array_slice($columns, 2, NULL, true);
176
+ return $columns;
177
+ }
178
+
179
+
180
+
181
+ // ##### DEFINE OUTPUT FOR EACH CUSTOM COLUMN DISPLAYED FOR THIS CUSTOM POST TYPE WITHIN THE DASHBOARD #####
182
+ function cpt_slider_custom_column_content($column) {
183
+ // get post object for this row
184
+ global $post;
185
+
186
+ // output for the 'Slides' column
187
+ if ($column == 'slides') {
188
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
189
+ if ($num_slides == '') {
190
+ $num_slides = '-';
191
+ }
192
+ echo esc_html($num_slides);
193
+ }
194
+
195
+ // output for the 'Shortcode' column
196
+ if ($column == 'shortcode') {
197
+ $shortcode = "[slide-anything id='".$post->ID."']";
198
+ echo esc_html($shortcode);
199
+ }
200
+
201
+ // output for the 'CSS ID' column
202
+ if ($column == 'css-id') {
203
+ $css_id = get_post_meta($post->ID, 'sa_css_id', true);
204
+ if ($css_id == '') {
205
+ $css_id = '-';
206
+ } else {
207
+ $css_id = "#".$css_id;
208
+ }
209
+ echo esc_html($css_id);
210
+ }
211
+ }
212
+
213
+
214
+
215
+ // ##### ACTION HOOK - ADD META BOXES TO THE 'Slider Anywhere' CUSTOM POST TYPE #####
216
+ function cpt_slider_add_meta_boxes() {
217
+ global $post;
218
+
219
+ $info_added = get_post_meta($post->ID, 'sa_info_added', true);
220
+ $info_deleted = get_post_meta($post->ID, 'sa_info_deleted', true);
221
+ $info_duplicated = get_post_meta($post->ID, 'sa_info_duplicated', true);
222
+ $info_moved = get_post_meta($post->ID, 'sa_info_moved', true);
223
+ if ($info_added == '1') {
224
+ add_meta_box('cpt_slide_added', __('Information'), 'cpt_slide_added_content', 'sa_slider', 'normal', 'high');
225
+ update_post_meta($post->ID, 'sa_info_added', '0');
226
+ }
227
+ if ($info_deleted == '1') {
228
+ add_meta_box('cpt_slide_deleted', __('Information'), 'cpt_slide_deleted_content', 'sa_slider', 'normal', 'high');
229
+ update_post_meta($post->ID, 'sa_info_deleted', '0');
230
+ }
231
+ if ($info_duplicated == '1') {
232
+ add_meta_box('cpt_slide_duplicated', __('Information'), 'cpt_slide_duplicated_content', 'sa_slider', 'normal', 'high');
233
+ update_post_meta($post->ID, 'sa_info_duplicated', '0');
234
+ }
235
+ if ($info_moved == '1') {
236
+ add_meta_box('cpt_slide_moved', __('Information'), 'cpt_slide_moved_content', 'sa_slider', 'normal', 'high');
237
+ update_post_meta($post->ID, 'sa_info_moved', '0');
238
+ }
239
+ add_meta_box('cpt_slider_settings', __('Slider Settings'), 'cpt_slider_settings_content', 'sa_slider', 'normal', 'high');
240
+ add_meta_box('cpt_slider_slides', __('Slides'), 'cpt_slider_slides_content', 'sa_slider', 'normal', 'high');
241
+ add_meta_box('cpt_slider_shortcode', __('Slider Shortcode'), 'cpt_slider_shortcode_content', 'sa_slider', 'side', 'high');
242
+ add_meta_box('cpt_slider_items', __('Items Displayed'), 'cpt_slider_items_content', 'sa_slider', 'side', 'default');
243
+ add_meta_box('cpt_slider_style', __('Slider Style'), 'cpt_slider_style_content', 'sa_slider', 'side', 'default');
244
+ }
245
+
246
+
247
+
248
+ // ##### META BOX CONTENT - 'Information' (slide added) BOX #####
249
+ function cpt_slide_added_content() {
250
+ echo "<h3 id='sa_slide_added_mess'>A new slide has been added to this slider.</h3>";
251
+ }
252
+
253
+
254
+
255
+ // ##### META BOX CONTENT - 'Information' (slide deleted) BOX #####
256
+ function cpt_slide_deleted_content() {
257
+ echo "<h3 id='sa_slide_deleted_mess'>A slide has been deleted from this slider.</h3>";
258
+ }
259
+
260
+
261
+
262
+ // ##### META BOX CONTENT - 'Information' (slide duplicated) BOX #####
263
+ function cpt_slide_duplicated_content() {
264
+ echo "<h3 id='sa_slide_duplicated_mess'>A slide has been duplicated (copied) within this slider.</h3>";
265
+ }
266
+
267
+
268
+
269
+ // ##### META BOX CONTENT - 'Information' (slide moved) BOX #####
270
+ function cpt_slide_moved_content() {
271
+ echo "<h3 id='sa_slide_moved_mess'>The slide order of this slider has been has changed.</h3>";
272
+ }
273
+
274
+
275
+
276
+ // ##### META BOX CONTENT - 'Slider Settings' BOX #####
277
+ function cpt_slider_settings_content($post) {
278
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
279
+
280
+ echo "<div id='sa_slider_settings'>\n";
281
+ // NONCE TO PREVENT CSRF SECURITY ATTACKS
282
+ wp_nonce_field(basename(__FILE__), 'nonce_save_slider');
283
+
284
+ // HIDDEN FIELD - NUMBER OF SLIDES
285
+ if ($num_slides == '') {
286
+ // new slider is being created
287
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='3'/>\n";
288
+ } else {
289
+ // existing slider
290
+ $num_slides = intval($num_slides);
291
+ echo "<input type='hidden' id='num_slides_id' name='sa_num_slides' value='".esc_attr($num_slides)."'/>\n";
292
+ }
293
+ // HIDDEN FIELD - SLIDE ADDED INDICATOR
294
+ echo "<input type='hidden' id='sa_info_added' name='sa_info_added' value='0'/>\n";
295
+ // HIDDEN FIELD - SLIDE DELETED INDICATOR
296
+ echo "<input type='hidden' id='sa_info_deleted' name='sa_info_deleted' value='0'/>\n";
297
+ // HIDDEN FIELD - SLIDE DUPLICATED INDICATOR
298
+ echo "<input type='hidden' id='sa_info_duplicated' name='sa_info_duplicated' value='0'/>\n";
299
+ // HIDDEN FIELD - SLIDE MOVED UP INDICATOR
300
+ echo "<input type='hidden' id='sa_info_moved' name='sa_info_moved' value='0'/>\n";
301
+ // HIDDEN FIELD - DUPLICATE SLIDE NUMBER
302
+ echo "<input type='hidden' id='sa_duplicate_slide' name='sa_duplicate_slide' value='0'/>\n";
303
+ // HIDDEN FIELD - MOVE SLIDE UP (SLIDE NUMBER)
304
+ echo "<input type='hidden' id='sa_move_slide_up' name='sa_move_slide_up' value='0'/>\n";
305
+ // SLIDE DURATION
306
+ $slide_duration = get_post_meta($post->ID, 'sa_slide_duration', true);
307
+ if ($slide_duration == '') {
308
+ $slide_duration = 5;
309
+ }
310
+ echo "<div class='sa_slider_value'><span>Slide Duration:</span>";
311
+ echo "<input type='text' id='sa_slide_duration' name='sa_slide_duration' readonly value='".esc_attr($slide_duration)."'><em>seconds</em>";
312
+ echo "<em class='sa_tooltip' href='' title='Set to 0 to disable slider autoplay (manual slider navigation only)'></em></div>\n";
313
+ echo "<div class='jquery_ui_slider' id='jq_slider_duration'></div><hr/>\n";
314
+ // SLIDE TRANSITION
315
+ $slide_transition = get_post_meta($post->ID, 'sa_slide_transition', true);
316
+ if ($slide_transition == '') {
317
+ $slide_transition = 0.2;
318
+ }
319
+ echo "<div class='sa_slider_value'><span>Slide Transition:</span>";
320
+ echo "<input type='text' id='sa_slide_transition' name='sa_slide_transition' readonly value='".esc_attr($slide_transition)."'><em>seconds</em>\n";
321
+ echo "<em class='sa_tooltip' href='' title='The time it takes to change from one slide to the next slide'></em></div>\n";
322
+ echo "<div class='jquery_ui_slider' id='jq_slider_transition'></div><hr/>\n";
323
+ echo "<div class='half_width_column'>\n";
324
+ // LOOP SLIDER
325
+ $loop_slider = get_post_meta($post->ID, 'sa_loop_slider', true);
326
+ if ($loop_slider == '') {
327
+ $loop_slider = '1';
328
+ }
329
+ echo "<div class='sa_setting_checkbox'><span>Loop Slider:</span>";
330
+ if ($loop_slider == '1') {
331
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1' checked/>";
332
+ } else {
333
+ echo "<input type='checkbox' id='sa_loop_slider' name='sa_loop_slider' value='1'/>";
334
+ }
335
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (loops back to first slide after last slide is displayed)'></em>";
336
+ echo "</div>\n";
337
+ // STOP ON HOVER
338
+ $stop_hover = get_post_meta($post->ID, 'sa_stop_hover', true);
339
+ if ($stop_hover == '') {
340
+ $stop_hover = '1';
341
+ }
342
+ echo "<div class='sa_setting_checkbox'><span>Stop on Hover:</span>";
343
+ if ($stop_hover == '1') {
344
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1' checked/>";
345
+ } else {
346
+ echo "<input type='checkbox' id='sa_stop_hover' name='sa_stop_hover' value='1'/>";
347
+ }
348
+ echo "<em class='sa_tooltip' href='' title='Only applies when slide duration is NOT zero (slideshow is paused when hovering over a slide)'></em>";
349
+ echo "</div>\n";
350
+ echo "</div>\n";
351
+ echo "<div class='half_width_column'>\n";
352
+ // NAVIGATE ARROWS
353
+ $nav_arrows = get_post_meta($post->ID, 'sa_nav_arrows', true);
354
+ if ($nav_arrows == '') {
355
+ $nav_arrows = '1';
356
+ }
357
+ echo "<div class='sa_setting_checkbox'><span>Navigate Arrows:</span>";
358
+ if ($nav_arrows == '1') {
359
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1' checked/>";
360
+ } else {
361
+ echo "<input type='checkbox' id='sa_nav_arrows' name='sa_nav_arrows' value='1'/>";
362
+ }
363
+ echo "<em class='sa_tooltip' href='' title='Display the \"next slide\" amd \"previous slide\" buttons'></em>\n";
364
+ echo "</div>\n";
365
+ // SHOW PAGINATION
366
+ $pagination = get_post_meta($post->ID, 'sa_pagination', true);
367
+ if ($pagination == '') {
368
+ $pagination = '1';
369
+ }
370
+ echo "<div class='sa_setting_checkbox'><span>Show Pagination:</span>";
371
+ if ($pagination == '1') {
372
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1' checked/>";
373
+ } else {
374
+ echo "<input type='checkbox' id='sa_pagination' name='sa_pagination' value='1'/>";
375
+ }
376
+ echo "<em class='sa_tooltip' href='' title='Display slider pagination below the slider'></em>\n";
377
+ echo "</div>\n";
378
+ echo "</div>\n";
379
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
380
+ echo "</div>\n";
381
+ }
382
+
383
+
384
+
385
+ // ##### META BOX CONTENT - 'Slides' BOX #####
386
+ function cpt_slider_slides_content($post) {
387
+ $num_slides = get_post_meta($post->ID, 'sa_num_slides', true);
388
+ // DISABLE VISUAL EDITOR CHECKBOX
389
+ $disable_visual_editor = get_post_meta($post->ID, 'sa_disable_visual_editor', true);
390
+ if ($disable_visual_editor == '') {
391
+ $disable_visual_editor = '0';
392
+ }
393
+ echo "<div id='sa_visual_editor_checkbox'><span>Disable Visual Editor:</span>";
394
+ if ($disable_visual_editor == '1') {
395
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1' checked/></div>\n";
396
+ } else {
397
+ echo "<input type='checkbox' id='sa_disable_visual_editor' name='sa_disable_visual_editor' value='1'/></div>\n";
398
+ }
399
+ // SLIDER EDITOR BOX SETTINGS
400
+ if ($disable_visual_editor == '1') {
401
+ $editor_args = array('tinymce' => false, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
402
+ } else {
403
+ $editor_args = array('tinymce' => true, 'wpautop' => false, 'media_buttons' => true, 'editor_class' => 'sa_slide_content', 'editor_height' => '250');
404
+ }
405
+ if ($num_slides == '') {
406
+ // A NEW SLIDER IS BEING CREATED - ADD 3 INITIAL SLIDES
407
+ $num_slides = 3;
408
+ $slide_data[0]['edit_id'] = "sa_slide1_content";
409
+ $slide_data[0]['content'] = "Slide content";
410
+ $slide_data[0]['del_id'] = "sa_slide1_delete";
411
+ $slide_data[0]['image_id'] = "sa_slide1_image_id";
412
+ $slide_data[0]['thumb'] = "slide1_thumb";
413
+ $slide_data[0]['image_del'] = "slide1_image_del";
414
+ $slide_data[0]['image_size'] = "sa_slide1_image_size";
415
+ $slide_data[0]['image_repeat'] = "sa_slide1_image_repeat";
416
+ $slide_data[0]['image_color'] = "sa_slide1_image_color";
417
+ $slide_data[0]['slide_no'] = 1;
418
+ $slide_data[1]['edit_id'] = "sa_slide2_content";
419
+ $slide_data[1]['content'] = "Slide content";
420
+ $slide_data[1]['del_id'] = "sa_slide2_delete";
421
+ $slide_data[1]['image_id'] = "sa_slide2_image_id";
422
+ $slide_data[1]['thumb'] = "slide2_thumb";
423
+ $slide_data[1]['image_del'] = "slide2_image_del";
424
+ $slide_data[1]['image_size'] = "sa_slide2_image_size";
425
+ $slide_data[1]['image_repeat'] = "sa_slide2_image_repeat";
426
+ $slide_data[1]['image_color'] = "sa_slide2_image_color";
427
+ $slide_data[1]['slide_no'] = 2;
428
+ $slide_data[2]['edit_id'] = "sa_slide3_content";
429
+ $slide_data[2]['content'] = "Slide content";
430
+ $slide_data[2]['del_id'] = "sa_slide3_delete";
431
+ $slide_data[2]['image_id'] = "sa_slide3_image_id";
432
+ $slide_data[2]['thumb'] = "slide3_thumb";
433
+ $slide_data[2]['image_del'] = "slide3_image_del";
434
+ $slide_data[2]['image_size'] = "sa_slide3_image_size";
435
+ $slide_data[2]['image_repeat'] = "sa_slide3_image_repeat";
436
+ $slide_data[2]['image_color'] = "sa_slide3_image_color";
437
+ $slide_data[2]['slide_no'] = 3;
438
+ } else {
439
+ // AN EXISTING SLIDER - GET SLIDE DATA FROM THE DATABASE AND SAVE WITHIN AN ARRAY
440
+ $num_slides = intval($num_slides);
441
+ $slide_data = array();
442
+ $count = 0;
443
+ for ($i = 1; $i <= $num_slides; $i++) {
444
+ $slide_edit_id = "sa_slide".$i."_content";
445
+ $slide_data[$count]['edit_id'] = $slide_edit_id;
446
+ $slide_data[$count]['content'] = get_post_meta($post->ID, $slide_edit_id, true);
447
+ $slide_data[$count]['del_id'] = "sa_slide".$i."_delete";
448
+ $slide_data[$count]['image_id'] = "sa_slide".$i."_image_id";
449
+ $slide_data[$count]['thumb'] = "slide".$i."_thumb";
450
+ $slide_data[$count]['image_del'] = "slide".$i."_image_del";
451
+ $slide_data[$count]['image_size'] = "sa_slide".$i."_image_size";
452
+ $slide_data[$count]['image_repeat'] = "sa_slide".$i."_image_repeat";
453
+ $slide_data[$count]['image_color'] = "sa_slide".$i."_image_color";
454
+ $slide_data[$count]['slide_no'] = $i;
455
+ $count++;
456
+ }
457
+ }
458
+
459
+ // ###### LOOP TO DISPLAY INPUT ELEMENTS FOR EACH SLIDE ######
460
+ echo "<div id='slider_accordion'>\n";
461
+ for ($i = 0; $i < count($slide_data); $i++) {
462
+ echo "<h3>Slide ".$slide_data[$i]['slide_no']."</h3>\n";
463
+ echo "<div>\n";
464
+
465
+ // ### DISPLAY THE SLIDE CONTENT EDITOR (textarea field) ###
466
+ wp_editor($slide_data[$i]['content'], wp_kses_post($slide_data[$i]['edit_id']), $editor_args);
467
+
468
+ // ### BACKGROUND COLOR/IMAGE FIELDS ###
469
+ // GET BACKGROUND IMAGE DATA FOR THIS SLIDE (image id, size, repeat and color)
470
+ $slide_image_id = get_post_meta($post->ID, $slide_data[$i]['image_id'], true);
471
+ $slide_image_size = get_post_meta($post->ID, $slide_data[$i]['image_size'], true);
472
+ if ($slide_image_size == '') {
473
+ $slide_image_size = 'contain';
474
+ }
475
+ $slide_image_repeat = get_post_meta($post->ID, $slide_data[$i]['image_repeat'], true);
476
+ if ($slide_image_repeat == '') {
477
+ $slide_image_repeat = 'no-repeat';
478
+ }
479
+ $slide_image_color = get_post_meta($post->ID, $slide_data[$i]['image_color'], true);
480
+ if ($slide_image_color == '') {
481
+ $slide_image_color = "rgba(0,0,0,0)";
482
+ }
483
+
484
+ // SLIDE BACKGROUND IMAGE - THUMBNAIL AND 'SET IMAGE' BUTTON
485
+ // get wordpress media upload frame url
486
+ $upload_frame_url = esc_url(get_upload_iframe_src('image', $post->ID)."&slide=".$slide_data[$i]['slide_no']);
487
+ // Get image src for slide background image
488
+ $slide_image_src = wp_get_attachment_image_src($slide_image_id, 'full');
489
+ // check if the slide background image id already exists
490
+ $image_exists = is_array($slide_image_src);
491
+ // slide backround image - thumbnail (and delete button)
492
+ echo "<div class='sa_slide_bg_wrapper'>\n";
493
+ echo "<h4>Slide Background</h4>\n";
494
+ echo "<div id='".$slide_data[$i]['thumb']."' class='sa_slide_thumb'>\n";
495
+ if ($image_exists) {
496
+ echo "<div style='background-image:url(\"".esc_attr($slide_image_src[0])."\"); background-size:".esc_attr($slide_image_size)."; ";
497
+ echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color).";'></div>\n";
498
+ echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
499
+ echo "</div>\n";
500
+ } else {
501
+ echo "<div style='background-color:#ffffff; background-size:".esc_attr($slide_image_size)."; ";
502
+ echo "background-repeat:".esc_attr($slide_image_repeat)."; background-color:".esc_attr($slide_image_color).";'></div>\n";
503
+ echo "<span id='".esc_attr($slide_data[$i]['image_del'])."' class='sa_hidden' onClick='remove_slide_bg_image(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Delete the background image for this slide'>X</span>\n";
504
+ echo "</div>\n";
505
+ }
506
+ // slide background image - 'set image' button
507
+ echo "<a class='button button-secondary slide_image_add' href='".esc_attr($upload_frame_url)."' title='Set the background image for this slide'>Set Image</a>\n";
508
+ // slide background image - image id text field
509
+ echo "<input type='hidden' id='".esc_attr($slide_data[$i]['image_id'])."' name='".esc_attr($slide_data[$i]['image_id'])."' value='".esc_attr($slide_image_id)."'/>\n";
510
+
511
+ // SLIDE BACKGROUND IMAGE - BACKGROUND SIZE (dropdown box)
512
+ echo "<div class='slide_image_settings_line'>";
513
+ echo "<span>Background Size:</span>";
514
+ $option_arr = array();
515
+ $option_arr[0]['value'] = 'auto'; $option_arr[0]['desc'] = 'no resize';
516
+ $option_arr[1]['value'] = 'contain'; $option_arr[1]['desc'] = 'contain';
517
+ $option_arr[2]['value'] = 'cover'; $option_arr[2]['desc'] = 'cover';
518
+ $option_arr[3]['value'] = '100% 100%'; $option_arr[3]['desc'] = '100%';
519
+ $option_arr[4]['value'] = '100% auto'; $option_arr[4]['desc'] = '100% width';
520
+ $option_arr[5]['value'] = 'auto 100%'; $option_arr[5]['desc'] = '100% height';
521
+ echo "<select id='".esc_attr($slide_data[$i]['image_size'])."' name='".esc_attr($slide_data[$i]['image_size'])."' onChange='change_slide_image_size(".esc_attr($slide_data[$i]['slide_no']).");'>";
522
+ for ($j = 0; $j < count($option_arr); $j++) {
523
+ if ($slide_image_size == $option_arr[$j]['value']) {
524
+ echo "<option value='".esc_attr($option_arr[$j]['value'])."' selected>".esc_html($option_arr[$j]['desc'])."</option>";
525
+ } else {
526
+ echo "<option value='".esc_attr($option_arr[$j]['value'])."'>".esc_html($option_arr[$j]['desc'])."</option>";
527
+ }
528
+ }
529
+ echo "</select>";
530
+ echo "</div>\n";
531
+
532
+ // SLIDER BACKGROUND IMAGE - BACKGROUND REPEAT (dropdown box)
533
+ echo "<div class='slide_image_settings_line'>";
534
+ echo "<span>Background Repeat:</span>";
535
+ $option_arr = array();
536
+ $option_arr[0] = 'no-repeat';
537
+ $option_arr[1] = 'repeat';
538
+ $option_arr[2] = 'repeat-x';
539
+ $option_arr[3] = 'repeat-y';
540
+ echo "<select id='".esc_attr($slide_data[$i]['image_repeat'])."' name='".esc_attr($slide_data[$i]['image_repeat'])."' ";
541
+ echo "onChange='change_slide_image_repeat(".esc_attr($slide_data[$i]['slide_no']).");'>";
542
+ for ($j = 0; $j < count($option_arr); $j++) {
543
+ if ($slide_image_repeat == $option_arr[$j]) {
544
+ echo "<option value='".esc_attr($option_arr[$j])."' selected>".esc_html($option_arr[$j])."</option>";
545
+ } else {
546
+ echo "<option value='".esc_attr($option_arr[$j])."'>".esc_html($option_arr[$j])."</option>";
547
+ }
548
+ }
549
+ echo "</select>";
550
+ echo "</div>\n";
551
+
552
+ // SLIDER BACKGROUND IMAGE - BACKGROUND COLOR (color picker)
553
+ echo "<div class='slide_image_settings_line'>";
554
+ echo "<span>Background Color:</span>";
555
+ echo "<input type='text' id='".esc_attr($slide_data[$i]['image_color'])."' name='".esc_attr($slide_data[$i]['image_color'])."' value='".esc_attr($slide_image_color)."' ";
556
+ echo "onChange='change_slide_image_color(".esc_attr($slide_data[$i]['slide_no']).");'>";
557
+ echo "</div>\n";
558
+
559
+ echo "<div style='clear:both; float:none; width:100%; height:1px;'></div>\n";
560
+ echo "</div>\n";
561
+
562
+ // 3. DELETE STATUS FIELD (hidden) AND DELETE SLIDE BUTTON
563
+ echo "<input type='hidden' id='".esc_attr($slide_data[$i]['del_id'])."' name='".esc_attr($slide_data[$i]['del_id'])."' value='1'/>\n";
564
+ echo "<div class='button button-secondary' onClick='delete_sa_slide(\"".esc_attr($slide_data[$i]['del_id'])."\");' title='Delete this slide'>Delete Slide</div>\n";
565
+
566
+ // 4. DUPLICATE SLIDE BUTTON
567
+ echo "<div class='button button-secondary' onClick='duplicate_slide(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Duplicate this slide'>Duplicate Slide</div>\n";
568
+
569
+ // 5. MOVE SLIDE UP BUTTON
570
+ if ($slide_data[$i]['slide_no'] != 1) {
571
+ echo "<div class='button button-secondary' onClick='move_slide_up(\"".esc_attr($slide_data[$i]['slide_no'])."\");' title='Move this slide up within the slide order'>Move Slide Up</div>\n";
572
+ }
573
+
574
+ echo "</div>\n";
575
+ }
576
+ echo "</div>\n";
577
+
578
+ // ADD SLIDE BUTTON
579
+ if ($num_slides < 50) {
580
+ // a maximum of 50 slides allowed
581
+ echo "<div id='sa_add_slide' class='button button-primary button-large' title='Add a new slide'>Add Slide</a>\n";
582
+ }
583
+ // JQUERY-UI DIALOG BOX DIV
584
+ echo "<div id='sa_dialog_box'></div>\n";
585
+ }
586
+
587
+
588
+
589
+ // ##### META BOX CONTENT - 'Slider Shortcode' BOX #####
590
+ function cpt_slider_shortcode_content($post) {
591
+ $shortcode = "[slide-anything id='".$post->ID."']";
592
+ echo "<div id='sa_slider_shortcode'>".esc_html($shortcode)."</div>\n";
593
+ echo "<div id='sa_shortcode_copy' class='button button-secondary'>Copy to Clipboard</div>\n";
594
+ echo "<div style='clear:both; width:100%; height:1px;'></div>\n";
595
+ }
596
+
597
+
598
+
599
+ // ##### META BOX CONTENT - 'Items Displayed' BOX #####
600
+ function cpt_slider_items_content($post) {
601
+ $items_width1 = intval(get_post_meta($post->ID, 'sa_items_width1', true));
602
+ $items_width2 = intval(get_post_meta($post->ID, 'sa_items_width2', true));
603
+ $items_width3 = intval(get_post_meta($post->ID, 'sa_items_width3', true));
604
+ $items_width4 = intval(get_post_meta($post->ID, 'sa_items_width4', true));
605
+ $items_width5 = intval(get_post_meta($post->ID, 'sa_items_width5', true));
606
+ if ($items_width1 == 0) { $items_width1 = 1; }
607
+ if ($items_width2 == 0) { $items_width2 = 1; }
608
+ if ($items_width3 == 0) { $items_width3 = 1; }
609
+ if ($items_width4 == 0) { $items_width4 = 1; }
610
+ if ($items_width5 == 0) { $items_width5 = 1; }
611
+
612
+ echo "<div id='items_displayed_metabox'>\n";
613
+ echo "<h4>Browser/Device Width:</h4>\n";
614
+ // items for browser width category 1
615
+ echo "<div><em class='sa_tooltip' href='' title='Up to 479 pixels'></em><span>Mobile Portrait</span><select name='sa_items_width1'>";
616
+ for ($i = 1; $i <= 12; $i++) {
617
+ if ($i == $items_width1) {
618
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
619
+ } else {
620
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
621
+ }
622
+ }
623
+ echo "</select></div>\n";
624
+ // items for browser width category 2
625
+ echo "<div><em class='sa_tooltip' href='' title='480 to 767 pixels'></em><span>Mobile Landscape</span><select name='sa_items_width2'>";
626
+ for ($i = 1; $i <= 12; $i++) {
627
+ if ($i == $items_width2) {
628
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
629
+ } else {
630
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
631
+ }
632
+ }
633
+ echo "</select></div>\n";
634
+ // items for browser width category 3
635
+ echo "<div><em class='sa_tooltip' href='' title='768 to 979 pixels'></em><span>Tablet Portrait</span><select name='sa_items_width3'>";
636
+ for ($i = 1; $i <= 12; $i++) {
637
+ if ($i == $items_width3) {
638
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
639
+ } else {
640
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
641
+ }
642
+ }
643
+ echo "</select></div>\n";
644
+ // items for browser width category 4
645
+ echo "<div><em class='sa_tooltip' href='' title='980 to 1199 pixels'></em><span>Desktop Small</span><select name='sa_items_width4'>";
646
+ for ($i = 1; $i <= 12; $i++) {
647
+ if ($i == $items_width4) {
648
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
649
+ } else {
650
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
651
+ }
652
+ }
653
+ echo "</select></div>\n";
654
+ // items for browser width category 5
655
+ echo "<div><em class='sa_tooltip' href='' title='Over 1200 pixels'></em><span>Desktop Large</span><select name='sa_items_width5'>";
656
+ for ($i = 1; $i <= 12; $i++) {
657
+ if ($i == $items_width5) {
658
+ echo "<option value='".esc_attr($i)."' selected>".esc_html($i)."</option>";
659
+ } else {
660
+ echo "<option value='".esc_attr($i)."'>".esc_html($i)."</option>";
661
+ }
662
+ }
663
+ echo "</select></div>\n";
664
+ echo "</div>\n";
665
+ }
666
+
667
+
668
+
669
+ // ##### META BOX CONTENT - 'Slider Style' BOX #####
670
+ function cpt_slider_style_content($post) {
671
+ // CSS ID
672
+ $css_id = get_post_meta($post->ID, 'sa_css_id', true);
673
+ if ($css_id == '') {
674
+ $css_id = "slider_".$post->ID;
675
+ }
676
+ echo "<div id='slider_style_metabox'>\n";
677
+ echo "<h4>CSS <span>#id</span> for Slider:</h4>\n";
678
+ echo "<input type='text' id='sa_css_id' name='sa_css_id' value='".esc_attr($css_id)."'/>\n";
679
+ echo "<div id='css_note_text'>To style slides use CSS selector:</div>";
680
+ echo "<div id='css_note_value'>#".esc_html($css_id)." .owl-item</div>";
681
+ echo "<div class='ca_style_hr'></div>\n";
682
+
683
+ // SLIDER PADDING (TOP, RIGHT, BOTTOM, LEFT)
684
+ $wrapper_padd_top = get_post_meta($post->ID, 'sa_wrapper_padd_top', true);
685
+ if ($wrapper_padd_top == '') { $wrapper_padd_top = '0'; }
686
+ $wrapper_padd_right = get_post_meta($post->ID, 'sa_wrapper_padd_right', true);
687
+ if ($wrapper_padd_right == '') { $wrapper_padd_right = '0'; }
688
+ $wrapper_padd_bottom = get_post_meta($post->ID, 'sa_wrapper_padd_bottom', true);
689
+ if ($wrapper_padd_bottom == '') { $wrapper_padd_bottom = '0'; }
690
+ $wrapper_padd_left = get_post_meta($post->ID, 'sa_wrapper_padd_left', true);
691
+ if ($wrapper_padd_left == '') { $wrapper_padd_left = '0'; }
692
+ $tooltip = "Padding space around the entire carousel/slider";
693
+ echo "<h4>Padding <span>(pixels)</span>:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
694
+ echo "<div class='ca_style_padding'>";
695
+ echo "<div id='padd_top'>";
696
+ echo "<input type='text' id='sa_wrapper_padd_top' name='sa_wrapper_padd_top' value='".esc_attr($wrapper_padd_top)."'></div>";
697
+ echo "<div id='padd_right'>";
698
+ echo "<input type='text' id='sa_wrapper_padd_right' name='sa_wrapper_padd_right' value='".esc_attr($wrapper_padd_right)."'></div>";
699
+ echo "<div type='text' id='padd_bottom'>";
700
+ echo "<input type='text' id='sa_wrapper_padd_bottom' name='sa_wrapper_padd_bottom' value='".esc_attr($wrapper_padd_bottom)."'></div>";
701
+ echo "<div id='padd_left'>";
702
+ echo "<input type='text' id='sa_wrapper_padd_left' name='sa_wrapper_padd_left' value='".esc_attr($wrapper_padd_left)."'></div>";
703
+ echo "</div>\n";
704
+ echo "<div style='clear:both; float:none; width:100%; height:10px;'></div>";
705
+
706
+ $tooltip = "The background color and border around the entire carousel/slider";
707
+ echo "<h4>Background/Border:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
708
+
709
+ // SLIDER BACKGROUND COLOR
710
+ $background_color = get_post_meta($post->ID, 'sa_background_color', true);
711
+ if ($background_color == '') {
712
+ $background_color = 'rgba(0,0,0,0)';
713
+ }
714
+ echo "<div class='ca_style_setting_line'><span>Background:</span>";
715
+ echo "<input type='text' id='sa_background_color' name='sa_background_color' value='".esc_attr($background_color)."'></div>\n";
716
+
717
+ // SLIDER BORDER (WIDTH & COLOR)
718
+ $border_width = get_post_meta($post->ID, 'sa_border_width', true);
719
+ if ($border_width == '') {
720
+ $border_width = '0';
721
+ }
722
+ $border_color = get_post_meta($post->ID, 'sa_border_color', true);
723
+ if ($border_color == '') {
724
+ $border_color = 'rgba(0,0,0,0)';
725
+ }
726
+ echo "<div class='ca_style_setting_line'><span>Border Style:</span>";
727
+ echo "<input type='text' id='sa_border_width' name='sa_border_width' value='".esc_attr($border_width)."'><em>px</em>";
728
+ echo "<input type='text' id='sa_border_color' name='sa_border_color' value='".esc_attr($border_color)."'></div>\n";
729
+
730
+ // SLIDER BORDER RADIUS
731
+ $border_radius = get_post_meta($post->ID, 'sa_border_radius', true);
732
+ if ($border_radius == '') {
733
+ $border_radius = '0';
734
+ }
735
+ echo "<div class='ca_style_setting_line'><span>Border Radius:</span>";
736
+ echo "<input type='text' id='sa_border_radius' name='sa_border_radius' value='".esc_attr($border_radius)."'></div>\n";
737
+
738
+ echo "<div class='ca_style_hr' style='margin-top:10px;'></div>\n";
739
+ $tooltip = "The style settings for each individual slide (within the slider/carousel)";
740
+ echo "<h4>SLIDE STYLE:<em class='sa_tooltip' title='".esc_attr($tooltip)."'></em></h4>";
741
+
742
+ // SLIDE - MINIMUM HEIGHT
743
+ $slide_min_height = get_post_meta($post->ID, 'sa_slide_min_height', true);
744
+ if ($slide_min_height == '') {
745
+ $slide_min_height = '100';
746
+ }
747
+ echo "<div class='ca_style_setting_line'><span>Min Height:</span>";
748
+ echo "<input type='text' id='sa_slide_min_height' name='sa_slide_min_height' value='".esc_attr($slide_min_height)."'><em>px</em></div>\n";
749
+
750
+ // SLIDE - PADDING TOP/BOTTOM
751
+ $slide_padding_tb = get_post_meta($post->ID, 'sa_slide_padding_tb', true);
752
+ if ($slide_padding_tb == '') {
753
+ $slide_padding_tb = '5';
754
+ }
755
+ $tooltip = "Padding space top/bottom for each individual slide";
756
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_top_bottom'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
757
+ echo "<input type='text' id='sa_slide_padding_tb' name='sa_slide_padding_tb' value='".esc_attr($slide_padding_tb)."'><em>%</em></div>\n";
758
+
759
+ // SLIDE - PADDING LEFT/RIGHT
760
+ $slide_padding_lr = get_post_meta($post->ID, 'sa_slide_padding_lr', true);
761
+ if ($slide_padding_lr == '') {
762
+ $slide_padding_lr = '5';
763
+ }
764
+ $tooltip = "Padding space left/right for each individual slide";
765
+ echo "<div class='ca_style_setting_line' id='ca_style_padding_left_right'><span class='sa_tooltip' title='".esc_attr($tooltip)."'>Padding:</span>";
766
+ echo "<input type='text' id='sa_slide_padding_lr' name='sa_slide_padding_lr' value='".esc_attr($slide_padding_lr)."'><em>%</em></div>\n";
767
+
768
+ echo "</div>\n";
769
+ }
770
+
771
+
772
+
773
+ // ##### ACTION HOOK - SAVE CUSTOM POST TYPE ('Slider Anywhere') DATA #####
774
+ function cpt_slider_save_postdata() {
775
+ global $post;
776
+
777
+ // ### VERIFY 1) LOGGED-IN USER IS ADMINISTRATOR AND 2) VALID NONCE TO PREVENT CSRF HACKER ATTACKS ###
778
+ if (current_user_can('manage_options') &&
779
+ isset($_POST['nonce_save_slider']) && wp_verify_nonce($_POST['nonce_save_slider'], basename(__FILE__))) {
780
+ $total_slides = intval($_POST['sa_num_slides']);
781
+ if (($_POST['sa_duplicate_slide'] == '') || ($_POST['sa_duplicate_slide'] == '0')) {
782
+ $duplicate_slide = 0;
783
+ } else {
784
+ // A SLIDE NEEDS TO BE DUPLICATED
785
+ $duplicate_slide = intval($_POST['sa_duplicate_slide']);
786
+ }
787
+ if (($_POST['sa_move_slide_up'] == '') || ($_POST['sa_move_slide_up'] == '0')) {
788
+ $move_slide_up = 0;
789
+ } else {
790
+ // A SLIDE NEEDS TO BE MOVED
791
+ $move_slide_up = intval($_POST['sa_move_slide_up']);
792
+ }
793
+
794
+ // UPDATE CONTENT FOR EACH SLIDE
795
+ $slides_saved = 0;
796
+ for ($i = 1; $i <= $total_slides; $i++) {
797
+ $slide_edit_id = "sa_slide".$i."_content";
798
+ $slide_image_id = "sa_slide".$i."_image_id";
799
+ $slide_image_size = "sa_slide".$i."_image_size";
800
+ $slide_image_repeat = "sa_slide".$i."_image_repeat";
801
+ $slide_image_color = "sa_slide".$i."_image_color";
802
+ $slide_content = wp_kses_post($_POST[$slide_edit_id]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
803
+ $slide_image_id_val = abs(intval($_POST[$slide_image_id])); // SANATIZE (slide BG image ID is a valid integer)
804
+ $slide_image_size_val = sanitize_text_field($_POST[$slide_image_size]); // SANATIZE (BG image size is a valid text-input string)
805
+ $slide_image_repeat_val = sanitize_text_field($_POST[$slide_image_repeat]); // SANATIZE (BG image repeat is a valid text-input string)
806
+ $slide_image_color_val = sanitize_text_field($_POST[$slide_image_color]); // SANATIZE (BG color is a valid text-input string)
807
+ // check delete status for slide
808
+ $del_status_id = "sa_slide".$i."_delete";
809
+ if (isset($_POST[$del_status_id]) && ($_POST[$del_status_id] != '')) {
810
+ $del_status = $_POST[$del_status_id];
811
+ } else {
812
+ // a new slide has been added
813
+ $del_status = '1';
814
+ $slide_content = '';
815
+ }
816
+ if ($del_status == '1') {
817
+ // save slide content only if slide has not been marked for deletion
818
+ $slides_saved++;
819
+ $slide_edit_id_save = "sa_slide".$slides_saved."_content";
820
+ $slide_image_id_saved = "sa_slide".$slides_saved."_image_id";
821
+ $slide_image_size_saved = "sa_slide".$slides_saved."_image_size";
822
+ $slide_image_repeat_saved = "sa_slide".$slides_saved."_image_repeat";
823
+ $slide_image_color_saved = "sa_slide".$slides_saved."_image_color";
824
+ update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
825
+ update_post_meta($post->ID, $slide_image_id_saved, $slide_image_id_val);
826
+ update_post_meta($post->ID, $slide_image_size_saved, $slide_image_size_val);
827
+ update_post_meta($post->ID, $slide_image_repeat_saved, $slide_image_repeat_val);
828
+ update_post_meta($post->ID, $slide_image_color_saved, $slide_image_color_val);
829
+ if ($i == $duplicate_slide) {
830
+ // the 'duplicate slide' button has been click for this slide - create a new slide that is an exact copy of previous slide
831
+ // (REPEAT THE CODE ABOVE HERE!!!)
832
+ $slides_saved++;
833
+ $slide_edit_id_save = "sa_slide".$slides_saved."_content";
834
+ $slide_image_id_saved = "sa_slide".$slides_saved."_image_id";
835
+ $slide_image_size_saved = "sa_slide".$slides_saved."_image_size";
836
+ $slide_image_repeat_saved = "sa_slide".$slides_saved."_image_repeat";
837
+ $slide_image_color_saved = "sa_slide".$slides_saved."_image_color";
838
+ update_post_meta($post->ID, $slide_edit_id_save, $slide_content);
839
+ update_post_meta($post->ID, $slide_image_id_saved, $slide_image_id_val);
840
+ update_post_meta($post->ID, $slide_image_size_saved, $slide_image_size_val);
841
+ update_post_meta($post->ID, $slide_image_repeat_saved, $slide_image_repeat_val);
842
+ update_post_meta($post->ID, $slide_image_color_saved, $slide_image_color_val);
843
+ }
844
+ }
845
+ }
846
+
847
+ if ($move_slide_up != 0) {
848
+ // A SLIDE NEEDS TO BE MOVED (TWO SLIDES ARE SWAPPED)
849
+ $slide2 = $move_slide_up;
850
+ $slide1 = intval($move_slide_up) - 1;
851
+ $slide1_content = wp_kses_post($_POST["sa_slide".$slide1."_content"]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
852
+ $slide1_image_id = abs(intval($_POST["sa_slide".$slide1."_image_id"])); // SANATIZE (slide BG image ID is a valid integer)
853
+ $slide1_image_size = sanitize_text_field($_POST["sa_slide".$slide1."_image_size"]); // SANATIZE (BG image size is a valid text-input string)
854
+ $slide1_image_repeat = sanitize_text_field($_POST["sa_slide".$slide1."_image_repeat"]); // SANATIZE (BG image repeat is a valid text-input string)
855
+ $slide1_image_color = sanitize_text_field($_POST["sa_slide".$slide1."_image_color"]); // SANATIZE (BG color is a valid text-input string)
856
+ $slide2_content = wp_kses_post($_POST["sa_slide".$slide2."_content"]); // SANATIZE (slide 'wp_editor' content to contain valid HTML tags)
857
+ $slide2_image_id = abs(intval($_POST["sa_slide".$slide2."_image_id"])); // SANATIZE (slide BG image ID is a valid integer)
858
+ $slide2_image_size = sanitize_text_field($_POST["sa_slide".$slide2."_image_size"]); // SANATIZE (BG image size is a valid text-input string)
859
+ $slide2_image_repeat = sanitize_text_field($_POST["sa_slide".$slide2."_image_repeat"]); // SANATIZE (BG image repeat is a valid text-input string)
860
+ $slide2_image_color = sanitize_text_field($_POST["sa_slide".$slide2."_image_color"]); // SANATIZE (BG color is a valid text-input string)
861
+ update_post_meta($post->ID, "sa_slide".$slide2."_content", $slide1_content);
862
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_id", $slide1_image_id);
863
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_size", $slide1_image_size);
864
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_repeat", $slide1_image_repeat);
865
+ update_post_meta($post->ID, "sa_slide".$slide2."_image_color", $slide1_image_color);
866
+ update_post_meta($post->ID, "sa_slide".$slide1."_content", $slide2_content);
867
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_id", $slide2_image_id);
868
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_size", $slide2_image_size);
869
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_repeat", $slide2_image_repeat);
870
+ update_post_meta($post->ID, "sa_slide".$slide1."_image_color", $slide2_image_color);
871
+ }
872
+
873
+ // UPDATE SLIDER SETTINGS
874
+ update_post_meta($post->ID, 'sa_disable_visual_editor', abs(intval($_POST['sa_disable_visual_editor']))); // SANATIZE (valid integer value)
875
+ update_post_meta($post->ID, 'sa_num_slides', abs(intval($slides_saved))); // SANATIZE (valid integer value)
876
+ update_post_meta($post->ID, 'sa_info_added', abs(intval($_POST['sa_info_added']))); // SANATIZE (valid integer value)
877
+ update_post_meta($post->ID, 'sa_info_deleted', abs(intval($_POST['sa_info_deleted']))); // SANATIZE (valid integer value)
878
+ update_post_meta($post->ID, 'sa_duplicate_slide', abs(intval($_POST['sa_duplicate_slide']))); // SANATIZE (valid integer value)
879
+ update_post_meta($post->ID, 'sa_info_duplicated', abs(intval($_POST['sa_info_duplicated']))); // SANATIZE (valid integer value)
880
+ update_post_meta($post->ID, 'sa_move_slide_up', abs(intval($_POST['sa_move_slide_up']))); // SANATIZE (valid integer value)
881
+ update_post_meta($post->ID, 'sa_info_moved', abs(intval($_POST['sa_info_moved']))); // SANATIZE (valid integer value)
882
+ update_post_meta($post->ID, 'sa_slide_duration', abs(floatval($_POST['sa_slide_duration']))); // SANATIZE (valid float value)
883
+ update_post_meta($post->ID, 'sa_slide_transition', abs(floatval($_POST['sa_slide_transition']))); // SANATIZE (valid float value)
884
+ if (isset($_POST['sa_loop_slider']) && ($_POST['sa_loop_slider'] == '1')) {
885
+ update_post_meta($post->ID, 'sa_loop_slider', '1');
886
+ } else {
887
+ update_post_meta($post->ID, 'sa_loop_slider', '0');
888
+ }
889
+ if (isset($_POST['sa_stop_hover']) && ($_POST['sa_stop_hover'] == '1')) {
890
+ update_post_meta($post->ID, 'sa_stop_hover', '1');
891
+ } else {
892
+ update_post_meta($post->ID, 'sa_stop_hover', '0');
893
+ }
894
+ if (isset($_POST['sa_nav_arrows']) && ($_POST['sa_nav_arrows'] == '1')) {
895
+ update_post_meta($post->ID, 'sa_nav_arrows', '1');
896
+ } else {
897
+ update_post_meta($post->ID, 'sa_nav_arrows', '0');
898
+ }
899
+ if (isset($_POST['sa_pagination']) && ($_POST['sa_pagination'] == '1')) {
900
+ update_post_meta($post->ID, 'sa_pagination', '1');
901
+ } else {
902
+ update_post_meta($post->ID, 'sa_pagination', '0');
903
+ }
904
+
905
+ // UPDATE SLIDER ITEMS DISPLAYED
906
+ update_post_meta($post->ID, 'sa_items_width1', abs(intval($_POST['sa_items_width1']))); // SANATIZE (valid integer value)
907
+ update_post_meta($post->ID, 'sa_items_width2', abs(intval($_POST['sa_items_width2']))); // SANATIZE (valid integer value)
908
+ update_post_meta($post->ID, 'sa_items_width3', abs(intval($_POST['sa_items_width3']))); // SANATIZE (valid integer value)
909
+ update_post_meta($post->ID, 'sa_items_width4', abs(intval($_POST['sa_items_width4']))); // SANATIZE (valid integer value)
910
+ update_post_meta($post->ID, 'sa_items_width5', abs(intval($_POST['sa_items_width5']))); // SANATIZE (valid integer value)
911
+
912
+ // UPDATE SLIDER STYLE
913
+ update_post_meta($post->ID, 'sa_css_id', sanitize_text_field($_POST['sa_css_id'])); // SANATIZE (valid text-input string)
914
+ update_post_meta($post->ID, 'sa_background_color', sanitize_text_field($_POST['sa_background_color'])); // SANATIZE (valid text-input string)
915
+ update_post_meta($post->ID, 'sa_border_width', abs(intval($_POST['sa_border_width']))); // SANATIZE (valid integer value)
916
+ update_post_meta($post->ID, 'sa_border_color', sanitize_text_field($_POST['sa_border_color'])); // SANATIZE (valid text-input string)
917
+ update_post_meta($post->ID, 'sa_border_radius', abs(intval($_POST['sa_border_radius']))); // SANATIZE (valid integer value)
918
+ update_post_meta($post->ID, 'sa_wrapper_padd_top', abs(intval($_POST['sa_wrapper_padd_top']))); // SANATIZE (valid integer value)
919
+ update_post_meta($post->ID, 'sa_wrapper_padd_right', abs(intval($_POST['sa_wrapper_padd_right']))); // SANATIZE (valid integer value)
920
+ update_post_meta($post->ID, 'sa_wrapper_padd_bottom', abs(intval($_POST['sa_wrapper_padd_bottom']))); // SANATIZE (valid integer value)
921
+ update_post_meta($post->ID, 'sa_wrapper_padd_left', abs(intval($_POST['sa_wrapper_padd_left']))); // SANATIZE (valid integer value)
922
+ update_post_meta($post->ID, 'sa_slide_min_height', abs(intval($_POST['sa_slide_min_height']))); // SANATIZE (valid integer value)
923
+ update_post_meta($post->ID, 'sa_slide_padding_tb', abs(floatval($_POST['sa_slide_padding_tb']))); // SANATIZE (valid float value)
924
+ update_post_meta($post->ID, 'sa_slide_padding_lr', abs(floatval($_POST['sa_slide_padding_lr']))); // SANATIZE (valid float value)
925
+ }
926
+ }
927
+ ?>
trunk/php/slide-anything-frontend.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // #####################################################################
3
+ // ### SLIDE ANYTHING PLUGIN - PHP FUNCTIONS FOR WORDPRESS FRONT-END ###
4
+ // #####################################################################
5
+
6
+ add_shortcode('slide-anything', 'slide_anything_shortcode');
7
+
8
+ /* ##### ROOT FUNCTION THAT IS CALLED TO BY THE 'slide-anything' SHORTCODE ##### */
9
+ function slide_anything_shortcode($atts) {
10
+ wp_enqueue_script('jquery');
11
+ wp_register_script('owl_carousel_js', PLUGIN_PATH.'owl-carousel/owl.carousel.min.js', array('jquery'), '1.3.3', true);
12
+ wp_enqueue_script('owl_carousel_js');
13
+ wp_register_style('owl_carousel_css', PLUGIN_PATH.'owl-carousel/owl.carousel.css');
14
+ wp_enqueue_style('owl_carousel_css');
15
+ wp_register_style('owl_theme_css', PLUGIN_PATH.'owl-carousel/owl-theme.css');
16
+ wp_enqueue_style('owl_theme_css');
17
+
18
+ // EXTRACT SHORTCODE ATTRIBUTES
19
+ extract(shortcode_atts(array(
20
+ 'id' => 0,
21
+ ), $atts));
22
+ $output = '';
23
+
24
+ if ($id == 0) {
25
+ // AN 'id' PARAMETER HAS NOT BEEN PROVIDED IN THE SHORTCODE
26
+ $output .= "<div id='sa_invalid_postid'>A valid 'Slide Anything' ID has not been provided</div>\n";
27
+ } else {
28
+ $metadata = get_metadata('post', $id);
29
+ if (count($metadata) == 0) {
30
+ // THE 'id' PARAMETER PROVIDED IN THE SHORTCODE IS INVALID
31
+ $output .= "<div id='sa_invalid_postid'>A valid 'Slide Anything' ID has not been provided</div>\n";
32
+ } else {
33
+ // ### VALID 'id' PROVIDED - PROCESS SHORTCODE ###
34
+ // GET SLIDE DATA FROM DATABASE AND SAVE IN ARRAY
35
+ $slide_data = array();
36
+ $slide_data['num_slides'] = $metadata['sa_num_slides'][0];
37
+ for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
38
+ // apply 'the_content' filter to slide content to process any shortcodes
39
+ $slide_data["slide".$i."_content"] = apply_filters('the_content', $metadata["sa_slide".$i."_content"][0]);
40
+ $slide_data["slide".$i."_image_id"] = $metadata["sa_slide".$i."_image_id"][0];
41
+ $slide_data["slide".$i."_image_size"] = $metadata["sa_slide".$i."_image_size"][0];
42
+ $slide_data["slide".$i."_image_repeat"] = $metadata["sa_slide".$i."_image_repeat"][0];
43
+ $slide_data["slide".$i."_image_color"] = $metadata["sa_slide".$i."_image_color"][0];
44
+ }
45
+ $slide_data['slide_duration'] = floatval($metadata['sa_slide_duration'][0]) * 1000;
46
+ if ($slide_data['slide_duration'] == 0) {
47
+ $slide_data['slide_duration'] = 'false';
48
+ }
49
+ $slide_data['slide_transition'] = floatval($metadata['sa_slide_transition'][0]) * 1000;
50
+ $slide_data['loop_slider'] = $metadata['sa_loop_slider'][0];
51
+ if ($slide_data['loop_slider'] == '1') {
52
+ $slide_data['loop_slider'] = 'true';
53
+ } else {
54
+ $slide_data['loop_slider'] = 'false';
55
+ }
56
+ $slide_data['stop_hover'] = $metadata['sa_stop_hover'][0];
57
+ if ($slide_data['stop_hover'] == '1') {
58
+ $slide_data['stop_hover'] = 'true';
59
+ } else {
60
+ $slide_data['stop_hover'] = 'false';
61
+ }
62
+ $slide_data['nav_arrows'] = $metadata['sa_nav_arrows'][0];
63
+ if ($slide_data['nav_arrows'] == '1') {
64
+ $slide_data['nav_arrows'] = 'true';
65
+ } else {
66
+ $slide_data['nav_arrows'] = 'false';
67
+ }
68
+ $slide_data['pagination'] = $metadata['sa_pagination'][0];
69
+ if ($slide_data['pagination'] == '1') {
70
+ $slide_data['pagination'] = 'true';
71
+ } else {
72
+ $slide_data['pagination'] = 'false';
73
+ }
74
+ $slide_data['items_width1'] = $metadata['sa_items_width1'][0];
75
+ $slide_data['items_width2'] = $metadata['sa_items_width2'][0];
76
+ $slide_data['items_width3'] = $metadata['sa_items_width3'][0];
77
+ $slide_data['items_width4'] = $metadata['sa_items_width4'][0];
78
+ $slide_data['items_width5'] = $metadata['sa_items_width5'][0];
79
+ $slide_data['css_id'] = $metadata['sa_css_id'][0];
80
+ $slide_data['background_color'] = $metadata['sa_background_color'][0];
81
+ $slide_data['border_width'] = $metadata['sa_border_width'][0];
82
+ $slide_data['border_color'] = $metadata['sa_border_color'][0];
83
+ $slide_data['border_radius'] = $metadata['sa_border_radius'][0];
84
+ $slide_data['wrapper_padd_top'] = $metadata['sa_wrapper_padd_top'][0];
85
+ $slide_data['wrapper_padd_right'] = $metadata['sa_wrapper_padd_right'][0];
86
+ $slide_data['wrapper_padd_bottom'] = $metadata['sa_wrapper_padd_bottom'][0];
87
+ $slide_data['wrapper_padd_left'] = $metadata['sa_wrapper_padd_left'][0];
88
+ $slide_data['slide_min_height'] = $metadata['sa_slide_min_height'][0];
89
+ $slide_data['slide_padding_tb'] = $metadata['sa_slide_padding_tb'][0];
90
+ $slide_data['slide_padding_lr'] = $metadata['sa_slide_padding_lr'][0];
91
+
92
+ // GENERATE HTML CODE FOR THE OWL CAROUSEL SLIDER
93
+ $wrapper_style = "background:".$slide_data['background_color']."; ";
94
+ $wrapper_style .= "border:solid ".$slide_data['border_width']."px ".$slide_data['border_color']."; ";
95
+ $wrapper_style .= "border-radius:".$slide_data['border_radius']."px; ";
96
+ $wrapper_style .= "padding:".$slide_data['wrapper_padd_top']."px ";
97
+ $wrapper_style .= $slide_data['wrapper_padd_right']."px ";
98
+ $wrapper_style .= $slide_data['wrapper_padd_bottom']."px ";
99
+ $wrapper_style .= $slide_data['wrapper_padd_left']."px;";
100
+ $output .= "<div style='".esc_attr($wrapper_style)."'>\n";
101
+ if ($slide_data['pagination'] == 'true') {
102
+ $output .= "<div id='".esc_attr($slide_data['css_id'])."' class='owl-carousel owl-pagination-true'>\n";
103
+ } else {
104
+ $output .= "<div id='".esc_attr($slide_data['css_id'])."' class='owl-carousel'>\n";
105
+ }
106
+ for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
107
+ $slide_content = $slide_data["slide".$i."_content"];
108
+ $slide_image_src = wp_get_attachment_image_src($slide_data["slide".$i."_image_id"], 'full');
109
+ $slide_image_size = $slide_data["slide".$i."_image_size"];
110
+ $slide_image_repeat = $slide_data["slide".$i."_image_repeat"];
111
+ $slide_image_color = $slide_data["slide".$i."_image_color"];
112
+ $slide_style = "padding:".$slide_data['slide_padding_tb']."% ".$slide_data['slide_padding_lr']."%; ";
113
+ $slide_style .= "min-height:".$slide_data['slide_min_height']."px; ";
114
+ $slide_style .= "background-image:url(\"".$slide_image_src[0]."\"); ";
115
+ $slide_style .= "background-size:".$slide_image_size."; ";
116
+ $slide_style .= "background-repeat:".$slide_image_repeat."; ";
117
+ $slide_style .= "background-color:".$slide_image_color."; ";
118
+ $output .= "<div style='".esc_attr($slide_style)."'>".wp_kses_post($slide_content)."</div>\n";
119
+ }
120
+ $output .= "</div>\n";
121
+ $output .= "</div>\n";
122
+
123
+ // GENERATE JQUERY CODE FOR THE OWL CAROUSEL SLIDER
124
+ if (wp_script_is('jquery', 'done')) { // Only generate JQuery code if JQuery has been loaded
125
+ $output .= "<script type='text/javascript'>\n";
126
+ $output .= " jQuery(document).ready(function() {\n";
127
+ $output .= " jQuery('#".esc_attr($slide_data['css_id'])."').owlCarousel({\n";
128
+ $output .= " itemsCustom : [\n";
129
+ $output .= " [0,".esc_attr($slide_data['items_width1'])."],\n";
130
+ $output .= " [480,".esc_attr($slide_data['items_width2'])."],\n";
131
+ $output .= " [768,".esc_attr($slide_data['items_width3'])."],\n";
132
+ $output .= " [980,".esc_attr($slide_data['items_width4'])."],\n";
133
+ $output .= " [1200,".esc_attr($slide_data['items_width5'])."]\n";
134
+ $output .= " ],\n";
135
+ $output .= " autoPlay : ".esc_attr($slide_data['slide_duration']).",\n";
136
+ $output .= " paginationSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
137
+ $output .= " slideSpeed : ".esc_attr($slide_data['slide_transition']).",\n";
138
+ $output .= " rewindSpeed : 1000,\n";
139
+ $output .= " rewindNav : ".esc_attr($slide_data['loop_slider']).",\n";
140
+ $output .= " stopOnHover : ".esc_attr($slide_data['stop_hover']).",\n";
141
+ $output .= " navigation : ".esc_attr($slide_data['nav_arrows']).",\n";
142
+ $output .= " navigationText : ['',''],\n";
143
+ $output .= " pagination : ".esc_attr($slide_data['pagination']).",\n";
144
+ $output .= " itemsScaleUp : false,\n";
145
+ $output .= " mouseDrag : true,\n";
146
+ $output .= " touchDrag : true\n";
147
+ $output .= " });\n";
148
+ $output .= " });\n";
149
+ $output .= "</script>\n";
150
+ }
151
+ }
152
+ }
153
+ return $output;
154
+ }
155
+ ?>
trunk/readme.txt ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Slide Anything ===
2
+ Contributors: simonpedge
3
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RP7JLGK6VT252
4
+ Tags: carousel, content slider, owl carousel, responsive, html slider
5
+ Requires at least: 4.0
6
+ Tested up to: 4.4
7
+ Stable tag: 1.0
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Create responsive carousels or sliders where the content for each slide can be anything you want - images, text, HTML, and even shortcodes.
12
+
13
+ == Description ==
14
+
15
+ Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
16
+
17
+ = Owl Carousel =
18
+
19
+ [Owl Carousel](http://owlgraphic.com/owlcarousel/) is an extremely powerful and flexible carousel/slider JQuery plugin, and it is also free to use!
20
+ Unfortunately, it's not easy to integrate Owl Carousel into a WordPress site if you are a non-developer, and requires JQuery and PHP coding skills. That is why I developed this plugin.
21
+
22
+ I use Owl Carousel a in various WordPress sites I develop, specifically where I need the additional flexibility to develop a carousel with a more complex layout, or use a layout not catered for by any existing carousel plugin product.
23
+
24
+ Owl Carousel has been tested in following browsers/devices: Chrome, Firefox, Opera, IE7/8/10/11, iPad Safari, iPod4 Safari, Nexus 7 Chrome, Galaxy S4, Nokia 8s and Windows 8.
25
+
26
+ == Installation ==
27
+
28
+ 1. Upload the entire `slide-anything` folder to the `/wp-content/plugins/` directory.
29
+ 1. Activate the plugin through the 'Plugins' menu within the WordPress Dashboard.
30
+
31
+ You will now see the `Sliders` menu in your WordPress admin panel.
32
+
33
+ == Frequently Asked Questions ==
34
+
35
+ = How do I get the `Slide Anything` sliders to display within my WordPress page or post? =
36
+
37
+ When editing your slider within the WordPress Dashboard, You will see a box labeled `Slider Shortcode`.
38
+ Click the `Copy to Clipboard` button within this box to copy the slider shortcode to your clipboard.
39
+ Paste this copied shortcode into the page or post where you would like your slider to appear.
40
+
41
+ = When creating sliders, what is the function of the `Items Displayed` box? =
42
+
43
+ Here you can define the number of slides that are displayed onscreen at a time, depending on the device or window-size of the browser you are using.
44
+ These setting are all initially set to `1` by default, so a traditional slider will be displayed on all devices.
45
+ When these are set to values greater than `1`, a carousel will be displayed, for example you may want to display a carousel with 4 slides visible on desktop devices, 3 slides visible on tables and only 2 slides visible on mobile phones.
46
+
47
+ == Screenshots ==
48
+
49
+ 1. The Create/Edit slider page within the WordPress Dashboard - this is where you define the settings and create the slides for your `Slide Anything` slider or carousel.
50
+ 2. How a carousel created using `Slide Anything` appears within a Website page.
51
+
52
+ == Changelog ==
53
+
54
+ = 1.0 =
55
+ * Initial release of this plugin.
56
+
57
+ == Upgrade Notice ==
58
+
59
+ = 1.0 =
60
+ * Initial release of this plugin.
trunk/slide-anything.php ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Plugin Name: Slide Anything
4
+ * Plugin URI: https://wordpress.org/support/plugin/slide-anything
5
+ * Description: Slide Anything allows you to create a carousel/slider where the content for each slide can be anything you want - images, text, HTML, and even shortcodes. This plugin uses the Owl Carousel jQuery plugin, and lets you create beautiful, touch enabled, responsive carousels and sliders.
6
+ * Author: Simon Edge
7
+ * Version: 1.0
8
+ * License: GPLv2 or later
9
+ */
10
+
11
+ if (!defined('ABSPATH')) exit; // EXIT IF ACCESSED DIRECTLY
12
+
13
+ // SET CONSTANT FOR PLUGIN PATH
14
+ define('PLUGIN_PATH', plugins_url('/', __FILE__));
15
+
16
+ require 'php/slide-anything-admin.php';
17
+ require 'php/slide-anything-frontend.php';
18
+
19
+ /* ##### PLUGIN ACTIVATION HOOK ##### */
20
+ register_activation_hook(__FILE__, 'cpt_slider_plugin_activation' );
21
+
22
+ /* ##### ADD ACTION HOOKS & FILTERS FOR PLUGIN ##### */
23
+ add_action('admin_enqueue_scripts', 'cpt_register_admin_scripts');
24
+ add_action('init', 'cpt_slider_register');
25
+ add_action('post_row_actions', 'cpt_slider_row_actions', 10, 2);
26
+ add_action('add_meta_boxes', 'cpt_slider_add_meta_boxes');
27
+ add_action('save_post', 'cpt_slider_save_postdata');
28
+ add_filter('manage_sa_slider_posts_columns', 'cpt_slider_modify_columns');
29
+ add_filter('manage_sa_slider_posts_custom_column', 'cpt_slider_custom_column_content');
30
+
31
+ ?>
trunk/spectrum/spectrum.css ADDED
@@ -0,0 +1,507 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /***
2
+ Spectrum Colorpicker v1.8.0
3
+ https://github.com/bgrins/spectrum
4
+ Author: Brian Grinstead
5
+ License: MIT
6
+ ***/
7
+
8
+ .sp-container {
9
+ position:absolute;
10
+ top:0;
11
+ left:0;
12
+ display:inline-block;
13
+ *display: inline;
14
+ *zoom: 1;
15
+ /* https://github.com/bgrins/spectrum/issues/40 */
16
+ z-index: 9999994;
17
+ overflow: hidden;
18
+ }
19
+ .sp-container.sp-flat {
20
+ position: relative;
21
+ }
22
+
23
+ /* Fix for * { box-sizing: border-box; } */
24
+ .sp-container,
25
+ .sp-container * {
26
+ -webkit-box-sizing: content-box;
27
+ -moz-box-sizing: content-box;
28
+ box-sizing: content-box;
29
+ }
30
+
31
+ /* http://ansciath.tumblr.com/post/7347495869/css-aspect-ratio */
32
+ .sp-top {
33
+ position:relative;
34
+ width: 100%;
35
+ display:inline-block;
36
+ }
37
+ .sp-top-inner {
38
+ position:absolute;
39
+ top:0;
40
+ left:0;
41
+ bottom:0;
42
+ right:0;
43
+ }
44
+ .sp-color {
45
+ position: absolute;
46
+ top:0;
47
+ left:0;
48
+ bottom:0;
49
+ right:20%;
50
+ }
51
+ .sp-hue {
52
+ position: absolute;
53
+ top:0;
54
+ right:0;
55
+ bottom:0;
56
+ left:84%;
57
+ height: 100%;
58
+ }
59
+
60
+ .sp-clear-enabled .sp-hue {
61
+ top:33px;
62
+ height: 77.5%;
63
+ }
64
+
65
+ .sp-fill {
66
+ padding-top: 80%;
67
+ }
68
+ .sp-sat, .sp-val {
69
+ position: absolute;
70
+ top:0;
71
+ left:0;
72
+ right:0;
73
+ bottom:0;
74
+ }
75
+
76
+ .sp-alpha-enabled .sp-top {
77
+ margin-bottom: 18px;
78
+ }
79
+ .sp-alpha-enabled .sp-alpha {
80
+ display: block;
81
+ }
82
+ .sp-alpha-handle {
83
+ position:absolute;
84
+ top:-4px;
85
+ bottom: -4px;
86
+ width: 6px;
87
+ left: 50%;
88
+ cursor: pointer;
89
+ border: 1px solid black;
90
+ background: white;
91
+ opacity: .8;
92
+ }
93
+ .sp-alpha {
94
+ display: none;
95
+ position: absolute;
96
+ bottom: -14px;
97
+ right: 0;
98
+ left: 0;
99
+ height: 8px;
100
+ }
101
+ .sp-alpha-inner {
102
+ border: solid 1px #333;
103
+ }
104
+
105
+ .sp-clear {
106
+ display: none;
107
+ }
108
+
109
+ .sp-clear.sp-clear-display {
110
+ background-position: center;
111
+ }
112
+
113
+ .sp-clear-enabled .sp-clear {
114
+ display: block;
115
+ position:absolute;
116
+ top:0px;
117
+ right:0;
118
+ bottom:0;
119
+ left:84%;
120
+ height: 28px;
121
+ }
122
+
123
+ /* Don't allow text selection */
124
+ .sp-container, .sp-replacer, .sp-preview, .sp-dragger, .sp-slider, .sp-alpha, .sp-clear, .sp-alpha-handle, .sp-container.sp-dragging .sp-input, .sp-container button {
125
+ -webkit-user-select:none;
126
+ -moz-user-select: -moz-none;
127
+ -o-user-select:none;
128
+ user-select: none;
129
+ }
130
+
131
+ .sp-container.sp-input-disabled .sp-input-container {
132
+ display: none;
133
+ }
134
+ .sp-container.sp-buttons-disabled .sp-button-container {
135
+ display: none;
136
+ }
137
+ .sp-container.sp-palette-buttons-disabled .sp-palette-button-container {
138
+ display: none;
139
+ }
140
+ .sp-palette-only .sp-picker-container {
141
+ display: none;
142
+ }
143
+ .sp-palette-disabled .sp-palette-container {
144
+ display: none;
145
+ }
146
+
147
+ .sp-initial-disabled .sp-initial {
148
+ display: none;
149
+ }
150
+
151
+
152
+ /* Gradients for hue, saturation and value instead of images. Not pretty... but it works */
153
+ .sp-sat {
154
+ background-image: -webkit-gradient(linear, 0 0, 100% 0, from(#FFF), to(rgba(204, 154, 129, 0)));
155
+ background-image: -webkit-linear-gradient(left, #FFF, rgba(204, 154, 129, 0));
156
+ background-image: -moz-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
157
+ background-image: -o-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
158
+ background-image: -ms-linear-gradient(left, #fff, rgba(204, 154, 129, 0));
159
+ background-image: linear-gradient(to right, #fff, rgba(204, 154, 129, 0));
160
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr=#FFFFFFFF, endColorstr=#00CC9A81)";
161
+ filter : progid:DXImageTransform.Microsoft.gradient(GradientType = 1, startColorstr='#FFFFFFFF', endColorstr='#00CC9A81');
162
+ }
163
+ .sp-val {
164
+ background-image: -webkit-gradient(linear, 0 100%, 0 0, from(#000000), to(rgba(204, 154, 129, 0)));
165
+ background-image: -webkit-linear-gradient(bottom, #000000, rgba(204, 154, 129, 0));
166
+ background-image: -moz-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
167
+ background-image: -o-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
168
+ background-image: -ms-linear-gradient(bottom, #000, rgba(204, 154, 129, 0));
169
+ background-image: linear-gradient(to top, #000, rgba(204, 154, 129, 0));
170
+ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr=#00CC9A81, endColorstr=#FF000000)";
171
+ filter : progid:DXImageTransform.Microsoft.gradient(startColorstr='#00CC9A81', endColorstr='#FF000000');
172
+ }
173
+
174
+ .sp-hue {
175
+ background: -moz-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
176
+ background: -ms-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
177
+ background: -o-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
178
+ background: -webkit-gradient(linear, left top, left bottom, from(#ff0000), color-stop(0.17, #ffff00), color-stop(0.33, #00ff00), color-stop(0.5, #00ffff), color-stop(0.67, #0000ff), color-stop(0.83, #ff00ff), to(#ff0000));
179
+ background: -webkit-linear-gradient(top, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
180
+ background: linear-gradient(to bottom, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
181
+ }
182
+
183
+ /* IE filters do not support multiple color stops.
184
+ Generate 6 divs, line them up, and do two color gradients for each.
185
+ Yes, really.
186
+ */
187
+ .sp-1 {
188
+ height:17%;
189
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0000', endColorstr='#ffff00');
190
+ }
191
+ .sp-2 {
192
+ height:16%;
193
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffff00', endColorstr='#00ff00');
194
+ }
195
+ .sp-3 {
196
+ height:17%;
197
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff00', endColorstr='#00ffff');
198
+ }
199
+ .sp-4 {
200
+ height:17%;
201
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ffff', endColorstr='#0000ff');
202
+ }
203
+ .sp-5 {
204
+ height:16%;
205
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0000ff', endColorstr='#ff00ff');
206
+ }
207
+ .sp-6 {
208
+ height:17%;
209
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff00ff', endColorstr='#ff0000');
210
+ }
211
+
212
+ .sp-hidden {
213
+ display: none !important;
214
+ }
215
+
216
+ /* Clearfix hack */
217
+ .sp-cf:before, .sp-cf:after { content: ""; display: table; }
218
+ .sp-cf:after { clear: both; }
219
+ .sp-cf { *zoom: 1; }
220
+
221
+ /* Mobile devices, make hue slider bigger so it is easier to slide */
222
+ @media (max-device-width: 480px) {
223
+ .sp-color { right: 40%; }
224
+ .sp-hue { left: 63%; }
225
+ .sp-fill { padding-top: 60%; }
226
+ }
227
+ .sp-dragger {
228
+ border-radius: 5px;
229
+ height: 5px;
230
+ width: 5px;
231
+ border: 1px solid #fff;
232
+ background: #000;
233
+ cursor: pointer;
234
+ position:absolute;
235
+ top:0;
236
+ left: 0;
237
+ }
238
+ .sp-slider {
239
+ position: absolute;
240
+ top:0;
241
+ cursor:pointer;
242
+ height: 3px;
243
+ left: -1px;
244
+ right: -1px;
245
+ border: 1px solid #000;
246
+ background: white;
247
+ opacity: .8;
248
+ }
249
+
250
+ /*
251
+ Theme authors:
252
+ Here are the basic themeable display options (colors, fonts, global widths).
253
+ See http://bgrins.github.io/spectrum/themes/ for instructions.
254
+ */
255
+
256
+ .sp-container {
257
+ border-radius: 0;
258
+ background-color: #ECECEC;
259
+ border: solid 1px #f0c49B;
260
+ padding: 0;
261
+ }
262
+ .sp-container, .sp-container button, .sp-container input, .sp-color, .sp-hue, .sp-clear {
263
+ font: normal 12px "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
264
+ -webkit-box-sizing: border-box;
265
+ -moz-box-sizing: border-box;
266
+ -ms-box-sizing: border-box;
267
+ box-sizing: border-box;
268
+ }
269
+ .sp-top {
270
+ margin-bottom: 3px;
271
+ }
272
+ .sp-color, .sp-hue, .sp-clear {
273
+ border: solid 1px #666;
274
+ }
275
+
276
+ /* Input */
277
+ .sp-input-container {
278
+ float:right;
279
+ width: 100px;
280
+ margin-bottom: 4px;
281
+ }
282
+ .sp-initial-disabled .sp-input-container {
283
+ width: 100%;
284
+ }
285
+ .sp-input {
286
+ font-size: 12px !important;
287
+ border: 1px inset;
288
+ padding: 4px 5px;
289
+ margin: 0;
290
+ width: 100%;
291
+ background:transparent;
292
+ border-radius: 3px;
293
+ color: #222;
294
+ }
295
+ .sp-input:focus {
296
+ border: 1px solid orange;
297
+ }
298
+ .sp-input.sp-validation-error {
299
+ border: 1px solid red;
300
+ background: #fdd;
301
+ }
302
+ .sp-picker-container , .sp-palette-container {
303
+ float:left;
304
+ position: relative;
305
+ padding: 10px;
306
+ padding-bottom: 300px;
307
+ margin-bottom: -290px;
308
+ }
309
+ .sp-picker-container {
310
+ width: 172px;
311
+ border-left: solid 1px #fff;
312
+ }
313
+
314
+ /* Palettes */
315
+ .sp-palette-container {
316
+ border-right: solid 1px #ccc;
317
+ }
318
+
319
+ .sp-palette-only .sp-palette-container {
320
+ border: 0;
321
+ }
322
+
323
+ .sp-palette .sp-thumb-el {
324
+ display: block;
325
+ position:relative;
326
+ float:left;
327
+ width: 24px;
328
+ height: 15px;
329
+ margin: 3px;
330
+ cursor: pointer;
331
+ border:solid 2px transparent;
332
+ }
333
+ .sp-palette .sp-thumb-el:hover, .sp-palette .sp-thumb-el.sp-thumb-active {
334
+ border-color: orange;
335
+ }
336
+ .sp-thumb-el {
337
+ position:relative;
338
+ }
339
+
340
+ /* Initial */
341
+ .sp-initial {
342
+ float: left;
343
+ border: solid 1px #333;
344
+ }
345
+ .sp-initial span {
346
+ width: 30px;
347
+ height: 25px;
348
+ border:none;
349
+ display:block;
350
+ float:left;
351
+ margin:0;
352
+ }
353
+
354
+ .sp-initial .sp-clear-display {
355
+ background-position: center;
356
+ }
357
+
358
+ /* Buttons */
359
+ .sp-palette-button-container,
360
+ .sp-button-container {
361
+ float: right;
362
+ }
363
+
364
+ /* Replacer (the little preview div that shows up instead of the <input>) */
365
+ .sp-replacer {
366
+ margin:0;
367
+ overflow:hidden;
368
+ cursor:pointer;
369
+ padding: 4px;
370
+ display:inline-block;
371
+ *zoom: 1;
372
+ *display: inline;
373
+ border: solid 1px #91765d;
374
+ background: #eee;
375
+ color: #333;
376
+ vertical-align: middle;
377
+ }
378
+ .sp-replacer:hover, .sp-replacer.sp-active {
379
+ border-color: #F0C49B;
380
+ color: #111;
381
+ }
382
+ .sp-replacer.sp-disabled {
383
+ cursor:default;
384
+ border-color: silver;
385
+ color: silver;
386
+ }
387
+ .sp-dd {
388
+ padding: 2px 0;
389
+ height: 16px;
390
+ line-height: 16px;
391
+ float:left;
392
+ font-size:10px;
393
+ }
394
+ .sp-preview {
395
+ position:relative;
396
+ width:25px;
397
+ height: 20px;
398
+ border: solid 1px #222;
399
+ margin-right: 5px;
400
+ float:left;
401
+ z-index: 0;
402
+ }
403
+
404
+ .sp-palette {
405
+ *width: 220px;
406
+ max-width: 220px;
407
+ }
408
+ .sp-palette .sp-thumb-el {
409
+ width:16px;
410
+ height: 16px;
411
+ margin:2px 1px;
412
+ border: solid 1px #d0d0d0;
413
+ }
414
+
415
+ .sp-container {
416
+ padding-bottom:0;
417
+ }
418
+
419
+
420
+ /* Buttons: http://hellohappy.org/css3-buttons/ */
421
+ .sp-container button {
422
+ background-color: #eeeeee;
423
+ background-image: -webkit-linear-gradient(top, #eeeeee, #cccccc);
424
+ background-image: -moz-linear-gradient(top, #eeeeee, #cccccc);
425
+ background-image: -ms-linear-gradient(top, #eeeeee, #cccccc);
426
+ background-image: -o-linear-gradient(top, #eeeeee, #cccccc);
427
+ background-image: linear-gradient(to bottom, #eeeeee, #cccccc);
428
+ border: 1px solid #ccc;
429
+ border-bottom: 1px solid #bbb;
430
+ border-radius: 3px;
431
+ color: #333;
432
+ font-size: 14px;
433
+ line-height: 1;
434
+ padding: 5px 4px;
435
+ text-align: center;
436
+ text-shadow: 0 1px 0 #eee;
437
+ vertical-align: middle;
438
+ }
439
+ .sp-container button:hover {
440
+ background-color: #dddddd;
441
+ background-image: -webkit-linear-gradient(top, #dddddd, #bbbbbb);
442
+ background-image: -moz-linear-gradient(top, #dddddd, #bbbbbb);
443
+ background-image: -ms-linear-gradient(top, #dddddd, #bbbbbb);
444
+ background-image: -o-linear-gradient(top, #dddddd, #bbbbbb);
445
+ background-image: linear-gradient(to bottom, #dddddd, #bbbbbb);
446
+ border: 1px solid #bbb;
447
+ border-bottom: 1px solid #999;
448
+ cursor: pointer;
449
+ text-shadow: 0 1px 0 #ddd;
450
+ }
451
+ .sp-container button:active {
452
+ border: 1px solid #aaa;
453
+ border-bottom: 1px solid #888;
454
+ -webkit-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
455
+ -moz-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
456
+ -ms-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
457
+ -o-box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
458
+ box-shadow: inset 0 0 5px 2px #aaaaaa, 0 1px 0 0 #eeeeee;
459
+ }
460
+ .sp-cancel {
461
+ font-size: 11px;
462
+ color: #d93f3f !important;
463
+ margin:0;
464
+ padding:2px;
465
+ margin-right: 5px;
466
+ vertical-align: middle;
467
+ text-decoration:none;
468
+
469
+ }
470
+ .sp-cancel:hover {
471
+ color: #d93f3f !important;
472
+ text-decoration: underline;
473
+ }
474
+
475
+
476
+ .sp-palette span:hover, .sp-palette span.sp-thumb-active {
477
+ border-color: #000;
478
+ }
479
+
480
+ .sp-preview, .sp-alpha, .sp-thumb-el {
481
+ position:relative;
482
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==);
483
+ }
484
+ .sp-preview-inner, .sp-alpha-inner, .sp-thumb-inner {
485
+ display:block;
486
+ position:absolute;
487
+ top:0;left:0;bottom:0;right:0;
488
+ }
489
+
490
+ .sp-palette .sp-thumb-inner {
491
+ background-position: 50% 50%;
492
+ background-repeat: no-repeat;
493
+ }
494
+
495
+ .sp-palette .sp-thumb-light.sp-thumb-active .sp-thumb-inner {
496
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAIVJREFUeNpiYBhsgJFMffxAXABlN5JruT4Q3wfi/0DsT64h8UD8HmpIPCWG/KemIfOJCUB+Aoacx6EGBZyHBqI+WsDCwuQ9mhxeg2A210Ntfo8klk9sOMijaURm7yc1UP2RNCMbKE9ODK1HM6iegYLkfx8pligC9lCD7KmRof0ZhjQACDAAceovrtpVBRkAAAAASUVORK5CYII=);
497
+ }
498
+
499
+ .sp-palette .sp-thumb-dark.sp-thumb-active .sp-thumb-inner {
500
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAadEVYdFNvZnR3YXJlAFBhaW50Lk5FVCB2My41LjEwMPRyoQAAAMdJREFUOE+tkgsNwzAMRMugEAahEAahEAZhEAqlEAZhEAohEAYh81X2dIm8fKpEspLGvudPOsUYpxE2BIJCroJmEW9qJ+MKaBFhEMNabSy9oIcIPwrB+afvAUFoK4H0tMaQ3XtlrggDhOVVMuT4E5MMG0FBbCEYzjYT7OxLEvIHQLY2zWwQ3D+9luyOQTfKDiFD3iUIfPk8VqrKjgAiSfGFPecrg6HN6m/iBcwiDAo7WiBeawa+Kwh7tZoSCGLMqwlSAzVDhoK+6vH4G0P5wdkAAAAASUVORK5CYII=);
501
+ }
502
+
503
+ .sp-clear-display {
504
+ background-repeat:no-repeat;
505
+ background-position: center;
506
+ background-image: url(data:image/gif;base64,R0lGODlhFAAUAPcAAAAAAJmZmZ2dnZ6enqKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq/Hx8fLy8vT09PX19ff39/j4+Pn5+fr6+vv7+wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAP8ALAAAAAAUABQAAAihAP9FoPCvoMGDBy08+EdhQAIJCCMybCDAAYUEARBAlFiQQoMABQhKUJBxY0SPICEYHBnggEmDKAuoPMjS5cGYMxHW3IiT478JJA8M/CjTZ0GgLRekNGpwAsYABHIypcAgQMsITDtWJYBR6NSqMico9cqR6tKfY7GeBCuVwlipDNmefAtTrkSzB1RaIAoXodsABiZAEFB06gIBWC1mLVgBa0AAOw==);
507
+ }
trunk/spectrum/spectrum.js ADDED
@@ -0,0 +1,2323 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Spectrum Colorpicker v1.8.0
2
+ // https://github.com/bgrins/spectrum
3
+ // Author: Brian Grinstead
4
+ // License: MIT
5
+
6
+ (function (factory) {
7
+ "use strict";
8
+
9
+ if (typeof define === 'function' && define.amd) { // AMD
10
+ define(['jquery'], factory);
11
+ }
12
+ else if (typeof exports == "object" && typeof module == "object") { // CommonJS
13
+ module.exports = factory(require('jquery'));
14
+ }
15
+ else { // Browser
16
+ factory(jQuery);
17
+ }
18
+ })(function($, undefined) {
19
+ "use strict";
20
+
21
+ var defaultOpts = {
22
+
23
+ // Callbacks
24
+ beforeShow: noop,
25
+ move: noop,
26
+ change: noop,
27
+ show: noop,
28
+ hide: noop,
29
+
30
+ // Options
31
+ color: false,
32
+ flat: false,
33
+ showInput: false,
34
+ allowEmpty: false,
35
+ showButtons: true,
36
+ clickoutFiresChange: true,
37
+ showInitial: false,
38
+ showPalette: false,
39
+ showPaletteOnly: false,
40
+ hideAfterPaletteSelect: false,
41
+ togglePaletteOnly: false,
42
+ showSelectionPalette: true,
43
+ localStorageKey: false,
44
+ appendTo: "body",
45
+ maxSelectionSize: 7,
46
+ cancelText: "cancel",
47
+ chooseText: "choose",
48
+ togglePaletteMoreText: "more",
49
+ togglePaletteLessText: "less",
50
+ clearText: "Clear Color Selection",
51
+ noColorSelectedText: "No Color Selected",
52
+ preferredFormat: false,
53
+ className: "", // Deprecated - use containerClassName and replacerClassName instead.
54
+ containerClassName: "",
55
+ replacerClassName: "",
56
+ showAlpha: false,
57
+ theme: "sp-light",
58
+ palette: [["#ffffff", "#000000", "#ff0000", "#ff8000", "#ffff00", "#008000", "#0000ff", "#4b0082", "#9400d3"]],
59
+ selectionPalette: [],
60
+ disabled: false,
61
+ offset: null
62
+ },
63
+ spectrums = [],
64
+ IE = !!/msie/i.exec( window.navigator.userAgent ),
65
+ rgbaSupport = (function() {
66
+ function contains( str, substr ) {
67
+ return !!~('' + str).indexOf(substr);
68
+ }
69
+
70
+ var elem = document.createElement('div');
71
+ var style = elem.style;
72
+ style.cssText = 'background-color:rgba(0,0,0,.5)';
73
+ return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');
74
+ })(),
75
+ replaceInput = [
76
+ "<div class='sp-replacer'>",
77
+ "<div class='sp-preview'><div class='sp-preview-inner'></div></div>",
78
+ "<div class='sp-dd'>&#9660;</div>",
79
+ "</div>"
80
+ ].join(''),
81
+ markup = (function () {
82
+
83
+ // IE does not support gradients with multiple stops, so we need to simulate
84
+ // that for the rainbow slider with 8 divs that each have a single gradient
85
+ var gradientFix = "";
86
+ if (IE) {
87
+ for (var i = 1; i <= 6; i++) {
88
+ gradientFix += "<div class='sp-" + i + "'></div>";
89
+ }
90
+ }
91
+
92
+ return [
93
+ "<div class='sp-container sp-hidden'>",
94
+ "<div class='sp-palette-container'>",
95
+ "<div class='sp-palette sp-thumb sp-cf'></div>",
96
+ "<div class='sp-palette-button-container sp-cf'>",
97
+ "<button type='button' class='sp-palette-toggle'></button>",
98
+ "</div>",
99
+ "</div>",
100
+ "<div class='sp-picker-container'>",
101
+ "<div class='sp-top sp-cf'>",
102
+ "<div class='sp-fill'></div>",
103
+ "<div class='sp-top-inner'>",
104
+ "<div class='sp-color'>",
105
+ "<div class='sp-sat'>",
106
+ "<div class='sp-val'>",
107
+ "<div class='sp-dragger'></div>",
108
+ "</div>",
109
+ "</div>",
110
+ "</div>",
111
+ "<div class='sp-clear sp-clear-display'>",
112
+ "</div>",
113
+ "<div class='sp-hue'>",
114
+ "<div class='sp-slider'></div>",
115
+ gradientFix,
116
+ "</div>",
117
+ "</div>",
118
+ "<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>",
119
+ "</div>",
120
+ "<div class='sp-input-container sp-cf'>",
121
+ "<input class='sp-input' type='text' spellcheck='false' />",
122
+ "</div>",
123
+ "<div class='sp-initial sp-thumb sp-cf'></div>",
124
+ "<div class='sp-button-container sp-cf'>",
125
+ "<a class='sp-cancel' href='#'></a>",
126
+ "<button type='button' class='sp-choose'></button>",
127
+ "</div>",
128
+ "</div>",
129
+ "</div>"
130
+ ].join("");
131
+ })();
132
+
133
+ function paletteTemplate (p, color, className, opts) {
134
+ var html = [];
135
+ for (var i = 0; i < p.length; i++) {
136
+ var current = p[i];
137
+ if(current) {
138
+ var tiny = tinycolor(current);
139
+ var c = tiny.toHsl().l < 0.5 ? "sp-thumb-el sp-thumb-dark" : "sp-thumb-el sp-thumb-light";
140
+ c += (tinycolor.equals(color, current)) ? " sp-thumb-active" : "";
141
+ var formattedString = tiny.toString(opts.preferredFormat || "rgb");
142
+ var swatchStyle = rgbaSupport ? ("background-color:" + tiny.toRgbString()) : "filter:" + tiny.toFilter();
143
+ html.push('<span title="' + formattedString + '" data-color="' + tiny.toRgbString() + '" class="' + c + '"><span class="sp-thumb-inner" style="' + swatchStyle + ';" /></span>');
144
+ } else {
145
+ var cls = 'sp-clear-display';
146
+ html.push($('<div />')
147
+ .append($('<span data-color="" style="background-color:transparent;" class="' + cls + '"></span>')
148
+ .attr('title', opts.noColorSelectedText)
149
+ )
150
+ .html()
151
+ );
152
+ }
153
+ }
154
+ return "<div class='sp-cf " + className + "'>" + html.join('') + "</div>";
155
+ }
156
+
157
+ function hideAll() {
158
+ for (var i = 0; i < spectrums.length; i++) {
159
+ if (spectrums[i]) {
160
+ spectrums[i].hide();
161
+ }
162
+ }
163
+ }
164
+
165
+ function instanceOptions(o, callbackContext) {
166
+ var opts = $.extend({}, defaultOpts, o);
167
+ opts.callbacks = {
168
+ 'move': bind(opts.move, callbackContext),
169
+ 'change': bind(opts.change, callbackContext),
170
+ 'show': bind(opts.show, callbackContext),
171
+ 'hide': bind(opts.hide, callbackContext),
172
+ 'beforeShow': bind(opts.beforeShow, callbackContext)
173
+ };
174
+
175
+ return opts;
176
+ }
177
+
178
+ function spectrum(element, o) {
179
+
180
+ var opts = instanceOptions(o, element),
181
+ flat = opts.flat,
182
+ showSelectionPalette = opts.showSelectionPalette,
183
+ localStorageKey = opts.localStorageKey,
184
+ theme = opts.theme,
185
+ callbacks = opts.callbacks,
186
+ resize = throttle(reflow, 10),
187
+ visible = false,
188
+ isDragging = false,
189
+ dragWidth = 0,
190
+ dragHeight = 0,
191
+ dragHelperHeight = 0,
192
+ slideHeight = 0,
193
+ slideWidth = 0,
194
+ alphaWidth = 0,
195
+ alphaSlideHelperWidth = 0,
196
+ slideHelperHeight = 0,
197
+ currentHue = 0,
198
+ currentSaturation = 0,
199
+ currentValue = 0,
200
+ currentAlpha = 1,
201
+ palette = [],
202
+ paletteArray = [],
203
+ paletteLookup = {},
204
+ selectionPalette = opts.selectionPalette.slice(0),
205
+ maxSelectionSize = opts.maxSelectionSize,
206
+ draggingClass = "sp-dragging",
207
+ shiftMovementDirection = null;
208
+
209
+ var doc = element.ownerDocument,
210
+ body = doc.body,
211
+ boundElement = $(element),
212
+ disabled = false,
213
+ container = $(markup, doc).addClass(theme),
214
+ pickerContainer = container.find(".sp-picker-container"),
215
+ dragger = container.find(".sp-color"),
216
+ dragHelper = container.find(".sp-dragger"),
217
+ slider = container.find(".sp-hue"),
218
+ slideHelper = container.find(".sp-slider"),
219
+ alphaSliderInner = container.find(".sp-alpha-inner"),
220
+ alphaSlider = container.find(".sp-alpha"),
221
+ alphaSlideHelper = container.find(".sp-alpha-handle"),
222
+ textInput = container.find(".sp-input"),
223
+ paletteContainer = container.find(".sp-palette"),
224
+ initialColorContainer = container.find(".sp-initial"),
225
+ cancelButton = container.find(".sp-cancel"),
226
+ clearButton = container.find(".sp-clear"),
227
+ chooseButton = container.find(".sp-choose"),
228
+ toggleButton = container.find(".sp-palette-toggle"),
229
+ isInput = boundElement.is("input"),
230
+ isInputTypeColor = isInput && boundElement.attr("type") === "color" && inputTypeColorSupport(),
231
+ shouldReplace = isInput && !flat,
232
+ replacer = (shouldReplace) ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),
233
+ offsetElement = (shouldReplace) ? replacer : boundElement,
234
+ previewElement = replacer.find(".sp-preview-inner"),
235
+ initialColor = opts.color || (isInput && boundElement.val()),
236
+ colorOnShow = false,
237
+ currentPreferredFormat = opts.preferredFormat,
238
+ clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,
239
+ isEmpty = !initialColor,
240
+ allowEmpty = opts.allowEmpty && !isInputTypeColor;
241
+
242
+ function applyOptions() {
243
+
244
+ if (opts.showPaletteOnly) {
245
+ opts.showPalette = true;
246
+ }
247
+
248
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
249
+
250
+ if (opts.palette) {
251
+ palette = opts.palette.slice(0);
252
+ paletteArray = $.isArray(palette[0]) ? palette : [palette];
253
+ paletteLookup = {};
254
+ for (var i = 0; i < paletteArray.length; i++) {
255
+ for (var j = 0; j < paletteArray[i].length; j++) {
256
+ var rgb = tinycolor(paletteArray[i][j]).toRgbString();
257
+ paletteLookup[rgb] = true;
258
+ }
259
+ }
260
+ }
261
+
262
+ container.toggleClass("sp-flat", flat);
263
+ container.toggleClass("sp-input-disabled", !opts.showInput);
264
+ container.toggleClass("sp-alpha-enabled", opts.showAlpha);
265
+ container.toggleClass("sp-clear-enabled", allowEmpty);
266
+ container.toggleClass("sp-buttons-disabled", !opts.showButtons);
267
+ container.toggleClass("sp-palette-buttons-disabled", !opts.togglePaletteOnly);
268
+ container.toggleClass("sp-palette-disabled", !opts.showPalette);
269
+ container.toggleClass("sp-palette-only", opts.showPaletteOnly);
270
+ container.toggleClass("sp-initial-disabled", !opts.showInitial);
271
+ container.addClass(opts.className).addClass(opts.containerClassName);
272
+
273
+ reflow();
274
+ }
275
+
276
+ function initialize() {
277
+
278
+ if (IE) {
279
+ container.find("*:not(input)").attr("unselectable", "on");
280
+ }
281
+
282
+ applyOptions();
283
+
284
+ if (shouldReplace) {
285
+ boundElement.after(replacer).hide();
286
+ }
287
+
288
+ if (!allowEmpty) {
289
+ clearButton.hide();
290
+ }
291
+
292
+ if (flat) {
293
+ boundElement.after(container).hide();
294
+ }
295
+ else {
296
+
297
+ var appendTo = opts.appendTo === "parent" ? boundElement.parent() : $(opts.appendTo);
298
+ if (appendTo.length !== 1) {
299
+ appendTo = $("body");
300
+ }
301
+
302
+ appendTo.append(container);
303
+ }
304
+
305
+ updateSelectionPaletteFromStorage();
306
+
307
+ offsetElement.bind("click.spectrum touchstart.spectrum", function (e) {
308
+ if (!disabled) {
309
+ toggle();
310
+ }
311
+
312
+ e.stopPropagation();
313
+
314
+ if (!$(e.target).is("input")) {
315
+ e.preventDefault();
316
+ }
317
+ });
318
+
319
+ if(boundElement.is(":disabled") || (opts.disabled === true)) {
320
+ disable();
321
+ }
322
+
323
+ // Prevent clicks from bubbling up to document. This would cause it to be hidden.
324
+ container.click(stopPropagation);
325
+
326
+ // Handle user typed input
327
+ textInput.change(setFromTextInput);
328
+ textInput.bind("paste", function () {
329
+ setTimeout(setFromTextInput, 1);
330
+ });
331
+ textInput.keydown(function (e) { if (e.keyCode == 13) { setFromTextInput(); } });
332
+
333
+ cancelButton.text(opts.cancelText);
334
+ cancelButton.bind("click.spectrum", function (e) {
335
+ e.stopPropagation();
336
+ e.preventDefault();
337
+ revert();
338
+ hide();
339
+ });
340
+
341
+ clearButton.attr("title", opts.clearText);
342
+ clearButton.bind("click.spectrum", function (e) {
343
+ e.stopPropagation();
344
+ e.preventDefault();
345
+ isEmpty = true;
346
+ move();
347
+
348
+ if(flat) {
349
+ //for the flat style, this is a change event
350
+ updateOriginalInput(true);
351
+ }
352
+ });
353
+
354
+ chooseButton.text(opts.chooseText);
355
+ chooseButton.bind("click.spectrum", function (e) {
356
+ e.stopPropagation();
357
+ e.preventDefault();
358
+
359
+ if (IE && textInput.is(":focus")) {
360
+ textInput.trigger('change');
361
+ }
362
+
363
+ if (isValid()) {
364
+ updateOriginalInput(true);
365
+ hide();
366
+ }
367
+ });
368
+
369
+ toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);
370
+ toggleButton.bind("click.spectrum", function (e) {
371
+ e.stopPropagation();
372
+ e.preventDefault();
373
+
374
+ opts.showPaletteOnly = !opts.showPaletteOnly;
375
+
376
+ // To make sure the Picker area is drawn on the right, next to the
377
+ // Palette area (and not below the palette), first move the Palette
378
+ // to the left to make space for the picker, plus 5px extra.
379
+ // The 'applyOptions' function puts the whole container back into place
380
+ // and takes care of the button-text and the sp-palette-only CSS class.
381
+ if (!opts.showPaletteOnly && !flat) {
382
+ container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));
383
+ }
384
+ applyOptions();
385
+ });
386
+
387
+ draggable(alphaSlider, function (dragX, dragY, e) {
388
+ currentAlpha = (dragX / alphaWidth);
389
+ isEmpty = false;
390
+ if (e.shiftKey) {
391
+ currentAlpha = Math.round(currentAlpha * 10) / 10;
392
+ }
393
+
394
+ move();
395
+ }, dragStart, dragStop);
396
+
397
+ draggable(slider, function (dragX, dragY) {
398
+ currentHue = parseFloat(dragY / slideHeight);
399
+ isEmpty = false;
400
+ if (!opts.showAlpha) {
401
+ currentAlpha = 1;
402
+ }
403
+ move();
404
+ }, dragStart, dragStop);
405
+
406
+ draggable(dragger, function (dragX, dragY, e) {
407
+
408
+ // shift+drag should snap the movement to either the x or y axis.
409
+ if (!e.shiftKey) {
410
+ shiftMovementDirection = null;
411
+ }
412
+ else if (!shiftMovementDirection) {
413
+ var oldDragX = currentSaturation * dragWidth;
414
+ var oldDragY = dragHeight - (currentValue * dragHeight);
415
+ var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);
416
+
417
+ shiftMovementDirection = furtherFromX ? "x" : "y";
418
+ }
419
+
420
+ var setSaturation = !shiftMovementDirection || shiftMovementDirection === "x";
421
+ var setValue = !shiftMovementDirection || shiftMovementDirection === "y";
422
+
423
+ if (setSaturation) {
424
+ currentSaturation = parseFloat(dragX / dragWidth);
425
+ }
426
+ if (setValue) {
427
+ currentValue = parseFloat((dragHeight - dragY) / dragHeight);
428
+ }
429
+
430
+ isEmpty = false;
431
+ if (!opts.showAlpha) {
432
+ currentAlpha = 1;
433
+ }
434
+
435
+ move();
436
+
437
+ }, dragStart, dragStop);
438
+
439
+ if (!!initialColor) {
440
+ set(initialColor);
441
+
442
+ // In case color was black - update the preview UI and set the format
443
+ // since the set function will not run (default color is black).
444
+ updateUI();
445
+ currentPreferredFormat = opts.preferredFormat || tinycolor(initialColor).format;
446
+
447
+ addColorToSelectionPalette(initialColor);
448
+ }
449
+ else {
450
+ updateUI();
451
+ }
452
+
453
+ if (flat) {
454
+ show();
455
+ }
456
+
457
+ function paletteElementClick(e) {
458
+ if (e.data && e.data.ignore) {
459
+ set($(e.target).closest(".sp-thumb-el").data("color"));
460
+ move();
461
+ }
462
+ else {
463
+ set($(e.target).closest(".sp-thumb-el").data("color"));
464
+ move();
465
+ updateOriginalInput(true);
466
+ if (opts.hideAfterPaletteSelect) {
467
+ hide();
468
+ }
469
+ }
470
+
471
+ return false;
472
+ }
473
+
474
+ var paletteEvent = IE ? "mousedown.spectrum" : "click.spectrum touchstart.spectrum";
475
+ paletteContainer.delegate(".sp-thumb-el", paletteEvent, paletteElementClick);
476
+ initialColorContainer.delegate(".sp-thumb-el:nth-child(1)", paletteEvent, { ignore: true }, paletteElementClick);
477
+ }
478
+
479
+ function updateSelectionPaletteFromStorage() {
480
+
481
+ if (localStorageKey && window.localStorage) {
482
+
483
+ // Migrate old palettes over to new format. May want to remove this eventually.
484
+ try {
485
+ var oldPalette = window.localStorage[localStorageKey].split(",#");
486
+ if (oldPalette.length > 1) {
487
+ delete window.localStorage[localStorageKey];
488
+ $.each(oldPalette, function(i, c) {
489
+ addColorToSelectionPalette(c);
490
+ });
491
+ }
492
+ }
493
+ catch(e) { }
494
+
495
+ try {
496
+ selectionPalette = window.localStorage[localStorageKey].split(";");
497
+ }
498
+ catch (e) { }
499
+ }
500
+ }
501
+
502
+ function addColorToSelectionPalette(color) {
503
+ if (showSelectionPalette) {
504
+ var rgb = tinycolor(color).toRgbString();
505
+ if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {
506
+ selectionPalette.push(rgb);
507
+ while(selectionPalette.length > maxSelectionSize) {
508
+ selectionPalette.shift();
509
+ }
510
+ }
511
+
512
+ if (localStorageKey && window.localStorage) {
513
+ try {
514
+ window.localStorage[localStorageKey] = selectionPalette.join(";");
515
+ }
516
+ catch(e) { }
517
+ }
518
+ }
519
+ }
520
+
521
+ function getUniqueSelectionPalette() {
522
+ var unique = [];
523
+ if (opts.showPalette) {
524
+ for (var i = 0; i < selectionPalette.length; i++) {
525
+ var rgb = tinycolor(selectionPalette[i]).toRgbString();
526
+
527
+ if (!paletteLookup[rgb]) {
528
+ unique.push(selectionPalette[i]);
529
+ }
530
+ }
531
+ }
532
+
533
+ return unique.reverse().slice(0, opts.maxSelectionSize);
534
+ }
535
+
536
+ function drawPalette() {
537
+
538
+ var currentColor = get();
539
+
540
+ var html = $.map(paletteArray, function (palette, i) {
541
+ return paletteTemplate(palette, currentColor, "sp-palette-row sp-palette-row-" + i, opts);
542
+ });
543
+
544
+ updateSelectionPaletteFromStorage();
545
+
546
+ if (selectionPalette) {
547
+ html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, "sp-palette-row sp-palette-row-selection", opts));
548
+ }
549
+
550
+ paletteContainer.html(html.join(""));
551
+ }
552
+
553
+ function drawInitial() {
554
+ if (opts.showInitial) {
555
+ var initial = colorOnShow;
556
+ var current = get();
557
+ initialColorContainer.html(paletteTemplate([initial, current], current, "sp-palette-row-initial", opts));
558
+ }
559
+ }
560
+
561
+ function dragStart() {
562
+ if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {
563
+ reflow();
564
+ }
565
+ isDragging = true;
566
+ container.addClass(draggingClass);
567
+ shiftMovementDirection = null;
568
+ boundElement.trigger('dragstart.spectrum', [ get() ]);
569
+ }
570
+
571
+ function dragStop() {
572
+ isDragging = false;
573
+ container.removeClass(draggingClass);
574
+ boundElement.trigger('dragstop.spectrum', [ get() ]);
575
+ }
576
+
577
+ function setFromTextInput() {
578
+
579
+ var value = textInput.val();
580
+
581
+ if ((value === null || value === "") && allowEmpty) {
582
+ set(null);
583
+ updateOriginalInput(true);
584
+ }
585
+ else {
586
+ var tiny = tinycolor(value);
587
+ if (tiny.isValid()) {
588
+ set(tiny);
589
+ updateOriginalInput(true);
590
+ }
591
+ else {
592
+ textInput.addClass("sp-validation-error");
593
+ }
594
+ }
595
+ }
596
+
597
+ function toggle() {
598
+ if (visible) {
599
+ hide();
600
+ }
601
+ else {
602
+ show();
603
+ }
604
+ }
605
+
606
+ function show() {
607
+ var event = $.Event('beforeShow.spectrum');
608
+
609
+ if (visible) {
610
+ reflow();
611
+ return;
612
+ }
613
+
614
+ boundElement.trigger(event, [ get() ]);
615
+
616
+ if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {
617
+ return;
618
+ }
619
+
620
+ hideAll();
621
+ visible = true;
622
+
623
+ $(doc).bind("keydown.spectrum", onkeydown);
624
+ $(doc).bind("click.spectrum", clickout);
625
+ $(window).bind("resize.spectrum", resize);
626
+ replacer.addClass("sp-active");
627
+ container.removeClass("sp-hidden");
628
+
629
+ reflow();
630
+ updateUI();
631
+
632
+ colorOnShow = get();
633
+
634
+ drawInitial();
635
+ callbacks.show(colorOnShow);
636
+ boundElement.trigger('show.spectrum', [ colorOnShow ]);
637
+ }
638
+
639
+ function onkeydown(e) {
640
+ // Close on ESC
641
+ if (e.keyCode === 27) {
642
+ hide();
643
+ }
644
+ }
645
+
646
+ function clickout(e) {
647
+ // Return on right click.
648
+ if (e.button == 2) { return; }
649
+
650
+ // If a drag event was happening during the mouseup, don't hide
651
+ // on click.
652
+ if (isDragging) { return; }
653
+
654
+ if (clickoutFiresChange) {
655
+ updateOriginalInput(true);
656
+ }
657
+ else {
658
+ revert();
659
+ }
660
+ hide();
661
+ }
662
+
663
+ function hide() {
664
+ // Return if hiding is unnecessary
665
+ if (!visible || flat) { return; }
666
+ visible = false;
667
+
668
+ $(doc).unbind("keydown.spectrum", onkeydown);
669
+ $(doc).unbind("click.spectrum", clickout);
670
+ $(window).unbind("resize.spectrum", resize);
671
+
672
+ replacer.removeClass("sp-active");
673
+ container.addClass("sp-hidden");
674
+
675
+ callbacks.hide(get());
676
+ boundElement.trigger('hide.spectrum', [ get() ]);
677
+ }
678
+
679
+ function revert() {
680
+ set(colorOnShow, true);
681
+ }
682
+
683
+ function set(color, ignoreFormatChange) {
684
+ if (tinycolor.equals(color, get())) {
685
+ // Update UI just in case a validation error needs
686
+ // to be cleared.
687
+ updateUI();
688
+ return;
689
+ }
690
+
691
+ var newColor, newHsv;
692
+ if (!color && allowEmpty) {
693
+ isEmpty = true;
694
+ } else {
695
+ isEmpty = false;
696
+ newColor = tinycolor(color);
697
+ newHsv = newColor.toHsv();
698
+
699
+ currentHue = (newHsv.h % 360) / 360;
700
+ currentSaturation = newHsv.s;
701
+ currentValue = newHsv.v;
702
+ currentAlpha = newHsv.a;
703
+ }
704
+ updateUI();
705
+
706
+ if (newColor && newColor.isValid() && !ignoreFormatChange) {
707
+ currentPreferredFormat = opts.preferredFormat || newColor.getFormat();
708
+ }
709
+ }
710
+
711
+ function get(opts) {
712
+ opts = opts || { };
713
+
714
+ if (allowEmpty && isEmpty) {
715
+ return null;
716
+ }
717
+
718
+ return tinycolor.fromRatio({
719
+ h: currentHue,
720
+ s: currentSaturation,
721
+ v: currentValue,
722
+ a: Math.round(currentAlpha * 100) / 100
723
+ }, { format: opts.format || currentPreferredFormat });
724
+ }
725
+
726
+ function isValid() {
727
+ return !textInput.hasClass("sp-validation-error");
728
+ }
729
+
730
+ function move() {
731
+ updateUI();
732
+
733
+ callbacks.move(get());
734
+ boundElement.trigger('move.spectrum', [ get() ]);
735
+ }
736
+
737
+ function updateUI() {
738
+
739
+ textInput.removeClass("sp-validation-error");
740
+
741
+ updateHelperLocations();
742
+
743
+ // Update dragger background color (gradients take care of saturation and value).
744
+ var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });
745
+ dragger.css("background-color", flatColor.toHexString());
746
+
747
+ // Get a format that alpha will be included in (hex and names ignore alpha)
748
+ var format = currentPreferredFormat;
749
+ if (currentAlpha < 1 && !(currentAlpha === 0 && format === "name")) {
750
+ if (format === "hex" || format === "hex3" || format === "hex6" || format === "name") {
751
+ format = "rgb";
752
+ }
753
+ }
754
+
755
+ var realColor = get({ format: format }),
756
+ displayColor = '';
757
+
758
+ //reset background info for preview element
759
+ previewElement.removeClass("sp-clear-display");
760
+ previewElement.css('background-color', 'transparent');
761
+
762
+ if (!realColor && allowEmpty) {
763
+ // Update the replaced elements background with icon indicating no color selection
764
+ previewElement.addClass("sp-clear-display");
765
+ }
766
+ else {
767
+ var realHex = realColor.toHexString(),
768
+ realRgb = realColor.toRgbString();
769
+
770
+ // Update the replaced elements background color (with actual selected color)
771
+ if (rgbaSupport || realColor.alpha === 1) {
772
+ previewElement.css("background-color", realRgb);
773
+ }
774
+ else {
775
+ previewElement.css("background-color", "transparent");
776
+ previewElement.css("filter", realColor.toFilter());
777
+ }
778
+
779
+ if (opts.showAlpha) {
780
+ var rgb = realColor.toRgb();
781
+ rgb.a = 0;
782
+ var realAlpha = tinycolor(rgb).toRgbString();
783
+ var gradient = "linear-gradient(left, " + realAlpha + ", " + realHex + ")";
784
+
785
+ if (IE) {
786
+ alphaSliderInner.css("filter", tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));
787
+ }
788
+ else {
789
+ alphaSliderInner.css("background", "-webkit-" + gradient);
790
+ alphaSliderInner.css("background", "-moz-" + gradient);
791
+ alphaSliderInner.css("background", "-ms-" + gradient);
792
+ // Use current syntax gradient on unprefixed property.
793
+ alphaSliderInner.css("background",
794
+ "linear-gradient(to right, " + realAlpha + ", " + realHex + ")");
795
+ }
796
+ }
797
+
798
+ displayColor = realColor.toString(format);
799
+ }
800
+
801
+ // Update the text entry input as it changes happen
802
+ if (opts.showInput) {
803
+ textInput.val(displayColor);
804
+ }
805
+
806
+ if (opts.showPalette) {
807
+ drawPalette();
808
+ }
809
+
810
+ drawInitial();
811
+ }
812
+
813
+ function updateHelperLocations() {
814
+ var s = currentSaturation;
815
+ var v = currentValue;
816
+
817
+ if(allowEmpty && isEmpty) {
818
+ //if selected color is empty, hide the helpers
819
+ alphaSlideHelper.hide();
820
+ slideHelper.hide();
821
+ dragHelper.hide();
822
+ }
823
+ else {
824
+ //make sure helpers are visible
825
+ alphaSlideHelper.show();
826
+ slideHelper.show();
827
+ dragHelper.show();
828
+
829
+ // Where to show the little circle in that displays your current selected color
830
+ var dragX = s * dragWidth;
831
+ var dragY = dragHeight - (v * dragHeight);
832
+ dragX = Math.max(
833
+ -dragHelperHeight,
834
+ Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight)
835
+ );
836
+ dragY = Math.max(
837
+ -dragHelperHeight,
838
+ Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight)
839
+ );
840
+ dragHelper.css({
841
+ "top": dragY + "px",
842
+ "left": dragX + "px"
843
+ });
844
+
845
+ var alphaX = currentAlpha * alphaWidth;
846
+ alphaSlideHelper.css({
847
+ "left": (alphaX - (alphaSlideHelperWidth / 2)) + "px"
848
+ });
849
+
850
+ // Where to show the bar that displays your current selected hue
851
+ var slideY = (currentHue) * slideHeight;
852
+ slideHelper.css({
853
+ "top": (slideY - slideHelperHeight) + "px"
854
+ });
855
+ }
856
+ }
857
+
858
+ function updateOriginalInput(fireCallback) {
859
+ var color = get(),
860
+ displayColor = '',
861
+ hasChanged = !tinycolor.equals(color, colorOnShow);
862
+
863
+ if (color) {
864
+ displayColor = color.toString(currentPreferredFormat);
865
+ // Update the selection palette with the current color
866
+ addColorToSelectionPalette(color);
867
+ }
868
+
869
+ if (isInput) {
870
+ boundElement.val(displayColor);
871
+ }
872
+
873
+ if (fireCallback && hasChanged) {
874
+ callbacks.change(color);
875
+ boundElement.trigger('change', [ color ]);
876
+ }
877
+ }
878
+
879
+ function reflow() {
880
+ if (!visible) {
881
+ return; // Calculations would be useless and wouldn't be reliable anyways
882
+ }
883
+ dragWidth = dragger.width();
884
+ dragHeight = dragger.height();
885
+ dragHelperHeight = dragHelper.height();
886
+ slideWidth = slider.width();
887
+ slideHeight = slider.height();
888
+ slideHelperHeight = slideHelper.height();
889
+ alphaWidth = alphaSlider.width();
890
+ alphaSlideHelperWidth = alphaSlideHelper.width();
891
+
892
+ if (!flat) {
893
+ container.css("position", "absolute");
894
+ if (opts.offset) {
895
+ container.offset(opts.offset);
896
+ } else {
897
+ container.offset(getOffset(container, offsetElement));
898
+ }
899
+ }
900
+
901
+ updateHelperLocations();
902
+
903
+ if (opts.showPalette) {
904
+ drawPalette();
905
+ }
906
+
907
+ boundElement.trigger('reflow.spectrum');
908
+ }
909
+
910
+ function destroy() {
911
+ boundElement.show();
912
+ offsetElement.unbind("click.spectrum touchstart.spectrum");
913
+ container.remove();
914
+ replacer.remove();
915
+ spectrums[spect.id] = null;
916
+ }
917
+
918
+ function option(optionName, optionValue) {
919
+ if (optionName === undefined) {
920
+ return $.extend({}, opts);
921
+ }
922
+ if (optionValue === undefined) {
923
+ return opts[optionName];
924
+ }
925
+
926
+ opts[optionName] = optionValue;
927
+
928
+ if (optionName === "preferredFormat") {
929
+ currentPreferredFormat = opts.preferredFormat;
930
+ }
931
+ applyOptions();
932
+ }
933
+
934
+ function enable() {
935
+ disabled = false;
936
+ boundElement.attr("disabled", false);
937
+ offsetElement.removeClass("sp-disabled");
938
+ }
939
+
940
+ function disable() {
941
+ hide();
942
+ disabled = true;
943
+ boundElement.attr("disabled", true);
944
+ offsetElement.addClass("sp-disabled");
945
+ }
946
+
947
+ function setOffset(coord) {
948
+ opts.offset = coord;
949
+ reflow();
950
+ }
951
+
952
+ initialize();
953
+
954
+ var spect = {
955
+ show: show,
956
+ hide: hide,
957
+ toggle: toggle,
958
+ reflow: reflow,
959
+ option: option,
960
+ enable: enable,
961
+ disable: disable,
962
+ offset: setOffset,
963
+ set: function (c) {
964
+ set(c);
965
+ updateOriginalInput();
966
+ },
967
+ get: get,
968
+ destroy: destroy,
969
+ container: container
970
+ };
971
+
972
+ spect.id = spectrums.push(spect) - 1;
973
+
974
+ return spect;
975
+ }
976
+
977
+ /**
978
+ * checkOffset - get the offset below/above and left/right element depending on screen position
979
+ * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js
980
+ */
981
+ function getOffset(picker, input) {
982
+ var extraY = 0;
983
+ var dpWidth = picker.outerWidth();
984
+ var dpHeight = picker.outerHeight();
985
+ var inputHeight = input.outerHeight();
986
+ var doc = picker[0].ownerDocument;
987
+ var docElem = doc.documentElement;
988
+ var viewWidth = docElem.clientWidth + $(doc).scrollLeft();
989
+ var viewHeight = docElem.clientHeight + $(doc).scrollTop();
990
+ var offset = input.offset();
991
+ offset.top += inputHeight;
992
+
993
+ offset.left -=
994
+ Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
995
+ Math.abs(offset.left + dpWidth - viewWidth) : 0);
996
+
997
+ offset.top -=
998
+ Math.min(offset.top, ((offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
999
+ Math.abs(dpHeight + inputHeight - extraY) : extraY));
1000
+
1001
+ return offset;
1002
+ }
1003
+
1004
+ /**
1005
+ * noop - do nothing
1006
+ */
1007
+ function noop() {
1008
+
1009
+ }
1010
+
1011
+ /**
1012
+ * stopPropagation - makes the code only doing this a little easier to read in line
1013
+ */
1014
+ function stopPropagation(e) {
1015
+ e.stopPropagation();
1016
+ }
1017
+
1018
+ /**
1019
+ * Create a function bound to a given object
1020
+ * Thanks to underscore.js
1021
+ */
1022
+ function bind(func, obj) {
1023
+ var slice = Array.prototype.slice;
1024
+ var args = slice.call(arguments, 2);
1025
+ return function () {
1026
+ return func.apply(obj, args.concat(slice.call(arguments)));
1027
+ };
1028
+ }
1029
+
1030
+ /**
1031
+ * Lightweight drag helper. Handles containment within the element, so that
1032
+ * when dragging, the x is within [0,element.width] and y is within [0,element.height]
1033
+ */
1034
+ function draggable(element, onmove, onstart, onstop) {
1035
+ onmove = onmove || function () { };
1036
+ onstart = onstart || function () { };
1037
+ onstop = onstop || function () { };
1038
+ var doc = document;
1039
+ var dragging = false;
1040
+ var offset = {};
1041
+ var maxHeight = 0;
1042
+ var maxWidth = 0;
1043
+ var hasTouch = ('ontouchstart' in window);
1044
+
1045
+ var duringDragEvents = {};
1046
+ duringDragEvents["selectstart"] = prevent;
1047
+ duringDragEvents["dragstart"] = prevent;
1048
+ duringDragEvents["touchmove mousemove"] = move;
1049
+ duringDragEvents["touchend mouseup"] = stop;
1050
+
1051
+ function prevent(e) {
1052
+ if (e.stopPropagation) {
1053
+ e.stopPropagation();
1054
+ }
1055
+ if (e.preventDefault) {
1056
+ e.preventDefault();
1057
+ }
1058
+ e.returnValue = false;
1059
+ }
1060
+
1061
+ function move(e) {
1062
+ if (dragging) {
1063
+ // Mouseup happened outside of window
1064
+ if (IE && doc.documentMode < 9 && !e.button) {
1065
+ return stop();
1066
+ }
1067
+
1068
+ var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];
1069
+ var pageX = t0 && t0.pageX || e.pageX;
1070
+ var pageY = t0 && t0.pageY || e.pageY;
1071
+
1072
+ var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));
1073
+ var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));
1074
+
1075
+ if (hasTouch) {
1076
+ // Stop scrolling in iOS
1077
+ prevent(e);
1078
+ }
1079
+
1080
+ onmove.apply(element, [dragX, dragY, e]);
1081
+ }
1082
+ }
1083
+
1084
+ function start(e) {
1085
+ var rightclick = (e.which) ? (e.which == 3) : (e.button == 2);
1086
+
1087
+ if (!rightclick && !dragging) {
1088
+ if (onstart.apply(element, arguments) !== false) {
1089
+ dragging = true;
1090
+ maxHeight = $(element).height();
1091
+ maxWidth = $(element).width();
1092
+ offset = $(element).offset();
1093
+
1094
+ $(doc).bind(duringDragEvents);
1095
+ $(doc.body).addClass("sp-dragging");
1096
+
1097
+ move(e);
1098
+
1099
+ prevent(e);
1100
+ }
1101
+ }
1102
+ }
1103
+
1104
+ function stop() {
1105
+ if (dragging) {
1106
+ $(doc).unbind(duringDragEvents);
1107
+ $(doc.body).removeClass("sp-dragging");
1108
+
1109
+ // Wait a tick before notifying observers to allow the click event
1110
+ // to fire in Chrome.
1111
+ setTimeout(function() {
1112
+ onstop.apply(element, arguments);
1113
+ }, 0);
1114
+ }
1115
+ dragging = false;
1116
+ }
1117
+
1118
+ $(element).bind("touchstart mousedown", start);
1119
+ }
1120
+
1121
+ function throttle(func, wait, debounce) {
1122
+ var timeout;
1123
+ return function () {
1124
+ var context = this, args = arguments;
1125
+ var throttler = function () {
1126
+ timeout = null;
1127
+ func.apply(context, args);
1128
+ };
1129
+ if (debounce) clearTimeout(timeout);
1130
+ if (debounce || !timeout) timeout = setTimeout(throttler, wait);
1131
+ };
1132
+ }
1133
+
1134
+ function inputTypeColorSupport() {
1135
+ return $.fn.spectrum.inputTypeColorSupport();
1136
+ }
1137
+
1138
+ /**
1139
+ * Define a jQuery plugin
1140
+ */
1141
+ var dataID = "spectrum.id";
1142
+ $.fn.spectrum = function (opts, extra) {
1143
+
1144
+ if (typeof opts == "string") {
1145
+
1146
+ var returnValue = this;
1147
+ var args = Array.prototype.slice.call( arguments, 1 );
1148
+
1149
+ this.each(function () {
1150
+ var spect = spectrums[$(this).data(dataID)];
1151
+ if (spect) {
1152
+ var method = spect[opts];
1153
+ if (!method) {
1154
+ throw new Error( "Spectrum: no such method: '" + opts + "'" );
1155
+ }
1156
+
1157
+ if (opts == "get") {
1158
+ returnValue = spect.get();
1159
+ }
1160
+ else if (opts == "container") {
1161
+ returnValue = spect.container;
1162
+ }
1163
+ else if (opts == "option") {
1164
+ returnValue = spect.option.apply(spect, args);
1165
+ }
1166
+ else if (opts == "destroy") {
1167
+ spect.destroy();
1168
+ $(this).removeData(dataID);
1169
+ }
1170
+ else {
1171
+ method.apply(spect, args);
1172
+ }
1173
+ }
1174
+ });
1175
+
1176
+ return returnValue;
1177
+ }
1178
+
1179
+ // Initializing a new instance of spectrum
1180
+ return this.spectrum("destroy").each(function () {
1181
+ var options = $.extend({}, opts, $(this).data());
1182
+ var spect = spectrum(this, options);
1183
+ $(this).data(dataID, spect.id);
1184
+ });
1185
+ };
1186
+
1187
+ $.fn.spectrum.load = true;
1188
+ $.fn.spectrum.loadOpts = {};
1189
+ $.fn.spectrum.draggable = draggable;
1190
+ $.fn.spectrum.defaults = defaultOpts;
1191
+ $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {
1192
+ if (typeof inputTypeColorSupport._cachedResult === "undefined") {
1193
+ var colorInput = $("<input type='color'/>")[0]; // if color element is supported, value will default to not null
1194
+ inputTypeColorSupport._cachedResult = colorInput.type === "color" && colorInput.value !== "";
1195
+ }
1196
+ return inputTypeColorSupport._cachedResult;
1197
+ };
1198
+
1199
+ $.spectrum = { };
1200
+ $.spectrum.localization = { };
1201
+ $.spectrum.palettes = { };
1202
+
1203
+ $.fn.spectrum.processNativeColorInputs = function () {
1204
+ var colorInputs = $("input[type=color]");
1205
+ if (colorInputs.length && !inputTypeColorSupport()) {
1206
+ colorInputs.spectrum({
1207
+ preferredFormat: "hex6"
1208
+ });
1209
+ }
1210
+ };
1211
+
1212
+ // TinyColor v1.1.2
1213
+ // https://github.com/bgrins/TinyColor
1214
+ // Brian Grinstead, MIT License
1215
+
1216
+ (function() {
1217
+
1218
+ var trimLeft = /^[\s,#]+/,
1219
+ trimRight = /\s+$/,
1220
+ tinyCounter = 0,
1221
+ math = Math,
1222
+ mathRound = math.round,
1223
+ mathMin = math.min,
1224
+ mathMax = math.max,
1225
+ mathRandom = math.random;
1226
+
1227
+ var tinycolor = function(color, opts) {
1228
+
1229
+ color = (color) ? color : '';
1230
+ opts = opts || { };
1231
+
1232
+ // If input is already a tinycolor, return itself
1233
+ if (color instanceof tinycolor) {
1234
+ return color;
1235
+ }
1236
+ // If we are called as a function, call using new instead
1237
+ if (!(this instanceof tinycolor)) {
1238
+ return new tinycolor(color, opts);
1239
+ }
1240
+
1241
+ var rgb = inputToRGB(color);
1242
+ this._originalInput = color,
1243
+ this._r = rgb.r,
1244
+ this._g = rgb.g,
1245
+ this._b = rgb.b,
1246
+ this._a = rgb.a,
1247
+ this._roundA = mathRound(100*this._a) / 100,
1248
+ this._format = opts.format || rgb.format;
1249
+ this._gradientType = opts.gradientType;
1250
+
1251
+ // Don't let the range of [0,255] come back in [0,1].
1252
+ // Potentially lose a little bit of precision here, but will fix issues where
1253
+ // .5 gets interpreted as half of the total, instead of half of 1
1254
+ // If it was supposed to be 128, this was already taken care of by `inputToRgb`
1255
+ if (this._r < 1) { this._r = mathRound(this._r); }
1256
+ if (this._g < 1) { this._g = mathRound(this._g); }
1257
+ if (this._b < 1) { this._b = mathRound(this._b); }
1258
+
1259
+ this._ok = rgb.ok;
1260
+ this._tc_id = tinyCounter++;
1261
+ };
1262
+
1263
+ tinycolor.prototype = {
1264
+ isDark: function() {
1265
+ return this.getBrightness() < 128;
1266
+ },
1267
+ isLight: function() {
1268
+ return !this.isDark();
1269
+ },
1270
+ isValid: function() {
1271
+ return this._ok;
1272
+ },
1273
+ getOriginalInput: function() {
1274
+ return this._originalInput;
1275
+ },
1276
+ getFormat: function() {
1277
+ return this._format;
1278
+ },
1279
+ getAlpha: function() {
1280
+ return this._a;
1281
+ },
1282
+ getBrightness: function() {
1283
+ var rgb = this.toRgb();
1284
+ return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
1285
+ },
1286
+ setAlpha: function(value) {
1287
+ this._a = boundAlpha(value);
1288
+ this._roundA = mathRound(100*this._a) / 100;
1289
+ return this;
1290
+ },
1291
+ toHsv: function() {
1292
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1293
+ return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
1294
+ },
1295
+ toHsvString: function() {
1296
+ var hsv = rgbToHsv(this._r, this._g, this._b);
1297
+ var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
1298
+ return (this._a == 1) ?
1299
+ "hsv(" + h + ", " + s + "%, " + v + "%)" :
1300
+ "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
1301
+ },
1302
+ toHsl: function() {
1303
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1304
+ return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
1305
+ },
1306
+ toHslString: function() {
1307
+ var hsl = rgbToHsl(this._r, this._g, this._b);
1308
+ var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
1309
+ return (this._a == 1) ?
1310
+ "hsl(" + h + ", " + s + "%, " + l + "%)" :
1311
+ "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
1312
+ },
1313
+ toHex: function(allow3Char) {
1314
+ return rgbToHex(this._r, this._g, this._b, allow3Char);
1315
+ },
1316
+ toHexString: function(allow3Char) {
1317
+ return '#' + this.toHex(allow3Char);
1318
+ },
1319
+ toHex8: function() {
1320
+ return rgbaToHex(this._r, this._g, this._b, this._a);
1321
+ },
1322
+ toHex8String: function() {
1323
+ return '#' + this.toHex8();
1324
+ },
1325
+ toRgb: function() {
1326
+ return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
1327
+ },
1328
+ toRgbString: function() {
1329
+ return (this._a == 1) ?
1330
+ "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
1331
+ "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
1332
+ },
1333
+ toPercentageRgb: function() {
1334
+ return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
1335
+ },
1336
+ toPercentageRgbString: function() {
1337
+ return (this._a == 1) ?
1338
+ "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
1339
+ "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
1340
+ },
1341
+ toName: function() {
1342
+ if (this._a === 0) {
1343
+ return "transparent";
1344
+ }
1345
+
1346
+ if (this._a < 1) {
1347
+ return false;
1348
+ }
1349
+
1350
+ return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
1351
+ },
1352
+ toFilter: function(secondColor) {
1353
+ var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);
1354
+ var secondHex8String = hex8String;
1355
+ var gradientType = this._gradientType ? "GradientType = 1, " : "";
1356
+
1357
+ if (secondColor) {
1358
+ var s = tinycolor(secondColor);
1359
+ secondHex8String = s.toHex8String();
1360
+ }
1361
+
1362
+ return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
1363
+ },
1364
+ toString: function(format) {
1365
+ var formatSet = !!format;
1366
+ format = format || this._format;
1367
+
1368
+ var formattedString = false;
1369
+ var hasAlpha = this._a < 1 && this._a >= 0;
1370
+ var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "name");
1371
+
1372
+ if (needsAlphaFormat) {
1373
+ // Special case for "transparent", all other non-alpha formats
1374
+ // will return rgba when there is transparency.
1375
+ if (format === "name" && this._a === 0) {
1376
+ return this.toName();
1377
+ }
1378
+ return this.toRgbString();
1379
+ }
1380
+ if (format === "rgb") {
1381
+ formattedString = this.toRgbString();
1382
+ }
1383
+ if (format === "prgb") {
1384
+ formattedString = this.toPercentageRgbString();
1385
+ }
1386
+ if (format === "hex" || format === "hex6") {
1387
+ formattedString = this.toHexString();
1388
+ }
1389
+ if (format === "hex3") {
1390
+ formattedString = this.toHexString(true);
1391
+ }
1392
+ if (format === "hex8") {
1393
+ formattedString = this.toHex8String();
1394
+ }
1395
+ if (format === "name") {
1396
+ formattedString = this.toName();
1397
+ }
1398
+ if (format === "hsl") {
1399
+ formattedString = this.toHslString();
1400
+ }
1401
+ if (format === "hsv") {
1402
+ formattedString = this.toHsvString();
1403
+ }
1404
+
1405
+ return formattedString || this.toHexString();
1406
+ },
1407
+
1408
+ _applyModification: function(fn, args) {
1409
+ var color = fn.apply(null, [this].concat([].slice.call(args)));
1410
+ this._r = color._r;
1411
+ this._g = color._g;
1412
+ this._b = color._b;
1413
+ this.setAlpha(color._a);
1414
+ return this;
1415
+ },
1416
+ lighten: function() {
1417
+ return this._applyModification(lighten, arguments);
1418
+ },
1419
+ brighten: function() {
1420
+ return this._applyModification(brighten, arguments);
1421
+ },
1422
+ darken: function() {
1423
+ return this._applyModification(darken, arguments);
1424
+ },
1425
+ desaturate: function() {
1426
+ return this._applyModification(desaturate, arguments);
1427
+ },
1428
+ saturate: function() {
1429
+ return this._applyModification(saturate, arguments);
1430
+ },
1431
+ greyscale: function() {
1432
+ return this._applyModification(greyscale, arguments);
1433
+ },
1434
+ spin: function() {
1435
+ return this._applyModification(spin, arguments);
1436
+ },
1437
+
1438
+ _applyCombination: function(fn, args) {
1439
+ return fn.apply(null, [this].concat([].slice.call(args)));
1440
+ },
1441
+ analogous: function() {
1442
+ return this._applyCombination(analogous, arguments);
1443
+ },
1444
+ complement: function() {
1445
+ return this._applyCombination(complement, arguments);
1446
+ },
1447
+ monochromatic: function() {
1448
+ return this._applyCombination(monochromatic, arguments);
1449
+ },
1450
+ splitcomplement: function() {
1451
+ return this._applyCombination(splitcomplement, arguments);
1452
+ },
1453
+ triad: function() {
1454
+ return this._applyCombination(triad, arguments);
1455
+ },
1456
+ tetrad: function() {
1457
+ return this._applyCombination(tetrad, arguments);
1458
+ }
1459
+ };
1460
+
1461
+ // If input is an object, force 1 into "1.0" to handle ratios properly
1462
+ // String input requires "1.0" as input, so 1 will be treated as 1
1463
+ tinycolor.fromRatio = function(color, opts) {
1464
+ if (typeof color == "object") {
1465
+ var newColor = {};
1466
+ for (var i in color) {
1467
+ if (color.hasOwnProperty(i)) {
1468
+ if (i === "a") {
1469
+ newColor[i] = color[i];
1470
+ }
1471
+ else {
1472
+ newColor[i] = convertToPercentage(color[i]);
1473
+ }
1474
+ }
1475
+ }
1476
+ color = newColor;
1477
+ }
1478
+
1479
+ return tinycolor(color, opts);
1480
+ };
1481
+
1482
+ // Given a string or object, convert that input to RGB
1483
+ // Possible string inputs:
1484
+ //
1485
+ // "red"
1486
+ // "#f00" or "f00"
1487
+ // "#ff0000" or "ff0000"
1488
+ // "#ff000000" or "ff000000"
1489
+ // "rgb 255 0 0" or "rgb (255, 0, 0)"
1490
+ // "rgb 1.0 0 0" or "rgb (1, 0, 0)"
1491
+ // "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
1492
+ // "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
1493
+ // "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
1494
+ // "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
1495
+ // "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
1496
+ //
1497
+ function inputToRGB(color) {
1498
+
1499
+ var rgb = { r: 0, g: 0, b: 0 };
1500
+ var a = 1;
1501
+ var ok = false;
1502
+ var format = false;
1503
+
1504
+ if (typeof color == "string") {
1505
+ color = stringInputToObject(color);
1506
+ }
1507
+
1508
+ if (typeof color == "object") {
1509
+ if (color.hasOwnProperty("r") && color.hasOwnProperty("g") && color.hasOwnProperty("b")) {
1510
+ rgb = rgbToRgb(color.r, color.g, color.b);
1511
+ ok = true;
1512
+ format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
1513
+ }
1514
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("v")) {
1515
+ color.s = convertToPercentage(color.s);
1516
+ color.v = convertToPercentage(color.v);
1517
+ rgb = hsvToRgb(color.h, color.s, color.v);
1518
+ ok = true;
1519
+ format = "hsv";
1520
+ }
1521
+ else if (color.hasOwnProperty("h") && color.hasOwnProperty("s") && color.hasOwnProperty("l")) {
1522
+ color.s = convertToPercentage(color.s);
1523
+ color.l = convertToPercentage(color.l);
1524
+ rgb = hslToRgb(color.h, color.s, color.l);
1525
+ ok = true;
1526
+ format = "hsl";
1527
+ }
1528
+
1529
+ if (color.hasOwnProperty("a")) {
1530
+ a = color.a;
1531
+ }
1532
+ }
1533
+
1534
+ a = boundAlpha(a);
1535
+
1536
+ return {
1537
+ ok: ok,
1538
+ format: color.format || format,
1539
+ r: mathMin(255, mathMax(rgb.r, 0)),
1540
+ g: mathMin(255, mathMax(rgb.g, 0)),
1541
+ b: mathMin(255, mathMax(rgb.b, 0)),
1542
+ a: a
1543
+ };
1544
+ }
1545
+
1546
+
1547
+ // Conversion Functions
1548
+ // --------------------
1549
+
1550
+ // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
1551
+ // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
1552
+
1553
+ // `rgbToRgb`
1554
+ // Handle bounds / percentage checking to conform to CSS color spec
1555
+ // <http://www.w3.org/TR/css3-color/>
1556
+ // *Assumes:* r, g, b in [0, 255] or [0, 1]
1557
+ // *Returns:* { r, g, b } in [0, 255]
1558
+ function rgbToRgb(r, g, b){
1559
+ return {
1560
+ r: bound01(r, 255) * 255,
1561
+ g: bound01(g, 255) * 255,
1562
+ b: bound01(b, 255) * 255
1563
+ };
1564
+ }
1565
+
1566
+ // `rgbToHsl`
1567
+ // Converts an RGB color value to HSL.
1568
+ // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
1569
+ // *Returns:* { h, s, l } in [0,1]
1570
+ function rgbToHsl(r, g, b) {
1571
+
1572
+ r = bound01(r, 255);
1573
+ g = bound01(g, 255);
1574
+ b = bound01(b, 255);
1575
+
1576
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1577
+ var h, s, l = (max + min) / 2;
1578
+
1579
+ if(max == min) {
1580
+ h = s = 0; // achromatic
1581
+ }
1582
+ else {
1583
+ var d = max - min;
1584
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
1585
+ switch(max) {
1586
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1587
+ case g: h = (b - r) / d + 2; break;
1588
+ case b: h = (r - g) / d + 4; break;
1589
+ }
1590
+
1591
+ h /= 6;
1592
+ }
1593
+
1594
+ return { h: h, s: s, l: l };
1595
+ }
1596
+
1597
+ // `hslToRgb`
1598
+ // Converts an HSL color value to RGB.
1599
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
1600
+ // *Returns:* { r, g, b } in the set [0, 255]
1601
+ function hslToRgb(h, s, l) {
1602
+ var r, g, b;
1603
+
1604
+ h = bound01(h, 360);
1605
+ s = bound01(s, 100);
1606
+ l = bound01(l, 100);
1607
+
1608
+ function hue2rgb(p, q, t) {
1609
+ if(t < 0) t += 1;
1610
+ if(t > 1) t -= 1;
1611
+ if(t < 1/6) return p + (q - p) * 6 * t;
1612
+ if(t < 1/2) return q;
1613
+ if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
1614
+ return p;
1615
+ }
1616
+
1617
+ if(s === 0) {
1618
+ r = g = b = l; // achromatic
1619
+ }
1620
+ else {
1621
+ var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
1622
+ var p = 2 * l - q;
1623
+ r = hue2rgb(p, q, h + 1/3);
1624
+ g = hue2rgb(p, q, h);
1625
+ b = hue2rgb(p, q, h - 1/3);
1626
+ }
1627
+
1628
+ return { r: r * 255, g: g * 255, b: b * 255 };
1629
+ }
1630
+
1631
+ // `rgbToHsv`
1632
+ // Converts an RGB color value to HSV
1633
+ // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
1634
+ // *Returns:* { h, s, v } in [0,1]
1635
+ function rgbToHsv(r, g, b) {
1636
+
1637
+ r = bound01(r, 255);
1638
+ g = bound01(g, 255);
1639
+ b = bound01(b, 255);
1640
+
1641
+ var max = mathMax(r, g, b), min = mathMin(r, g, b);
1642
+ var h, s, v = max;
1643
+
1644
+ var d = max - min;
1645
+ s = max === 0 ? 0 : d / max;
1646
+
1647
+ if(max == min) {
1648
+ h = 0; // achromatic
1649
+ }
1650
+ else {
1651
+ switch(max) {
1652
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
1653
+ case g: h = (b - r) / d + 2; break;
1654
+ case b: h = (r - g) / d + 4; break;
1655
+ }
1656
+ h /= 6;
1657
+ }
1658
+ return { h: h, s: s, v: v };
1659
+ }
1660
+
1661
+ // `hsvToRgb`
1662
+ // Converts an HSV color value to RGB.
1663
+ // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
1664
+ // *Returns:* { r, g, b } in the set [0, 255]
1665
+ function hsvToRgb(h, s, v) {
1666
+
1667
+ h = bound01(h, 360) * 6;
1668
+ s = bound01(s, 100);
1669
+ v = bound01(v, 100);
1670
+
1671
+ var i = math.floor(h),
1672
+ f = h - i,
1673
+ p = v * (1 - s),
1674
+ q = v * (1 - f * s),
1675
+ t = v * (1 - (1 - f) * s),
1676
+ mod = i % 6,
1677
+ r = [v, q, p, p, t, v][mod],
1678
+ g = [t, v, v, q, p, p][mod],
1679
+ b = [p, p, t, v, v, q][mod];
1680
+
1681
+ return { r: r * 255, g: g * 255, b: b * 255 };
1682
+ }
1683
+
1684
+ // `rgbToHex`
1685
+ // Converts an RGB color to hex
1686
+ // Assumes r, g, and b are contained in the set [0, 255]
1687
+ // Returns a 3 or 6 character hex
1688
+ function rgbToHex(r, g, b, allow3Char) {
1689
+
1690
+ var hex = [
1691
+ pad2(mathRound(r).toString(16)),
1692
+ pad2(mathRound(g).toString(16)),
1693
+ pad2(mathRound(b).toString(16))
1694
+ ];
1695
+
1696
+ // Return a 3 character hex if possible
1697
+ if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
1698
+ return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
1699
+ }
1700
+
1701
+ return hex.join("");
1702
+ }
1703
+ // `rgbaToHex`
1704
+ // Converts an RGBA color plus alpha transparency to hex
1705
+ // Assumes r, g, b and a are contained in the set [0, 255]
1706
+ // Returns an 8 character hex
1707
+ function rgbaToHex(r, g, b, a) {
1708
+
1709
+ var hex = [
1710
+ pad2(convertDecimalToHex(a)),
1711
+ pad2(mathRound(r).toString(16)),
1712
+ pad2(mathRound(g).toString(16)),
1713
+ pad2(mathRound(b).toString(16))
1714
+ ];
1715
+
1716
+ return hex.join("");
1717
+ }
1718
+
1719
+ // `equals`
1720
+ // Can be called with any tinycolor input
1721
+ tinycolor.equals = function (color1, color2) {
1722
+ if (!color1 || !color2) { return false; }
1723
+ return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
1724
+ };
1725
+ tinycolor.random = function() {
1726
+ return tinycolor.fromRatio({
1727
+ r: mathRandom(),
1728
+ g: mathRandom(),
1729
+ b: mathRandom()
1730
+ });
1731
+ };
1732
+
1733
+
1734
+ // Modification Functions
1735
+ // ----------------------
1736
+ // Thanks to less.js for some of the basics here
1737
+ // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
1738
+
1739
+ function desaturate(color, amount) {
1740
+ amount = (amount === 0) ? 0 : (amount || 10);
1741
+ var hsl = tinycolor(color).toHsl();
1742
+ hsl.s -= amount / 100;
1743
+ hsl.s = clamp01(hsl.s);
1744
+ return tinycolor(hsl);
1745
+ }
1746
+
1747
+ function saturate(color, amount) {
1748
+ amount = (amount === 0) ? 0 : (amount || 10);
1749
+ var hsl = tinycolor(color).toHsl();
1750
+ hsl.s += amount / 100;
1751
+ hsl.s = clamp01(hsl.s);
1752
+ return tinycolor(hsl);
1753
+ }
1754
+
1755
+ function greyscale(color) {
1756
+ return tinycolor(color).desaturate(100);
1757
+ }
1758
+
1759
+ function lighten (color, amount) {
1760
+ amount = (amount === 0) ? 0 : (amount || 10);
1761
+ var hsl = tinycolor(color).toHsl();
1762
+ hsl.l += amount / 100;
1763
+ hsl.l = clamp01(hsl.l);
1764
+ return tinycolor(hsl);
1765
+ }
1766
+
1767
+ function brighten(color, amount) {
1768
+ amount = (amount === 0) ? 0 : (amount || 10);
1769
+ var rgb = tinycolor(color).toRgb();
1770
+ rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
1771
+ rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
1772
+ rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
1773
+ return tinycolor(rgb);
1774
+ }
1775
+
1776
+ function darken (color, amount) {
1777
+ amount = (amount === 0) ? 0 : (amount || 10);
1778
+ var hsl = tinycolor(color).toHsl();
1779
+ hsl.l -= amount / 100;
1780
+ hsl.l = clamp01(hsl.l);
1781
+ return tinycolor(hsl);
1782
+ }
1783
+
1784
+ // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
1785
+ // Values outside of this range will be wrapped into this range.
1786
+ function spin(color, amount) {
1787
+ var hsl = tinycolor(color).toHsl();
1788
+ var hue = (mathRound(hsl.h) + amount) % 360;
1789
+ hsl.h = hue < 0 ? 360 + hue : hue;
1790
+ return tinycolor(hsl);
1791
+ }
1792
+
1793
+ // Combination Functions
1794
+ // ---------------------
1795
+ // Thanks to jQuery xColor for some of the ideas behind these
1796
+ // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
1797
+
1798
+ function complement(color) {
1799
+ var hsl = tinycolor(color).toHsl();
1800
+ hsl.h = (hsl.h + 180) % 360;
1801
+ return tinycolor(hsl);
1802
+ }
1803
+
1804
+ function triad(color) {
1805
+ var hsl = tinycolor(color).toHsl();
1806
+ var h = hsl.h;
1807
+ return [
1808
+ tinycolor(color),
1809
+ tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
1810
+ tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
1811
+ ];
1812
+ }
1813
+
1814
+ function tetrad(color) {
1815
+ var hsl = tinycolor(color).toHsl();
1816
+ var h = hsl.h;
1817
+ return [
1818
+ tinycolor(color),
1819
+ tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
1820
+ tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
1821
+ tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
1822
+ ];
1823
+ }
1824
+
1825
+ function splitcomplement(color) {
1826
+ var hsl = tinycolor(color).toHsl();
1827
+ var h = hsl.h;
1828
+ return [
1829
+ tinycolor(color),
1830
+ tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
1831
+ tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
1832
+ ];
1833
+ }
1834
+
1835
+ function analogous(color, results, slices) {
1836
+ results = results || 6;
1837
+ slices = slices || 30;
1838
+
1839
+ var hsl = tinycolor(color).toHsl();
1840
+ var part = 360 / slices;
1841
+ var ret = [tinycolor(color)];
1842
+
1843
+ for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
1844
+ hsl.h = (hsl.h + part) % 360;
1845
+ ret.push(tinycolor(hsl));
1846
+ }
1847
+ return ret;
1848
+ }
1849
+
1850
+ function monochromatic(color, results) {
1851
+ results = results || 6;
1852
+ var hsv = tinycolor(color).toHsv();
1853
+ var h = hsv.h, s = hsv.s, v = hsv.v;
1854
+ var ret = [];
1855
+ var modification = 1 / results;
1856
+
1857
+ while (results--) {
1858
+ ret.push(tinycolor({ h: h, s: s, v: v}));
1859
+ v = (v + modification) % 1;
1860
+ }
1861
+
1862
+ return ret;
1863
+ }
1864
+
1865
+ // Utility Functions
1866
+ // ---------------------
1867
+
1868
+ tinycolor.mix = function(color1, color2, amount) {
1869
+ amount = (amount === 0) ? 0 : (amount || 50);
1870
+
1871
+ var rgb1 = tinycolor(color1).toRgb();
1872
+ var rgb2 = tinycolor(color2).toRgb();
1873
+
1874
+ var p = amount / 100;
1875
+ var w = p * 2 - 1;
1876
+ var a = rgb2.a - rgb1.a;
1877
+
1878
+ var w1;
1879
+
1880
+ if (w * a == -1) {
1881
+ w1 = w;
1882
+ } else {
1883
+ w1 = (w + a) / (1 + w * a);
1884
+ }
1885
+
1886
+ w1 = (w1 + 1) / 2;
1887
+
1888
+ var w2 = 1 - w1;
1889
+
1890
+ var rgba = {
1891
+ r: rgb2.r * w1 + rgb1.r * w2,
1892
+ g: rgb2.g * w1 + rgb1.g * w2,
1893
+ b: rgb2.b * w1 + rgb1.b * w2,
1894
+ a: rgb2.a * p + rgb1.a * (1 - p)
1895
+ };
1896
+
1897
+ return tinycolor(rgba);
1898
+ };
1899
+
1900
+
1901
+ // Readability Functions
1902
+ // ---------------------
1903
+ // <http://www.w3.org/TR/AERT#color-contrast>
1904
+
1905
+ // `readability`
1906
+ // Analyze the 2 colors and returns an object with the following properties:
1907
+ // `brightness`: difference in brightness between the two colors
1908
+ // `color`: difference in color/hue between the two colors
1909
+ tinycolor.readability = function(color1, color2) {
1910
+ var c1 = tinycolor(color1);
1911
+ var c2 = tinycolor(color2);
1912
+ var rgb1 = c1.toRgb();
1913
+ var rgb2 = c2.toRgb();
1914
+ var brightnessA = c1.getBrightness();
1915
+ var brightnessB = c2.getBrightness();
1916
+ var colorDiff = (
1917
+ Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) +
1918
+ Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) +
1919
+ Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b)
1920
+ );
1921
+
1922
+ return {
1923
+ brightness: Math.abs(brightnessA - brightnessB),
1924
+ color: colorDiff
1925
+ };
1926
+ };
1927
+
1928
+ // `readable`
1929
+ // http://www.w3.org/TR/AERT#color-contrast
1930
+ // Ensure that foreground and background color combinations provide sufficient contrast.
1931
+ // *Example*
1932
+ // tinycolor.isReadable("#000", "#111") => false
1933
+ tinycolor.isReadable = function(color1, color2) {
1934
+ var readability = tinycolor.readability(color1, color2);
1935
+ return readability.brightness > 125 && readability.color > 500;
1936
+ };
1937
+
1938
+ // `mostReadable`
1939
+ // Given a base color and a list of possible foreground or background
1940
+ // colors for that base, returns the most readable color.
1941
+ // *Example*
1942
+ // tinycolor.mostReadable("#123", ["#fff", "#000"]) => "#000"
1943
+ tinycolor.mostReadable = function(baseColor, colorList) {
1944
+ var bestColor = null;
1945
+ var bestScore = 0;
1946
+ var bestIsReadable = false;
1947
+ for (var i=0; i < colorList.length; i++) {
1948
+
1949
+ // We normalize both around the "acceptable" breaking point,
1950
+ // but rank brightness constrast higher than hue.
1951
+
1952
+ var readability = tinycolor.readability(baseColor, colorList[i]);
1953
+ var readable = readability.brightness > 125 && readability.color > 500;
1954
+ var score = 3 * (readability.brightness / 125) + (readability.color / 500);
1955
+
1956
+ if ((readable && ! bestIsReadable) ||
1957
+ (readable && bestIsReadable && score > bestScore) ||
1958
+ ((! readable) && (! bestIsReadable) && score > bestScore)) {
1959
+ bestIsReadable = readable;
1960
+ bestScore = score;
1961
+ bestColor = tinycolor(colorList[i]);
1962
+ }
1963
+ }
1964
+ return bestColor;
1965
+ };
1966
+
1967
+
1968
+ // Big List of Colors
1969
+ // ------------------
1970
+ // <http://www.w3.org/TR/css3-color/#svg-color>
1971
+ var names = tinycolor.names = {
1972
+ aliceblue: "f0f8ff",
1973
+ antiquewhite: "faebd7",
1974
+ aqua: "0ff",
1975
+ aquamarine: "7fffd4",
1976
+ azure: "f0ffff",
1977
+ beige: "f5f5dc",
1978
+ bisque: "ffe4c4",
1979
+ black: "000",
1980
+ blanchedalmond: "ffebcd",
1981
+ blue: "00f",
1982
+ blueviolet: "8a2be2",
1983
+ brown: "a52a2a",
1984
+ burlywood: "deb887",
1985
+ burntsienna: "ea7e5d",
1986
+ cadetblue: "5f9ea0",
1987
+ chartreuse: "7fff00",
1988
+ chocolate: "d2691e",
1989
+ coral: "ff7f50",
1990
+ cornflowerblue: "6495ed",
1991
+ cornsilk: "fff8dc",
1992
+ crimson: "dc143c",
1993
+ cyan: "0ff",
1994
+ darkblue: "00008b",
1995
+ darkcyan: "008b8b",
1996
+ darkgoldenrod: "b8860b",
1997
+ darkgray: "a9a9a9",
1998
+ darkgreen: "006400",
1999
+ darkgrey: "a9a9a9",
2000
+ darkkhaki: "bdb76b",
2001
+ darkmagenta: "8b008b",
2002
+ darkolivegreen: "556b2f",
2003
+ darkorange: "ff8c00",
2004
+ darkorchid: "9932cc",
2005
+ darkred: "8b0000",
2006
+ darksalmon: "e9967a",
2007
+ darkseagreen: "8fbc8f",
2008
+ darkslateblue: "483d8b",
2009
+ darkslategray: "2f4f4f",
2010
+ darkslategrey: "2f4f4f",
2011
+ darkturquoise: "00ced1",
2012
+ darkviolet: "9400d3",
2013
+ deeppink: "ff1493",
2014
+ deepskyblue: "00bfff",
2015
+ dimgray: "696969",
2016
+ dimgrey: "696969",
2017
+ dodgerblue: "1e90ff",
2018
+ firebrick: "b22222",
2019
+ floralwhite: "fffaf0",
2020
+ forestgreen: "228b22",
2021
+ fuchsia: "f0f",
2022
+ gainsboro: "dcdcdc",
2023
+ ghostwhite: "f8f8ff",
2024
+ gold: "ffd700",
2025
+ goldenrod: "daa520",
2026
+ gray: "808080",
2027
+ green: "008000",
2028
+ greenyellow: "adff2f",
2029
+ grey: "808080",
2030
+ honeydew: "f0fff0",
2031
+ hotpink: "ff69b4",
2032
+ indianred: "cd5c5c",
2033
+ indigo: "4b0082",
2034
+ ivory: "fffff0",
2035
+ khaki: "f0e68c",
2036
+ lavender: "e6e6fa",
2037
+ lavenderblush: "fff0f5",
2038
+ lawngreen: "7cfc00",
2039
+ lemonchiffon: "fffacd",
2040
+ lightblue: "add8e6",
2041
+ lightcoral: "f08080",
2042
+ lightcyan: "e0ffff",
2043
+ lightgoldenrodyellow: "fafad2",
2044
+ lightgray: "d3d3d3",
2045
+ lightgreen: "90ee90",
2046
+ lightgrey: "d3d3d3",
2047
+ lightpink: "ffb6c1",
2048
+ lightsalmon: "ffa07a",
2049
+ lightseagreen: "20b2aa",
2050
+ lightskyblue: "87cefa",
2051
+ lightslategray: "789",
2052
+ lightslategrey: "789",
2053
+ lightsteelblue: "b0c4de",
2054
+ lightyellow: "ffffe0",
2055
+ lime: "0f0",
2056
+ limegreen: "32cd32",
2057
+ linen: "faf0e6",
2058
+ magenta: "f0f",
2059
+ maroon: "800000",
2060
+ mediumaquamarine: "66cdaa",
2061
+ mediumblue: "0000cd",
2062
+ mediumorchid: "ba55d3",
2063
+ mediumpurple: "9370db",
2064
+ mediumseagreen: "3cb371",
2065
+ mediumslateblue: "7b68ee",
2066
+ mediumspringgreen: "00fa9a",
2067
+ mediumturquoise: "48d1cc",
2068
+ mediumvioletred: "c71585",
2069
+ midnightblue: "191970",
2070
+ mintcream: "f5fffa",
2071
+ mistyrose: "ffe4e1",
2072
+ moccasin: "ffe4b5",
2073
+ navajowhite: "ffdead",
2074
+ navy: "000080",
2075
+ oldlace: "fdf5e6",
2076
+ olive: "808000",
2077
+ olivedrab: "6b8e23",
2078
+ orange: "ffa500",
2079
+ orangered: "ff4500",
2080
+ orchid: "da70d6",
2081
+ palegoldenrod: "eee8aa",
2082
+ palegreen: "98fb98",
2083
+ paleturquoise: "afeeee",
2084
+ palevioletred: "db7093",
2085
+ papayawhip: "ffefd5",
2086
+ peachpuff: "ffdab9",
2087
+ peru: "cd853f",
2088
+ pink: "ffc0cb",
2089
+ plum: "dda0dd",
2090
+ powderblue: "b0e0e6",
2091
+ purple: "800080",
2092
+ rebeccapurple: "663399",
2093
+ red: "f00",
2094
+ rosybrown: "bc8f8f",
2095
+ royalblue: "4169e1",
2096
+ saddlebrown: "8b4513",
2097
+ salmon: "fa8072",
2098
+ sandybrown: "f4a460",
2099
+ seagreen: "2e8b57",
2100
+ seashell: "fff5ee",
2101
+ sienna: "a0522d",
2102
+ silver: "c0c0c0",
2103
+ skyblue: "87ceeb",
2104
+ slateblue: "6a5acd",
2105
+ slategray: "708090",
2106
+ slategrey: "708090",
2107
+ snow: "fffafa",
2108
+ springgreen: "00ff7f",
2109
+ steelblue: "4682b4",
2110
+ tan: "d2b48c",
2111
+ teal: "008080",
2112
+ thistle: "d8bfd8",
2113
+ tomato: "ff6347",
2114
+ turquoise: "40e0d0",
2115
+ violet: "ee82ee",
2116
+ wheat: "f5deb3",
2117
+ white: "fff",
2118
+ whitesmoke: "f5f5f5",
2119
+ yellow: "ff0",
2120
+ yellowgreen: "9acd32"
2121
+ };
2122
+
2123
+ // Make it easy to access colors via `hexNames[hex]`
2124
+ var hexNames = tinycolor.hexNames = flip(names);
2125
+
2126
+
2127
+ // Utilities
2128
+ // ---------
2129
+
2130
+ // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
2131
+ function flip(o) {
2132
+ var flipped = { };
2133
+ for (var i in o) {
2134
+ if (o.hasOwnProperty(i)) {
2135
+ flipped[o[i]] = i;
2136
+ }
2137
+ }
2138
+ return flipped;
2139
+ }
2140
+
2141
+ // Return a valid alpha value [0,1] with all invalid values being set to 1
2142
+ function boundAlpha(a) {
2143
+ a = parseFloat(a);
2144
+
2145
+ if (isNaN(a) || a < 0 || a > 1) {
2146
+ a = 1;
2147
+ }
2148
+
2149
+ return a;
2150
+ }
2151
+
2152
+ // Take input from [0, n] and return it as [0, 1]
2153
+ function bound01(n, max) {
2154
+ if (isOnePointZero(n)) { n = "100%"; }
2155
+
2156
+ var processPercent = isPercentage(n);
2157
+ n = mathMin(max, mathMax(0, parseFloat(n)));
2158
+
2159
+ // Automatically convert percentage into number
2160
+ if (processPercent) {
2161
+ n = parseInt(n * max, 10) / 100;
2162
+ }
2163
+
2164
+ // Handle floating point rounding errors
2165
+ if ((math.abs(n - max) < 0.000001)) {
2166
+ return 1;
2167
+ }
2168
+
2169
+ // Convert into [0, 1] range if it isn't already
2170
+ return (n % max) / parseFloat(max);
2171
+ }
2172
+
2173
+ // Force a number between 0 and 1
2174
+ function clamp01(val) {
2175
+ return mathMin(1, mathMax(0, val));
2176
+ }
2177
+
2178
+ // Parse a base-16 hex value into a base-10 integer
2179
+ function parseIntFromHex(val) {
2180
+ return parseInt(val, 16);
2181
+ }
2182
+
2183
+ // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
2184
+ // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
2185
+ function isOnePointZero(n) {
2186
+ return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
2187
+ }
2188
+
2189
+ // Check to see if string passed in is a percentage
2190
+ function isPercentage(n) {
2191
+ return typeof n === "string" && n.indexOf('%') != -1;
2192
+ }
2193
+
2194
+ // Force a hex value to have 2 characters
2195
+ function pad2(c) {
2196
+ return c.length == 1 ? '0' + c : '' + c;
2197
+ }
2198
+
2199
+ // Replace a decimal with it's percentage value
2200
+ function convertToPercentage(n) {
2201
+ if (n <= 1) {
2202
+ n = (n * 100) + "%";
2203
+ }
2204
+
2205
+ return n;
2206
+ }
2207
+
2208
+ // Converts a decimal to a hex value
2209
+ function convertDecimalToHex(d) {
2210
+ return Math.round(parseFloat(d) * 255).toString(16);
2211
+ }
2212
+ // Converts a hex value to a decimal
2213
+ function convertHexToDecimal(h) {
2214
+ return (parseIntFromHex(h) / 255);
2215
+ }
2216
+
2217
+ var matchers = (function() {
2218
+
2219
+ // <http://www.w3.org/TR/css3-values/#integers>
2220
+ var CSS_INTEGER = "[-\\+]?\\d+%?";
2221
+
2222
+ // <http://www.w3.org/TR/css3-values/#number-value>
2223
+ var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
2224
+
2225
+ // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
2226
+ var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
2227
+
2228
+ // Actual matching.
2229
+ // Parentheses and commas are optional, but not required.
2230
+ // Whitespace can take the place of commas or opening paren
2231
+ var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2232
+ var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
2233
+
2234
+ return {
2235
+ rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
2236
+ rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
2237
+ hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
2238
+ hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
2239
+ hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
2240
+ hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
2241
+ hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
2242
+ hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
2243
+ hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
2244
+ };
2245
+ })();
2246
+
2247
+ // `stringInputToObject`
2248
+ // Permissive string parsing. Take in a number of formats, and output an object
2249
+ // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
2250
+ function stringInputToObject(color) {
2251
+
2252
+ color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
2253
+ var named = false;
2254
+ if (names[color]) {
2255
+ color = names[color];
2256
+ named = true;
2257
+ }
2258
+ else if (color == 'transparent') {
2259
+ return { r: 0, g: 0, b: 0, a: 0, format: "name" };
2260
+ }
2261
+
2262
+ // Try to match string input using regular expressions.
2263
+ // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
2264
+ // Just return an object and let the conversion functions handle that.
2265
+ // This way the result will be the same whether the tinycolor is initialized with string or object.
2266
+ var match;
2267
+ if ((match = matchers.rgb.exec(color))) {
2268
+ return { r: match[1], g: match[2], b: match[3] };
2269
+ }
2270
+ if ((match = matchers.rgba.exec(color))) {
2271
+ return { r: match[1], g: match[2], b: match[3], a: match[4] };
2272
+ }
2273
+ if ((match = matchers.hsl.exec(color))) {
2274
+ return { h: match[1], s: match[2], l: match[3] };
2275
+ }
2276
+ if ((match = matchers.hsla.exec(color))) {
2277
+ return { h: match[1], s: match[2], l: match[3], a: match[4] };
2278
+ }
2279
+ if ((match = matchers.hsv.exec(color))) {
2280
+ return { h: match[1], s: match[2], v: match[3] };
2281
+ }
2282
+ if ((match = matchers.hsva.exec(color))) {
2283
+ return { h: match[1], s: match[2], v: match[3], a: match[4] };
2284
+ }
2285
+ if ((match = matchers.hex8.exec(color))) {
2286
+ return {
2287
+ a: convertHexToDecimal(match[1]),
2288
+ r: parseIntFromHex(match[2]),
2289
+ g: parseIntFromHex(match[3]),
2290
+ b: parseIntFromHex(match[4]),
2291
+ format: named ? "name" : "hex8"
2292
+ };
2293
+ }
2294
+ if ((match = matchers.hex6.exec(color))) {
2295
+ return {
2296
+ r: parseIntFromHex(match[1]),
2297
+ g: parseIntFromHex(match[2]),
2298
+ b: parseIntFromHex(match[3]),
2299
+ format: named ? "name" : "hex"
2300
+ };
2301
+ }
2302
+ if ((match = matchers.hex3.exec(color))) {
2303
+ return {
2304
+ r: parseIntFromHex(match[1] + '' + match[1]),
2305
+ g: parseIntFromHex(match[2] + '' + match[2]),
2306
+ b: parseIntFromHex(match[3] + '' + match[3]),
2307
+ format: named ? "name" : "hex"
2308
+ };
2309
+ }
2310
+
2311
+ return false;
2312
+ }
2313
+
2314
+ window.tinycolor = tinycolor;
2315
+ })();
2316
+
2317
+ $(function () {
2318
+ if ($.fn.spectrum.load) {
2319
+ $.fn.spectrum.processNativeColorInputs();
2320
+ }
2321
+ });
2322
+
2323
+ });
trunk/uninstall.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * RUNS ON UNINSTALL OF 'Slide Anything'
4
+ *
5
+ * @package Slide Anything
6
+ * @author Simon Edge
7
+ * @license GPL-2.0+
8
+ */
9
+
10
+ // Check that we should be doing this
11
+ if (!defined('WP_UNINSTALL_PLUGIN')) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ // Delete Custom Post Type posts and metadata
16
+ $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ('sa_slider');");
17
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE wp.ID IS NULL;");
18
+ ?>
uninstall.php ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * RUNS ON UNINSTALL OF 'Slide Anything'
4
+ *
5
+ * @package Slide Anything
6
+ * @author Simon Edge
7
+ * @license GPL-2.0+
8
+ */
9
+
10
+ // Check that we should be doing this
11
+ if (!defined('WP_UNINSTALL_PLUGIN')) {
12
+ exit; // Exit if accessed directly
13
+ }
14
+
15
+ // Delete Custom Post Type posts and metadata
16
+ $wpdb->query("DELETE FROM {$wpdb->posts} WHERE post_type IN ('sa_slider');");
17
+ $wpdb->query("DELETE FROM {$wpdb->postmeta} meta LEFT JOIN {$wpdb->posts} posts ON posts.ID = meta.post_id WHERE wp.ID IS NULL;");
18
+ ?>