Font – official webfonts plugin of Fonts For Web. NO CODING! Just click & change font size, color and font face visually! - Version 7.5

Version Description

-Styles compacted -Styles bar doesn't show too early -Fixed bug with selection disappearing periodically -Removed fading animations -Added x button for easier preset removing

=

Download this release

Code changes from version 7.4 to 7.5

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.4
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.4';
27
  //url parts for requesting css for elements
28
  private $titleUrlPart;
29
  private $headerUrlPart;
@@ -500,6 +500,12 @@ class FontPlugin {
500
  }
501
  //file get contetns 2 - bulletproof remote request
502
  function file_get_contents2($src, $postData = false) {
 
 
 
 
 
 
503
  if ((ini_get('allow_url_fopen') == 1 || ini_get('allow_url_fopen') == 'on')) {
504
  $this->downloadMethod = 'fopen';
505
  } else if (in_array('curl', get_loaded_extensions())) {
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.5
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.5';
27
  //url parts for requesting css for elements
28
  private $titleUrlPart;
29
  private $headerUrlPart;
500
  }
501
  //file get contetns 2 - bulletproof remote request
502
  function file_get_contents2($src, $postData = false) {
503
+ // check if remote source is set to baseUrl
504
+ if(substr($src, 0, strlen($this->baseUrl)) !== $this->baseUrl) {
505
+ $this->errorMessage = 'Remote requests only allowed to: ' . $this->baseUrl;
506
+ return false;
507
+ }
508
+
509
  if ((ini_get('allow_url_fopen') == 1 || ini_get('allow_url_fopen') == 'on')) {
510
  $this->downloadMethod = 'fopen';
511
  } else if (in_array('curl', get_loaded_extensions())) {
css/fontsforwebstyle.css CHANGED
@@ -1,3 +1,13 @@
 
 
 
 
 
 
 
 
 
 
1
  .draggableModal * {
2
  -moz-box-sizing: content-box !important;
3
  box-sizing: content-box !important;
@@ -246,7 +256,7 @@
246
  }
247
  .draggableModal {
248
  background: none repeat scroll 0 0 rgba(255, 255, 255, 0.9);
249
- border:1px solid #999;
250
  border-radius: 4px;
251
  box-shadow: 0 0 7px rgba(0,0,0,0.1);
252
  margin: 0;
@@ -277,6 +287,7 @@ h1.draggableModalBar {
277
  text-indent: 7px;
278
  width: 100%;
279
  text-align: left;
 
280
  }
281
  h1.draggableModalBar #font_ver {
282
  background: url("../images/font_ver.png") repeat scroll 0 0 transparent;
@@ -299,14 +310,14 @@ h1.draggableModalBar small {
299
  }
300
  .draggableModalBar .closeModal {
301
  color: #000;
302
- font-size: 12px;
303
  font-weight: bold;
304
  height: 13px;
305
- padding: 2px;
306
  text-align: center;
307
  text-decoration: none;
308
  width: 15px;
309
- margin: 0;
310
  }
311
  .draggableModalBar a {
312
  float: right;
@@ -339,10 +350,10 @@ h1.draggableModalBar small {
339
  }
340
  #fontplugin {
341
  color: #464646;
342
- height: 80%;
343
  right: 0;
 
344
  top: 38px;
345
- width: 300px;
346
  z-index: 10000;
347
  position:fixed;
348
  background:#fff;
@@ -353,9 +364,9 @@ h1.draggableModalBar small {
353
  padding: 0;
354
  }
355
  #fontplugin #fontslist {
356
- height: 95%;
357
  margin-left: 15px;
358
- width: 285px;
359
  }
360
  #fontplugin #uploaded {
361
  height: 76%;
@@ -406,15 +417,16 @@ h1.draggableModalBar small {
406
  #fontplugin a.tablink {
407
  background: none repeat scroll 0 0 #FFFFFF;
408
  border-color: #AAAAAA;
409
- border-radius: 10px 10px 0 0;
410
  border-style: solid;
411
- border-width: 1px 1px 0;
 
412
  color: #222222;
413
  display: inline-block;
414
  font-size: 12px;
415
  font-weight: bold;
416
- line-height: 1.5em;
417
- padding: 5px 10px;
418
  position: relative;
419
  text-decoration: none;
420
  top: 1px;
@@ -426,10 +438,8 @@ h1.draggableModalBar small {
426
  padding: 9px 6px 3px 3px;
427
  }
428
  #fontplugin .fcarousel-container {
429
- height: 84%;
430
  left: -4px;
431
- padding-left: 10px;
432
- padding-right: 10px;
433
  position: relative;
434
  }
435
  #fontplugin .fcarousel-clip {
@@ -483,6 +493,9 @@ h1.draggableModalBar small {
483
  margin: 0;
484
  list-style-type:none;
485
  }
 
 
 
486
  #fontplugin li.categoriesList a {
487
  background: none repeat scroll 0 0 #FFFFFF;
488
  border-bottom: 1px solid #DDDDDD;
@@ -761,7 +774,7 @@ height:16px;
761
  a#upgradeToProButton {
762
  background: #4088e1;
763
  color: #ffffff;
764
- width: 135px;
765
  height: 40PX;
766
  margin: 0;
767
  padding: 0;
@@ -815,7 +828,7 @@ button#extrafieldsSettings:hover {
815
  #effectsButton {
816
  background: #ee4f84;
817
  color: #ffffff;
818
- width: 135px;
819
  height: 40PX;
820
  margin: 0;
821
  padding: 0;
@@ -837,7 +850,7 @@ button#extrafieldsSettings:hover {
837
  #stylesButton {
838
  background: #ee4f84;
839
  color: #ffffff;
840
- width: 135px;
841
  height: 40PX;
842
  margin: 0;
843
  padding: 0;
1
+ .deletePreset {
2
+ position: absolute;
3
+ top: -17px;
4
+ right: -13px;
5
+ font-size: 12px;
6
+ padding: 1px 3px;
7
+ margin: 0;
8
+ font-family: Arial, Helvetica, sans-serif;
9
+ font-weight: bold;
10
+ }
11
  .draggableModal * {
12
  -moz-box-sizing: content-box !important;
13
  box-sizing: content-box !important;
256
  }
257
  .draggableModal {
258
  background: none repeat scroll 0 0 rgba(255, 255, 255, 0.9);
259
+ border: 1px solid #ddd;
260
  border-radius: 4px;
261
  box-shadow: 0 0 7px rgba(0,0,0,0.1);
262
  margin: 0;
287
  text-indent: 7px;
288
  width: 100%;
289
  text-align: left;
290
+ height: 11px;
291
  }
292
  h1.draggableModalBar #font_ver {
293
  background: url("../images/font_ver.png") repeat scroll 0 0 transparent;
310
  }
311
  .draggableModalBar .closeModal {
312
  color: #000;
313
+ font-size: 18px;
314
  font-weight: bold;
315
  height: 13px;
316
+ padding: 0px;
317
  text-align: center;
318
  text-decoration: none;
319
  width: 15px;
320
+ margin: -2px 3px;
321
  }
322
  .draggableModalBar a {
323
  float: right;
350
  }
351
  #fontplugin {
352
  color: #464646;
 
353
  right: 0;
354
+ height: 70%;
355
  top: 38px;
356
+ width: 276px;
357
  z-index: 10000;
358
  position:fixed;
359
  background:#fff;
364
  padding: 0;
365
  }
366
  #fontplugin #fontslist {
367
+ height: 89%;
368
  margin-left: 15px;
369
+ width: 265px;
370
  }
371
  #fontplugin #uploaded {
372
  height: 76%;
417
  #fontplugin a.tablink {
418
  background: none repeat scroll 0 0 #FFFFFF;
419
  border-color: #AAAAAA;
420
+ border-radius: 5px 5px 0 0;
421
  border-style: solid;
422
+ border-width: 1px 0 0 1px;
423
+ border-top-color: #f2f2f2;
424
  color: #222222;
425
  display: inline-block;
426
  font-size: 12px;
427
  font-weight: bold;
428
+ line-height: 1.3em;
429
+ padding: 9px 5px 5px;
430
  position: relative;
431
  text-decoration: none;
432
  top: 1px;
438
  padding: 9px 6px 3px 3px;
439
  }
