Head and Footer Scripts Inserter - Version 3.1

Version Description

  • Style sheet of settings page improved and better commented.
  • The "main.js" file renamed to "admin.js".
  • JS code improved.
Download this release

Release Info

Developer Arthur Gareginyan
Plugin Icon 128x128 Head and Footer Scripts Inserter
Version 3.1
Comparing to
See all releases

Code changes from version 3.0.2 to 3.1

header-and-footer-scripts-inserter.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Easily add your scripts to the WordPress website's head and footer sections. This is a must have tool for authors and website's owners.
6
  * Author: Arthur Gareginyan
7
  * Author URI: http://www.arthurgareginyan.com
8
- * Version: 3.0.2
9
  * License: GPL3
10
  * Text Domain: header-and-footer-scripts-inserter
11
  * Domain Path: /languages/
@@ -93,7 +93,7 @@ require_once( HFSINS_PATH . 'inc/php/settings_page.php' );
93
  /**
94
  * Load scripts and style sheet for settings page
95
  *
96
- * @since 3.0
97
  */
98
  function HFScriptsIns_load_scripts($hook) {
99
 
@@ -102,20 +102,21 @@ function HFScriptsIns_load_scripts($hook) {
102
  return;
103
  }
104
 
 
 
 
 
 
 
105
  // CodeMirror
106
- wp_enqueue_style('codemirror_style', HFSINS_URL . 'inc/lib/codemirror/codemirror.css');
107
- wp_enqueue_script('codemirror', HFSINS_URL . 'inc/lib/codemirror/codemirror.js');
108
- wp_enqueue_script('codemirror-htmlmixed', HFSINS_URL . 'inc/lib/codemirror/mode/htmlmixed.js');
109
- wp_enqueue_script('codemirror-javascript', HFSINS_URL . 'inc/lib/codemirror/mode/javascript.js');
110
- wp_enqueue_script('codemirror-xml', HFSINS_URL . 'inc/lib/codemirror/mode/xml.js');
111
- wp_enqueue_script('codemirror-css', HFSINS_URL . 'inc/lib/codemirror/mode/css.js');
112
- wp_enqueue_script('codemirror-active-line', HFSINS_URL . 'inc/lib/codemirror/addons/active-line.js');
113
-
114
- // JS functions
115
- wp_enqueue_script('js-functions', HFSINS_URL . 'inc/js/main.js', array(), false, true);
116
 
117
- // Style sheet
118
- wp_enqueue_style('styles', HFSINS_URL . 'inc/css/admin.css');
119
  }
120
  add_action('admin_enqueue_scripts', 'HFScriptsIns_load_scripts');
121
 
5
  * Description: Easily add your scripts to the WordPress website's head and footer sections. This is a must have tool for authors and website's owners.
6
  * Author: Arthur Gareginyan
7
  * Author URI: http://www.arthurgareginyan.com
8
+ * Version: 3.1
9
  * License: GPL3
10
  * Text Domain: header-and-footer-scripts-inserter
11
  * Domain Path: /languages/
93
  /**
94
  * Load scripts and style sheet for settings page
95
  *
96
+ * @since 3.1
97
  */
98
  function HFScriptsIns_load_scripts($hook) {
99
 
102
  return;
103
  }
104
 
105
+ // Style sheet
106
+ wp_enqueue_style( 'admin-css', HFSINS_URL . 'inc/css/admin.css' );
107
+
108
+ // JavaScript
109
+ wp_enqueue_script( 'admin-js', HFSINS_URL . 'inc/js/admin.js', array(), false, true );
110
+
111
  // CodeMirror
112
+ wp_enqueue_style( 'codemirror-css', HFSINS_URL . 'inc/lib/codemirror/codemirror.css' );
113
+ wp_enqueue_script( 'codemirror-js', HFSINS_URL . 'inc/lib/codemirror/codemirror.js' );
114
+ wp_enqueue_script( 'codemirror-mode-htmlmixed', HFSINS_URL . 'inc/lib/codemirror/mode/htmlmixed.js' );
115
+ wp_enqueue_script( 'codemirror-mode-javascript', HFSINS_URL . 'inc/lib/codemirror/mode/javascript.js' );
116
+ wp_enqueue_script( 'codemirror-mode-xml', HFSINS_URL . 'inc/lib/codemirror/mode/xml.js' );
117
+ wp_enqueue_script( 'codemirror-mode-css', HFSINS_URL . 'inc/lib/codemirror/mode/css.js' );
118
+ wp_enqueue_script( 'codemirror-mode-active-line', HFSINS_URL . 'inc/lib/codemirror/addons/active-line.js' );
 
 
 
