Version Description
- Tested for 4.9.4
- Improved performance of editor javascript
- Fixed issue with showing certain conditional fields
- Fixed issue in maxmodal with double init
Download this release
Release Info
Developer | basszje |
Plugin | WordPress Button Plugin MaxButtons |
Version | 6.28 |
Comparing to | |
See all releases |
Code changes from version 6.27 to 6.28
- blocks/tpl/button.tpl +6 -4
- blocks/tpl/checkbox.tpl +8 -7
- blocks/tpl/hidden.tpl +3 -3
- blocks/tpl/number.tpl +6 -5
- blocks/tpl/radio.tpl +1 -0
- blocks/tpl/switch.tpl +8 -7
- blocks/tpl/text.tpl +6 -6
- classes/block.php +132 -111
- classes/blocks.php +67 -66
- classes/maxCSSParser.php +3 -3
- classes/maxbuttons-class.php +7 -6
- includes/social-share.php +1 -1
- js/maxbuttons-admin.js +35 -23
- js/maxbuttons_media_button.js +158 -156
- js/maxmodal.js +1 -1
- js/min/front.js +1 -1
- js/min/init.js +1 -1
- js/min/maxbuttons-admin.js +1 -1
- js/min/maxcollections.js +1 -1
- js/min/maxmodal.js +1 -1
- js/min/maxtabs.js +1 -1
- js/min/review-notice.js +1 -1
- maxbuttons.php +3 -3
- readme.txt +10 -2
blocks/tpl/button.tpl
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
{if:label}<label>%%label%%</label>{/if:label}
|
2 |
-
<div class='input %%name%%' {if:conditional}data-show="%%conditional%%"{/if:conditional}>
|
3 |
-
<button id='%%id%%' type='button' class='button {if:inputclass}%%inputclass%%{/if:inputclass}'
|
4 |
-
{if:modal}data-modal='%%modal%%'{/if:modal}
|
5 |
-
|
|
|
|
|
6 |
</div>
|
1 |
{if:label}<label>%%label%%</label>{/if:label}
|
2 |
+
<div class='input %%name%%' {if:conditional}data-show="%%conditional%%"{/if:conditional}>
|
3 |
+
<button id='%%id%%' type='button' class='button {if:inputclass}%%inputclass%%{/if:inputclass}'
|
4 |
+
{if:modal}data-modal='%%modal%%'{/if:modal}
|
5 |
+
{if:disabled} disabled {/if:disabled}
|
6 |
+
> %%button_label%% </button>
|
7 |
+
|
8 |
</div>
|
blocks/tpl/checkbox.tpl
CHANGED
@@ -1,14 +1,15 @@
|
|
1 |
-
<div class='input checkbox %%name%%'>
|
2 |
-
<input type='checkbox' name='%%name%%' id='%%id%%' data-field='%%name%%'
|
3 |
-
{if:inputclass}class="%%inputclass%%"{/if:inputclass}
|
4 |
-
value='%%value%%'
|
5 |
-
%%checked%%
|
6 |
-
{if:icon} tabindex='-1'{/if:icon}
|
|
|
7 |
/>
|
8 |
<label for='%%id%%' {if:title}title="%%title%%"{/if:title} >
|
9 |
|
10 |
{if:icon} <i class='dashicons %%icon%%' tabindex='0'></i> {/if:icon}
|
11 |
-
{if:label} %%label%% {/if:label}
|
12 |
|
13 |
</label>
|
14 |
</div>
|
1 |
+
<div class='input checkbox %%name%%'>
|
2 |
+
<input type='checkbox' name='%%name%%' id='%%id%%' data-field='%%name%%'
|
3 |
+
{if:inputclass}class="%%inputclass%%"{/if:inputclass}
|
4 |
+
value='%%value%%'
|
5 |
+
%%checked%%
|
6 |
+
{if:icon} tabindex='-1'{/if:icon}
|
7 |
+
{if:disabled} disabled {/if:disabled}
|
8 |
/>
|
9 |
<label for='%%id%%' {if:title}title="%%title%%"{/if:title} >
|
10 |
|
11 |
{if:icon} <i class='dashicons %%icon%%' tabindex='0'></i> {/if:icon}
|
12 |
+
{if:label} %%label%% {/if:label}
|
13 |
|
14 |
</label>
|
15 |
</div>
|
blocks/tpl/hidden.tpl
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<input type="hidden"
|
2 |
id="%%id%%"
|
3 |
name="%%name%%"
|
4 |
-
value="%%value%%"
|
5 |
-
placeholder="%%placeholder%%"
|
6 |
|
7 |
-
/>
|
1 |
<input type="hidden"
|
2 |
id="%%id%%"
|
3 |
name="%%name%%"
|
4 |
+
value="%%value%%"
|
5 |
+
placeholder="%%placeholder%%"
|
6 |
|
7 |
+
/>
|
blocks/tpl/number.tpl
CHANGED
@@ -1,15 +1,16 @@
|
|
1 |
-
{if:label} <label for='%%id%%'>%%label%%</label> {/if:label}
|
2 |
<div class="input number %%name%%" {if:conditional}data-show="%%conditional%%"{/if:conditional} >
|
3 |
{if:before_input} %%before_input%% {/if:before_input}
|
4 |
<input type="number"
|
5 |
id="%%id%%"
|
6 |
name="%%name%%"
|
7 |
-
value="%%value%%"
|
8 |
{if:min} min="%%min%%" {/if:min}
|
9 |
{if:max} max="%%max%%" {/if:max}
|
10 |
-
placeholder="%%placeholder%%"
|
11 |
-
{if:
|
|
|
12 |
/>
|
13 |
-
{if:help}<div class="help fa fa-question-circle "><span>%%help%%</span></div>{/if:help}
|
14 |
</div>
|
15 |
{if:default} <div class='default'>%%default%%</div> {/if:default}
|
1 |
+
{if:label} <label for='%%id%%'>%%label%%</label> {/if:label}
|
2 |
<div class="input number %%name%%" {if:conditional}data-show="%%conditional%%"{/if:conditional} >
|
3 |
{if:before_input} %%before_input%% {/if:before_input}
|
4 |
<input type="number"
|
5 |
id="%%id%%"
|
6 |
name="%%name%%"
|
7 |
+
value="%%value%%"
|
8 |
{if:min} min="%%min%%" {/if:min}
|
9 |
{if:max} max="%%max%%" {/if:max}
|
10 |
+
placeholder="%%placeholder%%"
|
11 |
+
{if:disabled} disabled {/if:disabled}
|
12 |
+
{if:inputclass}class="%%inputclass%%"{/if:inputclass}
|
13 |
/>
|
14 |
+
{if:help}<div class="help fa fa-question-circle "><span>%%help%%</span></div>{/if:help}
|
15 |
</div>
|
16 |
{if:default} <div class='default'>%%default%%</div> {/if:default}
|
blocks/tpl/radio.tpl
CHANGED
@@ -6,6 +6,7 @@
|
|
6 |
value='%%value%%'
|
7 |
%%checked%%
|
8 |
{if:icon}tabindex='-1'{/if:icon}
|
|
|
9 |
/>
|
10 |
<label for='%%id%%' {if:title}title="%%title%%"{/if:title}>
|
11 |
{if:icon} <i class='dashicons %%icon%%' tabindex='0'></i> {/if:icon}
|
6 |
value='%%value%%'
|
7 |
%%checked%%
|
8 |
{if:icon}tabindex='-1'{/if:icon}
|
9 |
+
{if:disabled} disabled {/if:disabled}
|
10 |
/>
|
11 |
<label for='%%id%%' {if:title}title="%%title%%"{/if:title}>
|
12 |
{if:icon} <i class='dashicons %%icon%%' tabindex='0'></i> {/if:icon}
|
blocks/tpl/switch.tpl
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
-
{if:label} <label for='%%id%%' class='switch_label %%name%%'>%%label%%</label> {/if:label}
|
2 |
-
<div class='input switch_button %%name%%'>
|
3 |
-
<label for='%%id%%' tabindex='0'>
|
4 |
-
<input type='checkbox' name='%%name%%' id='%%id%%' data-field='%%name%%'
|
5 |
-
value='%%value%%'
|
6 |
-
%%checked%%
|
7 |
tabindex='-1'
|
|
|
8 |
/>
|
9 |
|
10 |
<div class='the_switch' >
|
@@ -12,5 +13,5 @@
|
|
12 |
{if:icon} <i class='dashicons %%icon%%'></i> {/if:icon}
|
13 |
</div>
|
14 |
</label>
|
15 |
-
|
16 |
</div>
|
1 |
+
{if:label} <label for='%%id%%' class='switch_label %%name%%'>%%label%%</label> {/if:label}
|
2 |
+
<div class='input switch_button %%name%%'>
|
3 |
+
<label for='%%id%%' tabindex='0'>
|
4 |
+
<input type='checkbox' name='%%name%%' id='%%id%%' data-field='%%name%%'
|
5 |
+
value='%%value%%'
|
6 |
+
%%checked%%
|
7 |
tabindex='-1'
|
8 |
+
{if:disabled} disabled {/if:disabled}
|
9 |
/>
|
10 |
|
11 |
<div class='the_switch' >
|
13 |
{if:icon} <i class='dashicons %%icon%%'></i> {/if:icon}
|
14 |
</div>
|
15 |
</label>
|
16 |
+
|
17 |
</div>
|
blocks/tpl/text.tpl
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
-
{if:label} <label for='%%id%%'>%%label%%</label> {/if:label}
|
2 |
<div class="input text %%name%%">{if:before_input} %%before_input%% {/if:before_input}
|
3 |
<input type="text"
|
4 |
id="%%id%%"
|
5 |
name="%%name%%"
|
6 |
-
value="%%value%%"
|
7 |
-
placeholder="%%placeholder%%"
|
8 |
-
{if:inputclass}class="%%inputclass%%"{/if:inputclass}
|
|
|
9 |
/>
|
10 |
-
{if:help}<div class="help fa fa-question-circle "><span>%%help%%</span></div>{/if:help}
|
11 |
</div>
|
12 |
-
|
1 |
+
{if:label} <label for='%%id%%'>%%label%%</label> {/if:label}
|
2 |
<div class="input text %%name%%">{if:before_input} %%before_input%% {/if:before_input}
|
3 |
<input type="text"
|
4 |
id="%%id%%"
|
5 |
name="%%name%%"
|
6 |
+
value="%%value%%"
|
7 |
+
placeholder="%%placeholder%%"
|
8 |
+
{if:inputclass}class="%%inputclass%%"{/if:inputclass}
|
9 |
+
{if:disabled} disabled {/if:disabled}
|
10 |
/>
|
11 |
+
{if:help}<div class="help fa fa-question-circle "><span>%%help%%</span></div>{/if:help}
|
12 |
</div>
|
|
classes/block.php
CHANGED
@@ -1,79 +1,79 @@
|
|
1 |
<?php
|
2 |
-
namespace MaxButtons;
|
3 |
defined('ABSPATH') or die('No direct access permitted');
|
4 |
|
5 |
-
/** A block is a combination of related settings.
|
6 |
*
|
7 |
* Blocks are grouped and put into the same Database table row. This way related data, it's executing, display and other decision
|
8 |
* making is seperate from other blocks improving realiability and readability of the code.
|
9 |
*/
|
10 |
use MaxButtons\maxBlocks as maxBlocks;
|
11 |
use MaxButtons\maxField as maxField;
|
12 |
-
|
13 |
abstract class maxBlock
|
14 |
{
|
15 |
-
protected $data = array();
|
16 |
-
|
17 |
-
/** Block constructor
|
|
|
|
|
18 |
*
|
19 |
-
* Constructor for a button block. Hooks up all needed filters and inits data for a block.
|
20 |
-
*
|
21 |
*/
|
22 |
function __construct($priority = 10)
|
23 |
{
|
24 |
-
|
25 |
-
// filters for save_post, display etc. Buttons class will the filters.
|
26 |
-
//add_filter('mb-save-fields', array($this, 'save_fields'),10,2);
|
27 |
//add_action('mb-admin-fields', array($this,'admin_fields' ) );
|
28 |
//add_action('mb-data-load', array($this,'set') );
|
29 |
-
|
30 |
-
//add_filter('mb-parse-button', array($this, 'parse_button'),10,2 );
|
31 |
-
//add_filter('mb-js-blocks', array($this, 'parse_js'), 10, 2);
|
32 |
-
//add_filter('mb-parse-element-preview', array($this,'parse_element'), 10,2);
|
33 |
-
|
34 |
-
//add_filter('mb-css-blocks', array($this, 'parse_css'),10,2 );
|
35 |
-
//add_filter('mb-field-map', array($this, 'map_fields') );
|
36 |
-
|
37 |
-
|
38 |
-
$this->fields = apply_filters($this->blockname. "-block-fields",$this->fields);
|
39 |
$this->data[$this->blockname] = array(); //empty init
|
40 |
-
|
41 |
}
|
42 |
-
|
43 |
/** Save fields runs the POST variable through all blocks
|
44 |
*
|
45 |
-
* Taking the post variable from the form, the function will attach the submitted data to the block - field logic and
|
46 |
-
* return a data object to save to the Database. If no value is submitted, the default will be loaded.
|
47 |
-
*
|
48 |
* @param $data Array Data in blockname - field logic format
|
49 |
* @param $post Array $_POST style data
|
50 |
-
*
|
51 |
* @return $data Array
|
52 |
*/
|
53 |
public function save_fields($data, $post)
|
54 |
-
{
|
55 |
-
$block = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array();
|
56 |
|
57 |
-
foreach($this->fields as $field => $options)
|
58 |
{
|
59 |
-
$default = (isset($options["default"])) ? $options["default"] : '';
|
60 |
if (is_string($default) && strpos($default,"px") !== false)
|
61 |
-
$block[$field] = (isset($post[$field]) ) ? intval($post[$field]) : $default;
|
62 |
-
elseif( isset($post[$field]) && is_array($post[$field]))
|
63 |
{
|
64 |
$block[$field] = $post[$field];
|
65 |
}
|
66 |
-
else
|
67 |
-
$block[$field] = (isset($post[$field])) ? sanitize_text_field($post[$field]) : $default;
|
68 |
}
|
69 |
|
70 |
-
$data[$this->blockname] = $block;
|
71 |
-
return $data;
|
72 |
-
|
73 |
}
|
74 |
-
|
75 |
/** Return fields of current block
|
76 |
-
*
|
77 |
* Will return fields of current block only
|
78 |
* @return Array $fields
|
79 |
*/
|
@@ -81,152 +81,173 @@ abstract class maxBlock
|
|
81 |
{
|
82 |
return $this->fields;
|
83 |
}
|
84 |
-
|
85 |
/** Returns Blockname of current block
|
86 |
-
*
|
87 |
-
*
|
88 |
* @return $string | boolean Name of the block, if set, otherwise false
|
89 |
*/
|
90 |
-
public function get_name()
|
91 |
{
|
92 |
-
if (isset($this->blockname))
|
93 |
-
return $this->blockname;
|
94 |
-
|
95 |
return false;
|
96 |
}
|
97 |
-
|
98 |
-
|
99 |
/* Display Block admin interface
|
100 |
-
*
|
101 |
* Writes admin interface to output.
|
102 |
* @abstract
|
103 |
*/
|
104 |
abstract public function admin_fields();
|
105 |
-
|
106 |
/** Parse HTML portion of button
|
107 |
*
|
108 |
-
* This filter is passed through to modify the HTML parts of the button.
|
109 |
-
*
|
110 |
* Note: When changing parts of the DomObj writing new tags / DOM to elements, it's needed to regenerate the Object.
|
111 |
-
*
|
112 |
* @param $button DomObj SimpleDOMObject
|
113 |
-
* @param $mode String[normal|preview] Flag to check if loading in preview
|
114 |
-
*
|
115 |
* @return DomObj
|
116 |
*/
|
117 |
-
public function parse_button($button, $mode) { return $button; }
|
118 |
-
|
119 |
/* Parse CSS of the button
|
120 |
*
|
121 |
-
* This function will go through the blocks, matching the $css definitions of a fields and putting them in the
|
122 |
-
* correct tags ( partly using csspart ) .
|
123 |
-
*
|
124 |
* @param $css Array [normal|hover|other][cssline] = css declaration
|
125 |
-
* @param $mode String [normal|preview]
|
126 |
-
*
|
127 |
-
* @return $css Array
|
128 |
*/
|
129 |
-
public function parse_css($css, $mode = 'normal') {
|
130 |
|
131 |
-
$data = $this->data[$this->blockname];
|
132 |
|
133 |
// get all fields from this block
|
134 |
foreach($this->fields as $field => $field_data)
|
135 |
{
|
136 |
// get cssparts, can be comma-seperated value
|
137 |
-
$csspart = (isset($field_data["csspart"])) ? explode(",",$field_data["csspart"]) : array('maxbutton');
|
138 |
-
$csspseudo = (isset($field_data["csspseudo"])) ? explode(",", $field_data["csspseudo"]) : 'normal';
|
139 |
-
|
140 |
// if this field has a css property
|
141 |
-
if (isset($field_data["css"]))
|
142 |
{
|
143 |
// get the property value from the data
|
144 |
-
$value = isset($data[$field]) ? $data[$field] : '';
|
145 |
$value = str_replace(array(";"), '', $value); //sanitize
|
146 |
-
|
147 |
if (isset($field_data["default"]) && strpos($field_data["default"],"px") && ! strpos($value,"px"))
|
148 |
{
|
149 |
-
if ($value == '') $value = 0; // pixel values, no empty but 0
|
150 |
-
$value .= "px";
|
151 |
}
|
152 |
-
if (isset($data[$field]))
|
153 |
{
|
154 |
foreach($csspart as $part)
|
155 |
{
|
156 |
-
if (is_array($csspseudo))
|
157 |
{
|
158 |
foreach($csspseudo as $pseudo)
|
159 |
-
$css[$part][$pseudo][$field_data["css"]] = $value ;
|
160 |
}
|
161 |
else
|
162 |
$css[$part][$csspseudo][$field_data["css"]] = $value ;
|
163 |
}
|
164 |
}
|
165 |
}
|
166 |
-
|
167 |
-
}
|
168 |
|
169 |
-
|
|
|
|
|
170 |
}
|
171 |
-
|
172 |
-
/* Ability to output custom JS for each button */
|
173 |
public function parse_js($js, $mode = 'normal')
|
174 |
{
|
175 |
-
return $js;
|
176 |
}
|
177 |
-
|
178 |
-
|
179 |
-
/** Map the Block fields
|
|
|
|
|
|
|
180 |
*
|
181 |
-
* This function will take the field name and link it to the defined CSS definition to use in providing the live preview in the
|
182 |
-
* button editor. I.e. a field with name x will be linked to CSS-property X . Or to a custom Javascript function.
|
183 |
-
*
|
184 |
* @param $map Array [$field_id][css|attr|func|] = property/function
|
185 |
-
*
|
186 |
* @return Array
|
187 |
*/
|
188 |
-
public function map_fields($map)
|
189 |
{
|
190 |
foreach($this->fields as $field => $field_data)
|
191 |
{
|
192 |
-
if (isset($field_data["css"]))
|
193 |
{
|
194 |
-
$cssdef = $field_data["css"];
|
195 |
-
$multidef = explode('-',$cssdef);
|
196 |
if ( count($multidef) > 1)
|
197 |
{
|
198 |
-
$cssdef = "";
|
199 |
for($i = 0; $i < count($multidef); $i++)
|
200 |
-
{
|
201 |
-
if ($i == 0)
|
202 |
$cssdef .= $multidef[$i];
|
203 |
else
|
204 |
-
$cssdef .= ucfirst($multidef[$i]);
|
205 |
-
//$multidef[$i] . ucfirst($multidef[1]);
|
206 |
}
|
207 |
-
}
|
208 |
-
$map[$field]["css"] = $cssdef;
|
209 |
if ( isset($field_data["default"]) && strpos($field_data["default"],"px") != false )
|
210 |
-
$map[$field]["css_unit"] = 'px';
|
211 |
-
|
212 |
}
|
213 |
-
if (isset($field_data["csspart"]))
|
214 |
-
$map[$field]["csspart"] = $field_data["csspart"];
|
215 |
}
|
216 |
-
return $map;
|
217 |
-
|
218 |
}
|
219 |
-
|
220 |
/** Sets the data
|
221 |
*
|
222 |
* This action is called from button class when data is pulled from the database and populates the dataArray to all blocks
|
223 |
-
*
|
224 |
*/
|
225 |
function set($dataArray)
|
226 |
{
|
227 |
-
|
228 |
$this->data = $dataArray;
|
229 |
}
|
230 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
232 |
?>
|
1 |
<?php
|
2 |
+
namespace MaxButtons;
|
3 |
defined('ABSPATH') or die('No direct access permitted');
|
4 |
|
5 |
+
/** A block is a combination of related settings.
|
6 |
*
|
7 |
* Blocks are grouped and put into the same Database table row. This way related data, it's executing, display and other decision
|
8 |
* making is seperate from other blocks improving realiability and readability of the code.
|
9 |
*/
|
10 |
use MaxButtons\maxBlocks as maxBlocks;
|
11 |
use MaxButtons\maxField as maxField;
|
12 |
+
|
13 |
abstract class maxBlock
|
14 |
{
|
15 |
+
protected $data = array();
|
16 |
+
|
17 |
+
/** Block constructor
|
18 |
+
*
|
19 |
+
* Constructor for a button block. Hooks up all needed filters and inits data for a block.
|
20 |
*
|
|
|
|
|
21 |
*/
|
22 |
function __construct($priority = 10)
|
23 |
{
|
24 |
+
|
25 |
+
// filters for save_post, display etc. Buttons class will the filters.
|
26 |
+
//add_filter('mb-save-fields', array($this, 'save_fields'),10,2);
|
27 |
//add_action('mb-admin-fields', array($this,'admin_fields' ) );
|
28 |
//add_action('mb-data-load', array($this,'set') );
|
29 |
+
|
30 |
+
//add_filter('mb-parse-button', array($this, 'parse_button'),10,2 );
|
31 |
+
//add_filter('mb-js-blocks', array($this, 'parse_js'), 10, 2);
|
32 |
+
//add_filter('mb-parse-element-preview', array($this,'parse_element'), 10,2);
|
33 |
+
|
34 |
+
//add_filter('mb-css-blocks', array($this, 'parse_css'),10,2 );
|
35 |
+
//add_filter('mb-field-map', array($this, 'map_fields') );
|
36 |
+
|
37 |
+
|
38 |
+
$this->fields = apply_filters($this->blockname. "-block-fields",$this->fields);
|
39 |
$this->data[$this->blockname] = array(); //empty init
|
40 |
+
|
41 |
}
|
42 |
+
|
43 |
/** Save fields runs the POST variable through all blocks
|
44 |
*
|
45 |
+
* Taking the post variable from the form, the function will attach the submitted data to the block - field logic and
|
46 |
+
* return a data object to save to the Database. If no value is submitted, the default will be loaded.
|
47 |
+
*
|
48 |
* @param $data Array Data in blockname - field logic format
|
49 |
* @param $post Array $_POST style data
|
50 |
+
*
|
51 |
* @return $data Array
|
52 |
*/
|
53 |
public function save_fields($data, $post)
|
54 |
+
{
|
55 |
+
$block = isset($this->data[$this->blockname]) ? $this->data[$this->blockname] : array();
|
56 |
|
57 |
+
foreach($this->fields as $field => $options)
|
58 |
{
|
59 |
+
$default = (isset($options["default"])) ? $options["default"] : '';
|
60 |
if (is_string($default) && strpos($default,"px") !== false)
|
61 |
+
$block[$field] = (isset($post[$field]) ) ? intval($post[$field]) : $default;
|
62 |
+
elseif( isset($post[$field]) && is_array($post[$field]))
|
63 |
{
|
64 |
$block[$field] = $post[$field];
|
65 |
}
|
66 |
+
else
|
67 |
+
$block[$field] = (isset($post[$field])) ? sanitize_text_field($post[$field]) : $default;
|
68 |
}
|
69 |
|
70 |
+
$data[$this->blockname] = $block;
|
71 |
+
return $data;
|
72 |
+
|
73 |
}
|
74 |
+
|
75 |
/** Return fields of current block
|
76 |
+
*
|
77 |
* Will return fields of current block only
|
78 |
* @return Array $fields
|
79 |
*/
|
81 |
{
|
82 |
return $this->fields;
|
83 |
}
|
84 |
+
|
85 |
/** Returns Blockname of current block
|
86 |
+
*
|
87 |
+
*
|
88 |
* @return $string | boolean Name of the block, if set, otherwise false
|
89 |
*/
|
90 |
+
public function get_name()
|
91 |
{
|
92 |
+
if (isset($this->blockname))
|
93 |
+
return $this->blockname;
|
94 |
+
|
95 |
return false;
|
96 |
}
|
97 |
+
|
98 |
+
|
99 |
/* Display Block admin interface
|
100 |
+
*
|
101 |
* Writes admin interface to output.
|
102 |
* @abstract
|
103 |
*/
|
104 |
abstract public function admin_fields();
|
105 |
+
|
106 |
/** Parse HTML portion of button
|
107 |
*
|
108 |
+
* This filter is passed through to modify the HTML parts of the button.
|
109 |
+
*
|
110 |
* Note: When changing parts of the DomObj writing new tags / DOM to elements, it's needed to regenerate the Object.
|
111 |
+
*
|
112 |
* @param $button DomObj SimpleDOMObject
|
113 |
+
* @param $mode String[normal|preview] Flag to check if loading in preview
|
114 |
+
*
|
115 |
* @return DomObj
|
116 |
*/
|
117 |
+
public function parse_button($button, $mode) { return $button; }
|
118 |
+
|
119 |
/* Parse CSS of the button
|
120 |
*
|
121 |
+
* This function will go through the blocks, matching the $css definitions of a fields and putting them in the
|
122 |
+
* correct tags ( partly using csspart ) .
|
123 |
+
*
|
124 |
* @param $css Array [normal|hover|other][cssline] = css declaration
|
125 |
+
* @param $mode String [normal|preview]
|
126 |
+
*
|
127 |
+
* @return $css Array
|
128 |
*/
|
129 |
+
public function parse_css($css, $mode = 'normal') {
|
130 |
|
131 |
+
$data = $this->data[$this->blockname];
|
132 |
|
133 |
// get all fields from this block
|
134 |
foreach($this->fields as $field => $field_data)
|
135 |
{
|
136 |
// get cssparts, can be comma-seperated value
|
137 |
+
$csspart = (isset($field_data["csspart"])) ? explode(",",$field_data["csspart"]) : array('maxbutton');
|
138 |
+
$csspseudo = (isset($field_data["csspseudo"])) ? explode(",", $field_data["csspseudo"]) : 'normal';
|
139 |
+
|
140 |
// if this field has a css property
|
141 |
+
if (isset($field_data["css"]))
|
142 |
{
|
143 |
// get the property value from the data
|
144 |
+
$value = isset($data[$field]) ? $data[$field] : '';
|
145 |
$value = str_replace(array(";"), '', $value); //sanitize
|
146 |
+
|
147 |
if (isset($field_data["default"]) && strpos($field_data["default"],"px") && ! strpos($value,"px"))
|
148 |
{
|
149 |
+
if ($value == '') $value = 0; // pixel values, no empty but 0
|
150 |
+
$value .= "px";
|
151 |
}
|
152 |
+
if (isset($data[$field]))
|
153 |
{
|
154 |
foreach($csspart as $part)
|
155 |
{
|
156 |
+
if (is_array($csspseudo))
|
157 |
{
|
158 |
foreach($csspseudo as $pseudo)
|
159 |
+
$css[$part][$pseudo][$field_data["css"]] = $value ;
|
160 |
}
|
161 |
else
|
162 |
$css[$part][$csspseudo][$field_data["css"]] = $value ;
|
163 |
}
|
164 |
}
|
165 |
}
|
|
|
|
|
166 |
|
167 |
+
}
|
168 |
+
|
169 |
+
return $css;
|
170 |
}
|
171 |
+
|
172 |
+
/* Ability to output custom JS for each button */
|
173 |
public function parse_js($js, $mode = 'normal')
|
174 |
{
|
175 |
+
return $js;
|
176 |
}
|
177 |
+
|
178 |
+
|
179 |
+
/** Map the Block fields
|
180 |
+
*
|
181 |
+
* This function will take the field name and link it to the defined CSS definition to use in providing the live preview in the
|
182 |
+
* button editor. I.e. a field with name x will be linked to CSS-property X . Or to a custom Javascript function.
|
183 |
*
|
|
|
|
|
|
|
184 |
* @param $map Array [$field_id][css|attr|func|] = property/function
|
185 |
+
*
|
186 |
* @return Array
|
187 |
*/
|
188 |
+
public function map_fields($map)
|
189 |
{
|
190 |
foreach($this->fields as $field => $field_data)
|
191 |
{
|
192 |
+
if (isset($field_data["css"]))
|
193 |
{
|
194 |
+
$cssdef = $field_data["css"];
|
195 |
+
$multidef = explode('-',$cssdef);
|
196 |
if ( count($multidef) > 1)
|
197 |
{
|
198 |
+
$cssdef = "";
|
199 |
for($i = 0; $i < count($multidef); $i++)
|
200 |
+
{
|
201 |
+
if ($i == 0)
|
202 |
$cssdef .= $multidef[$i];
|
203 |
else
|
204 |
+
$cssdef .= ucfirst($multidef[$i]);
|
205 |
+
//$multidef[$i] . ucfirst($multidef[1]);
|
206 |
}
|
207 |
+
}
|
208 |
+
$map[$field]["css"] = $cssdef;
|
209 |
if ( isset($field_data["default"]) && strpos($field_data["default"],"px") != false )
|
210 |
+
$map[$field]["css_unit"] = 'px';
|
211 |
+
|
212 |
}
|
213 |
+
if (isset($field_data["csspart"]))
|
214 |
+
$map[$field]["csspart"] = $field_data["csspart"];
|
215 |
}
|
216 |
+
return $map;
|
217 |
+
|
218 |
}
|
219 |
+
|
220 |
/** Sets the data
|
221 |
*
|
222 |
* This action is called from button class when data is pulled from the database and populates the dataArray to all blocks
|
223 |
+
*
|
224 |
*/
|
225 |
function set($dataArray)
|
226 |
{
|
227 |
+
|
228 |
$this->data = $dataArray;
|
229 |
}
|
230 |
+
|
231 |
+
public function getValue($field)
|
232 |
+
{
|
233 |
+
$data = $this->data;
|
234 |
+
/*foreach($data as $blockname => $fieldname)
|
235 |
+
{
|
236 |
+
if ($fieldname == $field)
|
237 |
+
return $data[$blockname][$fieldname];
|
238 |
+
}*/
|
239 |
+
|
240 |
+
if (isset($data[$this->blockname][$field]))
|
241 |
+
{
|
242 |
+
return $data[$this->blockname][$field];
|
243 |
+
}
|
244 |
+
|
245 |
+
if (isset($this->fields[$field]['default']))
|
246 |
+
return $this->fields[$field]['default'];
|
247 |
+
|
248 |
+
// if not found return default
|
249 |
+
return false;
|
250 |
+
}
|
251 |
+
|
252 |
}
|
253 |
?>
|
classes/blocks.php
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
<?php
|
2 |
namespace MaxButtons;
|
3 |
defined('ABSPATH') or die('No direct access permitted');
|
4 |
|
@@ -8,33 +8,33 @@ defined('ABSPATH') or die('No direct access permitted');
|
|
8 |
*/
|
9 |
use \RecursiveDirectoryIterator as RecursiveDirectoryIterator;
|
10 |
use \RecursiveIteratorIterator as RecursiveIteratorIterator;
|
11 |
-
use \FilesystemIterator as FilesystemIterator;
|
12 |
|
13 |
class maxBlocks
|
14 |
{
|
15 |
protected static $blocks; // collection!
|
16 |
-
protected static $block_classes;
|
17 |
-
|
18 |
protected static $data; // full data array
|
19 |
-
protected static $fields = array(); // all fields
|
20 |
-
|
21 |
-
public static function init()
|
22 |
{
|
23 |
|
24 |
}
|
25 |
-
|
26 |
-
/** Find the block classes */
|
27 |
-
public static function initBlocks()
|
28 |
{
|
29 |
-
|
30 |
$block_paths = apply_filters('mb-block-paths', array(MB()->get_plugin_path() . "blocks/") );
|
31 |
-
|
32 |
//global $blockClass; // load requires only onc
|
33 |
|
34 |
$newBlocks = array();
|
35 |
-
$templates = array();
|
36 |
-
|
37 |
-
|
38 |
foreach($block_paths as $block_path)
|
39 |
{
|
40 |
$dir_iterator = new RecursiveDirectoryIterator($block_path, FilesystemIterator::SKIP_DOTS);
|
@@ -43,21 +43,21 @@ class maxBlocks
|
|
43 |
foreach ($iterator as $fileinfo)
|
44 |
{
|
45 |
|
46 |
-
$path = $fileinfo->getRealPath();
|
47 |
// THIS IS PHP > 5.3.6
|
48 |
-
//$extension = $fileinfo->getExtension();
|
49 |
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
50 |
-
|
51 |
if ($fileinfo->isFile() )
|
52 |
{
|
53 |
-
if ($extension == 'php')
|
54 |
{
|
55 |
require_once($path);
|
56 |
}
|
57 |
-
elseif($extension == 'tpl')
|
58 |
-
{
|
59 |
$filename = $fileinfo->getBasename('.tpl');
|
60 |
-
$templates[$filename] = array('path' => $path);
|
61 |
}
|
62 |
}
|
63 |
}
|
@@ -69,96 +69,97 @@ class maxBlocks
|
|
69 |
foreach($blockArray as $block)
|
70 |
{
|
71 |
if (isset($blockClass[$block]))
|
72 |
-
$newBlocks[$block] = $blockClass[$block];
|
73 |
-
|
74 |
}
|
75 |
}
|
76 |
$blockClass = $newBlocks;
|
77 |
if (is_admin())
|
78 |
{
|
79 |
-
// possible issue with some hosters faking is_admin flag.
|
80 |
if (class_exists( maxUtils::namespaceit('maxBlocks') ) && class_exists( maxUtils::namespaceit('maxBlocks') ) )
|
81 |
{
|
82 |
-
maxField::setTemplates($templates);
|
83 |
|
84 |
}
|
85 |
else
|
86 |
{
|
87 |
-
error_log('[MaxButtons] - MaxField class is not set within admin context. This can cause issues when using button editor');
|
88 |
}
|
89 |
}
|
90 |
-
|
91 |
-
//$this->loadBlockClasses($blockClass);
|
92 |
-
|
93 |
static::$block_classes = array_values($blockClass);
|
94 |
}
|
95 |
-
|
96 |
-
public static function getBlockClasses()
|
97 |
{
|
98 |
if ( is_null(static::$block_classes) )
|
99 |
self::initBlocks();
|
100 |
-
|
101 |
return static::$block_classes;
|
102 |
}
|
103 |
-
|
104 |
-
|
105 |
-
public static function setData($data)
|
106 |
{
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
|
|
112 |
{
|
113 |
-
if (is_array($fields))
|
114 |
-
$new_data = array_merge($new_data, $fields);
|
115 |
}
|
116 |
-
|
117 |
|
118 |
-
|
|
|
119 |
}
|
120 |
-
|
121 |
public static function add($block)
|
122 |
{
|
123 |
-
$name = $block->get_name();
|
124 |
|
125 |
static::$blocks[$name] = $block;
|
126 |
-
static::$fields = array_merge(self::$fields, $block->get_fields());
|
127 |
}
|
128 |
-
|
129 |
-
public static function getValue($fieldname)
|
130 |
{
|
131 |
|
132 |
-
if (isset(self::$data[$fieldname]))
|
133 |
-
return self::$data[$fieldname];
|
134 |
-
if (isset(self::$fields[$fieldname]))
|
135 |
return self::$fields[$fieldname]['default'];
|
136 |
-
|
137 |
-
return false; // dunno.
|
138 |
}
|
139 |
|
140 |
-
public static function getColorValue($fieldname)
|
141 |
{
|
142 |
-
$value = self::getValue($fieldname);
|
143 |
-
if (! $value )
|
144 |
return false;
|
145 |
-
|
146 |
-
if (substr($value,0,1) !== '#')
|
147 |
{
|
148 |
$value = '#' . $value;
|
149 |
}
|
150 |
-
|
151 |
return $value;
|
152 |
-
|
153 |
}
|
154 |
|
155 |
-
public static function getDefault($fieldname)
|
156 |
{
|
157 |
-
if (isset(self::$fields[$fieldname]['default']))
|
158 |
return self::$fields[$fieldname]['default'];
|
159 |
-
|
160 |
return false; // dunno
|
161 |
-
|
162 |
}
|
163 |
|
164 |
|
1 |
+
<?php
|
2 |
namespace MaxButtons;
|
3 |
defined('ABSPATH') or die('No direct access permitted');
|
4 |
|
8 |
*/
|
9 |
use \RecursiveDirectoryIterator as RecursiveDirectoryIterator;
|
10 |
use \RecursiveIteratorIterator as RecursiveIteratorIterator;
|
11 |
+
use \FilesystemIterator as FilesystemIterator;
|
12 |
|
13 |
class maxBlocks
|
14 |
{
|
15 |
protected static $blocks; // collection!
|
16 |
+
protected static $block_classes;
|
17 |
+
|
18 |
protected static $data; // full data array
|
19 |
+
protected static $fields = array(); // all fields
|
20 |
+
|
21 |
+
public static function init()
|
22 |
{
|
23 |
|
24 |
}
|
25 |
+
|
26 |
+
/** Find the block classes */
|
27 |
+
public static function initBlocks()
|
28 |
{
|
29 |
+
|
30 |
$block_paths = apply_filters('mb-block-paths', array(MB()->get_plugin_path() . "blocks/") );
|
31 |
+
|
32 |
//global $blockClass; // load requires only onc
|
33 |
|
34 |
$newBlocks = array();
|
35 |
+
$templates = array();
|
36 |
+
|
37 |
+
|
38 |
foreach($block_paths as $block_path)
|
39 |
{
|
40 |
$dir_iterator = new RecursiveDirectoryIterator($block_path, FilesystemIterator::SKIP_DOTS);
|
43 |
foreach ($iterator as $fileinfo)
|
44 |
{
|
45 |
|
46 |
+
$path = $fileinfo->getRealPath();
|
47 |
// THIS IS PHP > 5.3.6
|
48 |
+
//$extension = $fileinfo->getExtension();
|
49 |
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
50 |
+
|
51 |
if ($fileinfo->isFile() )
|
52 |
{
|
53 |
+
if ($extension == 'php')
|
54 |
{
|
55 |
require_once($path);
|
56 |
}
|
57 |
+
elseif($extension == 'tpl')
|
58 |
+
{
|
59 |
$filename = $fileinfo->getBasename('.tpl');
|
60 |
+
$templates[$filename] = array('path' => $path);
|
61 |
}
|
62 |
}
|
63 |
}
|
69 |
foreach($blockArray as $block)
|
70 |
{
|
71 |
if (isset($blockClass[$block]))
|
72 |
+
$newBlocks[$block] = $blockClass[$block];
|
73 |
+
|
74 |
}
|
75 |
}
|
76 |
$blockClass = $newBlocks;
|
77 |
if (is_admin())
|
78 |
{
|
79 |
+
// possible issue with some hosters faking is_admin flag.
|
80 |
if (class_exists( maxUtils::namespaceit('maxBlocks') ) && class_exists( maxUtils::namespaceit('maxBlocks') ) )
|
81 |
{
|
82 |
+
maxField::setTemplates($templates);
|
83 |
|
84 |
}
|
85 |
else
|
86 |
{
|
87 |
+
error_log('[MaxButtons] - MaxField class is not set within admin context. This can cause issues when using button editor');
|
88 |
}
|
89 |
}
|
90 |
+
|
91 |
+
//$this->loadBlockClasses($blockClass);
|
92 |
+
|
93 |
static::$block_classes = array_values($blockClass);
|
94 |
}
|
95 |
+
|
96 |
+
public static function getBlockClasses()
|
97 |
{
|
98 |
if ( is_null(static::$block_classes) )
|
99 |
self::initBlocks();
|
100 |
+
|
101 |
return static::$block_classes;
|
102 |
}
|
103 |
+
|
104 |
+
|
105 |
+
public static function setData($data)
|
106 |
{
|
107 |
+
|
108 |
+
$new_data = array(); //egalite
|
109 |
+
if (! is_array($data) || count($data) == 0) // no data
|
110 |
+
return false;
|
111 |
+
|
112 |
+
foreach($data as $block => $fields)
|
113 |
{
|
114 |
+
if (is_array($fields))
|
115 |
+
$new_data = array_merge($new_data, $fields);
|
116 |
}
|
|
|
117 |
|
118 |
+
|
119 |
+
self::$data = $new_data;
|
120 |
}
|
121 |
+
|
122 |
public static function add($block)
|
123 |
{
|
124 |
+
$name = $block->get_name();
|
125 |
|
126 |
static::$blocks[$name] = $block;
|
127 |
+
static::$fields = array_merge(self::$fields, $block->get_fields());
|
128 |
}
|
129 |
+
|
130 |
+
public static function getValue($fieldname)
|
131 |
{
|
132 |
|
133 |
+
if (isset(self::$data[$fieldname]))
|
134 |
+
return self::$data[$fieldname];
|
135 |
+
if (isset(self::$fields[$fieldname]))
|
136 |
return self::$fields[$fieldname]['default'];
|
137 |
+
|
138 |
+
return false; // dunno.
|
139 |
}
|
140 |
|
141 |
+
public static function getColorValue($fieldname)
|
142 |
{
|
143 |
+
$value = self::getValue($fieldname);
|
144 |
+
if (! $value )
|
145 |
return false;
|
146 |
+
|
147 |
+
if (substr($value,0,1) !== '#')
|
148 |
{
|
149 |
$value = '#' . $value;
|
150 |
}
|
151 |
+
|
152 |
return $value;
|
153 |
+
|
154 |
}
|
155 |
|
156 |
+
public static function getDefault($fieldname)
|
157 |
{
|
158 |
+
if (isset(self::$fields[$fieldname]['default']))
|
159 |
return self::$fields[$fieldname]['default'];
|
160 |
+
|
161 |
return false; // dunno
|
162 |
+
|
163 |
}
|
164 |
|
165 |
|
classes/maxCSSParser.php
CHANGED
@@ -504,9 +504,9 @@ class maxCSSParser
|
|
504 |
|
505 |
function mixin_boxshadow($results, $values)
|
506 |
{
|
507 |
-
$width = $results["box-shadow-width"];
|
508 |
-
$left = $results["box-shadow-offset-left"];
|
509 |
-
$top = $results["box-shadow-offset-top"];
|
510 |
$spread = isset($results['box-shadow-spread']) ? $results['box-shadow-spread'] : 0;
|
511 |
$color = isset($results["box-shadow-color"]) ? $results["box-shadow-color"] : '';
|
512 |
|
504 |
|
505 |
function mixin_boxshadow($results, $values)
|
506 |
{
|
507 |
+
$width = isset($results["box-shadow-width"]) ? $results["box-shadow-width"] : 0;
|
508 |
+
$left = isset($results["box-shadow-offset-left"]) ? $results["box-shadow-offset-left"] : 0;
|
509 |
+
$top = isset($results["box-shadow-offset-top"]) ? $results["box-shadow-offset-top"] : 0;
|
510 |
$spread = isset($results['box-shadow-spread']) ? $results['box-shadow-spread'] : 0;
|
511 |
$color = isset($results["box-shadow-color"]) ? $results["box-shadow-color"] : '';
|
512 |
|
classes/maxbuttons-class.php
CHANGED
@@ -192,7 +192,7 @@ class maxButtonsPlugin
|
|
192 |
register_setting( 'maxbuttons_settings', 'maxbuttons_hidedescription' );
|
193 |
register_setting( 'maxbuttons_settings', 'maxbuttons_forcefa') ;
|
194 |
register_setting( 'maxbuttons_settings', 'maxbuttons_borderbox');
|
195 |
-
register_setting( 'maxbuttons_settings', 'maxbuttons_protocol');
|
196 |
}
|
197 |
|
198 |
protected function checkbox_option($options)
|
@@ -255,11 +255,6 @@ class maxButtonsPlugin
|
|
255 |
//$submenu_function = 'maxbuttons_button';
|
256 |
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
|
257 |
|
258 |
-
// Now add the submenu page for the Export page
|
259 |
-
$submenu_page_title = __('MaxButtons: Social Share', 'maxbuttons');
|
260 |
-
$submenu_title = __('Social Share', 'maxbuttons');
|
261 |
-
$submenu_slug = 'maxbuttons-collections';
|
262 |
-
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
|
263 |
|
264 |
// Now add the submenu page for the Go Pro page
|
265 |
$submenu_page_title = __('MaxButtons: Upgrade to Pro', 'maxbuttons');
|
@@ -282,6 +277,12 @@ class maxButtonsPlugin
|
|
282 |
//$submenu_function = 'maxbuttons_support';
|
283 |
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $admin_capability, $submenu_slug, $submenu_function);
|
284 |
|
|
|
|
|
|
|
|
|
|
|
|
|
285 |
}
|
286 |
|
287 |
function load_admin_page($page)
|
192 |
register_setting( 'maxbuttons_settings', 'maxbuttons_hidedescription' );
|
193 |
register_setting( 'maxbuttons_settings', 'maxbuttons_forcefa') ;
|
194 |
register_setting( 'maxbuttons_settings', 'maxbuttons_borderbox');
|
195 |
+
register_setting( 'maxbuttons_settings', 'maxbuttons_protocol');
|
196 |
}
|
197 |
|
198 |
protected function checkbox_option($options)
|
255 |
//$submenu_function = 'maxbuttons_button';
|
256 |
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
|
257 |
|
|
|
|
|
|
|
|
|
|
|
258 |
|
259 |
// Now add the submenu page for the Go Pro page
|
260 |
$submenu_page_title = __('MaxButtons: Upgrade to Pro', 'maxbuttons');
|
277 |
//$submenu_function = 'maxbuttons_support';
|
278 |
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $admin_capability, $submenu_slug, $submenu_function);
|
279 |
|
280 |
+
// Now add the submenu page for the Export page
|
281 |
+
$submenu_page_title = __('MaxButtons: Share Buttons', 'maxbuttons');
|
282 |
+
$submenu_title = __('Share Buttons', 'maxbuttons');
|
283 |
+
$submenu_slug = 'maxbuttons-collections';
|
284 |
+
$admin_pages[] = add_submenu_page($menu_slug, $submenu_page_title, $submenu_title, $capability, $submenu_slug, $submenu_function);
|
285 |
+
|
286 |
}
|
287 |
|
288 |
function load_admin_page($page)
|
includes/social-share.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
|
17 |
<div class='social-share-move option-container'>
|
18 |
<div class='inside'>
|
19 |
-
<h3>MaxButtons
|
20 |
|
21 |
<p>We created a brand new plugin to make your Social Share experiences better. </p>
|
22 |
|
16 |
|
17 |
<div class='social-share-move option-container'>
|
18 |
<div class='inside'>
|
19 |
+
<h3>MaxButtons Share Buttons</h3>
|
20 |
|
21 |
<p>We created a brand new plugin to make your Social Share experiences better. </p>
|
22 |
|
js/maxbuttons-admin.js
CHANGED
@@ -21,8 +21,8 @@ maxAdmin.prototype = {
|
|
21 |
}; // MaxAdmin
|
22 |
|
23 |
maxAdmin.prototype.init = function () {
|
24 |
-
this.button_id = $('input[name="button_id"]').val();
|
25 |
|
|
|
26 |
// Prevents the output button from being clickable (also in admin list view )
|
27 |
$(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); });
|
28 |
$(document).on('click', '.output .preview-toggle', $.proxy(this.toggle_preview, this));
|
@@ -43,8 +43,8 @@ maxAdmin.prototype.init = function () {
|
|
43 |
// conditionals
|
44 |
$(document).on('reInitConditionals', $.proxy(this.initConditionials, this));
|
45 |
this.initConditionials(); // conditional options
|
46 |
-
|
47 |
// range inputs
|
|
|
48 |
$(document).on('change, input', 'input[type="range"]', $.proxy(this.updateRange, this ));
|
49 |
this.updateRange(null);
|
50 |
|
@@ -114,7 +114,6 @@ maxAdmin.prototype.init = function () {
|
|
114 |
// Expand shortcode tabs for more examples.
|
115 |
$('.shortcode-expand').on('click', this.toggleShortcode);
|
116 |
|
117 |
-
|
118 |
}; // INIT
|
119 |
|
120 |
|
@@ -612,7 +611,6 @@ maxAdmin.prototype.toggleManual = function (e)
|
|
612 |
maxAdmin.prototype.initConditionials = function ()
|
613 |
{
|
614 |
var mAP = this;
|
615 |
-
|
616 |
$('[data-show]').each(function () {
|
617 |
var condition = $(this).data('show');
|
618 |
var target = condition.target;
|
@@ -620,29 +618,38 @@ maxAdmin.prototype.initConditionials = function ()
|
|
620 |
var self = this;
|
621 |
|
622 |
$(document).on('change','[name="' + target + '"]', {child: this, values: values}, $.proxy(mAP.updateConditional, mAP) );
|
|
|
623 |
if ( $('[name="' + target + '"]').length > 1) // trigger change to test condition
|
624 |
{
|
625 |
-
|
626 |
-
$('[name="' + target + '"]:checked').change(['conditional']); // radio button
|
627 |
-
|
628 |
}
|
629 |
else {
|
630 |
$('[name="' + target + '"]').trigger('change', ['conditional']);
|
631 |
}
|
632 |
});
|
633 |
|
634 |
-
|
|
|
|
|
|
|
|
|
|
|
635 |
var condition = $(this).data('has');
|
636 |
var target = condition.target;
|
637 |
var values = condition.values;
|
638 |
-
var self = this;
|
639 |
-
|
640 |
-
$(document).on('change', '[name="' + target + '"]', {target: target, child: this, values: values}, $.proxy(mAP.updateHasConditional, mAP) );
|
641 |
|
642 |
-
|
643 |
|
|
|
|
|
|
|
644 |
});
|
645 |
|
|
|
|
|
|
|
|
|
|
|
646 |
|
647 |
}
|
648 |
|
@@ -667,7 +674,6 @@ maxAdmin.prototype.updateConditional = function (event)
|
|
667 |
value = 'unchecked';
|
668 |
else
|
669 |
value = 0;
|
670 |
-
|
671 |
}
|
672 |
|
673 |
if (cond_values.indexOf(value) >= 0)
|
@@ -695,16 +701,22 @@ maxAdmin.prototype.updateHasConditional = function(event)
|
|
695 |
|
696 |
var hascond = false;
|
697 |
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
708 |
|
709 |
if (hascond)
|
710 |
{
|
21 |
}; // MaxAdmin
|
22 |
|
23 |
maxAdmin.prototype.init = function () {
|
|
|
24 |
|
25 |
+
this.button_id = $('input[name="button_id"]').val();
|
26 |
// Prevents the output button from being clickable (also in admin list view )
|
27 |
$(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); });
|
28 |
$(document).on('click', '.output .preview-toggle', $.proxy(this.toggle_preview, this));
|
43 |
// conditionals
|
44 |
$(document).on('reInitConditionals', $.proxy(this.initConditionials, this));
|
45 |
this.initConditionials(); // conditional options
|
|
|
46 |
// range inputs
|
47 |
+
|
48 |
$(document).on('change, input', 'input[type="range"]', $.proxy(this.updateRange, this ));
|
49 |
this.updateRange(null);
|
50 |
|
114 |
// Expand shortcode tabs for more examples.
|
115 |
$('.shortcode-expand').on('click', this.toggleShortcode);
|
116 |
|
|
|
117 |
}; // INIT
|
118 |
|
119 |
|
611 |
maxAdmin.prototype.initConditionials = function ()
|
612 |
{
|
613 |
var mAP = this;
|
|
|
614 |
$('[data-show]').each(function () {
|
615 |
var condition = $(this).data('show');
|
616 |
var target = condition.target;
|
618 |
var self = this;
|
619 |
|
620 |
$(document).on('change','[name="' + target + '"]', {child: this, values: values}, $.proxy(mAP.updateConditional, mAP) );
|
621 |
+
|
622 |
if ( $('[name="' + target + '"]').length > 1) // trigger change to test condition
|
623 |
{
|
624 |
+
$('[name="' + target + '"]:checked').trigger('change', ['conditional']); // radio / checkbox button
|
|
|
|
|
625 |
}
|
626 |
else {
|
627 |
$('[name="' + target + '"]').trigger('change', ['conditional']);
|
628 |
}
|
629 |
});
|
630 |
|
631 |
+
// problem here is fields having same target, will add the same event over and over //
|
632 |
+
// the target, input array, have a lot of input fields, which all receive the events. this is the issue.
|
633 |
+
|
634 |
+
var updatelist = [];
|
635 |
+
|
636 |
+
$('[data-has]').each(function () {
|
637 |
var condition = $(this).data('has');
|
638 |
var target = condition.target;
|
639 |
var values = condition.values;
|
|
|
|
|
|
|
640 |
|
641 |
+
$('[name="' + target + '"]').on('change', {target: target, child: this, values: values}, $.proxy(mAP.updateHasConditional, mAP) );
|
642 |
|
643 |
+
var targetdecl = '[name="' + target + '"]';
|
644 |
+
if (! $.inArray(targetdecl, updatelist));
|
645 |
+
updatelist.push(targetdecl);
|
646 |
});
|
647 |
|
648 |
+
if (updatelist.length > 0)
|
649 |
+
{
|
650 |
+
// the issue will a lot of event checking still exist..
|
651 |
+
$(updatelist.toString()).first().trigger('change', ['conditional']);
|
652 |
+
}
|
653 |
|
654 |
}
|
655 |
|
674 |
value = 'unchecked';
|
675 |
else
|
676 |
value = 0;
|
|
|
677 |
}
|
678 |
|
679 |
if (cond_values.indexOf(value) >= 0)
|
701 |
|
702 |
var hascond = false;
|
703 |
|
704 |
+
/** The issue here is to change this calls, to searches directly for value form cond_values ( mostly 1-3 options ) and not run the entire DOM each time.
|
705 |
+
*/
|
706 |
+
var filter = [];
|
707 |
+
$(cond_values).each(function (el)
|
708 |
+
{
|
709 |
+
|
710 |
+
filter.push( '[value=' + this + ']');
|
711 |
+
} );
|
712 |
+
|
713 |
+
if ($('[name="' + target + '"]').filter( filter.toString() ).length > 0)
|
714 |
+
{
|
715 |
+
hascond = true;
|
716 |
+
}
|
717 |
+
else {
|
718 |
+
hascond = false
|
719 |
+
}
|
720 |
|
721 |
if (hascond)
|
722 |
{
|
js/maxbuttons_media_button.js
CHANGED
@@ -1,182 +1,184 @@
|
|
1 |
-
var maxMedia;
|
2 |
|
3 |
jQuery(document).ready(function($) {
|
4 |
|
5 |
-
/* Add button for the post editor screen + integrations */
|
6 |
var maxMedia = function() {
|
7 |
|
8 |
this.callback = null; // callback function when clicking 'insert button'
|
9 |
-
this.parent = '#poststuff'; // option parent flag as location to write button window.
|
10 |
-
this.window_loaded = null;
|
11 |
this.maxm = null;
|
12 |
-
this.closeOnCallback = true;
|
13 |
}
|
14 |
|
15 |
/* Default events and callback */
|
16 |
-
maxMedia.prototype.init = function()
|
17 |
{
|
18 |
-
|
19 |
this.maxm = new maxModal();
|
20 |
-
this.maxm.init();
|
21 |
-
|
22 |
$(document).on('click','.maxbutton_media_button',$.proxy(this.clickAddButton, this));
|
23 |
-
this.callback = 'this.buttonToEditor'; // default
|
24 |
}
|
25 |
|
26 |
/* Set the callback after selecting a button in the window */
|
27 |
maxMedia.prototype.setCallback = function (callback)
|
28 |
-
{
|
29 |
-
|
30 |
-
if (typeof callback !== 'function')
|
31 |
{
|
32 |
if (typeof window[callback] === 'function')
|
33 |
callback = window[callback];
|
34 |
-
else if (typeof eval(callback) === 'function')
|
35 |
{
|
36 |
-
callback = eval(callback);
|
37 |
-
}
|
38 |
else
|
39 |
-
return false;
|
40 |
}
|
41 |
|
42 |
this.callback = callback;
|
43 |
}
|
44 |
|
|
|
45 |
maxMedia.prototype.showShortcodeOptions = function(button_id, target)
|
46 |
{
|
47 |
-
this.closeOnCallback = false;
|
48 |
-
|
49 |
-
$currentModal = this.maxm.currentModal;
|
50 |
|
51 |
-
var button = $('[data-button="' + button_id + '"]').find('.shortcode-container');
|
52 |
|
53 |
options = $('<div class="shortcode_options">');
|
54 |
|
55 |
|
56 |
-
$('<input>',
|
57 |
{
|
58 |
'type' : 'hidden',
|
59 |
-
'id' : 'mb_shortcode_id',
|
60 |
-
'name' : 'button_id',
|
61 |
}).val(button_id).appendTo(options);
|
62 |
|
63 |
$('<h3>').text('Shortcode Options').appendTo(options);
|
64 |
-
|
65 |
$('<div class="button_example">').append(button).appendTo(options);
|
66 |
-
|
67 |
-
$('<label>', {
|
68 |
-
'for' : 'mb_shortcode_url',
|
69 |
}).text(mbtrans.short_url_label).appendTo(options);
|
70 |
-
|
71 |
-
|
72 |
-
$('<input>', {
|
73 |
'type' : 'text',
|
74 |
-
'id' : 'mb_shortcode_url',
|
75 |
-
'name' : 'shortcode_url',
|
76 |
'placeholder' : 'http://',
|
77 |
-
}).on('change, keyup',
|
78 |
function (e) {
|
79 |
-
var url = $(e.target).val();
|
80 |
-
$('.button_example').find('.maxbutton').prop('href', url);
|
81 |
}).appendTo(options);
|
82 |
-
|
83 |
|
84 |
-
|
85 |
-
|
|
|
86 |
}).text(mbtrans.short_text_label).appendTo(options);
|
87 |
|
88 |
-
|
89 |
-
$('<input>', {
|
90 |
-
'type' : 'text',
|
91 |
-
'name' : 'shortcode_text',
|
92 |
'id' : 'mb_shortcode_text',
|
93 |
-
}).on('change, keyup',
|
94 |
function (e) {
|
95 |
-
var text = $(e.target).val();
|
96 |
-
$('.button_example').find('.mb-text').text(text);
|
97 |
-
}).appendTo(options);
|
98 |
-
|
99 |
-
$('<p>').text(mbtrans.short_options_explain).appendTo(options);
|
100 |
-
|
101 |
-
$('<input>', {
|
102 |
-
'type' : 'button',
|
103 |
'name' : 'add_shortcode',
|
104 |
'class' : 'button-primary',
|
105 |
-
'value' : mbtrans.short_add_button,
|
|
|
|
|
106 |
|
107 |
-
}).on('click', $.proxy(this.addShortcodeOptions, this)).appendTo(options);
|
108 |
-
|
109 |
-
|
110 |
|
111 |
this.maxm.setContent( options );
|
112 |
-
this.maxm.checkResize();
|
113 |
|
114 |
}
|
115 |
|
|
|
116 |
maxMedia.prototype.addShortcodeOptions = function(e)
|
117 |
{
|
118 |
-
e.preventDefault();
|
119 |
-
|
120 |
-
var url = $('#mb_shortcode_url').val();
|
121 |
-
var text = $('#mb_shortcode_text').val();
|
122 |
-
var button_id = $('#mb_shortcode_id').val();
|
123 |
-
|
124 |
-
this.buttonToEditor(button_id, url, text);
|
125 |
-
|
126 |
-
|
127 |
}
|
128 |
|
129 |
-
|
130 |
-
|
|
|
131 |
e.preventDefault();
|
132 |
-
e.stopPropagation();
|
133 |
-
$(document).off('click','.pagination span'); // prevent multiple events
|
134 |
-
var self = this;
|
135 |
-
|
136 |
-
if (typeof $(e.target).data('callback') !== 'undefined')
|
137 |
{
|
138 |
-
this.setCallback($(e.target).data('callback'));
|
139 |
}
|
140 |
-
|
141 |
-
if (typeof $(e.target).data('parent') !== 'undefined')
|
142 |
{
|
143 |
-
this.parent = $(e.target).data('parent');
|
144 |
-
}
|
145 |
|
146 |
$(document).on('click', '.button-row', $.proxy(function (e)
|
147 |
{
|
148 |
-
var target = $(e.target);
|
149 |
-
|
150 |
if ( typeof $(target).data('button') === 'undefined')
|
151 |
{
|
152 |
target = $(target).parents('.button-row');
|
153 |
}
|
154 |
-
|
155 |
-
var button = $(target).data('button');
|
156 |
-
$('.button-row').removeClass('selected');
|
157 |
-
$(target).addClass('selected');
|
158 |
-
$('.controls .insert').data('button', button);
|
159 |
-
this.maxm.currentModal.find('.controls .insert').removeClass('disabled');
|
160 |
-
},this));
|
161 |
-
|
162 |
$(document).on('click','.pagination span, .pagination-links a', function (e) // eventception
|
163 |
{
|
164 |
e.preventDefault();
|
165 |
if ( $(e.target).hasClass('disabled'))
|
166 |
return false;
|
167 |
-
|
168 |
var page = $(e.target).data('page');
|
169 |
-
if (page <= 1) page = 1;
|
170 |
-
|
171 |
-
self.loadPostEditScreen(page);
|
172 |
});
|
173 |
$(document).on('change', '.input-paging', function (e)
|
174 |
{
|
175 |
-
e.preventDefault();
|
176 |
-
var page = parseInt($(e.target).val());
|
177 |
-
self.loadPostEditScreen(page);
|
178 |
-
});
|
179 |
-
|
180 |
this.loadPostEditScreen(0);
|
181 |
}
|
182 |
|
@@ -184,27 +186,27 @@ maxMedia.prototype.clickAddButton = function (e)
|
|
184 |
// Callback is the add function on button select
|
185 |
maxMedia.prototype.loadPostEditScreen = function(page)
|
186 |
{
|
187 |
-
if (typeof page == 'undefined')
|
188 |
-
page = 0;
|
189 |
-
|
190 |
-
var data = { action: 'getAjaxButtons',
|
191 |
-
paged : page,
|
192 |
//callback: callback,
|
193 |
-
};
|
194 |
var url = mbtrans.ajax_url;
|
195 |
-
var self = this;
|
196 |
-
|
197 |
-
// show load spinner if any
|
198 |
-
$('.media-buttons .loading').css('visibility', 'visible');
|
199 |
-
|
200 |
$.ajax({
|
201 |
url: url,
|
202 |
data: data,
|
203 |
-
success: function (res)
|
204 |
{
|
205 |
self.putResults(res)
|
206 |
-
},
|
207 |
-
|
208 |
});
|
209 |
|
210 |
return false;
|
@@ -212,68 +214,68 @@ maxMedia.prototype.loadPostEditScreen = function(page)
|
|
212 |
maxMedia.prototype.showPostEditScreen = function ()
|
213 |
{
|
214 |
|
215 |
-
this.maxm.parent = this.parent;
|
216 |
-
this.maxm.newModal('media-buttons');
|
217 |
-
|
218 |
-
this.maxm.setTitle(mbtrans.windowtitle);
|
219 |
|
220 |
-
$(document).trigger('mb_media_buttons_open', this.maxm);
|
221 |
|
222 |
-
|
223 |
this.maxm.show();
|
224 |
this.window_loaded = true;
|
225 |
-
|
226 |
}
|
227 |
|
228 |
maxMedia.prototype.putResults = function(res)
|
229 |
{
|
230 |
|
231 |
this.showPostEditScreen();
|
232 |
-
$('.media-buttons .loading').css('visibility', 'hidden');
|
233 |
-
|
234 |
-
this.maxm.addControl('insert', '', $.proxy(this.insertAction, this) );
|
235 |
this.maxm.setContent(res);
|
236 |
this.maxm.setControls();
|
237 |
-
this.maxm.checkResize();
|
|
|
|
|
238 |
|
239 |
-
this.resize();
|
240 |
-
|
241 |
// this feature resizes
|
242 |
-
$(window).on('resize', $.proxy(this.resize, this));
|
243 |
-
|
244 |
-
// events
|
245 |
$(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); }); // prevent button clicks
|
246 |
|
247 |
-
$(document).trigger('mb_media_put_results', [res, this.maxm] );
|
248 |
}
|
249 |
|
250 |
/** Contains the -inner- window to force scrollbar if inner part is bigger. **/
|
251 |
maxMedia.prototype.resize = function(e)
|
252 |
{
|
253 |
-
//contentHeight = this.maxm.currentModal.find('.modal_content').height();
|
254 |
-
|
255 |
-
if (this.maxm.currentModal === null)
|
256 |
-
return; // nothing to resize
|
257 |
-
|
258 |
topHeight = this.maxm.currentModal.find('.modal_header').height() + 17; // padding
|
259 |
-
controlsHeight = this.maxm.currentModal.find('.controls').height() + 21;
|
260 |
-
modalHeight = this.maxm.currentModal.height();
|
261 |
-
|
262 |
this.maxm.currentModal.find('.modal_content').css('height', modalHeight - topHeight - controlsHeight)
|
263 |
-
this.maxm.currentModal.find('.controls .insert').addClass('disabled');
|
264 |
-
|
265 |
}
|
266 |
-
|
267 |
-
|
|
|
268 |
{
|
269 |
-
e.preventDefault();
|
270 |
var button_id = $(e.target).data('button');
|
271 |
if (typeof button_id === 'undefined' || parseInt(button_id) <= 0)
|
272 |
-
return; // no button yet.
|
273 |
-
|
274 |
if (typeof this.callback == 'function')
|
275 |
-
this.callback(button_id, $(e.target) );
|
276 |
-
|
277 |
if (this.closeOnCallback)
|
278 |
{
|
279 |
this.maxm.close();
|
@@ -283,29 +285,29 @@ maxMedia.prototype.insertAction = function(e)
|
|
283 |
|
284 |
maxMedia.prototype.buttonToEditor = function(button_id, url, text)
|
285 |
{
|
286 |
-
var shortcode = '[maxbutton id="' + button_id + '"';
|
287 |
-
|
288 |
if (typeof url !== 'undefined' && url.length > 1)
|
289 |
-
shortcode += ' url="' + url + '"';
|
290 |
-
|
291 |
if (typeof text !== 'undefined' && text.length > 1)
|
292 |
shortcode += ' text="' + text + '"';
|
293 |
|
294 |
-
shortcode += ' ] ';
|
295 |
window.send_to_editor(shortcode);
|
296 |
this.maxm.close();
|
297 |
}
|
298 |
|
299 |
-
maxMedia.prototype.getEditor = function ()
|
300 |
{
|
301 |
|
302 |
var h2style = 'line-height: 32px; padding-left: 40px; background: url("' + mbtrans.icon + '") no-repeat';
|
303 |
-
var cancelstyle = 'margin-left: 10px; margin-top: 10px;';
|
304 |
-
var editor = $('<div>', { id: 'maxbutton-add-button', class: 'content' });
|
305 |
|
306 |
-
//.append( $('<a>', { 'class' : 'button-secondary', 'style' : cancelstyle }).text(mbtrans.cancel)
|
307 |
editor.append( $('<h2>', { 'style' : h2style } ).text(mbtrans.insert) )
|
308 |
-
.append( $('<p>').text(mbtrans.select) )
|
309 |
.append( $('<div>', { id: 'mb_media_buttons' }).append( '<div class="loading"></div>' )
|
310 |
|
311 |
);
|
@@ -320,4 +322,4 @@ window.maxMedia = maxMedia;
|
|
320 |
|
321 |
|
322 |
|
323 |
-
}); // jquery
|
1 |
+
var maxMedia;
|
2 |
|
3 |
jQuery(document).ready(function($) {
|
4 |
|
5 |
+
/* Add button for the post editor screen + integrations */
|
6 |
var maxMedia = function() {
|
7 |
|
8 |
this.callback = null; // callback function when clicking 'insert button'
|
9 |
+
this.parent = '#poststuff'; // option parent flag as location to write button window.
|
10 |
+
this.window_loaded = null;
|
11 |
this.maxm = null;
|
12 |
+
this.closeOnCallback = true;
|
13 |
}
|
14 |
|
15 |
/* Default events and callback */
|
16 |
+
maxMedia.prototype.init = function()
|
17 |
{
|
18 |
+
|
19 |
this.maxm = new maxModal();
|
20 |
+
this.maxm.init();
|
21 |
+
|
22 |
$(document).on('click','.maxbutton_media_button',$.proxy(this.clickAddButton, this));
|
23 |
+
this.callback = 'this.buttonToEditor'; // default
|
24 |
}
|
25 |
|
26 |
/* Set the callback after selecting a button in the window */
|
27 |
maxMedia.prototype.setCallback = function (callback)
|
28 |
+
{
|
29 |
+
|
30 |
+
if (typeof callback !== 'function')
|
31 |
{
|
32 |
if (typeof window[callback] === 'function')
|
33 |
callback = window[callback];
|
34 |
+
else if (typeof eval(callback) === 'function')
|
35 |
{
|
36 |
+
callback = eval(callback);
|
37 |
+
}
|
38 |
else
|
39 |
+
return false;
|
40 |
}
|
41 |
|
42 |
this.callback = callback;
|
43 |
}
|
44 |
|
45 |
+
/** Show the screen for shortcode options, like changing the text and url */
|
46 |
maxMedia.prototype.showShortcodeOptions = function(button_id, target)
|
47 |
{
|
48 |
+
this.closeOnCallback = false;
|
49 |
+
|
50 |
+
$currentModal = this.maxm.currentModal;
|
51 |
|
52 |
+
var button = $('[data-button="' + button_id + '"]').find('.shortcode-container');
|
53 |
|
54 |
options = $('<div class="shortcode_options">');
|
55 |
|
56 |
|
57 |
+
$('<input>',
|
58 |
{
|
59 |
'type' : 'hidden',
|
60 |
+
'id' : 'mb_shortcode_id',
|
61 |
+
'name' : 'button_id',
|
62 |
}).val(button_id).appendTo(options);
|
63 |
|
64 |
$('<h3>').text('Shortcode Options').appendTo(options);
|
65 |
+
|
66 |
$('<div class="button_example">').append(button).appendTo(options);
|
67 |
+
|
68 |
+
$('<label>', {
|
69 |
+
'for' : 'mb_shortcode_url',
|
70 |
}).text(mbtrans.short_url_label).appendTo(options);
|
71 |
+
|
72 |
+
|
73 |
+
$('<input>', {
|
74 |
'type' : 'text',
|
75 |
+
'id' : 'mb_shortcode_url',
|
76 |
+
'name' : 'shortcode_url',
|
77 |
'placeholder' : 'http://',
|
78 |
+
}).on('change, keyup',
|
79 |
function (e) {
|
80 |
+
var url = $(e.target).val();
|
81 |
+
$('.button_example').find('.maxbutton').prop('href', url);
|
82 |
}).appendTo(options);
|
|
|
83 |
|
84 |
+
|
85 |
+
$('<label>', {
|
86 |
+
'for' : 'mb_shortcode_text',
|
87 |
}).text(mbtrans.short_text_label).appendTo(options);
|
88 |
|
89 |
+
|
90 |
+
$('<input>', {
|
91 |
+
'type' : 'text',
|
92 |
+
'name' : 'shortcode_text',
|
93 |
'id' : 'mb_shortcode_text',
|
94 |
+
}).on('change, keyup',
|
95 |
function (e) {
|
96 |
+
var text = $(e.target).val();
|
97 |
+
$('.button_example').find('.mb-text').text(text);
|
98 |
+
}).appendTo(options);
|
99 |
+
|
100 |
+
$('<p>').text(mbtrans.short_options_explain).appendTo(options);
|
101 |
+
|
102 |
+
$('<input>', {
|
103 |
+
'type' : 'button',
|
104 |
'name' : 'add_shortcode',
|
105 |
'class' : 'button-primary',
|
106 |
+
'value' : mbtrans.short_add_button,
|
107 |
+
|
108 |
+
}).on('click', $.proxy(this.addShortcodeOptions, this)).appendTo(options);
|
109 |
|
|
|
|
|
|
|
110 |
|
111 |
this.maxm.setContent( options );
|
112 |
+
this.maxm.checkResize();
|
113 |
|
114 |
}
|
115 |
|
116 |
+
/** Function to add shortcode option to data, then delegate to browser **/
|
117 |
maxMedia.prototype.addShortcodeOptions = function(e)
|
118 |
{
|
119 |
+
e.preventDefault();
|
120 |
+
|
121 |
+
var url = $('#mb_shortcode_url').val();
|
122 |
+
var text = $('#mb_shortcode_text').val();
|
123 |
+
var button_id = $('#mb_shortcode_id').val();
|
124 |
+
|
125 |
+
this.buttonToEditor(button_id, url, text);
|
126 |
+
|
127 |
+
|
128 |
}
|
129 |
|
130 |
+
/** Event that fires when the 'add button' button is clicked **/
|
131 |
+
maxMedia.prototype.clickAddButton = function (e)
|
132 |
+
{
|
133 |
e.preventDefault();
|
134 |
+
e.stopPropagation();
|
135 |
+
$(document).off('click','.pagination span'); // prevent multiple events
|
136 |
+
var self = this;
|
137 |
+
|
138 |
+
if (typeof $(e.target).data('callback') !== 'undefined')
|
139 |
{
|
140 |
+
this.setCallback($(e.target).data('callback'));
|
141 |
}
|
142 |
+
|
143 |
+
if (typeof $(e.target).data('parent') !== 'undefined')
|
144 |
{
|
145 |
+
this.parent = $(e.target).data('parent');
|
146 |
+
}
|
147 |
|
148 |
$(document).on('click', '.button-row', $.proxy(function (e)
|
149 |
{
|
150 |
+
var target = $(e.target);
|
151 |
+
|
152 |
if ( typeof $(target).data('button') === 'undefined')
|
153 |
{
|
154 |
target = $(target).parents('.button-row');
|
155 |
}
|
156 |
+
|
157 |
+
var button = $(target).data('button');
|
158 |
+
$('.button-row').removeClass('selected');
|
159 |
+
$(target).addClass('selected');
|
160 |
+
$('.controls .insert').data('button', button);
|
161 |
+
this.maxm.currentModal.find('.controls .insert').removeClass('disabled');
|
162 |
+
},this));
|
163 |
+
|
164 |
$(document).on('click','.pagination span, .pagination-links a', function (e) // eventception
|
165 |
{
|
166 |
e.preventDefault();
|
167 |
if ( $(e.target).hasClass('disabled'))
|
168 |
return false;
|
169 |
+
|
170 |
var page = $(e.target).data('page');
|
171 |
+
if (page <= 1) page = 1;
|
172 |
+
|
173 |
+
self.loadPostEditScreen(page);
|
174 |
});
|
175 |
$(document).on('change', '.input-paging', function (e)
|
176 |
{
|
177 |
+
e.preventDefault();
|
178 |
+
var page = parseInt($(e.target).val());
|
179 |
+
self.loadPostEditScreen(page);
|
180 |
+
});
|
181 |
+
|
182 |
this.loadPostEditScreen(0);
|
183 |
}
|
184 |
|
186 |
// Callback is the add function on button select
|
187 |
maxMedia.prototype.loadPostEditScreen = function(page)
|
188 |
{
|
189 |
+
if (typeof page == 'undefined')
|
190 |
+
page = 0;
|
191 |
+
|
192 |
+
var data = { action: 'getAjaxButtons',
|
193 |
+
paged : page,
|
194 |
//callback: callback,
|
195 |
+
};
|
196 |
var url = mbtrans.ajax_url;
|
197 |
+
var self = this;
|
198 |
+
|
199 |
+
// show load spinner if any
|
200 |
+
$('.media-buttons .loading').css('visibility', 'visible');
|
201 |
+
|
202 |
$.ajax({
|
203 |
url: url,
|
204 |
data: data,
|
205 |
+
success: function (res)
|
206 |
{
|
207 |
self.putResults(res)
|
208 |
+
},
|
209 |
+
|
210 |
});
|
211 |
|
212 |
return false;
|
214 |
maxMedia.prototype.showPostEditScreen = function ()
|
215 |
{
|
216 |
|
217 |
+
this.maxm.parent = this.parent;
|
218 |
+
this.maxm.newModal('media-buttons');
|
219 |
+
|
220 |
+
this.maxm.setTitle(mbtrans.windowtitle);
|
221 |
|
222 |
+
$(document).trigger('mb_media_buttons_open', this.maxm);
|
223 |
|
|
|
224 |
this.maxm.show();
|
225 |
this.window_loaded = true;
|
226 |
+
|
227 |
}
|
228 |
|
229 |
maxMedia.prototype.putResults = function(res)
|
230 |
{
|
231 |
|
232 |
this.showPostEditScreen();
|
233 |
+
$('.media-buttons .loading').css('visibility', 'hidden');
|
234 |
+
|
235 |
+
this.maxm.addControl('insert', '', $.proxy(this.insertAction, this) );
|
236 |
this.maxm.setContent(res);
|
237 |
this.maxm.setControls();
|
238 |
+
this.maxm.checkResize();
|
239 |
+
|
240 |
+
this.resize();
|
241 |
|
|
|
|
|
242 |
// this feature resizes
|
243 |
+
$(window).on('resize', $.proxy(this.resize, this));
|
244 |
+
|
245 |
+
// events
|
246 |
$(document).on('click', ".maxbutton-preview", function(e) { e.preventDefault(); }); // prevent button clicks
|
247 |
|
248 |
+
$(document).trigger('mb_media_put_results', [res, this.maxm] );
|
249 |
}
|
250 |
|
251 |
/** Contains the -inner- window to force scrollbar if inner part is bigger. **/
|
252 |
maxMedia.prototype.resize = function(e)
|
253 |
{
|
254 |
+
//contentHeight = this.maxm.currentModal.find('.modal_content').height();
|
255 |
+
|
256 |
+
if (this.maxm.currentModal === null)
|
257 |
+
return; // nothing to resize
|
258 |
+
|
259 |
topHeight = this.maxm.currentModal.find('.modal_header').height() + 17; // padding
|
260 |
+
controlsHeight = this.maxm.currentModal.find('.controls').height() + 21;
|
261 |
+
modalHeight = this.maxm.currentModal.height();
|
262 |
+
|
263 |
this.maxm.currentModal.find('.modal_content').css('height', modalHeight - topHeight - controlsHeight)
|
264 |
+
this.maxm.currentModal.find('.controls .insert').addClass('disabled');
|
265 |
+
|
266 |
}
|
267 |
+
|
268 |
+
/** Action to fires when the 'insert button' is clicked in the modal **/
|
269 |
+
maxMedia.prototype.insertAction = function(e)
|
270 |
{
|
271 |
+
e.preventDefault();
|
272 |
var button_id = $(e.target).data('button');
|
273 |
if (typeof button_id === 'undefined' || parseInt(button_id) <= 0)
|
274 |
+
return; // no button yet.
|
275 |
+
|
276 |
if (typeof this.callback == 'function')
|
277 |
+
this.callback(button_id, $(e.target) );
|
278 |
+
|
279 |
if (this.closeOnCallback)
|
280 |
{
|
281 |
this.maxm.close();
|
285 |
|
286 |
maxMedia.prototype.buttonToEditor = function(button_id, url, text)
|
287 |
{
|
288 |
+
var shortcode = '[maxbutton id="' + button_id + '"';
|
289 |
+
|
290 |
if (typeof url !== 'undefined' && url.length > 1)
|
291 |
+
shortcode += ' url="' + url + '"';
|
292 |
+
|
293 |
if (typeof text !== 'undefined' && text.length > 1)
|
294 |
shortcode += ' text="' + text + '"';
|
295 |
|
296 |
+
shortcode += ' ] ';
|
297 |
window.send_to_editor(shortcode);
|
298 |
this.maxm.close();
|
299 |
}
|
300 |
|
301 |
+
maxMedia.prototype.getEditor = function ()
|
302 |
{
|
303 |
|
304 |
var h2style = 'line-height: 32px; padding-left: 40px; background: url("' + mbtrans.icon + '") no-repeat';
|
305 |
+
var cancelstyle = 'margin-left: 10px; margin-top: 10px;';
|
306 |
+
var editor = $('<div>', { id: 'maxbutton-add-button', class: 'content' });
|
307 |
|
308 |
+
//.append( $('<a>', { 'class' : 'button-secondary', 'style' : cancelstyle }).text(mbtrans.cancel)
|
309 |
editor.append( $('<h2>', { 'style' : h2style } ).text(mbtrans.insert) )
|
310 |
+
.append( $('<p>').text(mbtrans.select) )
|
311 |
.append( $('<div>', { id: 'mb_media_buttons' }).append( '<div class="loading"></div>' )
|
312 |
|
313 |
);
|
322 |
|
323 |
|
324 |
|
325 |
+
}); // jquery
|
js/maxmodal.js
CHANGED
@@ -22,10 +22,10 @@ jQuery(document).ready(function($) {
|
|
22 |
|
23 |
maxModal.prototype.init = function()
|
24 |
{
|
25 |
-
|
26 |
this.windowHeight = $(window).height();
|
27 |
this.windowWidth = $(window).width();
|
28 |
|
|
|
29 |
$(document).on('click', '.maxmodal', $.proxy(this.buildModal, this));
|
30 |
$(window).on('resize', $.proxy(this.checkResize, this));
|
31 |
|
22 |
|
23 |
maxModal.prototype.init = function()
|
24 |
{
|
|
|
25 |
this.windowHeight = $(window).height();
|
26 |
this.windowWidth = $(window).width();
|
27 |
|
28 |
+
$(document).off('click', '.maxmodal'); // should be on next update
|
29 |
$(document).on('click', '.maxmodal', $.proxy(this.buildModal, this));
|
30 |
$(window).on('resize', $.proxy(this.checkResize, this));
|
31 |
|
js/min/front.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(o){function t(t){t.preventDefault();var a=o(this).data("popup"),c=o(this).find("a").attr("href"),n=a.width,e=a.height,
|
1 |
+
jQuery(document).ready(function(o){function t(t){t.preventDefault();var a=o(this).data("popup"),c=o(this).find("a").attr("href"),n=a.width,e=a.height,l="toolbar=0,scrollbars=1, location=0, width="+n+",height="+e+",left="+(o(window).width()-n)/2+",top="+(o(window).height()-e)/2;window.open(c,"mb-social-share-window",l).focus(),mbSocialTrack()}function a(t,a){var c=mb_ajax.ajaxurl,n=a.share_url,e=a.network,l=a.collection_id,a=(a.nonce,{block_name:"social",block_action:"ajax_get_count",action:"mbpro_collection_block_front",collection_id:l,collection_type:"social",block_data:{share_url:n,network:e}});o.ajax({type:"POST",url:c,data:a,success:function(a){!function(t,a){var c=o.parseJSON(t),n=o(a).data("onload"),e=parseInt(n.count_threshold),l=parseInt(c.data.count);if(l>=e){var i=n.text,r=n.text2;i=i.replace("{count}",l),i=i.replace("{c}",l),r=r.replace("{count}",l),r=r.replace("{c}",l),o(a).find(".mb-text").html(i),o(a).find(".mb-text2").html(r)}}(a,t)}})}mbSocialTrack=function(o){},"function"==typeof o?(o(".maxcollection .mb-collection-item[data-popup]").on("click",t),o(".maxcollection .mb-collection-item[data-onload]").each(function(){var t=o(this).parents(".maxcollection").data("collection"),c=o(this).data("onload");c.collection_id=t,a(this,c)})):console.log("Maxbuttons : Jquery load conflict.")});
|
js/min/init.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(n){
|
1 |
+
jQuery(document).ready(function(n){void 0===window.maxFoundry&&(window.maxFoundry={}),window.maxFoundry.maxadmin=new maxAdmin,window.maxFoundry.maxadmin.init(),window.maxFoundry.maxmodal=new maxModal,window.maxFoundry.maxmodal.init(),window.maxFoundry.maxcollection=new maxCollection,window.maxFoundry.maxcollection.init()});
|
js/min/maxbuttons-admin.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var maxAdmin;jQuery(document).ready(function($){maxAdmin=function(){return this},maxAdmin.prototype={colorUpdateTime:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("click","[data-buttonaction]",$.proxy(this.button_action,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),$(document).on("change, input",'input[type="range"]',$.proxy(this.updateRange,this)),this.updateRange(null),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$("#maxbuttons .color-field").wpColorPicker({width:300,change:$.proxy(_.throttle(function(t,a){t.preventDefault();var e=a.color.toString();this.update_color(t,a,e)},200),this)}),$(".input.mbcolor .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("input.color-field").on("focus",$.proxy(this.select_field,this)),$("select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxcol_wp.leave_page},this)),$(document).on("keyup","input",function(t){if(t.keyCode&&13==t.keyCode)return $(":input")[$(":input").index(document.activeElement)+1].focus(),!1}),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(e){e.preventDefault(),this.saveIndicator(!0);var target=$(e.target),field=$(target).data("field");if(void 0===field)var id=$(target).attr("id");else var id=field;var data=this.fields[id];void 0!==data&&(void 0!==data.css&&(value=target.val(),void 0!==data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),target.is(":checkbox")&&!target.is(":checked")&&(value=""),this.putCSS(data,value)),void 0!==data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),void 0!==data.func&&eval("this."+data.func+"(target)"))},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.button_action=function(t){t.preventDefault();var a=$(t.target).data("buttonaction");this.form_updated=!1;var e=$(t.target).data("buttonid"),o=$('input[name="'+a+'_nonce"]').val(),n=mb_ajax.ajaxurl,i={action:"mb_button_action",button_action:a,button_id:e,nonce:o};$.post({url:n,data:i,success:function(t){response=JSON.parse(t),void 0!==response.redirection&&(window.location=response.redirection)},error:function(){console.log("error in button action"+a)}})},maxAdmin.prototype.checkCopyModal=function(t){this.form_updated?t.currentModal.find(".mb-message").show():$(t.currentModal).find(".mb-message").hide()},maxAdmin.prototype.toggle_preview=function(t){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,a,e){var o=".maxbutton";if("hover"==(e=e||"both")?o="a.hover ":"normal"==e&&(o="a.normal "),void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=o+" ."+n[i];$(".output .result").find(r).css(t.css,a)}}else $(".output .result").find(o).css(t.css,a)},maxAdmin.prototype.update_color=function(t,a,e){t.preventDefault(),this.saveIndicator(!0);var o=$(t.target);-1===e.indexOf("#")&&(e="#"+e);var n=o.attr("id");if($("#"+n).val(e),-1!==n.indexOf("box_shadow"))this.updateBoxShadow(o);else if(-1!==n.indexOf("text_shadow"))this.updateTextShadow(o);else if(-1!==n.indexOf("gradient"))-1==n.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=n){-1==n.indexOf("hover")?state="normal":state="hover";var i=this.fields[n];return void this.putCSS(i,e,state)}$(".output .result").css("backgroundColor",e)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var a=$(t.target),e=$(t.target).parents("[data-bind]"),o="#"+e.data("id"),n="#"+e.data("bind");if(a.hasClass("arrow-right"))i="right";else var i="left";if(e.hasClass("right"))r="left";else var r="right";"left"==r?copy="right"==i:"right"==r&&(copy="right"!=i),copy?($(n).val($(o).val()),$(n).trigger("change"),$(n).wpColorPicker("color",$(o).val())):($(o).val($(n).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(n).val()))},maxAdmin.prototype.updateGradient=function(t){var a="";(t=t||!1)&&(a="_hover");var e=parseInt($("#gradient_stop").val());isNaN(e)&&(e=45);var o=$("#use_gradient").prop("checked"),n=this.hexToRgb($("#gradient_start_color"+a).val()),i=this.hexToRgb($("#gradient_end_color"+a).val()),r=parseInt($("#gradient_start_opacity"+a).val()),d=parseInt($("#gradient_end_opacity"+a).val());if(o||(i=n,d=r),isNaN(r)&&(r=100),isNaN(d)&&(d=100),t)s=$(".output .result").find("a.hover");else var s=$(".output .result").find("a.normal");s.css("background","linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-moz-linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-o-linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-webkit-gradient(linear, left top, left bottom, color-stop("+e+"%, rgba("+n+","+r/100+")), color-stop(1, rgba("+i+","+d/100+") ));")},maxAdmin.prototype.hexToRgb=function(t){t=t.replace("#","");var a=parseInt(t,16);return(a>>16&255)+","+(a>>8&255)+","+(255&a)},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var a=$("#box_shadow_offset_left").val(),e=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),n=$("#box_shadow_spread").val(),i=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();$(".output .result").find("a.normal").css("boxShadow",a+"px "+e+"px "+o+"px "+n+"px "+i),$(".output .result").find("a.hover").css("boxShadow",a+"px "+e+"px "+o+"px "+n+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,a){a=a||!1;var e=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),n=$("#text_shadow_width").val(),i=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),d=$(t).attr("id"),s=this.fields[d];s.css="textShadow";var l=e+"px "+o+"px "+n+"px "+i;this.putCSS(s,l,"normal"),l=e+"px "+o+"px "+n+"px "+r,this.putCSS(s,l,"hover")},maxAdmin.prototype.updateAnchorText=function(t){0===$(".output .result").find("a .mb-text").length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(t){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var a=$(t).val(),e=$(t).attr("id"),o=this.fields[e];a>0?this.putCSS(o,a):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var a=t.val(),e=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<e.length;i++){var o=e[i];$("#"+o).val(a);var n=this.fields[o];this.putCSS(n,a+"px")}},maxAdmin.prototype.toggleRadiusLock=function(t){var a=$(t.target),e=$(a).data("lock");"lock"==e?($(a).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(a).data("lock","unlock")):"unlock"==e&&($(a).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(a).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive($),window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var a=parseInt($(t.target).val());if(a<=parseInt($(t.target).attr("max"))){var e=$(t.target).data("url");window.location=e+"&paged="+a}},maxAdmin.prototype.toggleShortcode=function(t){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var a=$(t.target),e=a.data("target"),o=$('.manual-entry[data-manual="'+e+'"]');if(o.is(":visible"))return o.hide(),!0;var n=$('[data-options="'+e+'"]').position().top+a.height();o.css("top",n),o.css("right",15),o.css("left","auto"),o.show()},maxAdmin.prototype.initConditionials=function(){var t=this;$("[data-show]").each(function(){var a=$(this).data("show"),e=a.target,o=a.values;$(document).on("change",'[name="'+e+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+e+'"]').length>1?$('[name="'+e+'"]:checked').change(["conditional"]):$('[name="'+e+'"]').trigger("change",["conditional"])}),$("[data-has]").each(function(){var a=$(this).data("has"),e=a.target,o=a.values;$(document).on("change",'[name="'+e+'"]',{target:e,child:this,values:o},$.proxy(t.updateHasConditional,t)),$('[name="'+e+'"]').trigger("change",["conditional"])})},maxAdmin.prototype.updateConditional=function(t){var a=t.data,e=a.values,o=a.child,n=$(t.currentTarget),i=$(n).val();if("checkbox"===n.attr("type")){var r=$(n).prop("checked");i="checked"==e&&r?"checked":"unchecked"!=e||r?0:"unchecked"}e.indexOf(i)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.updateHasConditional=function(t){var a=t.data,e=a.values,o=a.child,n=a.target,i=!1;$('[name="'+n+'"]').each(function(){var t=$(this).val();if(e.indexOf(t)>=0)return i=!0,!1}),i?$(o).fadeIn("fast"):$(o).fadeOut("fast")},maxAdmin.prototype.updateRange=function(t){if(void 0===t||null===t)a=$('input[type="range"]');else var a=[t.target];$(a).each(function(){var t=$(this).val();$(this).parents(".input").find(".range_value output").val(t+"%")})},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=!!t},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var a=mb_ajax.ajaxurl,e=$(t.target).serialize();$.ajax({type:"POST",url:a,data:e}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var a=$.parseJSON(t),e=a.result,o=a.title,n=a.data.id;if(void 0!==a.data.new_nonce){a.data.new_nonce;$('input[name="nonce"]').val(a.data.new_nonce)}if(e){$('input[name="collection_id"]').val(n);var i=window.location.href;-1===i.indexOf("collection_id")&&window.history.replaceState({},"",i+"&collection_id="+n),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),a.data.reload&&document.location.reload(!0)}e||($modal=window.maxFoundry.maxmodal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(a.body),$modal.setControls('<button class="modal_close button-primary">'+a.close_text+"</button>"),$modal.show())}});
|
1 |
+
var maxAdmin;jQuery(document).ready(function($){maxAdmin=function(){return this},maxAdmin.prototype={colorUpdateTime:!0,fields:null,button_id:null,form_updated:!1,tabs:null},maxAdmin.prototype.init=function(){this.button_id=$('input[name="button_id"]').val(),$(document).on("click",".maxbutton-preview",function(t){t.preventDefault()}),$(document).on("click",".output .preview-toggle",$.proxy(this.toggle_preview,this)),$("#maxbuttons .input-paging").on("change",$.proxy(this.do_paging,this)),$(".manual-toggle").on("click",$.proxy(this.toggleManual,this)),$(".manual-entry").draggable({cancel:"p, li"}),$(document).on("submit","form.mb_ajax_save",$.proxy(this.formAjaxSave,this)),$(document).on("click","[data-buttonaction]",$.proxy(this.button_action,this)),$(document).on("reInitConditionals",$.proxy(this.initConditionials,this)),this.initConditionials(),$(document).on("change, input",'input[type="range"]',$.proxy(this.updateRange,this)),this.updateRange(null),0!=$("#new-button-form").length&&(this.button_id>0&&$("#maxbuttons .mb-message").show(),this.initResponsive(),$("#maxbuttons .output").draggable({cancel:".nodrag"}),$("#maxbuttons .color-field").wpColorPicker({width:300,change:$.proxy(_.throttle(function(t,a){t.preventDefault();var e=a.color.toString();this.update_color(t,a,e)},200),this)}),$(".input.mbcolor .arrows").on("click",$.proxy(this.copyColor,this)),$("#radius_toggle").on("click",$.proxy(this.toggleRadiusLock,this)),"undefined"!=typeof buttonFieldMap&&(this.fields=$.parseJSON(buttonFieldMap)),$("input").not(".color-field").on("keyup change",$.proxy(this.update_preview,this)),$("input.color-field").on("focus",$.proxy(this.select_field,this)),$("select").on("change",$.proxy(this.update_preview,this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxcol_wp.leave_page},this)),$(document).on("keyup","input",function(t){if(t.keyCode&&13==t.keyCode)return $(":input")[$(":input").index(document.activeElement)+1].focus(),!1}),$(".button-save").click($.proxy(function(){return this.saveIndicator(!1),$("#new-button-form").submit(),!1},this)),$(".shortcode-expand").on("click",this.toggleShortcode))},maxAdmin.prototype.repaint_preview=function(){$('.mb_tab input[type="text"]').trigger("change"),$('.mb_tab input[type="number"]').trigger("change"),$(".mb_tab select").trigger("change"),$('.mb_tab input[type="hidden"]').trigger("change"),$('.mb_tab input[type="radio"]:checked').trigger("change"),$('.mb_tab input[type="checkbox"]:checked').trigger("change")},maxAdmin.prototype.update_preview=function(e){e.preventDefault(),this.saveIndicator(!0);var target=$(e.target),field=$(target).data("field");if(void 0===field)var id=$(target).attr("id");else var id=field;var data=this.fields[id];void 0!==data&&(void 0!==data.css&&(value=target.val(),void 0!==data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),target.is(":checkbox")&&!target.is(":checked")&&(value=""),this.putCSS(data,value)),void 0!==data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),void 0!==data.func&&eval("this."+data.func+"(target)"))},maxAdmin.prototype.select_field=function(t){$(t.target).select()},maxAdmin.prototype.button_action=function(t){t.preventDefault();var a=$(t.target).data("buttonaction");this.form_updated=!1;var e=$(t.target).data("buttonid"),o=$('input[name="'+a+'_nonce"]').val(),n=mb_ajax.ajaxurl,i={action:"mb_button_action",button_action:a,button_id:e,nonce:o};$.post({url:n,data:i,success:function(t){response=JSON.parse(t),void 0!==response.redirection&&(window.location=response.redirection)},error:function(){console.log("error in button action"+a)}})},maxAdmin.prototype.checkCopyModal=function(t){this.form_updated?t.currentModal.find(".mb-message").show():$(t.currentModal).find(".mb-message").hide()},maxAdmin.prototype.toggle_preview=function(t){$(".output .inner").is(":hidden")?($(".output .inner").show(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up")):($(".output .inner").hide(),$(".output").css("height","auto"),$(".preview .preview-toggle").removeClass("dashicons-arrow-up").addClass("dashicons-arrow-down"))},maxAdmin.prototype.putCSS=function(t,a,e){var o=".maxbutton";if("hover"==(e=e||"both")?o="a.hover ":"normal"==e&&(o="a.normal "),void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var r=o+" ."+n[i];$(".output .result").find(r).css(t.css,a)}}else $(".output .result").find(o).css(t.css,a)},maxAdmin.prototype.update_color=function(t,a,e){t.preventDefault(),this.saveIndicator(!0);var o=$(t.target);-1===e.indexOf("#")&&(e="#"+e);var n=o.attr("id");if($("#"+n).val(e),-1!==n.indexOf("box_shadow"))this.updateBoxShadow(o);else if(-1!==n.indexOf("text_shadow"))this.updateTextShadow(o);else if(-1!==n.indexOf("gradient"))-1==n.indexOf("hover")?this.updateGradient():this.updateGradient(!0);else{if("button_preview"!=n){-1==n.indexOf("hover")?state="normal":state="hover";var i=this.fields[n];return void this.putCSS(i,e,state)}$(".output .result").css("backgroundColor",e)}},maxAdmin.prototype.copyColor=function(t){t.preventDefault(),t.stopPropagation();var a=$(t.target),e=$(t.target).parents("[data-bind]"),o="#"+e.data("id"),n="#"+e.data("bind");if(a.hasClass("arrow-right"))i="right";else var i="left";if(e.hasClass("right"))r="left";else var r="right";"left"==r?copy="right"==i:"right"==r&&(copy="right"!=i),copy?($(n).val($(o).val()),$(n).trigger("change"),$(n).wpColorPicker("color",$(o).val())):($(o).val($(n).val()),$(o).trigger("change"),$(o).wpColorPicker("color",$(n).val()))},maxAdmin.prototype.updateGradient=function(t){var a="";(t=t||!1)&&(a="_hover");var e=parseInt($("#gradient_stop").val());isNaN(e)&&(e=45);var o=$("#use_gradient").prop("checked"),n=this.hexToRgb($("#gradient_start_color"+a).val()),i=this.hexToRgb($("#gradient_end_color"+a).val()),r=parseInt($("#gradient_start_opacity"+a).val()),d=parseInt($("#gradient_end_opacity"+a).val());if(o||(i=n,d=r),isNaN(r)&&(r=100),isNaN(d)&&(d=100),t)s=$(".output .result").find("a.hover");else var s=$(".output .result").find("a.normal");s.css("background","linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-moz-linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-o-linear-gradient( rgba("+n+","+r/100+") "+e+"%, rgba("+i+","+d/100+") )"),s.css("background","-webkit-gradient(linear, left top, left bottom, color-stop("+e+"%, rgba("+n+","+r/100+")), color-stop(1, rgba("+i+","+d/100+") ));")},maxAdmin.prototype.hexToRgb=function(t){t=t.replace("#","");var a=parseInt(t,16);return(a>>16&255)+","+(a>>8&255)+","+(255&a)},maxAdmin.prototype.updateBoxShadow=function(t){t=t||null;var a=$("#box_shadow_offset_left").val(),e=$("#box_shadow_offset_top").val(),o=$("#box_shadow_width").val(),n=$("#box_shadow_spread").val(),i=$("#box_shadow_color").val(),r=$("#box_shadow_color_hover").val();$(".output .result").find("a.normal").css("boxShadow",a+"px "+e+"px "+o+"px "+n+"px "+i),$(".output .result").find("a.hover").css("boxShadow",a+"px "+e+"px "+o+"px "+n+"px "+r)},maxAdmin.prototype.updateTextShadow=function(t,a){a=a||!1;var e=$("#text_shadow_offset_left").val(),o=$("#text_shadow_offset_top").val(),n=$("#text_shadow_width").val(),i=$("#text_shadow_color").val(),r=$("#text_shadow_color_hover").val(),d=$(t).attr("id"),s=this.fields[d];s.css="textShadow";var l=e+"px "+o+"px "+n+"px "+i;this.putCSS(s,l,"normal"),l=e+"px "+o+"px "+n+"px "+r,this.putCSS(s,l,"hover")},maxAdmin.prototype.updateAnchorText=function(t){0===$(".output .result").find("a .mb-text").length&&($(".output .result").find("a").append('<span class="mb-text"></span>'),$(".output .result").find("a .mb-text").css({display:"block","line-height":"1em","box-sizing":"border-box"}),this.repaint_preview()),$(".output .result").find("a .mb-text").text(t.val())},maxAdmin.prototype.updateGradientOpacity=function(t){this.updateGradient(!0),this.updateGradient(!1)},maxAdmin.prototype.updateDimension=function(t){var a=$(t).val(),e=$(t).attr("id"),o=this.fields[e];a>0?this.putCSS(o,a):this.putCSS(o,"auto")},maxAdmin.prototype.updateRadius=function(t){var a=t.val(),e=["radius_bottom_left","radius_bottom_right","radius_top_left","radius_top_right"];if("lock"==$("#radius_toggle").data("lock"))for(i=0;i<e.length;i++){var o=e[i];$("#"+o).val(a);var n=this.fields[o];this.putCSS(n,a+"px")}},maxAdmin.prototype.toggleRadiusLock=function(t){var a=$(t.target),e=$(a).data("lock");"lock"==e?($(a).removeClass("dashicons-lock").addClass("dashicons-unlock"),$(a).data("lock","unlock")):"unlock"==e&&($(a).removeClass("dashicons-unlock").addClass("dashicons-lock"),$(a).data("lock","lock"))},maxAdmin.prototype.initResponsive=function(){window.maxFoundry.maxadmin.responsive=new mbResponsive($),window.maxFoundry.maxadmin.responsive.init(this)},maxAdmin.prototype.do_paging=function(t){var a=parseInt($(t.target).val());if(a<=parseInt($(t.target).attr("max"))){var e=$(t.target).data("url");window.location=e+"&paged="+a}},maxAdmin.prototype.toggleShortcode=function(t){$(".shortcode-expand").hasClass("closed")?($(" .mb-message.shortcode .expanded").css("display","inline-block"),$(".shortcode-expand span").removeClass("dashicons-arrow-down").addClass("dashicons-arrow-up"),$(".shortcode-expand").removeClass("closed").addClass("open")):($(" .mb-message.shortcode .expanded").css("display","none"),$(".shortcode-expand span").addClass("dashicons-arrow-down").removeClass("dashicons-arrow-up"),$(".shortcode-expand").addClass("closed").removeClass("open"))},maxAdmin.prototype.toggleManual=function(t){t.preventDefault();var a=$(t.target),e=a.data("target"),o=$('.manual-entry[data-manual="'+e+'"]');if(o.is(":visible"))return o.hide(),!0;var n=$('[data-options="'+e+'"]').position().top+a.height();o.css("top",n),o.css("right",15),o.css("left","auto"),o.show()},maxAdmin.prototype.initConditionials=function(){var t=this;$("[data-show]").each(function(){var a=$(this).data("show"),e=a.target,o=a.values;$(document).on("change",'[name="'+e+'"]',{child:this,values:o},$.proxy(t.updateConditional,t)),$('[name="'+e+'"]').length>1?$('[name="'+e+'"]:checked').trigger("change",["conditional"]):$('[name="'+e+'"]').trigger("change",["conditional"])});var a=[];$("[data-has]").each(function(){var e=$(this).data("has"),o=e.target,n=e.values;$('[name="'+o+'"]').on("change",{target:o,child:this,values:n},$.proxy(t.updateHasConditional,t));var i='[name="'+o+'"]';$.inArray(i,a),a.push(i)}),a.length>0&&$(a.toString()).first().trigger("change",["conditional"])},maxAdmin.prototype.updateConditional=function(t){var a=t.data,e=a.values,o=a.child,n=$(t.currentTarget),i=$(n).val();if("checkbox"===n.attr("type")){var r=$(n).prop("checked");i="checked"==e&&r?"checked":"unchecked"!=e||r?0:"unchecked"}e.indexOf(i)>=0?($(o).fadeIn("fast"),$(o).find("input, select").trigger("change")):($(o).fadeOut("fast"),$(o).find("input, select").trigger("change"))},maxAdmin.prototype.updateHasConditional=function(t){var a=t.data,e=a.values,o=a.child,n=a.target,i=[];$(e).each(function(t){i.push("[value="+this+"]")}),$('[name="'+n+'"]').filter(i.toString()).length>0?$(o).fadeIn("fast"):$(o).fadeOut("fast")},maxAdmin.prototype.updateRange=function(t){if(void 0===t||null===t)a=$('input[type="range"]');else var a=[t.target];$(a).each(function(){var t=$(this).val();$(this).parents(".input").find(".range_value output").val(t+"%")})},maxAdmin.prototype.saveIndicator=function(t){this.form_updated=!!t},maxAdmin.prototype.formAjaxSave=function(t){t.preventDefault();var a=mb_ajax.ajaxurl,e=$(t.target).serialize();$.ajax({type:"POST",url:a,data:e}).done($.proxy(this.saveDone,this))},maxAdmin.prototype.saveDone=function(t){$("[data-form]").prop("disabled",!1);var a=$.parseJSON(t),e=a.result,o=a.title,n=a.data.id;if(void 0!==a.data.new_nonce){a.data.new_nonce;$('input[name="nonce"]').val(a.data.new_nonce)}if(e){$('input[name="collection_id"]').val(n);var i=window.location.href;-1===i.indexOf("collection_id")&&window.history.replaceState({},"",i+"&collection_id="+n),$(document).trigger("mbFormSaved");var r=$('input[name="sorted"]').val();$('input[name="previous_selection"]').val(r),a.data.reload&&document.location.reload(!0)}e||($modal=window.maxFoundry.maxmodal,$modal.newModal("collection_error"),$modal.setTitle(o),$modal.setContent(a.body),$modal.setControls('<button class="modal_close button-primary">'+a.close_text+"</button>"),$modal.show())}});
|
js/min/maxcollections.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var maxCollection;jQuery(document).ready(function($){maxCollection=function(){},maxCollection.prototype={fields:"",form_updated:!1,modalCurrentPage:0,item_maxwidth:0},maxCollection.prototype.init=function(){$(".collection_remove").on("click",$.proxy(this.confirmRemoveCollection,this)),0!=$("#collection_edit").length&&($(".mb-preview-window").draggable(),$(".button-picker .picker-wrapper").on("click",$.proxy(this.addButtontoCollection,this)),$(document).on("click",".sortable.buttons .button-remove",$.proxy(this.removeButton,this)),"undefined"!=typeof collectionFieldMap&&(this.fields=$.parseJSON(collectionFieldMap)),$(document).on("keyup",'.mb_ajax_save input[type="text"]',$.proxy(this.update_preview,this)),$(document).on("keyup change",".mb_ajax_save input",$.proxy(this.update_preview,this)),$(document).on("change",".mb_ajax_save select",$.proxy(this.update_preview,this)),this.initSortable(),$(document).on("click",'button[name="picker_popup"]',$.proxy(this.togglePickerPopup,this)),$(document).on("updatePreviewWindow",$.proxy(this.updatePlacement,this)),$(document).on("mbFormSaved",$.proxy(function(){this.form_updated=!1,this.toggleSaveIndicator(!1)},this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxcol_wp.leave_page},this)),$(document).on("click","#exportCollection",$.proxy(this.exportCollection,this)),this.updatePlacement(),this.updatePlacement(),""==$('input[name="sorted"]').val()&&this.togglePickerPopup())},maxCollection.prototype.addButtontoCollection=function(t){var e=$(t).clone(),o=e.data("id");e.find(".button_name").remove();var a=e,i=a.find(".button_data").text();a.find(".button_data").remove(),a.append('<input type="hidden" name="button-data-'+o+'" value="'+i+'">'),this.addButtontoPreview(e.clone()),$(a).appendTo(".mb_collection_selection .sortable "),$(".mb_collection_selection .sortable").sortable("refresh");var n=$(".mb_collection_selection .sortable").sortable("toArray",{attribute:"data-id"}),c=n.length;n=n.toString(),$('input[name="sorted"]').val(n),$.proxy(this.updateColPreview({action:"new_button",data:i,button_id:o,button_count:c}),this)},maxCollection.prototype.updateColPreview=function(t){if(void 0!==t.action)var e=t.action;else e="";var o=$('input[name="block_nonce"]').val(),a=$('input[name="collection_id"]').val(),i=$('input[name="collection_type"]').val(),n=t.button_count-1;if("new_button"==e){var c={block_name:"social",block_action:"ajax_new_button",action:"mbpro_collection_block",nonce:o,collection_id:a,collection_type:i,block_data:{data:t.data,button_id:t.button_id,index:n}};$.proxy(this.ajaxNewButton(c),this)}},maxCollection.prototype.addButtontoPreview=function(t){t.find("input").remove(),t.find(".dashicons").remove();var e=t.data("id");$("<span class='mb-collection-item' data-id='"+e+"'></span>").append(t.children()).appendTo(".mb-preview-window .maxcollection"),this.updatePlacement()},maxCollection.prototype.ajaxNewButton=function(t){var e=mb_ajax.ajaxurl;$.ajax({type:"POST",url:e,data:t}).done($.proxy(this.ajaxNewButtonDone,this))},maxCollection.prototype.ajaxNewButtonDone=function(t){var e=$.parseJSON(t);$('.mb_tab[data-tab="social-options"]').children(".inside").append(e.body),$(".no-buttons").hide(),$(document).trigger("reInitConditionals")},maxCollection.prototype.update_preview=function(e){e.preventDefault(),this.toggleSaveIndicator(!0);var target=$(e.target),id=$(target).attr("id");void 0!==$(target).data("target")&&(id=$(target).data("target"));var data=this.fields[id];void 0!==data&&(void 0!==data.css&&(value=target.val(),void 0!==data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),this.putCSS(data,value)),void 0!==data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),void 0!==data.func&&eval("this."+data.func+"(target)"),this.updatePlacement())},maxCollection.prototype.putCSS=function(t,e,o){o=o||"both";var a=".maxcollection";if(void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var c=n[i];if(a!=="."+c)l=a+" ."+c;else var l=a;$(".mb-preview-wrapper").find(l).css(t.css,e)}}else $(".output .result").find(a).css(t.css,e)},maxCollection.prototype.updatePlacement=function(){var t=$("#orientation").val();if(void 0!==t&&"auto"!==t)this.pushPreview(t);else if("auto"==t){var e=$("#placement").val();t="static-left"==e||"static-right"==e?"vertical":"horizontal",this.pushPreview(t)}},maxCollection.prototype.updateCollectionName=function(){var t=$("#collection_name").val();t=t.MBescapeHTML();var e=$(".mb-message.shortcode").html();e&&(e=e.replace(/\[maxcollection name="(.*)"]/gi,'[maxcollection name="'+t+'"]'),$(".mb-message.shortcode").html(e))};var __entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};String.prototype.MBescapeHTML=function(){return String(this).replace(/[&<>"'\/]/g,function(t){return __entityMap[t]})},maxCollection.prototype.parseTags=function(t){var e=$(t).parents(".social-option"),o=$(".social-option").index(e),a=$(".mb-preview-window .mb-collection-item").eq(o),i=$(e).find(".maxbutton"),n={network_name:$(e).find('[data-target="network"] :selected').text(),count:0},c=$(a).find(".mb-text"),l=$(a).find(".mb-text2"),r=$(i).find(".mb-text").text(),d=$(i).find(".mb-text2").text();$(c).text(r),$(l).text(d),this.replaceTags(c,n),this.replaceTags(l,n)},maxCollection.prototype.replaceTags=function(t,e){var o=$(t).text();void 0===$(t).data("original")?$(t).data("original",o):o=$(t).data("original"),$.each(e,function(e,a){o=o.replace("{"+e+"}",a),$(t).text(o)})},maxCollection.prototype.pushPreview=function(t){var e=$(".mb-preview-window.output"),o=$(".mb-preview-window .mb-collection-item"),a=$(".mb-preview-window .maxcollection").height()+75;o.css("float","left"),"relative"!=e.css("position")&&("horizontal"==t&&(e.css("width",$("#maxbuttons").css("width")),e.css("top","auto"),e.css("bottom","10px"),e.css("height",a+"px"),e.css("right","10px"),e.css("left","auto"),o.css("clear","none")),"vertical"==t&&(e.css("width","30%"),e.css("right","20px"),e.css("top","25%"),e.css("height",a+"px"),e.css("left","auto"),e.css("bottom","auto"),o.css("clear","both")))},maxCollection.prototype.exportCollection=function(){var t={block_name:"export",block_action:"export",action:"mbpro_collection_block",nonce:$('input[name="block_nonce"]').val(),collection_id:$('input[name="collection_id"]').val(),collection_type:$('input[name="collection_type"]').val(),block_data:{}},e=mb_ajax.ajaxurl;$.ajax({type:"POST",url:e,data:t}).done(function(t){var e=$.parseJSON(t).data.location;window.location.href=e})},maxCollection.prototype.checkPicker=function(){$(".mb_collection_picker").is(":visible")&&this.initButtonPicker()},maxCollection.prototype.initSortable=function(){var t=this;$(".mb_collection_selection .sortable").sortable({placeholder:"sortable-placeholder",connectWith:".maxcollection",start:function(t,e){iBefore=e.item.index()},create:function(t,e){var o=$(this).sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(o),$('input[name="previous_selection"]').val(o)},update:function(e,o){iAfter=o.item.index();var a=$(this).sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(a),t.updateListOrder(".maxcollection .mb-collection-item",iBefore,iAfter),t.updateListOrder(".social_block .social-option",iBefore,iAfter)}})},maxCollection.prototype.removeButton=function(t){t.preventDefault();$('input[name="sorted"]').val();var e=$(t.currentTarget).parents(".item"),o=$(".mb_collection_selection .sortable .item").index(e);$(t.currentTarget).parents(".item").remove(),$(".maxcollection .mb-collection-item:eq("+o+")").remove(),$(".social_block .social-option:eq("+o+")").remove(),$(".mb_collection_selection .sortable").sortable("refresh");var a=$(".mb_collection_selection .sortable").sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(a),this.toggleSaveIndicator(!0)},maxCollection.prototype.updateListOrder=function(t,e,o){if(this.toggleSaveIndicator(!0),evictee=$(t+":eq("+o+")"),evictor=$(t+":eq("+e+")"),evictee.replaceWith(evictor),iBefore>iAfter?evictor.after(evictee):evictor.before(evictee),".social_block .social-option"==t)$(t).each(function(t){var e=$(this).data("id"),o=$(this).html(),a=new RegExp("-"+e+"-\\d","gi");o=o.replace(a,"-"+e+"-"+t),$(this).html(o)})},maxCollection.prototype.confirmRemoveCollection=function(t){var e=$(t.target).parents(".collection").data("id"),o=$(t.target).parents(".collection").data("blocknonce"),a=$(t.target).parents(".collection").data("type"),i=$(".remove_action_title").text(),n="<p>"+$(".remove_action_text").text()+"</p>",c=window.maxFoundry.maxmodal;c.newModal("collection_remove"),c.setTitle(i),c.setContent(n),c.addControl("yes",{collection_id:e,nonce:o,collection_type:a},$.proxy(this.removeCollection,this)),c.addControl("no","",$.proxy(c.close,c)),c.setControls(),c.show()},maxCollection.prototype.removeCollection=function(t){var e=t.data.collection_id,o={block_name:"collection",block_action:"delete",action:"mbpro_collection_block",nonce:t.data.nonce,collection_id:e,collection_type:t.data.collection_type,block_data:{}},a=mb_ajax.ajaxurl;$.ajax({type:"POST",url:a,data:o}).done(function(t){var e=$.parseJSON(t),o=window.maxFoundry.maxmodal,a=e.data.title,i=e.data.body,n=e.data.collection_id;o.newModal("collection_removed"),o.setTitle(a),o.setContent(i),o.addControl("ok","",$.proxy(o.close,o)),o.setControls(),o.show(),$(".collection-"+n).hide()})},maxCollection.prototype.togglePickerPopup=function(t){var e=window.maxFoundry.maxmodal,o=$("#picker-modal").html();e.newModal("picker-modal"),e.setTitle(maxcol_wp.picker_title),e.setContent(o),e.show(),modal=e.get(),$(modal).off("click change keyup"),$(modal).on("click",".picker-packages a",$.proxy(this.getModalButtons,this)),$(modal).on("click",".picker-main .screen .item",$.proxy(this.toggleInSelection,this)),$(modal).on("click",".modal_close",$.proxy(e.close,e)),$(modal).on("click",".clear-selection",$.proxy(this.modalClearSelection,this)),$(modal).on("click",'button[name="add-buttons"]',$.proxy(this.modalAddButtons,this)),$(modal).on("click",".button-remove",$.proxy(this.modalDeleteButton,this)),$(modal).on("click",".pagination-links a",$.proxy(this.modalLoadPage,this)),$(modal).on("change keyup",".pagination-links input",$.proxy(this.modalLoadPage,this)),0==$(modal).find(".picker-main .current-screen").length&&$(modal).find(".picker-packages ul li a:first").trigger("click")},maxCollection.prototype.getModalButtons=function(t){t.preventDefault();var e=window.maxFoundry.maxmodal.get(),o=$(t.target),a=$(t.target).data("pack"),i=$(t.target).data("pack-loaded");if(void 0!==i&&i)return $(e).find(".picker-main .screen").hide().removeClass("current-screen"),$(e).find(".picker-main .screen-"+a).show().addClass("current-screen"),this.modalEqualHeight(),$(e).find(".picker-packages ul li a").removeClass("pack-active"),void $(t.target).addClass("pack-active");var n=$('input[name="collection_id"]').val(),c=$('input[name="collection_type"]').val(),l={block_name:"collection",block_action:"ajax_getButtons",action:"mbpro_collection_block",nonce:$('input[name="block_nonce"]').val(),collection_id:n,collection_type:c,block_data:{pack:a}},r=mb_ajax.ajaxurl,d=this;$.ajax({type:"POST",url:r,data:l}).done(function(t){d.modalLoadButtons(t,a,o)})},maxCollection.prototype.modalLoadButtons=function(t,e,o){var a=this,i=window.maxFoundry.maxmodal.get();$(i).find(".picker-main .screen").hide().removeClass("current-screen");var n=$.parseJSON(t);if(0==$(i).find(".picker-main .screen-"+e).length){c=$('<div class="screen screen-'+e+'">');$(i).find(".picker-main").append(c)}else var c=$(i).find(" .picker-main .screen-"+e);c.html(n.body),$(i).find(".picker-main .screen-"+e).show().addClass("current-screen"),setTimeout($.proxy(function(){$(i).find(".picker-main .current-screen .item").each(function(){a.modalScaleButton(this)})},this),400),this.modalEqualHeight(),$(o).data("pack-loaded",!0),$(i).find(".picker-packages ul li a").removeClass("pack-active"),$(o).addClass("pack-active"),$(document).trigger("mb-modalLoadButtons")},maxCollection.prototype.modalLoadPage=function(t){if(t.preventDefault(),void 0===(e=$(t.target).data("page"))){if("number"!=t.target.type)return;var e=$(t.target).val()}var o=$('input[name="collection_id"]').val(),a=$('input[name="collection_type"]').val(),i=$('input[name="block_nonce"]').val(),n=$(".picker-packages a.pack-active").data("pack"),c=$(".picker-packages a.pack-active"),l={block_name:"collection",block_action:"ajax_getButtons",action:"mbpro_collection_block",nonce:i,collection_id:o,collection_type:a,block_data:{pack:n,paged:e}},r=mb_ajax.ajaxurl,d=this;$.ajax({type:"POST",url:r,data:l}).done(function(t){d.modalLoadButtons(t,n,c)})},maxCollection.prototype.toggleInSelection=function(t){var e=$(t.target),o=window.maxFoundry.maxmodal.get();if(!e.hasClass("item"))e=$(t.target).parents(".item");var a=$(e).data("id");if($(o).find(".picker-inselection .items").children('[data-id="'+a+'"]').length>0)return $(e).find(".button-selected").remove(),$(o).find(".picker-inselection .items").children('[data-id="'+a+'"]').remove(),void this.modalUpdateCount();var i=$(e).clone();$(i).find(".dashicons").remove(),$(i).css("height","100%"),$(i).css("width","40px"),$(i).find("a").css("verticalAlign","middle"),0==$(e).children(".button-selected").length&&$(e).append('<div class="button-selected"><span class="dashicons dashicons-yes">'),i.append('<div class="button-remove"><span class="dashicons dashicons-no">'),$(o).find(".picker-inselection .items").append(i),this.modalScaleButton(i),this.modalUpdateCount()},maxCollection.prototype.modalEqualHeight=function(t){var e=0;$(modal).find(".picker-main .current-screen .item").each(function(){$(this).height()>e&&(e=$(this).height())}),e>0&&$(modal).find(".picker-main .current-screen .item").height(e)},maxCollection.prototype.modalScaleButton=function(t){var e=$(t).width();$(t).css("width","100%");var o=$(t).find("a"),a=$(o).width(),n=$(o).height();if($(t).css("width",e),!(e>=a)){var c=e/a;c=c.toFixed(2);var l=$(t).find("a"),r="width: calc("+a+"px * "+c+")!important; height: calc("+n+"px * "+c+") !important;";l.css("cssText",r),l.children(".mb-text").each(function(){$(this).css("fontSize");var t=["font-size","padding-left","padding-right","padding-top","padding-bottom"],e="";for(i=0;i<t.length;i++)if(parseInt($(this).css(t[i]))>0){var o=$(this).css(t[i]);e+=t[i]+": calc("+o+" * "+c+") !important; "}$(this).css("cssText",e)}),$icon=l.children(".mb-icon");var d=$icon.width(),s=$icon.height(),p="width: calc("+d+"px * "+c+") !important; height: calc("+s+"px * "+c+") !important;";$icon.css("cssText",p);var m=$icon.children("img");if(m.length>0){var d=m.width(),s=m.height(),p="width: calc("+d+"px * "+c+") !important; height: calc("+s+"px * "+c+") !important;";m.css("cssText",p)}}},maxCollection.prototype.unScaleButton=function(t){t.find("a, .mb-text, .mb-icon, img").css("cssText",""),t.css("cssText","")},maxCollection.prototype.modalClearSelection=function(t){var e=window.maxFoundry.maxmodal.get();$(e).find(".picker-inselection .items").html(""),$(e).find(".screen .item .button-selected").remove(),this.modalUpdateCount()},maxCollection.prototype.modalAddButtons=function(t){t.preventDefault;var e=this,o=window.maxFoundry.maxmodal,a=window.maxFoundry.maxmodal.get();$(a).find(".picker-inselection .items .item").each(function(){var t=$(this).clone().wrap("<div>").parent().html(),o=$(t);e.unScaleButton(o),e.addButtontoCollection(o)}),o.close(),this.modalClearSelection()},maxCollection.prototype.modalUpdateCount=function(t){var e=window.maxFoundry.maxmodal.get(),o=$(e).find(".picker-inselection .items .item").length;$(e).find(".picker-inselection .info .count").text(o),0==o?$(e).find(".picker-inselection .info").hide():$(e).find(".picker-inselection .info").show()},maxCollection.prototype.modalDeleteButton=function(t){var e=$(t.target).parents(".item"),o=e.data("id");$(".picker-main").find('[data-id="'+o+'"]').children(".button-selected").remove(),e.remove(),this.modalUpdateCount()},maxCollection.prototype.toggleSaveIndicator=function(t){t?(this.form_updated=!0,$(".save-indicator").css("display","block").addClass("dashicons-warning").removeClass("dashicons-yes")):$(".save-indicator").removeClass("dashicons-warning").addClass("dashicons-yes")}});
|
1 |
+
var maxCollection;jQuery(document).ready(function($){maxCollection=function(){},maxCollection.prototype={fields:"",form_updated:!1,modalCurrentPage:0,item_maxwidth:0},maxCollection.prototype.init=function(){$(".collection_remove").on("click",$.proxy(this.confirmRemoveCollection,this)),0!=$("#collection_edit").length&&($(".mb-preview-window").draggable(),$(".button-picker .picker-wrapper").on("click",$.proxy(this.addButtontoCollection,this)),$(document).on("click",".sortable.buttons .button-remove",$.proxy(this.removeButton,this)),"undefined"!=typeof collectionFieldMap&&(this.fields=$.parseJSON(collectionFieldMap)),$(document).on("keyup",'.mb_ajax_save input[type="text"]',$.proxy(this.update_preview,this)),$(document).on("keyup change",".mb_ajax_save input",$.proxy(this.update_preview,this)),$(document).on("change",".mb_ajax_save select",$.proxy(this.update_preview,this)),this.initSortable(),$(document).on("click",'button[name="picker_popup"]',$.proxy(this.togglePickerPopup,this)),$(document).on("updatePreviewWindow",$.proxy(this.updatePlacement,this)),$(document).on("mbFormSaved",$.proxy(function(){this.form_updated=!1,this.toggleSaveIndicator(!1)},this)),$(window).on("beforeunload",$.proxy(function(){if(this.form_updated)return maxcol_wp.leave_page},this)),$(document).on("click","#exportCollection",$.proxy(this.exportCollection,this)),this.updatePlacement(),this.updatePlacement(),""==$('input[name="sorted"]').val()&&this.togglePickerPopup())},maxCollection.prototype.addButtontoCollection=function(t){var e=$(t).clone(),o=e.data("id");e.find(".button_name").remove();var a=e,i=a.find(".button_data").text();a.find(".button_data").remove(),a.append('<input type="hidden" name="button-data-'+o+'" value="'+i+'">'),this.addButtontoPreview(e.clone()),$(a).appendTo(".mb_collection_selection .sortable "),$(".mb_collection_selection .sortable").sortable("refresh");var n=$(".mb_collection_selection .sortable").sortable("toArray",{attribute:"data-id"}),c=n.length;n=n.toString(),$('input[name="sorted"]').val(n),$.proxy(this.updateColPreview({action:"new_button",data:i,button_id:o,button_count:c}),this)},maxCollection.prototype.updateColPreview=function(t){if(void 0!==t.action)var e=t.action;else e="";var o=$('input[name="block_nonce"]').val(),a=$('input[name="collection_id"]').val(),i=$('input[name="collection_type"]').val(),n=t.button_count-1;if("new_button"==e){var c={block_name:"social",block_action:"ajax_new_button",action:"mbpro_collection_block",nonce:o,collection_id:a,collection_type:i,block_data:{data:t.data,button_id:t.button_id,index:n}};$.proxy(this.ajaxNewButton(c),this)}},maxCollection.prototype.addButtontoPreview=function(t){t.find("input").remove(),t.find(".dashicons").remove();var e=t.data("id");$("<span class='mb-collection-item' data-id='"+e+"'></span>").append(t.children()).appendTo(".mb-preview-window .maxcollection"),this.updatePlacement()},maxCollection.prototype.ajaxNewButton=function(t){var e=mb_ajax.ajaxurl;$.ajax({type:"POST",url:e,data:t}).done($.proxy(this.ajaxNewButtonDone,this))},maxCollection.prototype.ajaxNewButtonDone=function(t){var e=$.parseJSON(t);$('.mb_tab[data-tab="social-options"]').children(".inside").append(e.body),$(".no-buttons").hide(),$(document).trigger("reInitConditionals")},maxCollection.prototype.update_preview=function(e){e.preventDefault(),this.toggleSaveIndicator(!0);var target=$(e.target),id=$(target).attr("id");void 0!==$(target).data("target")&&(id=$(target).data("target"));var data=this.fields[id];void 0!==data&&(void 0!==data.css&&(value=target.val(),void 0!==data.css_unit&&-1==value.indexOf(data.css_unit)&&(value+=data.css_unit),this.putCSS(data,value)),void 0!==data.attr&&$(".output .result").find("a").attr(data.attr,target.val()),void 0!==data.func&&eval("this."+data.func+"(target)"),this.updatePlacement())},maxCollection.prototype.putCSS=function(t,e,o){o=o||"both";var a=".maxcollection";if(void 0!==t.csspart){var n=t.csspart.split(",");for(i=0;i<n.length;i++){var c=n[i];if(a!=="."+c)l=a+" ."+c;else var l=a;$(".mb-preview-wrapper").find(l).css(t.css,e)}}else $(".output .result").find(a).css(t.css,e)},maxCollection.prototype.updatePlacement=function(){var t=$("#orientation").val();if(void 0!==t&&"auto"!==t)this.pushPreview(t);else if("auto"==t){var e=$("#placement").val();t="static-left"==e||"static-right"==e?"vertical":"horizontal",this.pushPreview(t)}},maxCollection.prototype.updateCollectionName=function(){var t=$("#collection_name").val();t=t.MBescapeHTML();var e=$(".mb-message.shortcode").html();e&&(e=e.replace(/\[maxcollection name="(.*)"]/gi,'[maxcollection name="'+t+'"]'),$(".mb-message.shortcode").html(e))};var __entityMap={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};String.prototype.MBescapeHTML=function(){return String(this).replace(/[&<>"'\/]/g,function(t){return __entityMap[t]})},maxCollection.prototype.parseTags=function(t){var e=$(t).parents(".social-option"),o=$(".social-option").index(e),a=$(".mb-preview-window .mb-collection-item").eq(o),i=$(e).find(".maxbutton"),n={network_name:$(e).find('[data-target="network"] :selected').text(),count:0},c=$(a).find(".mb-text"),l=$(a).find(".mb-text2"),r=$(i).find(".mb-text").text(),d=$(i).find(".mb-text2").text();$(c).text(r),$(l).text(d),this.replaceTags(c,n),this.replaceTags(l,n)},maxCollection.prototype.replaceTags=function(t,e){var o=$(t).text();void 0===$(t).data("original")?$(t).data("original",o):o=$(t).data("original"),$.each(e,function(e,a){o=o.replace("{"+e+"}",a),$(t).text(o)})},maxCollection.prototype.pushPreview=function(t){var e=$(".mb-preview-window.output"),o=$(".mb-preview-window .mb-collection-item"),a=$(".mb-preview-window .maxcollection").height()+75;o.css("float","left"),"relative"!=e.css("position")&&("horizontal"==t&&(e.css("width",$("#maxbuttons").css("width")),e.css("top","auto"),e.css("bottom","10px"),e.css("height",a+"px"),e.css("right","10px"),e.css("left","auto"),o.css("clear","none")),"vertical"==t&&(e.css("width","30%"),e.css("right","20px"),e.css("top","25%"),e.css("height",a+"px"),e.css("left","auto"),e.css("bottom","auto"),o.css("clear","both")))},maxCollection.prototype.exportCollection=function(){var t={block_name:"export",block_action:"export",action:"mbpro_collection_block",nonce:$('input[name="block_nonce"]').val(),collection_id:$('input[name="collection_id"]').val(),collection_type:$('input[name="collection_type"]').val(),block_data:{}},e=mb_ajax.ajaxurl;$.ajax({type:"POST",url:e,data:t}).done(function(t){var e=$.parseJSON(t).data.location;window.location.href=e})},maxCollection.prototype.checkPicker=function(){$(".mb_collection_picker").is(":visible")&&this.initButtonPicker()},maxCollection.prototype.initSortable=function(){var t=this;$(".mb_collection_selection .sortable").sortable({placeholder:"sortable-placeholder",connectWith:".maxcollection",start:function(t,e){iBefore=e.item.index()},create:function(t,e){var o=$(this).sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(o),$('input[name="previous_selection"]').val(o)},update:function(e,o){iAfter=o.item.index();var a=$(this).sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(a),t.updateListOrder(".maxcollection .mb-collection-item",iBefore,iAfter),t.updateListOrder(".social_block .social-option",iBefore,iAfter)}})},maxCollection.prototype.removeButton=function(t){t.preventDefault();$('input[name="sorted"]').val();var e=$(t.currentTarget).parents(".item"),o=$(".mb_collection_selection .sortable .item").index(e);$(t.currentTarget).parents(".item").remove(),$(".maxcollection .mb-collection-item:eq("+o+")").remove(),$(".social_block .social-option:eq("+o+")").remove(),$(".mb_collection_selection .sortable").sortable("refresh");var a=$(".mb_collection_selection .sortable").sortable("toArray",{attribute:"data-id"}).toString();$('input[name="sorted"]').val(a),this.toggleSaveIndicator(!0)},maxCollection.prototype.updateListOrder=function(t,e,o){if(this.toggleSaveIndicator(!0),evictee=$(t+":eq("+o+")"),evictor=$(t+":eq("+e+")"),evictee.replaceWith(evictor),iBefore>iAfter?evictor.after(evictee):evictor.before(evictee),".social_block .social-option"==t)$(t).each(function(t){var e=$(this).data("id"),o=$(this).html(),a=new RegExp("-"+e+"-\\d","gi");o=o.replace(a,"-"+e+"-"+t),$(this).html(o)})},maxCollection.prototype.confirmRemoveCollection=function(t){var e=$(t.target).parents(".collection").data("id"),o=$(t.target).parents(".collection").data("blocknonce"),a=$(t.target).parents(".collection").data("type"),i=$(".remove_action_title").text(),n="<p>"+$(".remove_action_text").text()+"</p>",c=window.maxFoundry.maxmodal;c.newModal("collection_remove"),c.setTitle(i),c.setContent(n),c.addControl("yes",{collection_id:e,nonce:o,collection_type:a},$.proxy(this.removeCollection,this)),c.addControl("no","",$.proxy(c.close,c)),c.setControls(),c.show()},maxCollection.prototype.removeCollection=function(t){var e=t.data.collection_id,o={block_name:"collection",block_action:"delete",action:"mbpro_collection_block",nonce:t.data.nonce,collection_id:e,collection_type:t.data.collection_type,block_data:{}},a=mb_ajax.ajaxurl;$.ajax({type:"POST",url:a,data:o}).done(function(t){var e=$.parseJSON(t),o=window.maxFoundry.maxmodal,a=e.data.title,i=e.data.body,n=e.data.collection_id;o.newModal("collection_removed"),o.setTitle(a),o.setContent(i),o.addControl("ok","",$.proxy(o.close,o)),o.setControls(),o.show(),$(".collection-"+n).hide()})},maxCollection.prototype.togglePickerPopup=function(t){var e=window.maxFoundry.maxmodal,o=$("#picker-modal").html();e.newModal("picker-modal"),e.setTitle(maxcol_wp.picker_title),e.setContent(o),e.show(),modal=e.get(),$(modal).off("click change keyup"),$(modal).on("click",".picker-packages a",$.proxy(this.getModalButtons,this)),$(modal).on("click",".picker-main .screen .item",$.proxy(this.toggleInSelection,this)),$(modal).on("click",".modal_close",$.proxy(e.close,e)),$(modal).on("click",".clear-selection",$.proxy(this.modalClearSelection,this)),$(modal).on("click",'button[name="add-buttons"]',$.proxy(this.modalAddButtons,this)),$(modal).on("click",".button-remove",$.proxy(this.modalDeleteButton,this)),$(modal).on("click",".pagination-links a",$.proxy(this.modalLoadPage,this)),$(modal).on("change keyup",".pagination-links input",$.proxy(this.modalLoadPage,this)),0==$(modal).find(".picker-main .current-screen").length&&$(modal).find(".picker-packages ul li a:first").trigger("click")},maxCollection.prototype.getModalButtons=function(t){t.preventDefault();var e=window.maxFoundry.maxmodal.get(),o=$(t.target),a=$(t.target).data("pack"),i=$(t.target).data("pack-loaded");if(void 0!==i&&i)return $(e).find(".picker-main .screen").hide().removeClass("current-screen"),$(e).find(".picker-main .screen-"+a).show().addClass("current-screen"),this.modalEqualHeight(),$(e).find(".picker-packages ul li a").removeClass("pack-active"),void $(t.target).addClass("pack-active");var n=$('input[name="collection_id"]').val(),c=$('input[name="collection_type"]').val(),l={block_name:"collection",block_action:"ajax_getButtons",action:"mbpro_collection_block",nonce:$('input[name="block_nonce"]').val(),collection_id:n,collection_type:c,block_data:{pack:a}},r=mb_ajax.ajaxurl,d=this;$.ajax({type:"POST",url:r,data:l}).done(function(t){d.modalLoadButtons(t,a,o)})},maxCollection.prototype.modalLoadButtons=function(t,e,o){var a=this,i=window.maxFoundry.maxmodal.get();$(i).find(".picker-main .screen").hide().removeClass("current-screen");var n=$.parseJSON(t);if(0==$(i).find(".picker-main .screen-"+e).length){c=$('<div class="screen screen-'+e+'">');$(i).find(".picker-main").append(c)}else var c=$(i).find(" .picker-main .screen-"+e);c.html(n.body),$(i).find(".picker-main .screen-"+e).show().addClass("current-screen"),setTimeout($.proxy(function(){$(i).find(".picker-main .current-screen .item").each(function(){a.modalScaleButton(this)})},this),400),this.modalEqualHeight(),$(o).data("pack-loaded",!0),$(i).find(".picker-packages ul li a").removeClass("pack-active"),$(o).addClass("pack-active"),$(document).trigger("mb-modalLoadButtons")},maxCollection.prototype.modalLoadPage=function(t){t.preventDefault();if(void 0===(e=$(t.target).data("page"))){if("number"!=t.target.type)return;var e=$(t.target).val()}var o=$('input[name="collection_id"]').val(),a=$('input[name="collection_type"]').val(),i=$('input[name="block_nonce"]').val(),n=$(".picker-packages a.pack-active").data("pack"),c=$(".picker-packages a.pack-active"),l={block_name:"collection",block_action:"ajax_getButtons",action:"mbpro_collection_block",nonce:i,collection_id:o,collection_type:a,block_data:{pack:n,paged:e}},r=mb_ajax.ajaxurl,d=this;$.ajax({type:"POST",url:r,data:l}).done(function(t){d.modalLoadButtons(t,n,c)})},maxCollection.prototype.toggleInSelection=function(t){var e=$(t.target),o=window.maxFoundry.maxmodal.get();if(!e.hasClass("item"))e=$(t.target).parents(".item");var a=$(e).data("id");if($(o).find(".picker-inselection .items").children('[data-id="'+a+'"]').length>0)return $(e).find(".button-selected").remove(),$(o).find(".picker-inselection .items").children('[data-id="'+a+'"]').remove(),void this.modalUpdateCount();var i=$(e).clone();$(i).find(".dashicons").remove(),$(i).css("height","100%"),$(i).css("width","40px"),$(i).find("a").css("verticalAlign","middle"),0==$(e).children(".button-selected").length&&$(e).append('<div class="button-selected"><span class="dashicons dashicons-yes">'),i.append('<div class="button-remove"><span class="dashicons dashicons-no">'),$(o).find(".picker-inselection .items").append(i),this.modalScaleButton(i),this.modalUpdateCount()},maxCollection.prototype.modalEqualHeight=function(t){var e=0;$(modal).find(".picker-main .current-screen .item").each(function(){$(this).height()>e&&(e=$(this).height())}),e>0&&$(modal).find(".picker-main .current-screen .item").height(e)},maxCollection.prototype.modalScaleButton=function(t){var e=$(t).width();$(t).css("width","100%");var o=$(t).find("a"),a=$(o).width(),n=$(o).height();if($(t).css("width",e),!(e>=a)){var c=e/a;c=c.toFixed(2);var l=$(t).find("a"),r="width: calc("+a+"px * "+c+")!important; height: calc("+n+"px * "+c+") !important;";l.css("cssText",r),l.children(".mb-text").each(function(){$(this).css("fontSize");var t=["font-size","padding-left","padding-right","padding-top","padding-bottom"],e="";for(i=0;i<t.length;i++)if(parseInt($(this).css(t[i]))>0){var o=$(this).css(t[i]);e+=t[i]+": calc("+o+" * "+c+") !important; "}$(this).css("cssText",e)}),$icon=l.children(".mb-icon");var d=$icon.width(),s=$icon.height(),p="width: calc("+d+"px * "+c+") !important; height: calc("+s+"px * "+c+") !important;";$icon.css("cssText",p);var m=$icon.children("img");if(m.length>0){var d=m.width(),s=m.height(),p="width: calc("+d+"px * "+c+") !important; height: calc("+s+"px * "+c+") !important;";m.css("cssText",p)}}},maxCollection.prototype.unScaleButton=function(t){t.find("a, .mb-text, .mb-icon, img").css("cssText",""),t.css("cssText","")},maxCollection.prototype.modalClearSelection=function(t){var e=window.maxFoundry.maxmodal.get();$(e).find(".picker-inselection .items").html(""),$(e).find(".screen .item .button-selected").remove(),this.modalUpdateCount()},maxCollection.prototype.modalAddButtons=function(t){t.preventDefault;var e=this,o=window.maxFoundry.maxmodal,a=window.maxFoundry.maxmodal.get();$(a).find(".picker-inselection .items .item").each(function(){var t=$(this).clone().wrap("<div>").parent().html(),o=$(t);e.unScaleButton(o),e.addButtontoCollection(o)}),o.close(),this.modalClearSelection()},maxCollection.prototype.modalUpdateCount=function(t){var e=window.maxFoundry.maxmodal.get(),o=$(e).find(".picker-inselection .items .item").length;$(e).find(".picker-inselection .info .count").text(o),0==o?$(e).find(".picker-inselection .info").hide():$(e).find(".picker-inselection .info").show()},maxCollection.prototype.modalDeleteButton=function(t){var e=$(t.target).parents(".item"),o=e.data("id");$(".picker-main").find('[data-id="'+o+'"]').children(".button-selected").remove(),e.remove(),this.modalUpdateCount()},maxCollection.prototype.toggleSaveIndicator=function(t){t?(this.form_updated=!0,$(".save-indicator").css("display","block").addClass("dashicons-warning").removeClass("dashicons-yes")):$(".save-indicator").removeClass("dashicons-warning").addClass("dashicons-yes")}});
|
js/min/maxmodal.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
var maxModal;jQuery(document).ready(function(t){(maxModal=function(){}).prototype={currentModal:null,modals:[],controls:[],parent:"#maxbuttons",multiple:!1,windowHeight:!1,windowWidth:!1,setWidth:!1,setHeight:!1,target:!1},maxModal.prototype.init=function(){this.windowHeight=t(window).height(),this.windowWidth=t(window).width(),t(document).on("click",".maxmodal",t.proxy(this.buildModal,this)),t(window).on("resize",t.proxy(this.checkResize,this))},maxModal.prototype.focus=function(){this.currentModal.show()},maxModal.prototype.get=function(){return this.currentModal},maxModal.prototype.show=function(){t(".maxmodal_overlay").remove(),t("body").removeClass("max-modal-active"),this.writeOverlay(),this.setWidth&&this.currentModal.width(this.setWidth),this.setHeight&&this.currentModal.height(this.setHeight);var o=this.currentModal.height(),e=this.currentModal.width(),a=(this.windowHeight-o)/2,i=(this.windowWidth-e)/2;a<30&&(a=30),o>this.windowHeight&&this.currentModal.height(this.windowHeight-a-5+"px"),this.currentModal.css("left",i+"px"),this.currentModal.css("top",a+"px"),this.currentModal.css("height",o),this.currentModal.show(),t(".maxmodal_overlay").show(),t("body").addClass("max-modal-active"),t(document).off("keydown",t.proxy(this.keyPressHandler,this)),t(document).on("keydown",t.proxy(this.keyPressHandler,this)),this.currentModal.focus()},maxModal.prototype.keyPressHandler=function(t){27===t.keyCode&&this.close()},maxModal.prototype.checkResize=function(){this.windowHeight=t(window).height(),this.windowWidth=t(window).width(),null!==this.currentModal&&(this.currentModal.removeAttr("style"),this.currentModal.find(".modal_content").removeAttr("style"),this.show())},maxModal.prototype.close=function(){this.currentModal.trigger("modal_close",[this]),this.currentModal.remove(),this.currentModal=null,t(".maxmodal_overlay").remove(),t("body").removeClass("max-modal-active"),t(document).off("keydown",t.proxy(this.keyPressHandler,this))},maxModal.prototype.fadeOut=function(t){void 0==typeof t&&(t=600);var o=this;this.currentModal.fadeOut(t,function(){o.close()})},maxModal.prototype.setTitle=function(t){this.currentModal.find(".modal_title").text(t)},maxModal.prototype.setControls=function(o){var e=this.currentModal.find(".modal_content"),a=t('<div class="controls">');for(i=0;i<this.controls.length;i++)a.append(this.controls[i]);void 0!==o&&a.append(o),e.append(a),t(this.currentModal).find(".modal_close").off("click"),t(this.currentModal).find(".modal_close").on("click",t.proxy(this.close,this))},maxModal.prototype.addControl=function(o,e,a){var i="";switch(o){case"yes":i=modaltext.yes;break;case"ok":i=modaltext.ok;break;case"no":i=modaltext.no;break;case"cancel":i=modaltext.cancel;break;case"insert":i=mbtrans.insert}var d=t('<a class="button-primary '+o+'">'+i+"</a>");d.on("click",e,a),this.controls.push(d)},maxModal.prototype.setContent=function(t){this.currentModal.find(".modal_content").html(t)},maxModal.prototype.buildModal=function(o){o.preventDefault();var e=t(o.target);void 0===e.data("modal")&&(e=e.parents(".maxmodal")),this.target=e;var a=e.data("modal"),i=t("#"+a);void 0!==i.data("width")?this.setWidth=i.data("width"):this.setWidth=!1,void 0!==i.data("height")?this.setHeight=i.data("height"):this.setHeight=!1;var d=t(i).find(".title").text(),s=t(i).find(".controls").html(),n=t(i).find(".content").html();if(this.newModal(a),this.setTitle(d),this.setContent(n),this.setControls(s),void 0!==t(i).data("load")){var l=i.data("load")+"(modal)",r=new Function("modal",l);try{r(this)}catch(t){console.log("MB Modal Callback Error: "+t.message),console.log("MB Mobdal tried calling: "+l)}}this.show()},maxModal.prototype.newModal=function(o){null!==this.currentModal&&this.close();var e=t('<div class="max-modal '+o+'" > \t\t\t\t\t\t <div class="modal_header"> \t\t\t\t\t\t\t <div class="modal_close dashicons dashicons-no"></div><h3 class="modal_title"></h3> \t\t\t\t\t\t </div> \t\t\t\t\t\t <div class="inner modal_content"></div>\t\t\t\t\t </div>');return t(this.parent).length>0?t(this.parent).append(e):t("body").append(e),t(e).draggable({handle:".modal_header"}),this.modals.push(e),this.currentModal=e,this.controls=[],this},maxModal.prototype.writeOverlay=function(){t(this.parent).append('<div class="maxmodal_overlay"></div>'),t(".maxmodal_overlay").on("click",t.proxy(this.close,this))}});
|
1 |
+
var maxModal;jQuery(document).ready(function(t){(maxModal=function(){}).prototype={currentModal:null,modals:[],controls:[],parent:"#maxbuttons",multiple:!1,windowHeight:!1,windowWidth:!1,setWidth:!1,setHeight:!1,target:!1},maxModal.prototype.init=function(){this.windowHeight=t(window).height(),this.windowWidth=t(window).width(),t(document).off("click",".maxmodal"),t(document).on("click",".maxmodal",t.proxy(this.buildModal,this)),t(window).on("resize",t.proxy(this.checkResize,this))},maxModal.prototype.focus=function(){this.currentModal.show()},maxModal.prototype.get=function(){return this.currentModal},maxModal.prototype.show=function(){t(".maxmodal_overlay").remove(),t("body").removeClass("max-modal-active"),this.writeOverlay(),this.setWidth&&this.currentModal.width(this.setWidth),this.setHeight&&this.currentModal.height(this.setHeight);var o=this.currentModal.height(),e=this.currentModal.width(),a=(this.windowHeight-o)/2,i=(this.windowWidth-e)/2;a<30&&(a=30),o>this.windowHeight&&this.currentModal.height(this.windowHeight-a-5+"px"),this.currentModal.css("left",i+"px"),this.currentModal.css("top",a+"px"),this.currentModal.css("height",o),this.currentModal.show(),t(".maxmodal_overlay").show(),t("body").addClass("max-modal-active"),t(document).off("keydown",t.proxy(this.keyPressHandler,this)),t(document).on("keydown",t.proxy(this.keyPressHandler,this)),this.currentModal.focus()},maxModal.prototype.keyPressHandler=function(t){27===t.keyCode&&this.close()},maxModal.prototype.checkResize=function(){this.windowHeight=t(window).height(),this.windowWidth=t(window).width(),null!==this.currentModal&&(this.currentModal.removeAttr("style"),this.currentModal.find(".modal_content").removeAttr("style"),this.show())},maxModal.prototype.close=function(){this.currentModal.trigger("modal_close",[this]),this.currentModal.remove(),this.currentModal=null,t(".maxmodal_overlay").remove(),t("body").removeClass("max-modal-active"),t(document).off("keydown",t.proxy(this.keyPressHandler,this))},maxModal.prototype.fadeOut=function(t){void 0==typeof t&&(t=600);var o=this;this.currentModal.fadeOut(t,function(){o.close()})},maxModal.prototype.setTitle=function(t){this.currentModal.find(".modal_title").text(t)},maxModal.prototype.setControls=function(o){var e=this.currentModal.find(".modal_content"),a=t('<div class="controls">');for(i=0;i<this.controls.length;i++)a.append(this.controls[i]);void 0!==o&&a.append(o),e.append(a),t(this.currentModal).find(".modal_close").off("click"),t(this.currentModal).find(".modal_close").on("click",t.proxy(this.close,this))},maxModal.prototype.addControl=function(o,e,a){var i="";switch(o){case"yes":i=modaltext.yes;break;case"ok":i=modaltext.ok;break;case"no":i=modaltext.no;break;case"cancel":i=modaltext.cancel;break;case"insert":i=mbtrans.insert}var d=t('<a class="button-primary '+o+'">'+i+"</a>");d.on("click",e,a),this.controls.push(d)},maxModal.prototype.setContent=function(t){this.currentModal.find(".modal_content").html(t)},maxModal.prototype.buildModal=function(o){o.preventDefault();var e=t(o.target);void 0===e.data("modal")&&(e=e.parents(".maxmodal")),this.target=e;var a=e.data("modal"),i=t("#"+a);void 0!==i.data("width")?this.setWidth=i.data("width"):this.setWidth=!1,void 0!==i.data("height")?this.setHeight=i.data("height"):this.setHeight=!1;var d=t(i).find(".title").text(),s=t(i).find(".controls").html(),n=t(i).find(".content").html();if(this.newModal(a),this.setTitle(d),this.setContent(n),this.setControls(s),void 0!==t(i).data("load")){var l=i.data("load")+"(modal)",r=new Function("modal",l);try{r(this)}catch(t){console.log("MB Modal Callback Error: "+t.message),console.log("MB Mobdal tried calling: "+l)}}this.show()},maxModal.prototype.newModal=function(o){null!==this.currentModal&&this.close();var e=t('<div class="max-modal '+o+'" > \t\t\t\t\t\t <div class="modal_header"> \t\t\t\t\t\t\t <div class="modal_close dashicons dashicons-no"></div><h3 class="modal_title"></h3> \t\t\t\t\t\t </div> \t\t\t\t\t\t <div class="inner modal_content"></div>\t\t\t\t\t </div>');return t(this.parent).length>0?t(this.parent).append(e):t("body").append(e),t(e).draggable({handle:".modal_header"}),this.modals.push(e),this.currentModal=e,this.controls=[],this},maxModal.prototype.writeOverlay=function(){t(this.parent).append('<div class="maxmodal_overlay"></div>'),t(".maxmodal_overlay").on("click",t.proxy(this.close,this))}});
|
js/min/maxtabs.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(t){var a=function(){};a.prototype.init=function(){this.tabs(),this.previewTab()},a.prototype.tabs=function(){var a=".mb_tab";if(0!==t(a).length){var e=t("#maxbuttons").data("view");if(void 0===e&&(e="list"),"list"!=e){t("#maxbuttons").addClass("mb_tabs_active"),0===t(".sub-tabs").length?($tabslocation=t('<h2 class="nav-tab-wrapper sub-tabs"></h2>'),$tabslocation.insertBefore(t(a).first()),$tabslocation=t(".sub-tabs")):$tabslocation=t(".sub-tabs"),t(a).hide(),t.each(t(a),function(){var a=t(this).children("div.title").first(),e=a.clone(),i=e.children("span:first").clone().wrap("<p>").parent().html(),s=e.children("span.title").text();t(e).children("span").remove(),t(e).children("input,button").remove(),a.children("span:first").remove(),a.children(".title").remove(),tab_title=void 0!==i?i+s:s;var o=t('<a class="nav-tab" href="javascript:void(0);">'+tab_title+"</a>");s=(s=s.trim()).replace(/ /g,"-"),t(o).attr("data-tab",s.toLowerCase()),t(".sub-tabs").append(o),t(this).attr("data-tab",s.toLowerCase())});var i=t('input[name="tab"]').val();void 0===i&&(i=""),""==i?($tabslocation.children(".nav-tab").first().addClass("nav-tab-active"),t(a).first().show()):($tabslocation.children('[data-tab="'+i+'"]').addClass("nav-tab-active"),t(a+'[data-tab="'+i+'"]').show()),$tabslocation.children("a").on("click",this.toggleTabs),this.addSaveTab($tabslocation)}}},a.prototype.addSaveTab=function(t){t.append('<div class="save-indicator dashicons dashicons-warning"></div>')},a.prototype.toggleTabs=function(a){a.preventDefault();t(".sub-tabs").children("a").removeClass("nav-tab-active"),t(this).addClass("nav-tab-active"),t(".mb_tab").hide();var e=t(this).data("tab");t('.mb_tab[data-tab="'+e+'"]').show(),t('input[name="tab"]').val(e),t(document).trigger("maxTabChange",[e])},a.prototype.previewTab=function(){t(".mb-preview-window").is(":visible");var a='.sub-tabs a[data-tab="preview"]';this.togglePreview(),t(a).off("click"),t(document).on("click",a,t.proxy(function(a){
|
1 |
+
jQuery(document).ready(function(t){var a=function(){};a.prototype.init=function(){this.tabs(),this.previewTab()},a.prototype.tabs=function(){var a=".mb_tab";if(0!==t(a).length){var e=t("#maxbuttons").data("view");if(void 0===e&&(e="list"),"list"!=e){t("#maxbuttons").addClass("mb_tabs_active"),0===t(".sub-tabs").length?($tabslocation=t('<h2 class="nav-tab-wrapper sub-tabs"></h2>'),$tabslocation.insertBefore(t(a).first()),$tabslocation=t(".sub-tabs")):$tabslocation=t(".sub-tabs"),t(a).hide(),t.each(t(a),function(){var a=t(this).children("div.title").first(),e=a.clone(),i=e.children("span:first").clone().wrap("<p>").parent().html(),s=e.children("span.title").text();t(e).children("span").remove(),t(e).children("input,button").remove(),a.children("span:first").remove(),a.children(".title").remove(),tab_title=void 0!==i?i+s:s;var o=t('<a class="nav-tab" href="javascript:void(0);">'+tab_title+"</a>");s=(s=s.trim()).replace(/ /g,"-"),t(o).attr("data-tab",s.toLowerCase()),t(".sub-tabs").append(o),t(this).attr("data-tab",s.toLowerCase())});var i=t('input[name="tab"]').val();void 0===i&&(i=""),""==i?($tabslocation.children(".nav-tab").first().addClass("nav-tab-active"),t(a).first().show()):($tabslocation.children('[data-tab="'+i+'"]').addClass("nav-tab-active"),t(a+'[data-tab="'+i+'"]').show()),$tabslocation.children("a").on("click",this.toggleTabs),this.addSaveTab($tabslocation)}}},a.prototype.addSaveTab=function(t){t.append('<div class="save-indicator dashicons dashicons-warning"></div>')},a.prototype.toggleTabs=function(a){a.preventDefault();t(".sub-tabs").children("a").removeClass("nav-tab-active"),t(this).addClass("nav-tab-active"),t(".mb_tab").hide();var e=t(this).data("tab");t('.mb_tab[data-tab="'+e+'"]').show(),t('input[name="tab"]').val(e),t(document).trigger("maxTabChange",[e])},a.prototype.previewTab=function(){t(".mb-preview-window").is(":visible");var a='.sub-tabs a[data-tab="preview"]';this.togglePreview(),t(a).off("click"),t(document).on("click",a,t.proxy(function(a){a.preventDefault(),a.stopPropagation();return t(".mb-preview-window").is(":visible")?this.togglePreview(!1):this.togglePreview(!0),t(document).trigger("updatePreviewWindow"),!1},this)),t(".mb-preview-window .close").on("click",{tab:a},function(a){t(a.data.tab).trigger("click")})},a.prototype.togglePreview=function(a){var e='.sub-tabs a[data-tab="preview"]';if(void 0===a)if(localStorage.getItem("mb-col-preview")){var i=localStorage.getItem("mb-col-preview");"string"==typeof i&&(i="true"==i),"boolean"==typeof i&&this.togglePreview(i)}else this.togglePreview(!0);else a?(t(".mb-preview-window").show(),t(e).addClass(" preview-on"),t(e+" .dashicons").addClass("dashicons-yes").removeClass("dashicons-no"),t(e).removeClass("preview-off"),localStorage.setItem("mb-col-preview",!0)):(t(".mb-preview-window").hide(),t(e).removeClass("preview-on"),t(e+" .dashicons").removeClass("dashicons-yes").addClass("dashicons-no"),t(e).addClass("preview-off"),localStorage.setItem("mb-col-preview",!1))};(new a).init()});
|
js/min/review-notice.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
jQuery(document).ready(function(t){function a(a){a.preventDefault
|
1 |
+
jQuery(document).ready(function(t){function a(a){a.preventDefault;!function(a){var e=mb_ajax_review.ajaxurl,n={action:"set_review_notice_status",status:a};t.ajax({method:"POST",url:e,data:n,success:function(a){t(".maxbuttons-notice, .maxbuttons-reviewoffer").fadeOut()}})}(t(a.target).data("action"))}t(".maxbuttons-notice [data-action], .maxbuttons-reviewoffer [data-action]").on("click",a)});
|
maxbuttons.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: MaxButtons
|
4 |
Plugin URI: http://maxbuttons.com
|
5 |
Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
|
6 |
-
Version: 6.
|
7 |
Author: Max Foundry
|
8 |
Author URI: http://maxfoundry.com
|
9 |
Text Domain: maxbuttons
|
@@ -16,9 +16,9 @@ namespace MaxButtons;
|
|
16 |
if (! defined('MAXBUTTONS_ROOT_FILE'))
|
17 |
define("MAXBUTTONS_ROOT_FILE", __FILE__);
|
18 |
if (! defined('MAXBUTTONS_VERSION_NUM'))
|
19 |
-
define('MAXBUTTONS_VERSION_NUM', '6.
|
20 |
|
21 |
-
define('MAXBUTTONS_RELEASE',"
|
22 |
|
23 |
|
24 |
if (! function_exists('MaxButtons\maxbutton_double_load'))
|
3 |
Plugin Name: MaxButtons
|
4 |
Plugin URI: http://maxbuttons.com
|
5 |
Description: The best WordPress button generator. This is the free version; the Pro version <a href="http://maxbuttons.com/?ref=mbfree">can be found here</a>.
|
6 |
+
Version: 6.28
|
7 |
Author: Max Foundry
|
8 |
Author URI: http://maxfoundry.com
|
9 |
Text Domain: maxbuttons
|
16 |
if (! defined('MAXBUTTONS_ROOT_FILE'))
|
17 |
define("MAXBUTTONS_ROOT_FILE", __FILE__);
|
18 |
if (! defined('MAXBUTTONS_VERSION_NUM'))
|
19 |
+
define('MAXBUTTONS_VERSION_NUM', '6.28');
|
20 |
|
21 |
+
define('MAXBUTTONS_RELEASE',"7 Feb 2018");
|
22 |
|
23 |
|
24 |
if (! function_exists('MaxButtons\maxbutton_double_load'))
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: maxfoundry, basszje, arcware, johnbhartley
|
3 |
Tags: wordpress button plugin, share button, wordpress buttons, css3 button generator, responsive buttons, css wordpress button
|
4 |
Requires at least: 4.0
|
5 |
-
Tested up to: 4.9.
|
6 |
Requires PHP: 5.3
|
7 |
-
Stable tag: 6.
|
8 |
|
9 |
WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
|
10 |
|
@@ -251,6 +251,14 @@ Secondly, please use latin only characters for button name ( Basic settings) and
|
|
251 |
|
252 |
== Changelog ==
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
= 6.27 =
|
255 |
|
256 |
* Tested for 4.9.2
|
2 |
Contributors: maxfoundry, basszje, arcware, johnbhartley
|
3 |
Tags: wordpress button plugin, share button, wordpress buttons, css3 button generator, responsive buttons, css wordpress button
|
4 |
Requires at least: 4.0
|
5 |
+
Tested up to: 4.9.4
|
6 |
Requires PHP: 5.3
|
7 |
+
Stable tag: 6.28
|
8 |
|
9 |
WordPress button plugin so powerful and easy to use anyone can create beautiful buttons, share buttons and social icons.
|
10 |
|
251 |
|
252 |
== Changelog ==
|
253 |
|
254 |
+
|
255 |
+
= 6.28 =
|
256 |
+
|
257 |
+
* Tested for 4.9.4
|
258 |
+
* Improved performance of editor javascript
|
259 |
+
* Fixed issue with showing certain conditional fields
|
260 |
+
* Fixed issue in maxmodal with double init
|
261 |
+
|
262 |
= 6.27 =
|
263 |
|
264 |
* Tested for 4.9.2
|