440
  #fontplugin .fcarousel-container {
441
+ height: 100%;
442
  left: -4px;
 
 
443
  position: relative;
444
  }
445
  #fontplugin .fcarousel-clip {
493
  margin: 0;
494
  list-style-type:none;
495
  }
496
+ #fontplugin li.categoriesList ul li.instructions {
497
+ margin: 15px;
498
+ }
499
  #fontplugin li.categoriesList a {
500
  background: none repeat scroll 0 0 #FFFFFF;
501
  border-bottom: 1px solid #DDDDDD;
774
  a#upgradeToProButton {
775
  background: #4088e1;
776
  color: #ffffff;
777
+ width: 130px;
778
  height: 40PX;
779
  margin: 0;
780
  padding: 0;
828
  #effectsButton {
829
  background: #ee4f84;
830
  color: #ffffff;
831
+ width: 95px;
832
  height: 40PX;
833
  margin: 0;
834
  padding: 0;
850
  #stylesButton {
851
  background: #ee4f84;
852
  color: #ffffff;
853
+ width: 85px;
854
  height: 40PX;
855
  margin: 0;
856
  padding: 0;
js/jquery.fontPlugin.js CHANGED
@@ -3,7 +3,6 @@ if (fQuery === undefined) {
3
  }
4
  //font control panel plugin
