This commit is contained in:
nguyen dung
2022-02-18 16:43:41 +07:00
commit 39b8cb3612
4470 changed files with 1378320 additions and 0 deletions

View File

@@ -0,0 +1,465 @@
/*-----------------------------------------------------------------------------------
/* Admin styles
/*-----------------------------------------------------------------------------------*/
.updated, .error {
display:none!important
} /* disable the admin notices */
.flatsome-instagram-accounts .theme .theme-screenshot::after {
padding-top: 100%;
}
.flatsome-instagram-connect {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: auto;
background: rgba(0,0,0,0.3);
z-index: 900;
}
.flatsome-instagram-connect-body {
margin: 64px auto 32px;
padding: 8px 16px 16px;
max-width: 450px;
background: #fff;
box-shadow: 0 5px 5px rgba(0,0,0,0.1);
}
#of_container {
margin: 0;
width: 100%;
position:relative;
z-index: 0
}
#of_container ul,#of_container ol {margin: 0;}
#of_container .logo{padding:10px 20px; display: block;}
#of_container .logo span{font-size: 80%;font-weight: normal;opacity: 0.6;display: block;}
#of_container #main {
display: table;
vertical-align: top;
margin-left: -20px;
}
#of_container #of-nav {
display: table-cell;
z-index: 99;
min-width: 200px;
max-width: 200px;
vertical-align: top;
}
#of_container #of-nav ul {
margin:0;
}
#of_container #of-nav ul li a{
color:#666;
text-decoration: none;
padding:10px 30px 10px 20px;
display: block;
border-bottom: 1px solid #ddd;
font-weight: bold;
font-size: 100%;
background-repeat: no-repeat;
background-position: 90% 50%;
transition: all 0.3s;
}
#of_container #of-nav ul li{
margin: 0;padding:0;
}
#of_container #of-nav ul li.current a, #of_container #of-nav ul li a:hover{
color:#000; background-color: #fff;
margin-right: -1px;
position: relative;
}
/*menu icons - customize to your liking*/
#of_container #content {
border-left:1px solid #ddd;
display: table-cell;
min-height: 500px;
min-height: 100%;
background-color: #FFF;padding:30px;
width: 100%;
/*font-family: "Lucida Grande", Sans-serif;*/
}
#of_container #content .section {
margin-bottom: 10px;
max-width: 450px;
}
#of_container #content .section h3.heading {
font-size: 13px;
text-transform: uppercase;
margin: 20px 0 0 0;
padding: 15px 0px;
border-top: 1px solid #ddd;
}
#of_container #content .section .controls {
position: relative;
margin: 0 15px 10px 0;
}
#of_container #content .section .explain {
font-size: 11px;
color: #999;
}
/* Slider ui */
.section-sliderui .controls > *{display: inline-block;}
.section-sliderui .controls input{width:80px!important;}
/* Checkboxes */
#of_container #content .section-checkbox .option{
display: table;
}
#of_container #content .section-checkbox .option > div{
display: table-cell;
padding-right: 5px;
vertical-align: top;
}
#of_container #content input[type=checkbox] {
width: 17px;
min-width: 17px;
}
#of_container #content .section-multicheck .controls input{
display: inline-block;
width: 20px;
margin-right: 10px;
}
/* Options and select */
#of_container select, #of_container input, #of_container textarea{
width:100%;
background-color: #f9f9f9;
border:1px solid #ddd;
border-radius: 3px;
padding:10px;
color:#666;
font-size: 12px;
line-height: 16px;
}
#of_container select{
height: 32px;
padding: 0 0 0 10px;
max-width: 200px;
}
#of_container textarea{
max-width: 100%;
padding: 5px;
color:#666;
min-height: 150px;
}
#of_container .controls .of-radio-img-img {
outline:3px solid #fff;
margin:0 10px 10px 0;
border:1px solid #ccc;
display:none;
cursor:pointer;
float:left;
}
#of_container .controls .of-radio-img-selected {
outline:3px solid #0074a2
}
#of_container .controls .of-radio-img-img:hover {
opacity:.8;
}
#of_container .accept {
background: #DBF6BE no-repeat 10px center;
border: solid #9BBF65;
border-width: 0px 1px 1px 1px;
color: #060;
font-weight: bold;
padding: 10px;
text-align: center;
}
#of_container .warning {
background: #ffeeee no-repeat 10px center;
;
border: solid #dfbfbf;
border-width: 0px 1px 1px 1px;
color: #333;
font-weight: bold;
padding: 10px;
text-align: center;
}
#of_container .update_available {
background: #FFFEEB no-repeat 10px center;
border: solid #CCCCCC;
border-width: 0px 1px 1px 1px;
color: #333;
font-weight: bold;
padding: 10px;
text-align: center;
}
#of_container .of-save-popup {
position:fixed;
top:0px!important;
left:0!important;right:0!important;
background:#55c524;
opacity: 0.96;
color:#fff;
font-size:24px;
text-align:center;
display:none;
}
#of_container .of-save-popup div{
padding:40px 15px 15px;
}
html[data-iframe] #of_container .of-save-popup div{padding-top: 15px;}
#of_container .accept,
#of_container .warning,
#of_container .update_available,
#of_container .of-save-popup {
z-index: 9999;
}
#of_container .upload_button_div {
margin: 10px 0;
}
#of_backup_button {
margin-right: 5px;
}
#of_import_button {
margin-top: 10px;
}
#of_container .image_reset_button, #of_container .button.remove-image {
margin-left:10px;
color:#ef521d;
}
#of_container .image_reset_button:hover, #of_container .button.remove-image:hover {
color:red;
}
#of_container .upload-error {
float:left;
color:#666;
font-size:10px;
font-weight:bold;
text-decoration:none;
text-shadow:1px 1px 0 #FFFFFF;
margin: 0 10px 0 0;
padding:3px 10px;
background:#FFDFEC;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
#of_container .reset-button {
font-family:Arial,Verdana,sans-serif;
margin:0 ;
color: #ef521d;
border-color: #bbb;
}
#of_container .reset-button:hover { color: #ef521d; border-color: #888}
#of_container .slide_add_button { float:right; margin-top:10px; }
#of_container .save_bar {
padding: 15px 20px;
display: block;
}
#of_save {
font-family: Arial,Verdana,sans-serif;
}
#of_save:hover {
border:1px solid #111 !important;
}
#of_container .hide {
display:none
}
#of_container .ajax-loading-img-top {
margin: 5px 4px 0;
float:left
}
#of_container .ajax-loading-img-bottom {
margin: 0 5px;
}
#of_container .ajax-reset-loading-img {
display: block;
margin-left: 100px;
}
#of_container .of-option-image {
max-width:340px;
padding: 5px;
border:1px solid #e3e3e3;
background:#f7f7f7;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
#of_container .of-notice {
background: #ffd1d1;
border:1px solid #DFDFDF;
-moz-border-radius:8px;
text-align: center;
margin-bottom: 15px
}
/* google fonts previewer field style */
#of_container p.google_font_preview{
display: block;
border: 1px dotted lightgray;
float: left;
padding: 10px;
font-size: 10pt;
width: 318px;
height: auto;
margin: 0 0 10px 0;
line-height: 1.2;
}
/* Option folding */
#of_container .temphide {
display: none;
}
/*-------------------------------------------------------------------------------------------*/
/* Tipsy
/*-------------------------------------------------------------------------------------------*/
.tipsy { font-size: 10px; position: absolute; padding: 5px; z-index: 100000; }
.tipsy-inner { background-color: #000; color: #FFF; max-width: 200px; padding: 5px 8px 4px 8px; text-align: center; }
/* Rounded corners */
.tipsy-inner { border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; }
/* Uncomment for shadow */
/*.tipsy-inner { box-shadow: 0 0 5px #000000; -webkit-box-shadow: 0 0 5px #000000; -moz-box-shadow: 0 0 5px #000000; }*/
.tipsy-arrow { position: absolute; width: 0; height: 0; line-height: 0; border: 5px dashed #000; }
/* Rules to colour arrows */
.tipsy-arrow-n { border-bottom-color: #000; }
.tipsy-arrow-s { border-top-color: #000; }
.tipsy-arrow-e { border-left-color: #000; }
.tipsy-arrow-w { border-right-color: #000; }
.tipsy-n .tipsy-arrow { top: 0px; left: 50%; margin-left: -5px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-nw .tipsy-arrow { top: 0; left: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
.tipsy-ne .tipsy-arrow { top: 0; right: 10px; border-bottom-style: solid; border-top: none; border-left-color: transparent; border-right-color: transparent;}
.tipsy-s .tipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-sw .tipsy-arrow { bottom: 0; left: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-se .tipsy-arrow { bottom: 0; right: 10px; border-top-style: solid; border-bottom: none; border-left-color: transparent; border-right-color: transparent; }
.tipsy-e .tipsy-arrow { right: 0; top: 50%; margin-top: -5px; border-left-style: solid; border-right: none; border-top-color: transparent; border-bottom-color: transparent; }
.tipsy-w .tipsy-arrow { left: 0; top: 50%; margin-top: -5px; border-right-style: solid; border-left: none; border-top-color: transparent; border-bottom-color: transparent; }
/*-------------------------------------------------------------------------------------------*/
/* Color picker overwrite
/*-------------------------------------------------------------------------------------------*/
#of_container .controls .wp-picker-container input.button{
width: auto;
height: auto;
line-height: 1.5;
padding: 2px 8px;
margin: 0px 6px 6px 6px;
}
#of_container .controls .of-color {
float: left;
width: 70px;
margin-left: 5px;
margin-top: 0px;
padding: 3px;
}
#of_container .controls .wp-color-result.wp-picker-open {
top: -3px;
}
#of_container #content .section-color .controls {
width: 345px;
}
#of_container #content .section-color .explain {
width: 225px;
}
#of_container #content .iris-picker .iris-strip .ui-slider-handle {
position: absolute;
background: none!important;
right: -3px;
left: -3px;
border: 4px solid #aaa!important;
border-width: 4px 3px;
width: auto;
height: 6px;
border-radius: 4px;
box-shadow: 0 1px 2px rgba(0,0,0,.2);
opacity: .9;
z-index: 5;
cursor: ns-resize;
}
#of_container #content .iris-picker .iris-slider-offset {
position: absolute;
top: 3px;
left: 0;
right: 0;
bottom: 6px;
width: 28px;
background: none!important;
border: 0!important;
height: auto;
}
#of_container .controls .wp-picker-container .wp-color-result {
outline: 0;
border-color: #dddddd;
}
#section-top_right_text .explain{
float:none; width:100%!important;
}
/* presets */
.pre_select_wrapper{display: none;padding:30px;border-radius:3px;background-color: #ccc;margin-top: 10px; text-align: center;}
#of_container #content .section-presets {max-width: 100%;}
#of_container #content .section-presets .controls{width:100%;padding-bottom: 30px}
#of_container #content .section-presets .cancel{display: block;}
#of_container #content .section-presets .controls img{max-width: 900px;border:3px solid #ccc; margin:10px 0}
.pre_select_wrapper > a{display: inline-block;}
#of_container #content .section-presets .controls img:hover{border-color:#0074a2;}

View File

@@ -0,0 +1 @@
.wp-color-picker{width:80px}.wp-picker-container .hidden{display:none}.wp-color-result{background-color:#f9f9f9;border:1px solid #bbb;border-radius:2px;cursor:pointer;display:inline-block;height:22px;margin:0 6px 6px 0;position:relative;top:1px;user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;vertical-align:bottom;display:inline-block;padding-left:30px}.wp-color-result:after{background:#f3f3f3;background-image:-webkit-gradient(linear,left top,left bottom,from(#fefefe),to(#f4f4f4));background-image:-webkit-linear-gradient(top,#fefefe,#f4f4f4);background-image:-moz-linear-gradient(top,#fefefe,#f4f4f4);background-image:-o-linear-gradient(top,#fefefe,#f4f4f4);background-image:linear-gradient(to bottom,#fefefe,#f4f4f4);color:#333;text-shadow:0 1px 0 #fff;border-radius:0 1px 1px 0;border-left:1px solid #bbb;content:attr(title);display:block;font-size:11px;line-height:22px;padding:0 6px;position:relative;right:0;text-align:center;top:0}.wp-color-result:hover{border-color:#aaa;box-shadow:0 1px 1px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 1px rgba(0,0,0,0.1);-ms-box-shadow:0 1px 1px rgba(0,0,0,0.1);-o-box-shadow:0 1px 1px rgba(0,0,0,0.1);-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.1)}.wp-color-result:hover:after{color:#222;border-color:#aaa;border-left:1px solid #999}.wp-color-result.wp-picker-open{top:0}.wp-color-result.wp-picker-open:after{content:attr(data-current)}.wp-picker-container,.wp-picker-container:active{display:inline-block;outline:0}.wp-color-result:focus{border-color:#888;-moz-box-shadow:0 1px 2px rgba(0,0,0,0.2);-ms-box-shadow:0 1px 2px rgba(0,0,0,0.2);-o-box-shadow:0 1px 2px rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.2);box-shadow:0 1px 2px rgba(0,0,0,0.2)}.wp-color-result:focus:after{border-color:#888}.wp-picker-open+.wp-picker-input-wrap{display:inline-block;vertical-align:top}.wp-picker-container .button{margin-left:6px}.wp-picker-container .iris-square-slider .ui-slider-handle:focus{background-color:#555}.wp-picker-container .iris-picker{border-color:#dfdfdf;margin-top:6px}input[type="text"].iris-error{background-color:#ffebe8;border-color:#c00;color:#000}

View File

@@ -0,0 +1,78 @@
/*
* jQuery UI CSS Framework 1.8.14
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,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:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*
* jQuery UI Slider 1.8.14
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Slider#theming
*/
.ui-slider { position: relative; text-align: left; background:#eee; border-radius:2px; width:200px; display:inline-block; margin-right:10px; border: 1px solid #999;}
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 18px; height: 18px; cursor: default; background: url(../images/slider-control.png) no-repeat center center !important; cursor: pointer;}
.ui-slider .ui-slider-handle.ui-corner-all { border:0 !important;}
.ui-slider .ui-slider-handle.ui-state-focus { border:0 !important; background: url(../images/slider-control.png) no-repeat center center !important;outline: none;}
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.ui-slider-horizontal { height: 7px; border-color: #aaa;
border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;
box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
-moz-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
-webkit-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);}
.ui-slider-horizontal .ui-slider-handle { top: -5px; margin-left: -9px; }
.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-range{border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;
box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
-moz-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);
-webkit-box-shadow: inset 0px 1px 2px rgba(0, 0, 0, 0.20), 0px 0px 1px rgba(0, 0, 0, 0.20);}
.ui-slider-range.ui-widget-header{border: 1px solid #094B97; margin-top: -1px; margin-left: -1px; background: #0F7FFF;border-radius: 2px;-webkit-border-radius: 2px;-moz-border-radius: 2px;}
.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; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
(function(f,e){var a='<a tabindex="0" class="wp-color-result" />',c='<div class="wp-picker-holder" />',b='<div class="wp-picker-container" />',g='<input type="button" class="button button-small hidden" />';var d={options:{defaultColor:false,change:false,clear:false,hide:true,palettes:true},_create:function(){if(f.browser.msie&&parseInt(f.browser.version,10)<8){return}var h=this;var i=h.element;f.extend(h.options,i.data());h.initialValue=i.val();i.addClass("wp-color-picker").hide().wrap(b);h.wrap=i.parent();h.toggler=f(a).insertBefore(i).css({backgroundColor:h.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current);h.pickerContainer=f(c).insertAfter(i);h.button=f(g);if(h.options.defaultColor){h.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString)}else{h.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear)}i.wrap('<span class="wp-picker-input-wrap" />').after(h.button);i.iris({target:h.pickerContainer,hide:true,width:255,mode:"hsv",palettes:h.options.palettes,change:function(j,k){h.toggler.css({backgroundColor:k.color.toString()});if(f.isFunction(h.options.change)){h.options.change.call(this,j,k)}}});i.val(h.initialValue);h._addListeners();if(!h.options.hide){h.toggler.click()}},_addListeners:function(){var h=this;h.toggler.click(function(i){i.stopPropagation();h.element.toggle().iris("toggle");h.button.toggleClass("hidden");h.toggler.toggleClass("wp-picker-open");if(h.toggler.hasClass("wp-picker-open")){f("body").on("click",{wrap:h.wrap,toggler:h.toggler},h._bodyListener)}else{f("body").off("click",h._bodyListener)}});h.element.change(function(j){var i=f(this),k=i.val();if(k===""||k==="#"){h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}});h.toggler.on("keyup",function(i){if(i.keyCode===13||i.keyCode===32){i.preventDefault();h.toggler.trigger("click").next().focus()}});h.button.click(function(j){var i=f(this);if(i.hasClass("wp-picker-clear")){h.element.val("");h.toggler.css("backgroundColor","");if(f.isFunction(h.options.clear)){h.options.clear.call(this,j)}}else{if(i.hasClass("wp-picker-default")){h.element.val(h.options.defaultColor).change()}}})},_bodyListener:function(h){if(!h.data.wrap.find(h.target).length){h.data.toggler.click()}},color:function(h){if(h===e){return this.element.iris("option","color")}this.element.iris("option","color",h)},defaultColor:function(h){if(h===e){return this.options.defaultColor}this.options.defaultColor=h}};f.widget("wp.wpColorPicker",d)}(jQuery));