119
 
 
 
120
  }
121
  add_action('admin_enqueue_scripts', 'HFScriptsIns_load_scripts');
122
 
inc/css/admin.css CHANGED
@@ -1,20 +1,13 @@
1
  /*
2
- * Header and Footer Scripts Inserter
3
- * Style sheet for plugin page
4
- * @since 3.0.2
5
- * @agareginyan
6
  */
7
 
8
 
9
- .aligncenter {
10
- text-align: center;
11
- }
12
-
13
- .form-table {
14
- clear: none;
15
- margin-top: 30px;
16
- }
17
-
18
  h2 {
19
  text-align: center;
20
  font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
@@ -42,55 +35,21 @@ h3.title {
42
  display: none;
43
  }
44
 
45
- /* CodeMirror Editor
46
  -------------------------------------------------------------- */
47
- .CodeMirror {
48
- height: 100% !important;
49
- border: 1px solid #ddd;
50
- margin-left: 5px;
51
- margin-right: 5px;
52
- }
53
-
54
- textarea {
55
- width: 100%;
56
- }
57
-
58
- .inner-sidebar h3.title {
59
- text-align: center;
60
- }
61
-
62
- p.help-text {
63
- font-style: italic;
64
- font-size: 12px !important;
65
- clear: left;
66
- color: #797979;
67
- line-height: 15px;
68
- padding-top: 0px !important;
69
- padding-left: 5px;
70
- margin-top: 0px !important;
71
- margin-bottom: 25px !important;
72
- }
73
-
74
- .postbox a {
75
- text-decoration: none;
76
- }
77
-
78
  #side-sortables {
79
  position: relative;
80
  }
81
 
82
- #about,
83
- #help,
84
- #donate,
85
- #advertisement{
86
  text-align: center;
87
  }
88
 
89
- #help p {
90
  margin: 0;
91
  }
92
 
93
- /* Responsive
94
  -------------------------------------------------------------- */
95
  @media (max-width: 860px) {
96
  .inner-sidebar {
@@ -101,6 +60,38 @@ p.help-text {
101
  }
102
  }
103
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  /* <pre> and <code> tag in "Using" section
105
  -------------------------------------------------------------- */
106
  #Using pre {
1
  /*
2
+ * Style sheet for plugin settings page
3
+ *
4
+ * Copyright (c) 2016 Arthur Gareginyan ( http://www.arthurgareginyan.com ).
5
+ * All Rights Reserved.
6
  */
7
 
8
 
9
+ /* Titles
10
+ -------------------------------------------------------------- */
 
 
 
 
 
 
 
11
  h2 {
12
  text-align: center;
13
  font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
35
  display: none;
36
  }
37
 
38
+ /* Sidebar
39
  -------------------------------------------------------------- */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  #side-sortables {
41
  position: relative;
42
  }
43
 
44
+ #side-sortables .postbox {
 
 
 
45
  text-align: center;
46
  }
47
 
48
+ #side-sortables #help p {
49
  margin: 0;
50
  }
51
 
52
+ /* Responsive page
53
  -------------------------------------------------------------- */
54
  @media (max-width: 860px) {
55
  .inner-sidebar {
60
  }
61
  }
62
 
63
+ /* Help text
64
+ -------------------------------------------------------------- */
65
+ td.help-text {
66
+ font-style: italic;
67
+ font-size: 12px !important;
68
+ float: left;
69
+ clear: left;
70
+ color: #797979;
71
+ line-height: 15px;
72
+ padding-top: 0px !important;
73
+ }
74
+
75
+ /* CodeMirror Editor
76
+ -------------------------------------------------------------- */
77
+ .CodeMirror {
78
+ height: 100% !important;
79
+ border: 1px solid #ddd;
80
+ margin-left: 5px;
81
+ margin-right: 5px;
82
+ }
83
+
84
+ /* Other
85
+ -------------------------------------------------------------- */
86
+ .form-table {
87
+ clear: none;
88
+ margin-top: 30px;
89
+ }
90
+
91
+ .postbox a {
92
+ text-decoration: none;
93
+ }
94
+
95
  /* <pre> and <code> tag in "Using" section
96
  -------------------------------------------------------------- */