5
  (function ($) {
6
- 'use strict';
7
  /*global document */
8
  /*global setTimeout */
9
  /*global setInterval */
@@ -87,7 +86,7 @@ if (fQuery === undefined) {
87
  show: true
88
  };
89
  modal = self.createNewModal(modalOptions);
90
- modal.hide().fadeIn(500);
91
  self.$presets = modal;
92
  //add presets list
93
  self.settingFields.presets = $('<fieldset id="presetsDropdownFieldset"><label>Selections<select id="presetsDropdown" name="presetsDropdown"></select></label></fieldset>');
@@ -308,6 +307,9 @@ if (fQuery === undefined) {
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);
@@ -316,8 +318,8 @@ if (fQuery === undefined) {
316
  clearInterval(self.checkForApikeyInterval);
317
  }
318
  self.loadStylesPanel(data.styles);
319
-
320
  self.options.apikey = data.apikey;
 
321
  }
322
  });
323
  };
@@ -358,33 +360,7 @@ if (fQuery === undefined) {
358
  self.tryAnotherAjaxproxy();
359
  return;
360
  }
361
- // try loading the plugin
362
- try {
363
- //console.log(self.options);
364
- self.hideLoading();
365
- // markup
366
- self.createPresetsPanel();
367
- self.createAppearancePanel();
368
- self.createActionButtons();
369
- self.loadPreset(0);
370
- self.bindShowCategoriesAction();
371
- self.bindShowFontsAction();
372
- self.bindLinkOverlay();
373
- self.setFontOnclick();
374
- self.initUploadForm();
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
- }
388
  },
