Version Description
-Fixed lack of zindex -Added style presets
=
Download this release
Release Info
Developer | killerdeveloper |
Plugin | Font – official webfonts plugin of Fonts For Web. NO CODING! Just click & change font size, color and font face visually! |
Version | 7.4 |
Comparing to | |
See all releases |
Code changes from version 7.3.1 to 7.4
- Font.php +2 -2
- css/colorpicker.css +1 -161
- css/fontsforwebstyle.css +37 -1
- js/jquery.fontPlugin.js +238 -82
- readme.txt +7 -1
Font.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Font
|
4 |
Plugin URI: http://fontsforweb.com
|
5 |
Description: Now go to your home page. And click on "Font settings" in admin bar and choose some exciting font out of 1000+ availabile! And that's just the beginning!
|
6 |
-
Version: 7.
|
7 |
Author: Paweł Misiurski
|
8 |
Author URI: http://fontsforweb.com
|
9 |
License: Copyright (C) 2012 Pawel Misiurski
|
@@ -23,7 +23,7 @@
|
|
23 |
class FontPlugin {
|
24 |
public $pluginName = 'Font';
|
25 |
public $baseUrl = 'http://fontsforweb.com';
|
26 |
-
public $version = '7.
|
27 |
//url parts for requesting css for elements
|
28 |
private $titleUrlPart;
|
29 |
private $headerUrlPart;
|
3 |
Plugin Name: Font
|
4 |
Plugin URI: http://fontsforweb.com
|
5 |
Description: Now go to your home page. And click on "Font settings" in admin bar and choose some exciting font out of 1000+ availabile! And that's just the beginning!
|
6 |
+
Version: 7.4
|
7 |
Author: Paweł Misiurski
|
8 |
Author URI: http://fontsforweb.com
|
9 |
License: Copyright (C) 2012 Pawel Misiurski
|
23 |
class FontPlugin {
|
24 |
public $pluginName = 'Font';
|
25 |
public $baseUrl = 'http://fontsforweb.com';
|
26 |
+
public $version = '7.4';
|
27 |
//url parts for requesting css for elements
|
28 |
private $titleUrlPart;
|
29 |
private $headerUrlPart;
|
css/colorpicker.css
CHANGED
@@ -1,161 +1 @@
|
|
1 |
-
.colorpicker {
|
2 |
-
width: 356px;
|
3 |
-
height: 176px;
|
4 |
-
overflow: hidden;
|
5 |
-
position: absolute;
|
6 |
-
background: url(../images/colorpicker_background.png);
|
7 |
-
font-family: Arial, Helvetica, sans-serif;
|
8 |
-
display: none;
|
9 |
-
}
|
10 |
-
.colorpicker_color {
|
11 |
-
width: 150px;
|
12 |
-
height: 150px;
|
13 |
-
left: 14px;
|
14 |
-
top: 13px;
|
15 |
-
position: absolute;
|
16 |
-
background: #f00;
|
17 |
-
overflow: hidden;
|
18 |
-
cursor: crosshair;
|
19 |
-
}
|
20 |
-
.colorpicker_color div {
|
21 |
-
position: absolute;
|
22 |
-
top: 0;
|
23 |
-
left: 0;
|
24 |
-
width: 150px;
|
25 |
-
height: 150px;
|
26 |
-
background: url(../images/colorpicker_overlay.png);
|
27 |
-
}
|
28 |
-
.colorpicker_color div div {
|
29 |
-
position: absolute;
|
30 |
-
top: 0;
|
31 |
-
left: 0;
|
32 |
-
width: 11px;
|
33 |
-
height: 11px;
|
34 |
-
overflow: hidden;
|
35 |
-
background: url(../images/colorpicker_select.gif);
|
36 |
-
margin: -5px 0 0 -5px;
|
37 |
-
}
|
38 |
-
.colorpicker_hue {
|
39 |
-
position: absolute;
|
40 |
-
top: 13px;
|
41 |
-
left: 171px;
|
42 |
-
width: 35px;
|
43 |
-
height: 150px;
|
44 |
-
cursor: n-resize;
|
45 |
-
}
|
46 |
-
.colorpicker_hue div {
|
47 |
-
position: absolute;
|
48 |
-
width: 35px;
|
49 |
-
height: 9px;
|
50 |
-
overflow: hidden;
|
51 |
-
background: url(../images/colorpicker_indic.gif) left top;
|
52 |
-
margin: -4px 0 0 0;
|
53 |
-
left: 0px;
|
54 |
-
}
|
55 |
-
.colorpicker_new_color {
|
56 |
-
position: absolute;
|
57 |
-
width: 60px;
|
58 |
-
height: 30px;
|
59 |
-
left: 213px;
|
60 |
-
top: 13px;
|
61 |
-
background: #f00;
|
62 |
-
}
|
63 |
-
.colorpicker_current_color {
|
64 |
-
position: absolute;
|
65 |
-
width: 60px;
|
66 |
-
height: 30px;
|
67 |
-
left: 283px;
|
68 |
-
top: 13px;
|
69 |
-
background: #f00;
|
70 |
-
}
|
71 |
-
.colorpicker input {
|
72 |
-
background-color: transparent;
|
73 |
-
border: 1px solid transparent;
|
74 |
-
position: absolute;
|
75 |
-
font-size: 10px;
|
76 |
-
font-family: Arial, Helvetica, sans-serif;
|
77 |
-
color: #898989;
|
78 |
-
top: 4px;
|
79 |
-
right: 11px;
|
80 |
-
text-align: right;
|
81 |
-
margin: 0;
|
82 |
-
padding: 0;
|
83 |
-
height: 11px;
|
84 |
-
}
|
85 |
-
.colorpicker_hex {
|
86 |
-
position: absolute;
|
87 |
-
width: 72px;
|
88 |
-
height: 22px;
|
89 |
-
background: url(../images/colorpicker_hex.png) top;
|
90 |
-
left: 212px;
|
91 |
-
top: 142px;
|
92 |
-
}
|
93 |
-
.colorpicker_hex input {
|
94 |
-
right: 6px;
|
95 |
-
}
|
96 |
-
.colorpicker_field {
|
97 |
-
height: 22px;
|
98 |
-
width: 62px;
|
99 |
-
background-position: top;
|
100 |
-
position: absolute;
|
101 |
-
}
|
102 |
-
.colorpicker_field span {
|
103 |
-
position: absolute;
|
104 |
-
width: 12px;
|
105 |
-
height: 22px;
|
106 |
-
overflow: hidden;
|
107 |
-
top: 0;
|
108 |
-
right: 0;
|
109 |
-
cursor: n-resize;
|
110 |
-
}
|
111 |
-
.colorpicker_rgb_r {
|
112 |
-
background-image: url(../images/colorpicker_rgb_r.png);
|
113 |
-
top: 52px;
|
114 |
-
left: 212px;
|
115 |
-
}
|
116 |
-
.colorpicker_rgb_g {
|
117 |
-
background-image: url(../images/colorpicker_rgb_g.png);
|
118 |
-
top: 82px;
|
119 |
-
left: 212px;
|
120 |
-
}
|
121 |
-
.colorpicker_rgb_b {
|
122 |
-
background-image: url(../images/colorpicker_rgb_b.png);
|
123 |
-
top: 112px;
|
124 |
-
left: 212px;
|
125 |
-
}
|
126 |
-
.colorpicker_hsb_h {
|
127 |
-
background-image: url(../images/colorpicker_hsb_h.png);
|
128 |
-
top: 52px;
|
129 |
-
left: 282px;
|
130 |
-
}
|
131 |
-
.colorpicker_hsb_s {
|
132 |
-
background-image: url(../images/colorpicker_hsb_s.png);
|
133 |
-
top: 82px;
|
134 |
-
left: 282px;
|
135 |
-
}
|
136 |
-
.colorpicker_hsb_b {
|
137 |
-
background-image: url(../images/colorpicker_hsb_b.png);
|
138 |
-
top: 112px;
|
139 |
-
left: 282px;
|
140 |
-
}
|
141 |
-
.colorpicker_submit {
|
142 |
-
position: absolute;
|
143 |
-
width: 22px;
|
144 |
-
height: 22px;
|
145 |
-
background: url(../images/colorpicker_submit.png) top;
|
146 |
-
left: 322px;
|
147 |
-
top: 142px;
|
148 |
-
overflow: hidden;
|
149 |
-
}
|
150 |
-
.colorpicker_focus {
|
151 |
-
background-position: center;
|
152 |
-
}
|
153 |
-
.colorpicker_hex.colorpicker_focus {
|
154 |
-
background-position: bottom;
|
155 |
-
}
|
156 |
-
.colorpicker_submit.colorpicker_focus {
|
157 |
-
background-position: bottom;
|
158 |
-
}
|
159 |
-
.colorpicker_slider {
|
160 |
-
background-position: bottom;
|
161 |
-
}
|
1 |
+
.colorpicker {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/fontsforwebstyle.css
CHANGED
@@ -703,7 +703,7 @@ h1.draggableModalBar small {
|
|
703 |
background-size: 100% 100%;
|
704 |
}
|
705 |
div.colorpicker {
|
706 |
-
z-index:
|
707 |
}
|
708 |
#presetsPanel #selectorFieldset .pickElement.pickAddElement {
|
709 |
background: url("../images/pick_add.png") repeat scroll 0 0 transparent;
|
@@ -714,6 +714,20 @@ div.colorpicker {
|
|
714 |
font-size: 0;
|
715 |
padding: 0;
|
716 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
|
718 |
button#fontfaceSettings {
|
719 |
background: url("../images/font_settings.png") repeat scroll 0 0 transparent;
|
@@ -820,6 +834,28 @@ button#extrafieldsSettings:hover {
|
|
820 |
background: #ff7ca7;
|
821 |
text-shadow: rgb(255, 255, 255) 1px 1px 10px, rgb(255, 255, 255) -1px 1px 10px, rgb(255, 255, 255) 1px -1px 10px, rgb(255, 255, 255) -1px -1px 10px, rgb(255, 255, 255) -1.13px -0.41px 0.3px !important;
|
822 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
823 |
button#shadowSettings {
|
824 |
background: lightgray;
|
825 |
margin-top: 0;
|
703 |
background-size: 100% 100%;
|
704 |
}
|
705 |
div.colorpicker {
|
706 |
+
z-index: 1500000;
|
707 |
}
|
708 |
#presetsPanel #selectorFieldset .pickElement.pickAddElement {
|
709 |
background: url("../images/pick_add.png") repeat scroll 0 0 transparent;
|
714 |
font-size: 0;
|
715 |
padding: 0;
|
716 |
}
|
717 |
+
#stylesPanel ul {
|
718 |
+
overflow-y: auto;
|
719 |
+
}
|
720 |
+
#stylesPanel li {
|
721 |
+
list-style-type: none;
|
722 |
+
padding: 10px;
|
723 |
+
border: 1px solid #dddddd;
|
724 |
+
margin: 10px;
|
725 |
+
cursor: pointer;
|
726 |
+
}
|
727 |
+
#stylesPanel div {
|
728 |
+
outline: none !important;
|
729 |
+
cursor: pointer !important;
|
730 |
+
}
|
731 |
|
732 |
button#fontfaceSettings {
|
733 |
background: url("../images/font_settings.png") repeat scroll 0 0 transparent;
|
834 |
background: #ff7ca7;
|
835 |
text-shadow: rgb(255, 255, 255) 1px 1px 10px, rgb(255, 255, 255) -1px 1px 10px, rgb(255, 255, 255) 1px -1px 10px, rgb(255, 255, 255) -1px -1px 10px, rgb(255, 255, 255) -1.13px -0.41px 0.3px !important;
|
836 |
}
|
837 |
+
#stylesButton {
|
838 |
+
background: #ee4f84;
|
839 |
+
color: #ffffff;
|
840 |
+
width: 135px;
|
841 |
+
height: 40PX;
|
842 |
+
margin: 0;
|
843 |
+
padding: 0;
|
844 |
+
margin-left: 3px;
|
845 |
+
float: left;
|
846 |
+
font-size: 18px;
|
847 |
+
text-align: center;
|
848 |
+
vertical-align: middle;
|
849 |
+
display: inline-block;
|
850 |
+
line-height: 40px;
|
851 |
+
text-shadow: rgb(205, 142, 222) 1px 1px 10px, rgb(205, 142, 222) -1px 1px 10px, rgb(205, 142, 222) 1px -1px 10px, rgb(205, 142, 222) -1px -1px 10px, rgb(159, 113, 171) -1.13px -0.41px 0.3px !important;
|
852 |
+
/* Standard */
|
853 |
+
transition: all 100ms;
|
854 |
+
}
|
855 |
+
#stylesButton:hover {
|
856 |
+
background: #ff7ca7;
|
857 |
+
text-shadow: rgb(255, 255, 255) 1px 1px 10px, rgb(255, 255, 255) -1px 1px 10px, rgb(255, 255, 255) 1px -1px 10px, rgb(255, 255, 255) -1px -1px 10px, rgb(255, 255, 255) -1.13px -0.41px 0.3px !important;
|
858 |
+
}
|
859 |
button#shadowSettings {
|
860 |
background: lightgray;
|
861 |
margin-top: 0;
|
js/jquery.fontPlugin.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
if (
|
2 |
fQuery = jQuery;
|
3 |
}
|
4 |
//font control panel plugin
|
@@ -22,6 +22,11 @@ if (typeof fQuery === 'undefined') {
|
|
22 |
/*global fontBlogUrl */
|
23 |
/*global fontBlogName */
|
24 |
/*global clearInterval */
|
|
|
|
|
|
|
|
|
|
|
25 |
$.fontPlugin = function (el, options) {
|
26 |
var self = this;
|
27 |
self.$el = $(el);
|
@@ -65,11 +70,13 @@ if (typeof fQuery === 'undefined') {
|
|
65 |
presetId,
|
66 |
field,
|
67 |
paramObj,
|
68 |
-
upgrade
|
|
|
|
|
69 |
/*
|
70 |
PRESETS
|
71 |
*/
|
72 |
-
|
73 |
id: 'presetsPanel',
|
74 |
name: 'stdSettings',
|
75 |
title: self.options.compatibilityMode ? 'SAFE MODE!' : 'Font ' + self.version,
|
@@ -79,7 +86,7 @@ if (typeof fQuery === 'undefined') {
|
|
79 |
width: '98px',
|
80 |
show: true
|
81 |
};
|
82 |
-
|
83 |
modal.hide().fadeIn(500);
|
84 |
self.$presets = modal;
|
85 |
//add presets list
|
@@ -141,12 +148,15 @@ if (typeof fQuery === 'undefined') {
|
|
141 |
field,
|
142 |
paramObj,
|
143 |
saveButton,
|
144 |
-
upgrade
|
|
|
|
|
|
|
145 |
/*
|
146 |
SELECTORS
|
147 |
*/
|
148 |
//get standard fields in a new window
|
149 |
-
|
150 |
id: 'appearancePanel',
|
151 |
name: 'stdSettings',
|
152 |
title: 'Size and color settings',
|
@@ -156,13 +166,13 @@ if (typeof fQuery === 'undefined') {
|
|
156 |
nobar: true,
|
157 |
show: true
|
158 |
};
|
159 |
-
|
160 |
self.$apr = modal;
|
161 |
self.$apr.hide();
|
162 |
//create a fieldset
|
163 |
self.$standardFields = $('<div id="appearanceStandardFields"></div>').appendTo(modal);
|
164 |
//get standard fields in a new window
|
165 |
-
|
166 |
title: 'Extended settings',
|
167 |
left: '0',
|
168 |
top: '0'
|
@@ -184,7 +194,7 @@ if (typeof fQuery === 'undefined') {
|
|
184 |
self.addSettingsField(paramObj);
|
185 |
}
|
186 |
//add window opening buttons
|
187 |
-
|
188 |
//bind toggle modal
|
189 |
$('body').on('click', '.toggleModal', function () {
|
190 |
if (self.mode === 'global') {
|
@@ -218,10 +228,12 @@ if (typeof fQuery === 'undefined') {
|
|
218 |
});
|
219 |
};
|
220 |
self.createActionButtons = function () {
|
221 |
-
var saveButton
|
|
|
|
|
222 |
//add buttons fieldset
|
223 |
-
|
224 |
-
|
225 |
actions.append(closeMod);
|
226 |
self.$actions = actions;
|
227 |
closeMod.click(function () {
|
@@ -258,6 +270,9 @@ if (typeof fQuery === 'undefined') {
|
|
258 |
extrafieldsSettings.hide();
|
259 |
// effects button
|
260 |
var effects = $('<button id="effectsButton" class="toggleModal" data-modal-name="effects">Effects</button>').appendTo(self.$apr);
|
|
|
|
|
|
|
261 |
//add save button
|
262 |
saveButton = $('<button id="fontSaveSettings">Save settings</button>').appendTo(actions);
|
263 |
saveButton.click(function (e) {
|
@@ -270,7 +285,7 @@ if (typeof fQuery === 'undefined') {
|
|
270 |
});
|
271 |
self.saveSettings();
|
272 |
});
|
273 |
-
self.$apr.append(actions)
|
274 |
};
|
275 |
/*
|
276 |
* API FUNCTIONS
|
@@ -288,17 +303,20 @@ if (typeof fQuery === 'undefined') {
|
|
288 |
}
|
289 |
}, function (data) {
|
290 |
if (!data || data.success !== 'true') {
|
291 |
-
if (console !== undefined)
|
292 |
-
|
293 |
-
|
|
|
294 |
} else {
|
295 |
-
self.
|
296 |
if (data.extended.length) {
|
297 |
self.loadExtendedFields(data.extended);
|
298 |
$('#upgradeToProButton').remove();
|
299 |
$('#extrafieldsSettings').show();
|
300 |
clearInterval(self.checkForApikeyInterval);
|
301 |
}
|
|
|
|
|
302 |
self.options.apikey = data.apikey;
|
303 |
}
|
304 |
});
|
@@ -357,13 +375,13 @@ that your computer has an internet connection.');
|
|
357 |
self.adaptOptionsToMode();
|
358 |
self.addLikeYesNo();
|
359 |
self.checkForApikey();
|
360 |
-
if(self.options.presets && self.options.presets[1]) {
|
361 |
self.loadPreset(1);
|
362 |
}
|
363 |
} catch (e) {
|
364 |
fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').unbind();
|
365 |
fQuery('#fontplugin').data('fontPlugin', false);
|
366 |
-
engageCompatibilityMode
|
367 |
fQuery('#wp-admin-bar-font_settings > a').trigger('click');
|
368 |
}, e);
|
369 |
}
|
@@ -374,11 +392,11 @@ that your computer has an internet connection.');
|
|
374 |
});
|
375 |
};
|
376 |
self.tryAnotherAjaxproxy = function () {
|
377 |
-
if(ajaxproxy === ajaxproxy3) {
|
378 |
alert('Sorry, but the plugin couldn\'t start. Please contact your server administrator to allow AJAX use. Power users: Use console (F12 in Chrome) to see what else could be the problem.');
|
379 |
return;
|
380 |
}
|
381 |
-
else if(ajaxproxy === ajaxproxy2) {
|
382 |
ajaxproxy = ajaxproxy3;
|
383 |
} else {
|
384 |
ajaxproxy = ajaxproxy2;
|
@@ -495,7 +513,7 @@ that your computer has an internet connection.');
|
|
495 |
} catch (e) {
|
496 |
selectorValid = false;
|
497 |
}
|
498 |
-
if(selectorValid && $selectorContents.length > 1) {
|
499 |
selectorValid = false;
|
500 |
}
|
501 |
//get node
|
@@ -510,7 +528,7 @@ that your computer has an internet connection.');
|
|
510 |
newSpan.css(settingName, value);
|
511 |
$tempDiv = $('<div>').append(newSpan.clone());
|
512 |
$tempDiv.find('*').each(function () {
|
513 |
-
//if($(this).inlineStyle && $(this).inlineStyle(settingName)) {
|
514 |
$(this).css(settingName, value);
|
515 |
//}
|
516 |
});
|
@@ -532,16 +550,18 @@ that your computer has an internet connection.');
|
|
532 |
self.loadExtendedFields = function (data) {
|
533 |
var i,
|
534 |
field,
|
535 |
-
paramObj
|
|
|
|
|
536 |
//create a new modal for it
|
537 |
-
|
538 |
name: 'extrafields',
|
539 |
title: 'Pro options',
|
540 |
left: '5px',
|
541 |
top: '40px',
|
542 |
width: '270px'
|
543 |
};
|
544 |
-
|
545 |
for (i = 0; i < data.length; i += 1) {
|
546 |
field = data[i];
|
547 |
paramObj = {};
|
@@ -569,11 +589,11 @@ that your computer has an internet connection.');
|
|
569 |
fieldParam,
|
570 |
container,
|
571 |
inputFields = [];
|
572 |
-
if(loadDefaults === undefined) {
|
573 |
loadDefaults = false;
|
574 |
}
|
575 |
//add support for multi value field
|
576 |
-
if (field.settingType
|
577 |
if (!paramObj.target) {
|
578 |
//create a new modal for it
|
579 |
var modalOptions = {
|
@@ -630,7 +650,7 @@ that your computer has an internet connection.');
|
|
630 |
stop = true;
|
631 |
// if xy slider set then add it
|
632 |
XYSliderOptions.label = field.label;
|
633 |
-
if(field.invertX) {
|
634 |
XYSliderOptions.invertX = true;
|
635 |
}
|
636 |
XYSliderOptions.settingName = paramObj.settings.uniqueId;
|
@@ -801,7 +821,7 @@ that your computer has an internet connection.');
|
|
801 |
});
|
802 |
|
803 |
// load defaults
|
804 |
-
if(loadDefaults) {
|
805 |
for(var i = 0; i < inputs.length; i++) {
|
806 |
inputs.eq(i).trigger('change');
|
807 |
}
|
@@ -844,7 +864,7 @@ that your computer has an internet connection.');
|
|
844 |
thisInput.val('');
|
845 |
thisInput.trigger('change');
|
846 |
});
|
847 |
-
if(field.settingType === 'dropdown') {
|
848 |
thisInput = self.extendField(thisInput, 'dropdown');
|
849 |
} else {
|
850 |
thisInput = self.extendField(thisInput, field.extendWith);
|
@@ -1043,7 +1063,7 @@ that your computer has an internet connection.');
|
|
1043 |
/*
|
1044 |
* EFFECTS
|
1045 |
*/
|
1046 |
-
self.
|
1047 |
var i,
|
1048 |
field,
|
1049 |
paramObj,
|
@@ -1058,7 +1078,7 @@ that your computer has an internet connection.');
|
|
1058 |
id: 'effectsPanel',
|
1059 |
name: 'effects', // name conflict was here
|
1060 |
title: 'Effects',
|
1061 |
-
left: '
|
1062 |
top: '50px',
|
1063 |
width: '190px'
|
1064 |
};
|
@@ -1105,6 +1125,100 @@ that your computer has an internet connection.');
|
|
1105 |
}
|
1106 |
});
|
1107 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1108 |
/*
|
1109 |
* load effect settings
|
1110 |
*/
|
@@ -1112,6 +1226,7 @@ that your computer has an internet connection.');
|
|
1112 |
// if no effects loaded yet quit
|
1113 |
if (!self.effects) return;
|
1114 |
if (!self.currentPreset.effects) return;
|
|
|
1115 |
// get effect saved settings
|
1116 |
for (var i = 0; i < self.currentPreset.effects.length; i++) {
|
1117 |
var effect = self.currentPreset.effects[i],
|
@@ -1122,7 +1237,7 @@ that your computer has an internet connection.');
|
|
1122 |
}
|
1123 |
// go through all the parameters and set them accordingly
|
1124 |
// clone object beforehand to avoid properties overwriting inside effect
|
1125 |
-
var params = $.extend({}, effect.params);
|
1126 |
for (var property in params) {
|
1127 |
var value = params[property];
|
1128 |
// get field from current effect
|
@@ -1141,7 +1256,7 @@ that your computer has an internet connection.');
|
|
1141 |
*/
|
1142 |
self.unloadCurrentElementEffects = function () {
|
1143 |
//console.log(self.effectSliders, self.currentPreset, self.currentPreset.effects);
|
1144 |
-
if(self.currentPreset === undefined || self.currentPreset.effects === undefined) return;
|
1145 |
if (self.effectSliders && Object.size(self.effectSliders)) {
|
1146 |
// unload all handles
|
1147 |
for (var i = 0; i < self.currentPreset.effects.length; i++) {
|
@@ -1151,6 +1266,7 @@ that your computer has an internet connection.');
|
|
1151 |
}
|
1152 |
}
|
1153 |
}
|
|
|
1154 |
if (!self.modals['effects']) return;
|
1155 |
self.modals['effects'].find('.effectsList').html('');
|
1156 |
};
|
@@ -1191,7 +1307,7 @@ that your computer has an internet connection.');
|
|
1191 |
arrow = $('<a href="#" class="effectArrow"></a>'),
|
1192 |
label = $('<a href="#" class="effectName">' + effectDefinition.label + '</a>'),
|
1193 |
closeButton = $('<a href="#" class="removeEffect">x</a>');
|
1194 |
-
if(loadDefaults === undefined) {
|
1195 |
loadDefaults = 0;
|
1196 |
}
|
1197 |
// create item markup
|
@@ -1267,6 +1383,20 @@ that your computer has an internet connection.');
|
|
1267 |
}
|
1268 |
return false;
|
1269 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1270 |
/*
|
1271 |
* Enable effect
|
1272 |
*
|
@@ -1316,7 +1446,7 @@ that your computer has an internet connection.');
|
|
1316 |
}
|
1317 |
// delete shadow css
|
1318 |
self.removeShadowEffect(effectId);
|
1319 |
-
if(self.effectSliders[effectId]) {
|
1320 |
// remove handle
|
1321 |
self.effectSliders[effectId].remove();
|
1322 |
}
|
@@ -1554,15 +1684,19 @@ that your computer has an internet connection.');
|
|
1554 |
self.currentPreset.name = presetName;
|
1555 |
};
|
1556 |
//delete preset
|
1557 |
-
self.deletePreset = function (presetNo) {
|
1558 |
-
if
|
1559 |
-
|
|
|
|
|
1560 |
}
|
1561 |
if (self.options.presets.length === 1) {
|
1562 |
alert('At least one preset has to be present');
|
1563 |
return;
|
1564 |
}
|
1565 |
-
|
|
|
|
|
1566 |
self.options.presets.splice(presetNo, 1);
|
1567 |
self.$presetsDropdown.find('option[value=' + presetNo + ']').remove();
|
1568 |
// delete all presets
|
@@ -1578,9 +1712,11 @@ that your computer has an internet connection.');
|
|
1578 |
}
|
1579 |
self.$presetsDropdown.append('<option value="' + presetId + '">' + presetName + '</option>');
|
1580 |
}
|
1581 |
-
|
1582 |
-
|
1583 |
-
|
|
|
|
|
1584 |
};
|
1585 |
//delete current preset
|
1586 |
self.deleteCurrentPreset = function () {
|
@@ -1599,9 +1735,8 @@ that your computer has an internet connection.');
|
|
1599 |
* @returns {unresolved}
|
1600 |
*/
|
1601 |
self.loadPreset = function (presetNo) {
|
1602 |
-
var preset = self.options.presets[parseInt(presetNo, 10)]
|
1603 |
-
|
1604 |
-
found;
|
1605 |
self.unloadPreset();
|
1606 |
if (!preset) {
|
1607 |
return;
|
@@ -1636,6 +1771,15 @@ that your computer has an internet connection.');
|
|
1636 |
self.currentPreset.shadowEffects = [];
|
1637 |
//select preset from dropdown
|
1638 |
self.$presetsDropdown.val(presetNo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1639 |
/*
|
1640 |
populate general fields
|
1641 |
*/
|
@@ -1656,47 +1800,40 @@ that your computer has an internet connection.');
|
|
1656 |
found.trigger('change');
|
1657 |
}
|
1658 |
}
|
1659 |
-
self.highlightCurrent();
|
1660 |
-
//load effects
|
1661 |
-
self.loadEffectSettings();
|
1662 |
-
self.loadFontPreview();
|
1663 |
};
|
1664 |
self.unloadPreset = function () {
|
1665 |
var $field,
|
1666 |
$input,
|
1667 |
$dropdown,
|
1668 |
key;
|
1669 |
-
|
1670 |
-
console.log(self.settingFields);
|
1671 |
// go through all fields
|
1672 |
for (key in self.settingFields) {
|
1673 |
$dropdown = [];
|
1674 |
$field = self.settingFields[key];
|
1675 |
-
if(!$field || !($field instanceof $)) {
|
1676 |
continue;
|
1677 |
}
|
1678 |
$input = $field.find('input');
|
1679 |
$input.val('');
|
1680 |
//$input.trigger('change');
|
1681 |
$dropdown = $field.find('select');
|
1682 |
-
if($dropdown.length) {
|
1683 |
$dropdown.val('');
|
1684 |
$input.hide();
|
1685 |
}
|
1686 |
}
|
1687 |
-
|
1688 |
};
|
1689 |
self.loadFontPreview = function () {
|
1690 |
var preset = self.currentPreset,
|
1691 |
imageUrl = '',
|
1692 |
originalBg = $('#fontfaceSettings').data('originalBackground');
|
1693 |
-
if(preset['fontid'] && preset['fontName']) {
|
1694 |
-
if(!originalBg) {
|
1695 |
$('#fontfaceSettings').data('originalBackground', $('#fontfaceSettings').css('backgroundImage'));
|
1696 |
}
|
1697 |
imageUrl = self.options.FFW_baseUrl + '/public/fonts/' + preset['fontid'] + '/' + preset['fontName'] + '.png';
|
1698 |
$('#fontfaceSettings').css({'backgroundImage': 'url(' + imageUrl + ')'});
|
1699 |
-
} else if(originalBg) {
|
1700 |
$('#fontfaceSettings').css({'backgroundImage': $('#fontfaceSettings').data('originalBackground')});
|
1701 |
}
|
1702 |
}
|
@@ -1876,10 +2013,7 @@ that your computer has an internet connection.');
|
|
1876 |
$('body').on('click', self.baseSelector + ' #fontList a.font_pick, ' + self.baseSelector + ' .fontsList a.font_pick', function () {
|
1877 |
var element,
|
1878 |
fontName = $(this).parent().attr('title'),
|
1879 |
-
selector
|
1880 |
-
elements,
|
1881 |
-
head,
|
1882 |
-
linkElement;
|
1883 |
//PAGE POST version
|
1884 |
if (self.mode === 'postPage') { //it's single post editing page
|
1885 |
//set font to id from name attribute of a
|
@@ -1898,28 +2032,49 @@ that your computer has an internet connection.');
|
|
1898 |
//get target element from iframe or current page
|
1899 |
if ($("#header1preview").length) {
|
1900 |
element = $("#header1preview").contents().find();
|
|
|
1901 |
} else {
|
1902 |
-
|
1903 |
}
|
1904 |
-
//set font family to a selector
|
1905 |
-
elements = element.find(selector);
|
1906 |
-
elements.each(function () {
|
1907 |
-
$(this).style("font-family", fontName, 'important');
|
1908 |
-
});
|
1909 |
-
head = element[0].getElementsByTagName('head')[0];
|
1910 |
-
linkElement = $(document.createElement('link'));
|
1911 |
-
//get and add stylesheet
|
1912 |
-
linkElement.attr({
|
1913 |
-
href: self.options.FFW_baseUrl + '/font/generatepreviewcss/?id=' + $(this).attr('name'),
|
1914 |
-
rel: 'stylesheet',
|
1915 |
-
type: 'text/css'
|
1916 |
-
});
|
1917 |
-
linkElement.appendTo(head);
|
1918 |
self.loadFontPreview();
|
1919 |
return false;
|
1920 |
}
|
1921 |
});
|
1922 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1923 |
/*
|
1924 |
* Load uploaded fonts
|
1925 |
*
|
@@ -2122,7 +2277,7 @@ that your computer has an internet connection.');
|
|
2122 |
//classses only for first 3 parents(now it's reversed)
|
2123 |
if (i < 2) {
|
2124 |
//get id
|
2125 |
-
//if(id = $parent.attr('id')) {
|
2126 |
// parentSelector += '#' + id;
|
2127 |
//}
|
2128 |
//class names
|
@@ -2371,11 +2526,12 @@ that your computer has an internet connection.');
|
|
2371 |
self.createNewModal = function (options) {
|
2372 |
var modal = $('<div class="draggableModal"><h1 class="draggableModalBar">' + options.title + '<a class="closeModal" href="#">x</a></h1></div>');
|
2373 |
modal.css({
|
2374 |
-
left: options.left,
|
|
|
2375 |
top: options.top,
|
2376 |
width: options.width,
|
2377 |
position: 'fixed',
|
2378 |
-
zIndex:
|
2379 |
});
|
2380 |
if (options.nobar) {
|
2381 |
modal.find('h1.draggableModalBar').hide();
|
@@ -2547,7 +2703,7 @@ that your computer has an internet connection.');
|
|
2547 |
} catch (e) {
|
2548 |
selectorValid = false;
|
2549 |
}
|
2550 |
-
if(selectorValid && $selectorContents.length > 1) {
|
2551 |
selectorValid = false;
|
2552 |
multipleSelectors = true;
|
2553 |
}
|
1 |
+
if (fQuery === undefined) {
|
2 |
fQuery = jQuery;
|
3 |
}
|
4 |
//font control panel plugin
|
22 |
/*global fontBlogUrl */
|
23 |
/*global fontBlogName */
|
24 |
/*global clearInterval */
|
25 |
+
/*global fontPluginVersion */
|
26 |
+
/*global engageCompatibilityMode*/
|
27 |
+
/*global ajaxproxy*/
|
28 |
+
/*global ajaxproxy2*/
|
29 |
+
/*global ajaxproxy3*/
|
30 |
$.fontPlugin = function (el, options) {
|
31 |
var self = this;
|
32 |
self.$el = $(el);
|
70 |
presetId,
|
71 |
field,
|
72 |
paramObj,
|
73 |
+
upgrade,
|
74 |
+
modalOptions,
|
75 |
+
modal;
|
76 |
/*
|
77 |
PRESETS
|
78 |
*/
|
79 |
+
modalOptions = {
|
80 |
id: 'presetsPanel',
|
81 |
name: 'stdSettings',
|
82 |
title: self.options.compatibilityMode ? 'SAFE MODE!' : 'Font ' + self.version,
|
86 |
width: '98px',
|
87 |
show: true
|
88 |
};
|
89 |
+
modal = self.createNewModal(modalOptions);
|
90 |
modal.hide().fadeIn(500);
|
91 |
self.$presets = modal;
|
92 |
//add presets list
|
148 |
field,
|
149 |
paramObj,
|
150 |
saveButton,
|
151 |
+
upgrade,
|
152 |
+
modalOptions,
|
153 |
+
modal,
|
154 |
+
settingWindows;
|
155 |
/*
|
156 |
SELECTORS
|
157 |
*/
|
158 |
//get standard fields in a new window
|
159 |
+
modalOptions = {
|
160 |
id: 'appearancePanel',
|
161 |
name: 'stdSettings',
|
162 |
title: 'Size and color settings',
|
166 |
nobar: true,
|
167 |
show: true
|
168 |
};
|
169 |
+
modal = self.createNewModal(modalOptions);
|
170 |
self.$apr = modal;
|
171 |
self.$apr.hide();
|
172 |
//create a fieldset
|
173 |
self.$standardFields = $('<div id="appearanceStandardFields"></div>').appendTo(modal);
|
174 |
//get standard fields in a new window
|
175 |
+
modalOptions = {
|
176 |
title: 'Extended settings',
|
177 |
left: '0',
|
178 |
top: '0'
|
194 |
self.addSettingsField(paramObj);
|
195 |
}
|
196 |
//add window opening buttons
|
197 |
+
settingWindows = $('<fieldset id="settingsButtons"></fieldset>');
|
198 |
//bind toggle modal
|
199 |
$('body').on('click', '.toggleModal', function () {
|
200 |
if (self.mode === 'global') {
|
228 |
});
|
229 |
};
|
230 |
self.createActionButtons = function () {
|
231 |
+
var saveButton,
|
232 |
+
actions,
|
233 |
+
closeMod;
|
234 |
//add buttons fieldset
|
235 |
+
actions = $('<fieldset id="actionsFieldset"></fieldset>');
|
236 |
+
closeMod = $('<a class="closeModal" href="#">x</a>');
|
237 |
actions.append(closeMod);
|
238 |
self.$actions = actions;
|
239 |
closeMod.click(function () {
|
270 |
extrafieldsSettings.hide();
|
271 |
// effects button
|
272 |
var effects = $('<button id="effectsButton" class="toggleModal" data-modal-name="effects">Effects</button>').appendTo(self.$apr);
|
273 |
+
// styles button
|
274 |
+
var styles = $('<button id="stylesButton" class="toggleModal" data-modal-name="styles">Styles</button>').appendTo(self.$apr);
|
275 |
+
|
276 |
//add save button
|
277 |
saveButton = $('<button id="fontSaveSettings">Save settings</button>').appendTo(actions);
|
278 |
saveButton.click(function (e) {
|
285 |
});
|
286 |
self.saveSettings();
|
287 |
});
|
288 |
+
self.$apr.append(actions);
|
289 |
};
|
290 |
/*
|
291 |
* API FUNCTIONS
|
303 |
}
|
304 |
}, function (data) {
|
305 |
if (!data || data.success !== 'true') {
|
306 |
+
if (console !== undefined) {
|
307 |
+
console.log(data.message);
|
308 |
+
}
|
309 |
+
alert('An error has occured and the plugin is not working. If you\'re working on local server, make sure \n that your computer has an internet connection.');
|
310 |
} else {
|
311 |
+
self.loadEffectsPanel(data.effects);
|
312 |
if (data.extended.length) {
|
313 |
self.loadExtendedFields(data.extended);
|
314 |
$('#upgradeToProButton').remove();
|
315 |
$('#extrafieldsSettings').show();
|
316 |
clearInterval(self.checkForApikeyInterval);
|
317 |
}
|
318 |
+
self.loadStylesPanel(data.styles);
|
319 |
+
|
320 |
self.options.apikey = data.apikey;
|
321 |
}
|
322 |
});
|
375 |
self.adaptOptionsToMode();
|
376 |
self.addLikeYesNo();
|
377 |
self.checkForApikey();
|
378 |
+
if (self.options.presets && self.options.presets[1]) {
|
379 |
self.loadPreset(1);
|
380 |
}
|
381 |
} catch (e) {
|
382 |
fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').unbind();
|
383 |
fQuery('#fontplugin').data('fontPlugin', false);
|
384 |
+
engageCompatibilityMode(function () {
|
385 |
fQuery('#wp-admin-bar-font_settings > a').trigger('click');
|
386 |
}, e);
|
387 |
}
|
392 |
});
|
393 |
};
|
394 |
self.tryAnotherAjaxproxy = function () {
|
395 |
+
if (ajaxproxy === ajaxproxy3) {
|
396 |
alert('Sorry, but the plugin couldn\'t start. Please contact your server administrator to allow AJAX use. Power users: Use console (F12 in Chrome) to see what else could be the problem.');
|
397 |
return;
|
398 |
}
|
399 |
+
else if (ajaxproxy === ajaxproxy2) {
|
400 |
ajaxproxy = ajaxproxy3;
|
401 |
} else {
|
402 |
ajaxproxy = ajaxproxy2;
|
513 |
} catch (e) {
|
514 |
selectorValid = false;
|
515 |
}
|
516 |
+
if (selectorValid && $selectorContents.length > 1) {
|
517 |
selectorValid = false;
|
518 |
}
|
519 |
//get node
|
528 |
newSpan.css(settingName, value);
|
529 |
$tempDiv = $('<div>').append(newSpan.clone());
|
530 |
$tempDiv.find('*').each(function () {
|
531 |
+
//if ($(this).inlineStyle && $(this).inlineStyle(settingName)) {
|
532 |
$(this).css(settingName, value);
|
533 |
//}
|
534 |
});
|
550 |
self.loadExtendedFields = function (data) {
|
551 |
var i,
|
552 |
field,
|
553 |
+
paramObj,
|
554 |
+
modalOptions,
|
555 |
+
modal;
|
556 |
//create a new modal for it
|
557 |
+
modalOptions = {
|
558 |
name: 'extrafields',
|
559 |
title: 'Pro options',
|
560 |
left: '5px',
|
561 |
top: '40px',
|
562 |
width: '270px'
|
563 |
};
|
564 |
+
modal = self.createNewModal(modalOptions);
|
565 |
for (i = 0; i < data.length; i += 1) {
|
566 |
field = data[i];
|
567 |
paramObj = {};
|
589 |
fieldParam,
|
590 |
container,
|
591 |
inputFields = [];
|
592 |
+
if (loadDefaults === undefined) {
|
593 |
loadDefaults = false;
|
594 |
}
|
595 |
//add support for multi value field
|
596 |
+
if (field.settingType === 'cssmultival') {
|
597 |
if (!paramObj.target) {
|
598 |
//create a new modal for it
|
599 |
var modalOptions = {
|
650 |
stop = true;
|
651 |
// if xy slider set then add it
|
652 |
XYSliderOptions.label = field.label;
|
653 |
+
if (field.invertX) {
|
654 |
XYSliderOptions.invertX = true;
|
655 |
}
|
656 |
XYSliderOptions.settingName = paramObj.settings.uniqueId;
|
821 |
});
|
822 |
|
823 |
// load defaults
|
824 |
+
if (loadDefaults) {
|
825 |
for(var i = 0; i < inputs.length; i++) {
|
826 |
inputs.eq(i).trigger('change');
|
827 |
}
|
864 |
thisInput.val('');
|
865 |
thisInput.trigger('change');
|
866 |
});
|
867 |
+
if (field.settingType === 'dropdown') {
|
868 |
thisInput = self.extendField(thisInput, 'dropdown');
|
869 |
} else {
|
870 |
thisInput = self.extendField(thisInput, field.extendWith);
|
1063 |
/*
|
1064 |
* EFFECTS
|
1065 |
*/
|
1066 |
+
self.loadEffectsPanel = function (data) {
|
1067 |
var i,
|
1068 |
field,
|
1069 |
paramObj,
|
1078 |
id: 'effectsPanel',
|
1079 |
name: 'effects', // name conflict was here
|
1080 |
title: 'Effects',
|
1081 |
+
left: '50%',
|
1082 |
top: '50px',
|
1083 |
width: '190px'
|
1084 |
};
|
1125 |
}
|
1126 |
});
|
1127 |
};
|
1128 |
+
/*
|
1129 |
+
* Styles
|
1130 |
+
*/
|
1131 |
+
self.loadStylesPanel = function (data) {
|
1132 |
+
var i,
|
1133 |
+
field,
|
1134 |
+
paramObj,
|
1135 |
+
$list,
|
1136 |
+
field,
|
1137 |
+
$li,
|
1138 |
+
$div;
|
1139 |
+
// save effects to array
|
1140 |
+
self.styles = data;
|
1141 |
+
// Create styles modal
|
1142 |
+
var modalOptions = {
|
1143 |
+
id: 'stylesPanel',
|
1144 |
+
name: 'styles', // name conflict was here
|
1145 |
+
title: 'Style presets',
|
1146 |
+
right: '0',
|
1147 |
+
top: '50px',
|
1148 |
+
width: '400px'
|
1149 |
+
};
|
1150 |
+
var modal = self.createNewModal(modalOptions);
|
1151 |
+
$list = $('<ul>');
|
1152 |
+
// add dropdown to modal
|
1153 |
+
modal.append($list);
|
1154 |
+
// add options to the modal
|
1155 |
+
for (i = 0; i < data.length; i += 1) {
|
1156 |
+
field = data[i];
|
1157 |
+
$div = $('<div>');
|
1158 |
+
$li = $('<li>').append($div)
|
1159 |
+
$list.append($li);
|
1160 |
+
|
1161 |
+
$div.text(field.label);
|
1162 |
+
$div.attr('data-value', field.settingName);
|
1163 |
+
|
1164 |
+
// create temporary preset
|
1165 |
+
self.createPreset(field.settingName, '[data-value="' + field.settingName + '"]');
|
1166 |
+
self.loadStylePreset(field.settingName);
|
1167 |
+
self.unhighlightCurrent();
|
1168 |
+
self.deletePreset(self.currentPresetNo, true);
|
1169 |
+
self.loadPreset(1);
|
1170 |
+
}
|
1171 |
+
if (data.length < 3) {
|
1172 |
+
$list.append('<option value="upgrade">More options</option>');
|
1173 |
+
}
|
1174 |
+
|
1175 |
+
var button = $('<button>Show style</button>').appendTo(modal);
|
1176 |
+
button.click(function () {
|
1177 |
+
var i,
|
1178 |
+
presetSettings = {};
|
1179 |
+
$.extend(true, presetSettings, self.currentPreset);
|
1180 |
+
delete presetSettings.name;
|
1181 |
+
delete presetSettings.selector;
|
1182 |
+
delete presetSettings.shadowEffects;
|
1183 |
+
delete presetSettings.styles["text-shadow"];
|
1184 |
+
for(i = 0; i < presetSettings.effects.length; i++) {
|
1185 |
+
delete presetSettings.effects[i].calculated;
|
1186 |
+
}
|
1187 |
+
|
1188 |
+
alert(JSON.stringify(presetSettings));
|
1189 |
+
});
|
1190 |
+
modal.append(button);
|
1191 |
+
// change
|
1192 |
+
$list.on('click', 'li', function () {
|
1193 |
+
var value = $(this).find('div').data('value');
|
1194 |
+
if (value === 'upgrade') {
|
1195 |
+
var link = $('<a href="http://fontsforweb.com/purchase/pluginupgradesubscribe?url=' + fontBlogUrl + '&name=' + fontBlogName + '" class="overlay_url" id="upgradeToProButton" data-upgrade="true">Pro settings</a>').appendTo('body');
|
1196 |
+
link.click();
|
1197 |
+
link.remove();
|
1198 |
+
return;
|
1199 |
+
} else if (!value) {
|
1200 |
+
return;
|
1201 |
+
}
|
1202 |
+
self.loadStylePreset(value);
|
1203 |
+
});
|
1204 |
+
};
|
1205 |
+
/**
|
1206 |
+
* Load style from style presets
|
1207 |
+
**/
|
1208 |
+
self.loadStylePreset = function (settingName) {
|
1209 |
+
var stylePreset = self.getStyleDefinitionByName(settingName),
|
1210 |
+
presetSettings = stylePreset.presetSettings;
|
1211 |
+
|
1212 |
+
self.unloadCurrentElementEffects();
|
1213 |
+
self.currentPreset.effects = [];
|
1214 |
+
|
1215 |
+
self.populateStyles(presetSettings);
|
1216 |
+
|
1217 |
+
$.extend(true, self.currentPreset, presetSettings);
|
1218 |
+
self.loadEffectSettings();
|
1219 |
+
self.applyFont();
|
1220 |
+
self.loadFontPreview();
|
1221 |
+
};
|
1222 |
/*
|
1223 |
* load effect settings
|
1224 |
*/
|
1226 |
// if no effects loaded yet quit
|
1227 |
if (!self.effects) return;
|
1228 |
if (!self.currentPreset.effects) return;
|
1229 |
+
|
1230 |
// get effect saved settings
|
1231 |
for (var i = 0; i < self.currentPreset.effects.length; i++) {
|
1232 |
var effect = self.currentPreset.effects[i],
|
1237 |
}
|
1238 |
// go through all the parameters and set them accordingly
|
1239 |
// clone object beforehand to avoid properties overwriting inside effect
|
1240 |
+
var params = $.extend(true, {}, effect.params);
|
1241 |
for (var property in params) {
|
1242 |
var value = params[property];
|
1243 |
// get field from current effect
|
1256 |
*/
|
1257 |
self.unloadCurrentElementEffects = function () {
|
1258 |
//console.log(self.effectSliders, self.currentPreset, self.currentPreset.effects);
|
1259 |
+
if (self.currentPreset === undefined || self.currentPreset.effects === undefined) return;
|
1260 |
if (self.effectSliders && Object.size(self.effectSliders)) {
|
1261 |
// unload all handles
|
1262 |
for (var i = 0; i < self.currentPreset.effects.length; i++) {
|
1266 |
}
|
1267 |
}
|
1268 |
}
|
1269 |
+
|
1270 |
if (!self.modals['effects']) return;
|
1271 |
self.modals['effects'].find('.effectsList').html('');
|
1272 |
};
|
1307 |
arrow = $('<a href="#" class="effectArrow"></a>'),
|
1308 |
label = $('<a href="#" class="effectName">' + effectDefinition.label + '</a>'),
|
1309 |
closeButton = $('<a href="#" class="removeEffect">x</a>');
|
1310 |
+
if (loadDefaults === undefined) {
|
1311 |
loadDefaults = 0;
|
1312 |
}
|
1313 |
// create item markup
|
1383 |
}
|
1384 |
return false;
|
1385 |
};
|
1386 |
+
/*
|
1387 |
+
* get style
|
1388 |
+
*/
|
1389 |
+
self.getStyleDefinitionByName = function (styleId) {
|
1390 |
+
if (!self.styles) return false;
|
1391 |
+
// go thorugh all effects and find the ONE
|
1392 |
+
for (var i = 0; i < self.styles.length; i++) {
|
1393 |
+
var style = self.styles[i];
|
1394 |
+
if (style.settingName === styleId) {
|
1395 |
+
return style;
|
1396 |
+
}
|
1397 |
+
}
|
1398 |
+
return false;
|
1399 |
+
};
|
1400 |
/*
|
1401 |
* Enable effect
|
1402 |
*
|
1446 |
}
|
1447 |
// delete shadow css
|
1448 |
self.removeShadowEffect(effectId);
|
1449 |
+
if (self.effectSliders[effectId]) {
|
1450 |
// remove handle
|
1451 |
self.effectSliders[effectId].remove();
|
1452 |
}
|
1684 |
self.currentPreset.name = presetName;
|
1685 |
};
|
1686 |
//delete preset
|
1687 |
+
self.deletePreset = function (presetNo, silent) {
|
1688 |
+
if(silent === undefined) {
|
1689 |
+
if (!confirm("Are you sure you want to delete this preset?")) {
|
1690 |
+
return false;
|
1691 |
+
}
|
1692 |
}
|
1693 |
if (self.options.presets.length === 1) {
|
1694 |
alert('At least one preset has to be present');
|
1695 |
return;
|
1696 |
}
|
1697 |
+
if(silent === undefined) {
|
1698 |
+
self.unhighlightCurrent();
|
1699 |
+
}
|
1700 |
self.options.presets.splice(presetNo, 1);
|
1701 |
self.$presetsDropdown.find('option[value=' + presetNo + ']').remove();
|
1702 |
// delete all presets
|
1712 |
}
|
1713 |
self.$presetsDropdown.append('<option value="' + presetId + '">' + presetName + '</option>');
|
1714 |
}
|
1715 |
+
if(silent === undefined) {
|
1716 |
+
self.outlineAllPresets();
|
1717 |
+
self.loadPreset(0);
|
1718 |
+
alert('When resetting settings or deleting preset you have to save to see the change');
|
1719 |
+
}
|
1720 |
};
|
1721 |
//delete current preset
|
1722 |
self.deleteCurrentPreset = function () {
|
1735 |
* @returns {unresolved}
|
1736 |
*/
|
1737 |
self.loadPreset = function (presetNo) {
|
1738 |
+
var preset = self.options.presets[parseInt(presetNo, 10)];
|
1739 |
+
|
|
|
1740 |
self.unloadPreset();
|
1741 |
if (!preset) {
|
1742 |
return;
|
1771 |
self.currentPreset.shadowEffects = [];
|
1772 |
//select preset from dropdown
|
1773 |
self.$presetsDropdown.val(presetNo);
|
1774 |
+
self.populateStyles(preset);
|
1775 |
+
self.highlightCurrent();
|
1776 |
+
//load effects
|
1777 |
+
self.loadEffectSettings();
|
1778 |
+
self.loadFontPreview();
|
1779 |
+
};
|
1780 |
+
self.populateStyles = function (preset) {
|
1781 |
+
var property,
|
1782 |
+
found;
|
1783 |
/*
|
1784 |
populate general fields
|
1785 |
*/
|
1800 |
found.trigger('change');
|
1801 |
}
|
1802 |
}
|
|
|
|
|
|
|
|
|
1803 |
};
|
1804 |
self.unloadPreset = function () {
|
1805 |
var $field,
|
1806 |
$input,
|
1807 |
$dropdown,
|
1808 |
key;
|
|
|
|
|
1809 |
// go through all fields
|
1810 |
for (key in self.settingFields) {
|
1811 |
$dropdown = [];
|
1812 |
$field = self.settingFields[key];
|
1813 |
+
if (!$field || !($field instanceof $)) {
|
1814 |
continue;
|
1815 |
}
|
1816 |
$input = $field.find('input');
|
1817 |
$input.val('');
|
1818 |
//$input.trigger('change');
|
1819 |
$dropdown = $field.find('select');
|
1820 |
+
if ($dropdown.length) {
|
1821 |
$dropdown.val('');
|
1822 |
$input.hide();
|
1823 |
}
|
1824 |
}
|
|
|
1825 |
};
|
1826 |
self.loadFontPreview = function () {
|
1827 |
var preset = self.currentPreset,
|
1828 |
imageUrl = '',
|
1829 |
originalBg = $('#fontfaceSettings').data('originalBackground');
|
1830 |
+
if (preset['fontid'] && preset['fontName']) {
|
1831 |
+
if (!originalBg) {
|
1832 |
$('#fontfaceSettings').data('originalBackground', $('#fontfaceSettings').css('backgroundImage'));
|
1833 |
}
|
1834 |
imageUrl = self.options.FFW_baseUrl + '/public/fonts/' + preset['fontid'] + '/' + preset['fontName'] + '.png';
|
1835 |
$('#fontfaceSettings').css({'backgroundImage': 'url(' + imageUrl + ')'});
|
1836 |
+
} else if (originalBg) {
|
1837 |
$('#fontfaceSettings').css({'backgroundImage': $('#fontfaceSettings').data('originalBackground')});
|
1838 |
}
|
1839 |
}
|
2013 |
$('body').on('click', self.baseSelector + ' #fontList a.font_pick, ' + self.baseSelector + ' .fontsList a.font_pick', function () {
|
2014 |
var element,
|
2015 |
fontName = $(this).parent().attr('title'),
|
2016 |
+
selector;
|
|
|
|
|
|
|
2017 |
//PAGE POST version
|
2018 |
if (self.mode === 'postPage') { //it's single post editing page
|
2019 |
//set font to id from name attribute of a
|
2032 |
//get target element from iframe or current page
|
2033 |
if ($("#header1preview").length) {
|
2034 |
element = $("#header1preview").contents().find();
|
2035 |
+
self.applyFont(element);
|
2036 |
} else {
|
2037 |
+
self.applyFont();
|
2038 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2039 |
self.loadFontPreview();
|
2040 |
return false;
|
2041 |
}
|
2042 |
});
|
2043 |
};
|
2044 |
+
/**
|
2045 |
+
* apply font to selection
|
2046 |
+
**/
|
2047 |
+
self.applyFont = function (frame) {
|
2048 |
+
//get selector
|
2049 |
+
var element,
|
2050 |
+
elements,
|
2051 |
+
fontName = self.currentPreset.fontName,
|
2052 |
+
selector = self.currentPreset.selector,
|
2053 |
+
head,
|
2054 |
+
linkElement;
|
2055 |
+
|
2056 |
+
if(frame === undefined) {
|
2057 |
+
element = $(document);
|
2058 |
+
head = document.getElementsByTagName('head')[0];
|
2059 |
+
} else {
|
2060 |
+
element = frame;
|
2061 |
+
head = element[0].getElementsByTagName('head')[0];
|
2062 |
+
}
|
2063 |
+
|
2064 |
+
linkElement = $(document.createElement('link'));
|
2065 |
+
//get and add stylesheet
|
2066 |
+
linkElement.attr({
|
2067 |
+
href: self.options.FFW_baseUrl + '/font/generatepreviewcss/?id=' + self.currentPreset.fontid,
|
2068 |
+
rel: 'stylesheet',
|
2069 |
+
type: 'text/css'
|
2070 |
+
});
|
2071 |
+
linkElement.appendTo(head);
|
2072 |
+
//set font family to a selector
|
2073 |
+
elements = element.find(selector);
|
2074 |
+
elements.each(function () {
|
2075 |
+
$(this).style("font-family", fontName, 'important');
|
2076 |
+
});
|
2077 |
+
}
|
2078 |
/*
|
2079 |
* Load uploaded fonts
|
2080 |
*
|
2277 |
//classses only for first 3 parents(now it's reversed)
|
2278 |
if (i < 2) {
|
2279 |
//get id
|
2280 |
+
//if (id = $parent.attr('id')) {
|
2281 |
// parentSelector += '#' + id;
|
2282 |
//}
|
2283 |
//class names
|
2526 |
self.createNewModal = function (options) {
|
2527 |
var modal = $('<div class="draggableModal"><h1 class="draggableModalBar">' + options.title + '<a class="closeModal" href="#">x</a></h1></div>');
|
2528 |
modal.css({
|
2529 |
+
left: options.left ? options.left : 'auto',
|
2530 |
+
right: options.right ? options.right : 'auto',
|
2531 |
top: options.top,
|
2532 |
width: options.width,
|
2533 |
position: 'fixed',
|
2534 |
+
zIndex: 1000000
|
2535 |
});
|
2536 |
if (options.nobar) {
|
2537 |
modal.find('h1.draggableModalBar').hide();
|
2703 |
} catch (e) {
|
2704 |
selectorValid = false;
|
2705 |
}
|
2706 |
+
if (selectorValid && $selectorContents.length > 1) {
|
2707 |
selectorValid = false;
|
2708 |
multipleSelectors = true;
|
2709 |
}
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://fontsforweb.com/
|
|
4 |
Tags: fonts, web fonts, font, fonts plugin, typekit, google webfont, TinyMCE plugin, ajax, webfonts
|
5 |
Requires at least: 2.8.0
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag: 7.
|
8 |
Finally official* web fonts plugin for wordpress. CLICK ON ANYTHING TO CHANGE IT(see screenshots)! Then change color, size and font face using sliders and color picker!
|
9 |
== Description ==
|
10 |
Finally official web fonts plugin for wordpress. No need for any coding at all! How? This plugin has an unique method of recognizing of what you click at!
|
@@ -176,6 +176,9 @@ Minor bug fixes
|
|
176 |
-added current font preview
|
177 |
= 7.3.1 =
|
178 |
-Fixed startup error
|
|
|
|
|
|
|
179 |
|
180 |
== Upgrade Notice ==
|
181 |
= 5.00 =
|
@@ -304,6 +307,9 @@ Fixed:
|
|
304 |
-added current font preview
|
305 |
= 7.3.1 =
|
306 |
-Fixed startup error
|
|
|
|
|
|
|
307 |
|
308 |
== Arbitrary section ==
|
309 |
== Source ==
|
4 |
Tags: fonts, web fonts, font, fonts plugin, typekit, google webfont, TinyMCE plugin, ajax, webfonts
|
5 |
Requires at least: 2.8.0
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 7.4
|
8 |
Finally official* web fonts plugin for wordpress. CLICK ON ANYTHING TO CHANGE IT(see screenshots)! Then change color, size and font face using sliders and color picker!
|
9 |
== Description ==
|
10 |
Finally official web fonts plugin for wordpress. No need for any coding at all! How? This plugin has an unique method of recognizing of what you click at!
|
176 |
-added current font preview
|
177 |
= 7.3.1 =
|
178 |
-Fixed startup error
|
179 |
+
= 7.4 =
|
180 |
+
-Fixed lack of zindex
|
181 |
+
-Added style presets
|
182 |
|
183 |
== Upgrade Notice ==
|
184 |
= 5.00 =
|
307 |
-added current font preview
|
308 |
= 7.3.1 =
|
309 |
-Fixed startup error
|
310 |
+
= 7.4 =
|
311 |
+
-Fixed lack of zindex
|
312 |
+
-Added style presets
|
313 |
|
314 |
== Arbitrary section ==
|
315 |
== Source ==
|