97
  #Using pre {
inc/js/admin.js ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * JS functions for plugin settings page
3
+ *
4
+ * Copyright (c) 2016 Arthur Gareginyan ( http://www.arthurgareginyan.com ).
5
+ * All Rights Reserved.
6
+ */
7
+
8
+
9
+ jQuery(document).ready(function($) {
10
+
11
+ "use strict";
12
+
13
+ // Find all textareas on page
14
+ $('textarea').each(function(index, elements) {
15
+
16
+ // Change textarea to CodeMirror editor
17
+ var editor = CodeMirror.fromTextArea( elements , {
18
+ lineNumbers: true,
19
+ firstLineNumber: 1,
20
+ matchBrackets: true,
21
+ indentUnit: 4,
22
+ mode: 'text/html',
23
+ styleActiveLine: true
24
+ });
25
+
26
+ // Refresh CodeMirror editor after 1 second
27
+ setTimeout(function() {
28
+ editor.refresh();
29
+ },1);
30
+ });
31
+
32
+ // Remove the "successful" message after 3 seconds
33
+ if (".updated") {
34
+ setTimeout(function() {
35
+ $(".updated").fadeOut();
36
+ }, 3000);
37
+ }
38
+
39
+ });
inc/js/main.js DELETED
@@ -1,41 +0,0 @@
1
- /*
2
- * Head and Footer Scripts Inserter
3
- * JS functions
4
- * @since 3.0
5
- * @agareginyan
6
- */
7
-
8
-
9
- (function(){
10
- "use strict";
11
-
12
- jQuery(document).ready(function($) {
13
-
14
- // Find all textareas on page
15
- $('textarea').each(function(index, elements) {
16
-
17
- // Change textarea to CodeMirror editor
18
- var editor = CodeMirror.fromTextArea( elements , {
19
- lineNumbers: true,
20
- firstLineNumber: 1,
21
- matchBrackets: true,
22
- indentUnit: 4,
23
- mode: 'text/html',
24
- styleActiveLine: true
25
- });
26
-
27
- // Refresh CodeMirror editor after 1 second
28
- setTimeout(function() {
29
- editor.refresh();
30
- },1);
31
- });
32
-
33
- // Remove the "successful" message after 3 seconds
34
- if (".updated") {
35
- setTimeout(function() {
36
- $(".updated").fadeOut();
37
- }, 3000);
38
- }
39
- });
40
-
41
- }());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: inject, insert, insert scripts, insert javascript, insert js, insert html,
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS
5
  Requires at least: 3.9
6
  Tested up to: 4.6
7
- Stable tag: 3.0.2
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -119,7 +119,7 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
119
 
120
  **Credits**
121
 
122
- [CodeMirror](https://codemirror.net/) is an open-source project shared under a [MIT license](https://codemirror.net/LICENSE).
123
 
124
  **Links**
125
 
@@ -127,6 +127,10 @@ Commercial licensing (e.g. for projects that can’t use an open-source license)
127
  * [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/header-and-footer-scripts-inserter)
128
 
129
  == Changelog ==
 
 
 
 
130
  = 3.0.2 =
131
  * Added improved section with using explanation to plugin settings page.
132
  * admin.css improved.
4
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8A88KC7TFF6CS
5
  Requires at least: 3.9
6
  Tested up to: 4.6
7
+ Stable tag: 3.1
8
  License: GPL3
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
119
 
120
  **Credits**
121
 
122
+ [CodeMirror](https://codemirror.net/) is an open-source project shared under the [MIT license](https://codemirror.net/LICENSE).
123
 
124
  **Links**
125
 
127
  * [Dedicated Plugin Page on GitHub](https://github.com/ArthurGareginyan/header-and-footer-scripts-inserter)
128
 
129
  == Changelog ==
130
+ = 3.1 =
131
+ * Style sheet of settings page improved and better commented.
132
+ * The "main.js" file renamed to "admin.js".
133
+ * JS code improved.
134
  = 3.0.2 =
135
  * Added improved section with using explanation to plugin settings page.
136
  * admin.css improved.