389
  error: function (response) {
390
  self.tryAnotherAjaxproxy();
@@ -403,6 +379,43 @@ if (fQuery === undefined) {
403
  }
404
  self.loadSettings();
405
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
406
  /*
407
  * Save settings by ajax
408
  *
@@ -415,8 +428,8 @@ if (fQuery === undefined) {
415
  alert('Click on "Update" or "Publish" to save');
416
  return;
417
  }
418
- self.$presets.fadeOut();
419
- self.$apr.fadeOut();
420
  self.showLoading();
421
  savingOptions.settingFields = self.options.settingFields;
422
  savingOptions.presets = self.options.presets;
@@ -989,11 +1002,11 @@ if (fQuery === undefined) {
989
  input.ColorPicker({
990
  color: '#0000ff',
991
  onShow: function (colpkr) {
992
- $(colpkr).fadeIn(500);
993
  return false;
994
  },
995
  onHide: function (colpkr) {
996
- $(colpkr).fadeOut(500);
997
  return false;
998
  },
999
  onChange: function (hsb, hex, rgb) {
@@ -1166,13 +1179,19 @@ if (fQuery === undefined) {
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 = {};
@@ -1186,7 +1205,7 @@ if (fQuery === undefined) {
1186
  }
1187
 
1188
  alert(JSON.stringify(presetSettings));
1189
- });
1190
  modal.append(button);
1191
  // change
1192
  $list.on('click', 'li', function () {
@@ -1714,8 +1733,12 @@ if (fQuery === undefined) {
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
@@ -1735,7 +1758,9 @@ if (fQuery === undefined) {
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) {
@@ -1849,7 +1874,7 @@ if (fQuery === undefined) {
1849
  var i;
1850
  var iframe = '<iframe style="width:98%; height:200px; border:none; margin: 10px 1%" frameBorder="0" src="http://fontsforweb.com/user/pluginactivate?apikey=' + self.options.apikey + '&blogurl=' + fontBlogUrl + '"></iframe>';
1851
 
1852
- //create html withing font browser
1853
  self.$el.show();
1854
  self.$el.append($('<h1 class="draggableModalBar"><a class="closeModal" href="#">x</a></h1>'));
1855
  self.$el.append('<div class="tablinks"><a class="tablink" href="fontslist">Fontsforweb.com</a><a class="tablink" href="uploaded">Upload</a><a class="tablink" href="pro">PRO settings</a></div>');
@@ -1879,7 +1904,7 @@ if (fQuery === undefined) {
1879
  self.modalToTop(this);
1880
  });
1881
  self.$el.find('a.closeModal').on('click', function () {
1882
- self.$el.fadeOut('slow');
1883
  return false;
1884
  });
1885
  };
@@ -1892,7 +1917,7 @@ if (fQuery === undefined) {
1892
  self.loadFontCategories();
1893
  this.fontInitialized = true;
1894
  } else {
1895
- self.$el.fadeToggle();
1896
  }
1897
  self.modalToTop(self.$el);
1898
  };
@@ -2345,7 +2370,7 @@ if (fQuery === undefined) {
2345
  self.tempHightlighted = $(selector);
2346
  self.tempHightlighted.css('outline', '3px dashed rgba(100,250,100,0.7)');
2347
  };
2348
- /*
2349
  * highlight all elements(with edititng option)
2350
  */
2351
  self.outlineAllPresets = function () {
@@ -2360,6 +2385,7 @@ if (fQuery === undefined) {
2360
  }
2361
  var litme = $(selector);
2362
  litme.css('outline', '2px dashed rgba(150,150,250,0.3)');
 
2363
  litme.css("cursor", 'pointer', 'important');
2364
  if (litme.data('wired') === true) {
2365
  continue;
@@ -2396,7 +2422,8 @@ if (fQuery === undefined) {
2396
  * @returns {unresolved}
2397
  */
2398
  self.highlightCurrent = function () {
2399
- var selector = self.currentPreset.selector;
 
2400
  self.outlineAllPresets();
2401
  //exit when default selector
2402
  if (selector.indexOf('ELEMENT NOW') != -1 || selector.indexOf('PICK ELEMENT') != -1) {
@@ -2405,6 +2432,15 @@ if (fQuery === undefined) {
2405
  self.hightlighted = $(selector);
2406
  self.hightlighted.css('outline', '3px dashed rgba(250,50,30,0.7)');
2407
  self.hightlighted.style("cursor", 'move', 'important');
 
 
 
 
 
 
 
 
 
2408
  self.makeCurrentDraggable();
2409
  };
2410
  /*
@@ -2439,8 +2475,6 @@ if (fQuery === undefined) {
2439
  $el.each(function () {
2440
  //set position to relative
2441
  $(this).style("position", 'relative', 'important');
2442
- //hide before styles are applied
2443
- $(this).style("visibility", 'hidden', 'important');
2444
  //set slider y to dragged value (parseInt(top,10) + parseInt($(window).scrollTop(),10))
2445
  //for firefox only
2446
  if (isMozilla) {
@@ -2456,8 +2490,6 @@ if (fQuery === undefined) {
2456
  //waiting to set top and left to "!important" after jquery ui draggable
2457
  setTimeout(function () {
2458
  $el.each(function () {
2459
- $(this).style("visibility", 'visible', 'important');
2460
- //set slider y to dragged value
2461
  //for firefox only
2462
  if (isMozilla) {
2463
  $(this).style("top", (parseInt(top, 10) + parseInt($(window).scrollTop(), 10)) + 'px', 'important');
@@ -2467,7 +2499,7 @@ if (fQuery === undefined) {
2467
  //set slider x to dragged value
2468
  $(this).style("left", left + 'px', 'important');
2469
  });
2470
- }, 30);
2471
  }
2472
  });
2473
  };
@@ -2553,7 +2585,7 @@ if (fQuery === undefined) {
2553
  });
2554
 
2555
  modal.find('.closeModal').click(function () {
2556
- modal.fadeOut('slow');
2557
  return;
2558
  });
2559
  modal.appendTo($('body'));
@@ -2589,7 +2621,7 @@ if (fQuery === undefined) {
2589
  '-moz-opacity': 0.5,
2590
  '-khtml-opacity': 0.5,
2591
  opacity: 0.5,
2592
- 'z-index': 200000
2593
  });
2594
  modal = $('<div class="draggableModal ui-draggable"><h1 class="draggableModalBar">' + href + ' <a class="closeModal" href="#">x</a></h1></div>');
2595
  modal.css({
@@ -2598,7 +2630,7 @@ if (fQuery === undefined) {
2598
  marginLeft: '50%',
2599
  width: '950px',
2600
  top: '40px',
2601
- zIndex: 200001
2602
  });
2603
  modal.find('.closeModal').bind('mousedown', function () {
2604
  modal.remove();
@@ -2608,7 +2640,7 @@ if (fQuery === undefined) {
2608
  frameSrc = href;
2609
  iframe = $('<iframe style="width:98%; height:490px; border:none; margin: 10px 1%" frameBorder="0" src="' + frameSrc + '"></iframe>');
2610
  iframe.appendTo(modal);
2611
- modal.appendTo($('body')).hide().fadeIn('slow');
2612
  overlay.click(function () {
2613
  modal.remove();
2614
  $(this).remove();
@@ -2647,7 +2679,7 @@ if (fQuery === undefined) {
2647
  return;
2648
  }
2649
  }
2650
- self.modals[modalName].fadeToggle();
2651
  self.modalToTop(self.modals[modalName]);
2652
  };
2653
  /*
@@ -2656,7 +2688,7 @@ if (fQuery === undefined) {
2656
  * @param {type} selectedModal
2657
  */
2658
  self.modalToTop = function (selectedModal) {
2659
- var highestZindex = 10000;
2660
  for (var index in self.modals) {
2661
  var modal = self.modals[index],
2662
  modalZindex = modal.css('zIndex');
3
  }
4
  //font control panel plugin
5
  (function ($) {
 
6
  /*global document */
7
  /*global setTimeout */
8
  /*global setInterval */
86
  show: true
87
  };
88
  modal = self.createNewModal(modalOptions);
89
+ modal.show();
90
  self.$presets = modal;
91
  //add presets list
92
  self.settingFields.presets = $('<fieldset id="presetsDropdownFieldset"><label>Selections<select id="presetsDropdown" name="presetsDropdown"></select></label></fieldset>');
307
  }
308
  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.');
309
  } else {
310
+ if(data.keytype === 'FREE' && self.loaded === true) {
311
+ return;
312
+ }
313
  self.loadEffectsPanel(data.effects);
314
  if (data.extended.length) {
315
  self.loadExtendedFields(data.extended);
318
  clearInterval(self.checkForApikeyInterval);
319
  }
320
  self.loadStylesPanel(data.styles);
 
321
  self.options.apikey = data.apikey;
322
+ self.loaded = true;
323
  }
324
  });
325
  };
360
  self.tryAnotherAjaxproxy();
361
  return;
362
  }
363
+ self.loadConfig();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  },
365
  error: function (response) {
366
  self.tryAnotherAjaxproxy();
379
  }
380
  self.loadSettings();
381
  };