View File

@@ -0,0 +1 @@
jQuery.cookie=function(key,value,options){if(arguments.length>1&&String(value)!=="[object Object]"){options=jQuery.extend({},options);if(value===null||value===undefined){options.expires=-1}if(typeof options.expires==='number'){var days=options.expires,t=options.expires=new Date();t.setDate(t.getDate()+days)}value=String(value);return(document.cookie=[encodeURIComponent(key),'=',options.raw?value:encodeURIComponent(value),options.expires?'; expires='+options.expires.toUTCString():'',options.path?'; path='+options.path:'',options.domain?'; domain='+options.domain:'',options.secure?'; secure':''].join(''))}options=value||{};var result,decode=options.raw?function(s){return s}:decodeURIComponent;return(result=new RegExp('(?:^|; )'+encodeURIComponent(key)+'=([^;]*)').exec(document.cookie))?decode(result[1]):null};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,182 @@
/*
jQuery Masked Input Plugin
Copyright (c) 2007 - 2015 Josh Bush (digitalbush.com)
Licensed under the MIT license (http://digitalbush.com/projects/masked-input-plugin/#license)
Version: 1.4.1
*/
!function(factory) {
"function" == typeof define && define.amd ? define([ "jquery" ], factory) : factory("object" == typeof exports ? require("jquery") : jQuery);
}(function($) {
var caretTimeoutId, ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua);
$.mask = {
definitions: {
"9": "[0-9]",
a: "[A-Za-z]",
"*": "[A-Za-z0-9]"
},
autoclear: !0,
dataName: "rawMaskFn",
placeholder: "_"
}, $.fn.extend({
caret: function(begin, end) {
var range;
if (0 !== this.length && !this.is(":hidden")) return "number" == typeof begin ? (end = "number" == typeof end ? end : begin,
this.each(function() {
this.setSelectionRange ? this.setSelectionRange(begin, end) : this.createTextRange && (range = this.createTextRange(),
range.collapse(!0), range.moveEnd("character", end), range.moveStart("character", begin),
range.select());
})) : (this[0].setSelectionRange ? (begin = this[0].selectionStart, end = this[0].selectionEnd) : document.selection && document.selection.createRange && (range = document.selection.createRange(),
begin = 0 - range.duplicate().moveStart("character", -1e5), end = begin + range.text.length),
{
begin: begin,
end: end
});
},
unmask: function() {
return this.trigger("unmask");
},
mask: function(mask, settings) {
var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal;
if (!mask && this.length > 0) {
input = $(this[0]);
var fn = input.data($.mask.dataName);
return fn ? fn() : void 0;
}
return settings = $.extend({
autoclear: $.mask.autoclear,
placeholder: $.mask.placeholder,
completed: null
}, settings), defs = $.mask.definitions, tests = [], partialPosition = len = mask.length,
firstNonMaskPos = null, $.each(mask.split(""), function(i, c) {
"?" == c ? (len--, partialPosition = i) : defs[c] ? (tests.push(new RegExp(defs[c])),
null === firstNonMaskPos && (firstNonMaskPos = tests.length - 1), partialPosition > i && (lastRequiredNonMaskPos = tests.length - 1)) : tests.push(null);
}), this.trigger("unmask").each(function() {
function tryFireCompleted() {
if (settings.completed) {
for (var i = firstNonMaskPos; lastRequiredNonMaskPos >= i; i++) if (tests[i] && buffer[i] === getPlaceholder(i)) return;
settings.completed.call(input);
}
}
function getPlaceholder(i) {
return settings.placeholder.charAt(i < settings.placeholder.length ? i : 0);
}
function seekNext(pos) {
for (;++pos < len && !tests[pos]; ) ;
return pos;
}
function seekPrev(pos) {
for (;--pos >= 0 && !tests[pos]; ) ;
return pos;
}
function shiftL(begin, end) {
var i, j;
if (!(0 > begin)) {
for (i = begin, j = seekNext(end); len > i; i++) if (tests[i]) {
if (!(len > j && tests[i].test(buffer[j]))) break;
buffer[i] = buffer[j], buffer[j] = getPlaceholder(j), j = seekNext(j);
}
writeBuffer(), input.caret(Math.max(firstNonMaskPos, begin));
}
}
function shiftR(pos) {
var i, c, j, t;
for (i = pos, c = getPlaceholder(pos); len > i; i++) if (tests[i]) {
if (j = seekNext(i), t = buffer[i], buffer[i] = c, !(len > j && tests[j].test(t))) break;
c = t;
}
}
function androidInputEvent() {
var curVal = input.val(), pos = input.caret();
if (oldVal && oldVal.length && oldVal.length > curVal.length) {
for (checkVal(!0); pos.begin > 0 && !tests[pos.begin - 1]; ) pos.begin--;
if (0 === pos.begin) for (;pos.begin < firstNonMaskPos && !tests[pos.begin]; ) pos.begin++;
input.caret(pos.begin, pos.begin);
} else {
for (checkVal(!0); pos.begin < len && !tests[pos.begin]; ) pos.begin++;
input.caret(pos.begin, pos.begin);
}
tryFireCompleted();
}
function blurEvent() {
checkVal(), input.val() != focusText && input.change();
}
function keydownEvent(e) {
if (!input.prop("readonly")) {
var pos, begin, end, k = e.which || e.keyCode;
oldVal = input.val(), 8 === k || 46 === k || iPhone && 127 === k ? (pos = input.caret(),
begin = pos.begin, end = pos.end, end - begin === 0 && (begin = 46 !== k ? seekPrev(begin) : end = seekNext(begin - 1),
end = 46 === k ? seekNext(end) : end), clearBuffer(begin, end), shiftL(begin, end - 1),
e.preventDefault()) : 13 === k ? blurEvent.call(this, e) : 27 === k && (input.val(focusText),
input.caret(0, checkVal()), e.preventDefault());
}
}
function keypressEvent(e) {
if (!input.prop("readonly")) {
var p, c, next, k = e.which || e.keyCode, pos = input.caret();
if (!(e.ctrlKey || e.altKey || e.metaKey || 32 > k) && k && 13 !== k) {
if (pos.end - pos.begin !== 0 && (clearBuffer(pos.begin, pos.end), shiftL(pos.begin, pos.end - 1)),
p = seekNext(pos.begin - 1), len > p && (c = String.fromCharCode(k), tests[p].test(c))) {
if (shiftR(p), buffer[p] = c, writeBuffer(), next = seekNext(p), android) {
var proxy = function() {
$.proxy($.fn.caret, input, next)();
};
setTimeout(proxy, 0);
} else input.caret(next);
pos.begin <= lastRequiredNonMaskPos && tryFireCompleted();
}
e.preventDefault();
}
}
}
function clearBuffer(start, end) {
var i;
for (i = start; end > i && len > i; i++) tests[i] && (buffer[i] = getPlaceholder(i));
}
function writeBuffer() {
input.val(buffer.join(""));
}
function checkVal(allow) {
var i, c, pos, test = input.val(), lastMatch = -1;
for (i = 0, pos = 0; len > i; i++) if (tests[i]) {
for (buffer[i] = getPlaceholder(i); pos++ < test.length; ) if (c = test.charAt(pos - 1),
tests[i].test(c)) {
buffer[i] = c, lastMatch = i;
break;
}
if (pos > test.length) {
clearBuffer(i + 1, len);
break;
}
} else buffer[i] === test.charAt(pos) && pos++, partialPosition > i && (lastMatch = i);
return allow ? writeBuffer() : partialPosition > lastMatch + 1 ? settings.autoclear || buffer.join("") === defaultBuffer ? (input.val() && input.val(""),
clearBuffer(0, len)) : writeBuffer() : (writeBuffer(), input.val(input.val().substring(0, lastMatch + 1))),
partialPosition ? i : firstNonMaskPos;
}
var input = $(this), buffer = $.map(mask.split(""), function(c, i) {
return "?" != c ? defs[c] ? getPlaceholder(i) : c : void 0;
}), defaultBuffer = buffer.join(""), focusText = input.val();
input.data($.mask.dataName, function() {
return $.map(buffer, function(c, i) {
return tests[i] && c != getPlaceholder(i) ? c : null;
}).join("");
}), input.one("unmask", function() {
input.off(".mask").removeData($.mask.dataName);
}).on("focus.mask", function() {
if (!input.prop("readonly")) {
clearTimeout(caretTimeoutId);
var pos;
focusText = input.val(), pos = checkVal(), caretTimeoutId = setTimeout(function() {
input.get(0) === document.activeElement && (writeBuffer(), pos == mask.replace("?", "").length ? input.caret(0, pos) : input.caret(pos));
}, 10);
}
}).on("blur.mask", blurEvent).on("keydown.mask", keydownEvent).on("keypress.mask", keypressEvent).on("input.mask paste.mask", function() {
input.prop("readonly") || setTimeout(function() {
var pos = checkVal(!0);
input.caret(pos), tryFireCompleted();
}, 0);
}), chrome && android && input.off("input.mask").on("input.mask", androidInputEvent),
checkVal();
});
}
});
});