382
+
383
+
384
+ /**
385
+ *
386
+ * continue loading with config file
387
+ *
388
+ **/
389
+ self.loadConfig = function () {
390
+ // try loading the plugin
391
+ try {
392
+ //console.log(self.options);
393
+ self.hideLoading();
394
+ // markup
395
+ self.createPresetsPanel();
396
+ self.createAppearancePanel();
397
+ self.createActionButtons();
398
+ self.loadPreset(0);
399
+ self.bindShowCategoriesAction();
400
+ self.bindShowFontsAction();
401
+ self.bindLinkOverlay();
402
+ self.setFontOnclick();
403
+ self.initUploadForm();
404
+ self.adaptOptionsToMode();
405
+ self.addLikeYesNo();
406
+ self.checkForApikey();
407
+ if (self.options.presets && self.options.presets[1]) {
408
+ self.loadPreset(1);
409
+ }
410
+ } catch (e) {
411
+ console.dir(e);
412
+ fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').unbind();
413
+ fQuery('#fontplugin').data('fontPlugin', false);
414
+ engageCompatibilityMode(function () {
415
+ fQuery('#wp-admin-bar-font_settings > a').trigger('click');
416
+ }, e);
417
+ }
418
+ },
419
  /*
420
  * Save settings by ajax
421
  *
428
  alert('Click on "Update" or "Publish" to save');
429
  return;
430
  }
431
+ self.$presets.hide();
432
+ self.$apr.hide();
433
  self.showLoading();
434
  savingOptions.settingFields = self.options.settingFields;
435
  savingOptions.presets = self.options.presets;
1002
  input.ColorPicker({
1003
  color: '#0000ff',
1004
  onShow: function (colpkr) {
1005
+ $(colpkr).show();
1006
  return false;
1007
  },
1008
  onHide: function (colpkr) {
1009
+ $(colpkr).hide();
1010
  return false;
1011
  },
1012
  onChange: function (hsb, hex, rgb) {
1179
  self.loadStylePreset(field.settingName);
1180
  self.unhighlightCurrent();
1181
  self.deletePreset(self.currentPresetNo, true);
 
1182
  }
1183
  if (data.length < 3) {
1184
+ var button = $('<button>More options</button>');
1185
+ $list.append(button);
1186
+ button.click(function () {
1187
+ 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');
1188
+ link.click();
1189
+ link.remove();
1190
+ return;
1191
+ });
1192
  }
1193
+
1194
+ /*var button = $('<button>Show style</button>').appendTo(modal);
1195
  button.click(function () {
1196
  var i,
1197
  presetSettings = {};
1205
  }
1206
 
1207
  alert(JSON.stringify(presetSettings));
1208
+ });*/
1209
  modal.append(button);