View File

@@ -0,0 +1,241 @@
// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license
(function($) {
function maybeCall(thing, ctx) {
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
};
function Tipsy(element, options) {
this.$element = $(element);
this.options = options;
this.enabled = true;
this.fixTitle();
};
Tipsy.prototype = {
show: function() {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
});
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight,
gravity = maybeCall(this.options.gravity, this.$element[0]);
var tp;
switch (gravity.charAt(0)) {
case 'n':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 's':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'e':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
break;
case 'w':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
break;
}
if (gravity.length == 2) {
if (gravity.charAt(1) == 'w') {
tp.left = pos.left + pos.width / 2 - 15;
} else {
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
}
}
$tip.css(tp).addClass('tipsy-' + gravity);
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
if (this.options.className) {
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
}
if (this.options.fade) {
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
} else {
$tip.css({visibility: 'visible', opacity: this.options.opacity});
}
}
},
hide: function() {
if (this.options.fade) {
this.tip().stop().fadeOut(function() { $(this).remove(); });
} else {
this.tip().remove();
}
},
fixTitle: function() {
var $e = this.$element;
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
}
},
getTitle: function() {
var title, $e = this.$element, o = this.options;
this.fixTitle();
var title, o = this.options;
if (typeof o.title == 'string') {
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
} else if (typeof o.title == 'function') {
title = o.title.call($e[0]);
}
title = ('' + title).replace(/(^\s*|\s*$)/, "");
return title || o.fallback;
},
tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
}
return this.$tip;
},
validate: function() {
if (!this.$element[0].parentNode) {
this.hide();
this.$element = null;
this.options = null;
}
},
enable: function() { this.enabled = true; },
disable: function() { this.enabled = false; },
toggleEnabled: function() { this.enabled = !this.enabled; }
};
$.fn.tipsy = function(options) {
if (options === true) {
return this.data('tipsy');
} else if (typeof options == 'string') {
var tipsy = this.data('tipsy');
if (tipsy) tipsy[options]();
return this;
}
options = $.extend({}, $.fn.tipsy.defaults, options);
function get(ele) {
var tipsy = $.data(ele, 'tipsy');
if (!tipsy) {
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
$.data(ele, 'tipsy', tipsy);
}
return tipsy;
}
function enter() {
var tipsy = get(this);
tipsy.hoverState = 'in';
if (options.delayIn == 0) {
tipsy.show();
} else {
tipsy.fixTitle();
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
}
};
function leave() {
var tipsy = get(this);
tipsy.hoverState = 'out';
if (options.delayOut == 0) {
tipsy.hide();
} else {
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
}
};
if (!options.live) this.each(function() { get(this); });
if (options.trigger != 'manual') {
var binder = options.live ? 'live' : 'bind',
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
this[binder](eventIn, enter)[binder](eventOut, leave);
}
return this;
};
$.fn.tipsy.defaults = {
className: null,
delayIn: 0,
delayOut: 0,
fade: false,
fallback: '',
gravity: 'n',
html: false,
live: false,
offset: 0,
opacity: 0.8,
title: 'title',
trigger: 'hover'
};
// Overwrite this method to provide options on a per-element basis.
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
// (remember - do not modify 'options' in place!)
$.fn.tipsy.elementOptions = function(ele, options) {
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
};
$.fn.tipsy.autoNS = function() {
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
};
$.fn.tipsy.autoWE = function() {
return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
};
/**
* yields a closure of the supplied parameters, producing a function that takes
* no arguments and is suitable for use as an autogravity function like so:
*
* @param margin (int) - distance from the viewable region edge that an
* element should be before setting its tooltip's gravity to be away
* from that edge.
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
* if there are no viewable region edges effecting the tooltip's
* gravity. It will try to vary from this minimally, for example,
* if 'sw' is preferred and an element is near the right viewable
* region edge, but not the top edge, it will set the gravity for
* that element's tooltip to be 'se', preserving the southern
* component.
*/
$.fn.tipsy.autoBounds = function(margin, prefer) {
return function() {
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
boundTop = $(document).scrollTop() + margin,
boundLeft = $(document).scrollLeft() + margin,
$this = $(this);
if ($this.offset().top < boundTop) dir.ns = 'n';
if ($this.offset().left < boundLeft) dir.ew = 'w';
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
return dir.ns + (dir.ew ? dir.ew : '');
}
};
})(jQuery);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,673 @@
/**
* SMOF js
*
* contains the core functionalities to be used
* inside SMOF
*/
jQuery.noConflict();
/** Fire up jQuery - let's dance!
*/
jQuery(document).ready(function($){
var $ofContainer = $('#of_container');
//(un)fold options in a checkbox-group
jQuery('.fld').click(function() {
var $fold='.f_'+this.id;
$($fold).slideToggle('normal', "swing");
});
//Color picker
$('.of-color').wpColorPicker();
//hides warning if js is enabled
$('#js-warning').hide();
//Tabify Options
$('.group').hide();
// Get the URL parameter for tab
function getURLParameter(name) {
return decodeURI(
(RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,''])[1]
);
}
// If the $_GET param of tab is set, use that for the tab that should be open
if (getURLParameter('tab') != "") {
$.cookie('of_current_opt', '#'+getURLParameter('tab'), { expires: 7, path: '/' });
}
// Display last current tab
if ($.cookie("of_current_opt") === null) {
$('.group:first').fadeIn('fast');
$('#of-nav li:first').addClass('current');
} else {
var hooks = $('#hooks').html();
hooks = jQuery.parseJSON(hooks);
$.each(hooks, function(key, value) {
if ($.cookie("of_current_opt") == '#of-option-'+ value) {
$('.group#of-option-' + value).fadeIn();
$('#of-nav li.' + value).addClass('current');
}
});
}
//Current Menu Class
$('#of-nav li a').click(function(evt){
// event.preventDefault();
$('#of-nav li').removeClass('current');
$(this).parent().addClass('current');
var clicked_group = $(this).attr('href');
$.cookie('of_current_opt', clicked_group, { expires: 7, path: '/' });
$('.group').hide();
$(clicked_group).fadeIn('fast');
return false;
});
//Masked Inputs (images as radio buttons)
$('.of-radio-img-img').click(function(){
$(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
$(this).addClass('of-radio-img-selected');
});
$('.of-radio-img-label').hide();
$('.of-radio-img-img').show();
$('.of-radio-img-radio').hide();
//Masked Inputs (background images as radio buttons)
$('.of-radio-tile-img').click(function(){
$(this).parent().parent().find('.of-radio-tile-img').removeClass('of-radio-tile-selected');
$(this).addClass('of-radio-tile-selected');
});
$('.of-radio-tile-label').hide();
$('.of-radio-tile-img').show();
$('.of-radio-tile-radio').hide();
/** Aquagraphite Slider MOD */
//Hide (Collapse) the toggle containers on load
$(".slide_body").hide();
//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
$ofContainer.on('click', '.slide_edit_button', function () {
/*
//display as an accordion
$(".slide_header").removeClass("active");
$(".slide_body").slideUp("fast");
*/
//toggle for each
$(this).parent().toggleClass("active").next().slideToggle("fast");
return false; //Prevent the browser jump to the link anchor
});
// Update slide title upon typing
function update_slider_title(e) {
var element = e;
if ( this.timer ) {
clearTimeout( element.timer );
}
this.timer = setTimeout( function() {
$(element).parent().prev().find('strong').text( element.value );
}, 100);
return true;
}
$ofContainer.on('keyup', '.of-slider-title', function () {
update_slider_title(this);
});
//Remove individual slide
$ofContainer.on('click', '.slide_delete_button', function () {
// event.preventDefault();
var agree = confirm("Are you sure you wish to delete this slide?");
if (agree) {
var $trash = $(this).parents('li');
//$trash.slideUp('slow', function(){ $trash.remove(); }); //chrome + confirm bug made slideUp not working...
$trash.animate({
opacity: 0.25,
height: 0,
}, 500, function() {
$(this).remove();
});
return false; //Prevent the browser jump to the link anchor
} else {
return false;
}
});
//Add new slide
$ofContainer.on('click', '.slide_add_button', function () {
var slidesContainer = $(this).prev();
var sliderId = slidesContainer.attr('id');
var numArr = $('#'+sliderId +' li').find('.order').map(function() {
var str = this.id;
str = str.replace(/\D/g,'');
str = parseFloat(str);
return str;
}).get();
var maxNum = Math.max.apply(Math, numArr);
if (maxNum < 1 ) { maxNum = 0};
var newNum = maxNum + 1;
var newSlide = '<li class="temphide"><div class="slide_header"><strong>Slide ' + newNum + '</strong><input type="hidden" class="slide of-input order" name="' + sliderId + '[' + newNum + '][order]" id="' + sliderId + '_slide_order-' + newNum + '" value="' + newNum + '"><a class="slide_edit_button" href="#">Edit</a></div><div class="slide_body" style="display: none; "><label>Title</label><input class="slide of-input of-slider-title" name="' + sliderId + '[' + newNum + '][title]" id="' + sliderId + '_' + newNum + '_slide_title" value=""><label>Image URL</label><input class="upload slide of-input" name="' + sliderId + '[' + newNum + '][url]" id="' + sliderId + '_' + newNum + '_slide_url" value=""><div class="upload_button_div"><span class="button media_upload_button" id="' + sliderId + '_' + newNum + '">Upload</span><span class="button remove-image hide" id="reset_' + sliderId + '_' + newNum + '" title="' + sliderId + '_' + newNum + '">Remove</span></div><div class="screenshot"></div><label>Link URL (optional)</label><input class="slide of-input" name="' + sliderId + '[' + newNum + '][link]" id="' + sliderId + '_' + newNum + '_slide_link" value=""><label>Description (optional)</label><textarea class="slide of-input" name="' + sliderId + '[' + newNum + '][description]" id="' + sliderId + '_' + newNum + '_slide_description" cols="8" rows="8"></textarea><a class="slide_delete_button" href="#">Delete</a><div class="clear"></div></div></li>';
slidesContainer.append(newSlide);
var nSlide = slidesContainer.find('.temphide');
nSlide.fadeIn('fast', function() {
$(this).removeClass('temphide');
});
optionsframework_file_bindings(); // re-initialise upload image..
return false; //prevent jumps, as always..
});
//Sort slides
jQuery('.slider').find('ul').each( function() {
var id = jQuery(this).attr('id');
$('#'+ id).sortable({
placeholder: "placeholder",
opacity: 0.6,
handle: ".slide_header",
cancel: "a"
});
});
/** Sorter (Layout Manager) */
jQuery('.sorter').each( function() {
var id = jQuery(this).attr('id');
$('#'+ id).find('ul').sortable({
items: 'li',
placeholder: "placeholder",
connectWith: '.sortlist_' + id,
opacity: 0.6,
update: function() {
$(this).find('.position').each( function() {
var listID = $(this).parent().attr('id');
var parentID = $(this).parent().parent().attr('id');
parentID = parentID.replace(id + '_', '')
var optionID = $(this).parent().parent().parent().attr('id');
$(this).prop("name", optionID + '[' + parentID + '][' + listID + ']');
});
}
});
});
/** Ajax Backup & Restore MOD */
//backup button
$ofContainer.on('click', '#of_backup_button', function () {
var answer = confirm("Click OK to backup your current saved options.")
if (answer){
var clickedObject = $(this);
var clickedID = $(this).attr('id');
var nonce = $('#security').val();
var data = {
action: 'of_ajax_post_action',
type: 'backup_options',
security: nonce
};
$.post(ajaxurl, data, function(response) {
//check nonce
if(response==-1){ //failed
var fail_popup = $('#of-popup-fail');
fail_popup.fadeIn();
window.setTimeout(function(){
fail_popup.fadeOut();
}, 2000);
}
else {
var success_popup = $('#of-popup-save');
success_popup.fadeIn();
window.setTimeout(function(){
location.reload();
}, 1000);
}
});
}
return false;
});
//restore button
$ofContainer.on('click', '#of_restore_button', function () {
var answer = confirm("'Warning: All of your current options will be replaced with the data from your last backup! Proceed?")
if (answer){
var clickedObject = $(this);
var clickedID = $(this).attr('id');
var nonce = $('#security').val();
var data = {
action: 'of_ajax_post_action',
type: 'restore_options',
security: nonce
};
$.post(ajaxurl, data, function(response) {
//check nonce
if(response==-1){ //failed
var fail_popup = $('#of-popup-fail');
fail_popup.fadeIn();
window.setTimeout(function(){
fail_popup.fadeOut();
}, 2000);
}
else {
var success_popup = $('#of-popup-save');
success_popup.fadeIn();
window.setTimeout(function(){
location.reload();
}, 1000);
}
});
}
return false;
});
/** Ajax Transfer (Import/Export) Option */
$ofContainer.on('click', '#of_import_button', function () {
var answer = confirm("Click OK to import options.")
if (answer){
var clickedObject = $(this);
var clickedID = $(this).attr('id');
var nonce = $('#security').val();
var import_data = $('#export_data').val();
var data = {
action: 'of_ajax_post_action',
type: 'import_options',
security: nonce,
data: import_data
};
$.post(ajaxurl, data, function(response) {
var fail_popup = $('#of-popup-fail');
var success_popup = $('#of-popup-save');
//check nonce
if(response==-1){ //failed
fail_popup.fadeIn();
window.setTimeout(function(){
fail_popup.fadeOut();
}, 2000);
}
else
{
success_popup.fadeIn();
window.setTimeout(function(){
location.reload();
}, 1000);
}
});
}
return false;
});
/** AJAX Save Options */
$ofContainer.on('click', '#of_save', function () {
var nonce = $('#security').val();
$('.ajax-loading-img').fadeIn();
//get serialized data from all our option fields
var serializedReturn = $('#of_form :input[name][name!="security"][name!="of_reset"]').serialize();
$('#of_form :input[type=checkbox]').each(function() {
if (!this.checked) {
serializedReturn += '&'+this.name+'=0';
}
});
var data = {
type: 'save',
action: 'of_ajax_post_action',
security: nonce,
data: serializedReturn
};
$.post(ajaxurl, data, function(response) {
var success = $('#of-popup-save');
var fail = $('#of-popup-fail');
var loading = $('.ajax-loading-img');
loading.fadeOut();
if (response==1) {
success.fadeIn();
} else {
fail.fadeIn();
}
window.setTimeout(function(){
success.fadeOut();
fail.fadeOut();
}, 2000);
});
return false;
});
/* AJAX Options Reset */
$('#of_reset').click(function() {
//confirm reset
var answer = confirm("Click OK to reset. All settings will be lost and replaced with default settings!");
//ajax reset
if (answer){
var nonce = $('#security').val();
$('.ajax-reset-loading-img').fadeIn();
var data = {
type: 'reset',
action: 'of_ajax_post_action',
security: nonce,
};
$.post(ajaxurl, data, function(response) {
var success = $('#of-popup-reset');
var fail = $('#of-popup-fail');
var loading = $('.ajax-reset-loading-img');
loading.fadeOut();
if (response==1)
{
success.fadeIn();
window.setTimeout(function(){
location.reload();
}, 1000);
}
else
{
fail.fadeIn();
window.setTimeout(function(){
fail.fadeOut();
}, 2000);
}
});
}
return false;
});
/** Tipsy @since v1.3 */
if (jQuery().tipsy) {
$('.tooltip, .typography-size, .typography-height, .typography-face, .typography-style, .of-typography-color').tipsy({
fade: true,
gravity: 's',
opacity: 0.7,
});
}
/**
* JQuery UI Slider function
* Dependencies : jquery, jquery-ui-slider
* Feature added by : Smartik - http://smartik.ws/
* Date : 03.17.2013
*/
jQuery('.smof_sliderui').each(function() {
var obj = jQuery(this);
var sId = "#" + obj.data('id');
var val = parseInt(obj.data('val'));
var min = parseInt(obj.data('min'));
var max = parseInt(obj.data('max'));
var step = parseInt(obj.data('step'));
//slider init
obj.slider({
value: val,
min: min,
max: max,
step: step,
range: "min",
slide: function( event, ui ) {
jQuery(sId).val( ui.value );
}
});
});
/**
* Switch
* Dependencies : jquery
* Feature added by : Smartik - http://smartik.ws/
* Date : 03.17.2013
*/
jQuery(".cb-enable").click(function(){
var parent = $(this).parents('.switch-options');
jQuery('.cb-disable',parent).removeClass('selected');
jQuery(this).addClass('selected');
jQuery('.main_checkbox',parent).attr('checked', true);
//fold/unfold related options
var obj = jQuery(this);
var $fold='.f_'+obj.data('id');
jQuery($fold).slideDown('normal', "swing");
});
jQuery(".cb-disable").click(function(){
var parent = $(this).parents('.switch-options');
jQuery('.cb-enable',parent).removeClass('selected');
jQuery(this).addClass('selected');
jQuery('.main_checkbox',parent).attr('checked', false);
//fold/unfold related options
var obj = jQuery(this);
var $fold='.f_'+obj.data('id');
jQuery($fold).slideUp('normal', "swing");
});
//disable text select(for modern chrome, safari and firefox is done via CSS)
// if (($.browser.msie && $.browser.version < 10) || $.browser.opera) {
// $('.cb-enable span, .cb-disable span').find().attr('unselectable', 'on');
// }
/**
* Google Fonts
* Dependencies : google.com, jquery
* Feature added by : Smartik - http://smartik.ws/
* Date : 03.17.2013
*/
function GoogleFontSelect( slctr, mainID ){
var _selected = $(slctr).val(); //get current value - selected and saved
var _linkclass = 'style_link_'+ mainID;
var _previewer = mainID +'_ggf_previewer';
if( _selected ){ //if var exists and isset
$('.'+ _previewer ).fadeIn();
//Check if selected is not equal with "Select a font" and execute the script.
if ( _selected !== 'none' && _selected !== 'Select a font' ) {
//remove other elements crested in <head>
$( '.'+ _linkclass ).remove();
//replace spaces with "+" sign
var the_font = _selected.replace(/\s+/g, '+');
//add reference to google font family
$('head').append('<link href="http://fonts.googleapis.com/css?family='+ the_font +'" rel="stylesheet" type="text/css" class="'+ _linkclass +'">');
//show in the preview box the font
$('.'+ _previewer ).css('font-family', _selected +', sans-serif' );
}else{
//if selected is not a font remove style "font-family" at preview box
$('.'+ _previewer ).css('font-family', '' );
$('.'+ _previewer ).fadeOut();
}
}
}
//init for each element
jQuery( '.google_font_select' ).each(function(){
var mainID = jQuery(this).attr('id');
GoogleFontSelect( this, mainID );
});
//init when value is changed
jQuery( '.google_font_select' ).change(function(){
var mainID = jQuery(this).attr('id');
GoogleFontSelect( this, mainID );
});
/**
* Media Uploader
* Dependencies : jquery, wp media uploader
* Feature added by : Smartik - http://smartik.ws/
* Date : 05.28.2013
*/
function optionsframework_add_file(event, selector) {
var upload = $(".uploaded-file"), frame;
var $el = $(this);
event.preventDefault();
// If the media frame already exists, reopen it.
if ( frame ) {
frame.open();
return;
}
// Create the media frame.
frame = wp.media({
// Set the title of the modal.
title: $el.data('choose'),
// Customize the submit button.
button: {
// Set the text of the button.
text: $el.data('update'),
// Tell the button not to close the modal, since we're
// going to refresh the page when the image is selected.
close: false
}
});
// When an image is selected, run a callback.
frame.on( 'select', function() {
// Grab the selected attachment.
var attachment = frame.state().get('selection').first();
frame.close();
selector.find('.upload').val(attachment.attributes.url);
if ( attachment.attributes.type == 'image' ) {
selector.find('.screenshot').empty().hide().append('<img class="of-option-image" src="' + attachment.attributes.url + '">').slideDown('fast');
}
selector.find('.media_upload_button').unbind();
selector.find('.remove-image').show().removeClass('hide');//show "Remove" button
selector.find('.of-background-properties').slideDown();
optionsframework_file_bindings();
});
// Finally, open the modal.
frame.open();
}
function optionsframework_remove_file(selector) {
selector.find('.remove-image').hide().addClass('hide');//hide "Remove" button
selector.find('.upload').val('');
selector.find('.of-background-properties').hide();
selector.find('.screenshot').slideUp();
selector.find('.remove-file').unbind();
// We don't display the upload button if .upload-notice is present
// This means the user doesn't have the WordPress 3.5 Media Library Support
if ( $('.section-upload .upload-notice').length > 0 ) {
$('.media_upload_button').remove();
}
optionsframework_file_bindings();
}
function optionsframework_file_bindings() {
$('.remove-image, .remove-file').on('click', function() {
optionsframework_remove_file( $(this).parents('.section-upload, .section-media, .slide_body') );
});
$('.media_upload_button').unbind('click').click( function( event ) {
optionsframework_add_file(event, $(this).parents('.section-upload, .section-media, .slide_body'));
});
}
optionsframework_file_bindings();
}); //end doc ready