1210
  // change
1211
  $list.on('click', 'li', function () {
1733
  }
1734
  if(silent === undefined) {
1735
  self.outlineAllPresets();
 
1736
  alert('When resetting settings or deleting preset you have to save to see the change');
1737
+ self.loadPreset(0);
1738
+ } else if (self.options.presets && self.options.presets[1]) {
1739
+ self.loadPreset(1);
1740
+ } else {
1741
+ self.loadPreset(0);
1742
  }
1743
  };
1744
  //delete current preset
1758
  * @returns {unresolved}
1759
  */
1760
  self.loadPreset = function (presetNo) {
1761
+ var preset;
1762
+ presetNo = parseInt(presetNo, 10);
1763
+ var preset = self.options.presets[presetNo];
1764
 
1765
  self.unloadPreset();
1766
  if (!preset) {
1874
  var i;
1875
  var iframe = '<iframe style="width:98%; height:200px; border:none; margin: 10px 1%" frameBorder="0" src="http://fontsforweb.com/user/pluginactivate?apikey=' + self.options.apikey + '&blogurl=' + fontBlogUrl + '"></iframe>';
1876
 
1877
+ //create html within font browser
1878
  self.$el.show();
1879
  self.$el.append($('<h1 class="draggableModalBar"><a class="closeModal" href="#">x</a></h1>'));
1880
  self.$el.append('<div class="tablinks"><a class="tablink" href="fontslist">Fontsforweb.com</a><a class="tablink" href="uploaded">Upload</a><a class="tablink" href="pro">PRO settings</a></div>');
1904
  self.modalToTop(this);
1905
  });
1906
  self.$el.find('a.closeModal').on('click', function () {
1907
+ self.$el.hide();
1908
  return false;
1909
  });
1910
  };
1917
  self.loadFontCategories();
1918
  this.fontInitialized = true;
1919
  } else {
1920
+ self.$el.toggle();
1921
  }
1922
  self.modalToTop(self.$el);
1923
  };
2370
  self.tempHightlighted = $(selector);
2371
  self.tempHightlighted.css('outline', '3px dashed rgba(100,250,100,0.7)');
2372
  };
2373
+ /*
2374
  * highlight all elements(with edititng option)
2375
  */
2376
  self.outlineAllPresets = function () {
2385
  }
2386
  var litme = $(selector);
2387
  litme.css('outline', '2px dashed rgba(150,150,250,0.3)');
2388
+ $('.deletePreset').remove();
2389
  litme.css("cursor", 'pointer', 'important');
2390
  if (litme.data('wired') === true) {
2391
  continue;
2422
  * @returns {unresolved}
2423
  */
2424
  self.highlightCurrent = function () {
2425
+ var selector = self.currentPreset.selector,
2426
+ btn;
2427
  self.outlineAllPresets();
2428
  //exit when default selector
2429
  if (selector.indexOf('ELEMENT NOW') != -1 || selector.indexOf('PICK ELEMENT') != -1) {
2432
  self.hightlighted = $(selector);
2433
  self.hightlighted.css('outline', '3px dashed rgba(250,50,30,0.7)');
2434
  self.hightlighted.style("cursor", 'move', 'important');
2435
+ if(!self.hightlighted.find('.deletePreset')[0]) {
2436
+ btn = $('<button class="deletePreset">X</button>')
2437
+ self.hightlighted.append(btn);
2438
+ btn.click(function (e) {
2439
+ e.preventDefault();
2440
+ self.deleteCurrentPreset();
2441
+ return false;
2442
+ });
2443
+ }
2444
  self.makeCurrentDraggable();
2445
  };
2446
  /*
2475
  $el.each(function () {
2476
  //set position to relative
2477
  $(this).style("position", 'relative', 'important');
 
 
2478
  //set slider y to dragged value (parseInt(top,10) + parseInt($(window).scrollTop(),10))
2479
  //for firefox only
2480
  if (isMozilla) {
2490
  //waiting to set top and left to "!important" after jquery ui draggable
2491
  setTimeout(function () {
2492
  $el.each(function () {
 
 
2493
  //for firefox only
2494
  if (isMozilla) {
2495
  $(this).style("top", (parseInt(top, 10) + parseInt($(window).scrollTop(), 10)) + 'px', 'important');
2499
  //set slider x to dragged value
2500
  $(this).style("left", left + 'px', 'important');
2501
  });
2502
+ }, 10);
2503
  }
2504
  });
2505
  };
2585
  });
2586
 
2587
  modal.find('.closeModal').click(function () {
2588
+ modal.hide();
2589
  return;
2590
  });
2591
  modal.appendTo($('body'));
2621
  '-moz-opacity': 0.5,
2622
  '-khtml-opacity': 0.5,
2623
  opacity: 0.5,
2624
+ 'z-index': 200000001
2625
  });
2626
  modal = $('<div class="draggableModal ui-draggable"><h1 class="draggableModalBar">' + href + ' <a class="closeModal" href="#">x</a></h1></div>');
2627
  modal.css({
2630
  marginLeft: '50%',
2631
  width: '950px',
2632
  top: '40px',
2633
+ zIndex: 200000001
2634
  });
2635
  modal.find('.closeModal').bind('mousedown', function () {
2636
  modal.remove();
2640
  frameSrc = href;
2641
  iframe = $('<iframe style="width:98%; height:490px; border:none; margin: 10px 1%" frameBorder="0" src="' + frameSrc + '"></iframe>');
2642
  iframe.appendTo(modal);
2643
+ modal.appendTo($('body')).show();
2644
  overlay.click(function () {
2645
  modal.remove();
2646
  $(this).remove();
2679
  return;
2680
  }
2681
  }
2682
+ self.modals[modalName].toggle();
2683
  self.modalToTop(self.modals[modalName]);
2684
  };
2685
  /*
2688
  * @param {type} selectedModal
2689
  */
2690
  self.modalToTop = function (selectedModal) {
2691
+ var highestZindex = 1000000;
2692
  for (var index in self.modals) {
2693
  var modal = self.modals[index],
2694
  modalZindex = modal.css('zIndex');
js/pluginscripts.js CHANGED
@@ -20,7 +20,7 @@ var documentLoaded = setInterval(function () {
20
 
21
  function engageCompatibilityMode (callback, e) {
22
  if(e !== undefined) {
23
- alert(e.message);
24
  }
25
  jQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery-1.10.2.min.js', function () {
26
  fQuery = jQuery.noConflict(true);
@@ -44,21 +44,20 @@ function initializeFontPlugin (compatibilityMode) {
44
  /*
45
  show font plugin browser BUTTON
46
  */
47
- 'use strict';
48
  fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').bind('click', function (e) {
49
  e.preventDefault();
50
-
51
  //if initialized already just toggle
52
  if (fQuery('#fontplugin')[0] && fQuery('#fontplugin').data('fontPlugin') && fQuery('#fontplugin').data('fontPlugin').$presets) {
53
  fQuery('#fontplugin').data('fontPlugin').$presets.fadeToggle(500);
54
  } else {
55
  if(compatibilityMode) {
56
- alert('WARNING: Font plugin is running in safe mode. \n\n It may not work correctly! \n\nWhy?\n\nThis is usually caused by a conflict with a poorly written plugin.\n\n Try disabling all other plugins and then see if Font plugin starts without this message. If that works, enable other plguins one by one to find the one, which is causing the conflict.');
57
  }
58
  window.onbeforeunload = function () {
59
  return 'Have you saved the changes?';
60
  };
61
-
62
  //open jquery plugin
63
  var fontPluginWrapper = fQuery('<div id="fontplugin" class="draggableModal"></div>'),
64
  settings;
@@ -99,7 +98,8 @@ function initializeFontPlugin (compatibilityMode) {
99
  try {
100
  fontPluginWrapper.fontPlugin(settings);
101
  } catch (e) {
102
- alert('The plugin cannot start because of an error. This is usually caused by a conflict with a poorly written plugin. Try disabling all other plugins and then see if the "Font" plugin works. If that works, enable them one by one to find the one, which is causing the conflict.');
 
103
  }
104
  }
105
  return false;
20
 
21
  function engageCompatibilityMode (callback, e) {
22
  if(e !== undefined) {
23
+ alert('compatibility mode: ' + e.message);
24
  }
25
  jQuery.getScript(fontBlogUrl + '/wp-content/plugins/font/js/jquery-1.10.2.min.js', function () {
26
  fQuery = jQuery.noConflict(true);
44
  /*
45
  show font plugin browser BUTTON
46
  */
 
47
  fQuery('#FFW_chooseFontButton, #content_FFWButton, #wp-admin-bar-font_settings > a').bind('click', function (e) {
48
  e.preventDefault();
49
+
50
  //if initialized already just toggle
51
  if (fQuery('#fontplugin')[0] && fQuery('#fontplugin').data('fontPlugin') && fQuery('#fontplugin').data('fontPlugin').$presets) {
52
  fQuery('#fontplugin').data('fontPlugin').$presets.fadeToggle(500);
53
  } else {
54
  if(compatibilityMode) {
55
+ //alert('WARNING: Font plugin is running in safe mode. \n\n It may not work correctly! \n\nWhy?\n\nThis is usually caused by a conflict with a poorly written plugin.\n\n Try disabling all other plugins and then see if Font plugin starts without this message. If that works, enable other plguins one by one to find the one, which is causing the conflict.');
56
  }
57
  window.onbeforeunload = function () {
58
  return 'Have you saved the changes?';
59
  };
60
+
61
  //open jquery plugin
62
  var fontPluginWrapper = fQuery('<div id="fontplugin" class="draggableModal"></div>'),
63
  settings;
98
  try {
99
  fontPluginWrapper.fontPlugin(settings);
100
  } catch (e) {
101
+ console.dir(e);
102
+ alert('The plugin cannot start because of an error. This is usually caused by a conflict with a poorly written plugin or a theme overwriting jQuery. Try disabling all other plugins and then see if the "Font" plugin works. If that works, enable them one by one to find the one, which is causing the conflict. If nothing helps copy this error and send to the plugin author: ' + e);
103
  }
104
  }
105
  return false;
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.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!
@@ -179,6 +179,12 @@ Minor bug fixes
179
  = 7.4 =
180
  -Fixed lack of zindex
181
  -Added style presets
 
 
 
 
 
 
182
 
183
  == Upgrade Notice ==
184
  = 5.00 =
@@ -310,6 +316,12 @@ Fixed:
310
  = 7.4 =
311
  -Fixed lack of zindex
312
  -Added style presets
 
 
 
 
 
 
313
 
314
  == Arbitrary section ==
315
  == 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.5
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!
179
  = 7.4 =
180
  -Fixed lack of zindex
181
  -Added style presets
182
+ = 7.5 =
183
+ -Styles compacted
184
+ -Styles bar doesn't show too early
185
+ -Fixed bug with selection disappearing periodically
186
+ -Removed fading animations
187
+ -Added x button for easier preset removing
188
 
189
  == Upgrade Notice ==
190
  = 5.00 =
316
  = 7.4 =
317
  -Fixed lack of zindex
318
  -Added style presets
319
+ = 7.5 =
320
+ -Styles compacted
321
+ -Styles bar doesn't show too early
322
+ -Fixed bug with selection disappearing periodically
323
+ -Removed fading animations
324
+ -Added x button for easier preset removing
325
 
326
  == Arbitrary section ==
327
  == Source ==