Skip to content

Commit a025c73

Browse files
Scroll Class Option
1 parent bd05fa8 commit a025c73

File tree

8 files changed

+110
-66
lines changed

8 files changed

+110
-66
lines changed

addons/scrolling-pagination/scrolling-pagination-functions.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function generate_scrolling_pagination($content, $page, $pages, $args, $s
5959

6060
$first_num = 1;
6161
$first_num = ' '
62-
. _wp_link_page($first_num)
62+
. sh_wp_link_page($first_num, $r['firstpageclass'])
6363
. $r['link_before']
6464
. $r['firstpage']
6565
. $r['link_after']
@@ -71,7 +71,7 @@ public function generate_scrolling_pagination($content, $page, $pages, $args, $s
7171
if ($page > 1) {
7272
$prev_num = $page - 1;
7373
$prev_link = ' '
74-
. _wp_link_page($prev_num)
74+
. sh_wp_link_page($prev_num, $r['previouspageclass'])
7575
. $r['link_before']
7676
. $r['previouspagelink']
7777
. $r['link_after']
@@ -84,7 +84,7 @@ public function generate_scrolling_pagination($content, $page, $pages, $args, $s
8484
if ($page < $pages) {
8585
$next_num = $page + 1;
8686
$next_link = ' '
87-
. _wp_link_page($next_num)
87+
. sh_wp_link_page($next_num, $r['nextpageclass'])
8888
. $r['link_before']
8989
. $r['nextpagelink']
9090
. $r['link_after']
@@ -95,7 +95,7 @@ public function generate_scrolling_pagination($content, $page, $pages, $args, $s
9595

9696
$last_num = $pages;
9797
$last_num = ' '
98-
. _wp_link_page($last_num)
98+
. sh_wp_link_page($last_num, $r['lastpageclass'])
9999
. $r['link_before']
100100
. $r['lastpage']
101101
. $r['link_after']

addons/scrolling-pagination/scrolling-pagination-options.php

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,35 +65,67 @@ public function options_fields($options = array())
6565
),
6666
'nextpagelink' => array(
6767
'id' => 'nextpagelink',
68-
'title' => '"'. __('nextpagelink', SH_PAGE_LINKS_DOMAIN) . '"',
68+
'title' => __('Next Page Text', SH_PAGE_LINKS_DOMAIN),
6969
'type' => 'text',
7070
'valid' => 'formatted',
7171
'default' => __('Next &rarr;'),
7272
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
7373
),
74+
'nextpageclass' => array(
75+
'id' => 'nextpageclass',
76+
'title' => __('Next Page Class', SH_PAGE_LINKS_DOMAIN),
77+
'type' => 'text',
78+
'valid' => 'formatted',
79+
'default' => '',
80+
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
81+
),
7482
'previouspagelink' => array(
7583
'id' => 'previouspagelink',
76-
'title' => '"'. __('previouspagelink', SH_PAGE_LINKS_DOMAIN) . '"',
84+
'title' => __('Previous Page Text', SH_PAGE_LINKS_DOMAIN),
7785
'type' => 'text',
7886
'valid' => 'formatted',
7987
'default' => __('&larr; Previous'),
8088
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
89+
),
90+
'previouspageclass' => array(
91+
'id' => 'previouspageclass',
92+
'title' => __('Previous Page Class', SH_PAGE_LINKS_DOMAIN),
93+
'type' => 'text',
94+
'valid' => 'formatted',
95+
'default' => '',
96+
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
8197
),
8298
'firstpage' => array(
8399
'id' => 'firstpage',
84-
'title' => '"'. __('firstpage', SH_PAGE_LINKS_DOMAIN) . '"',
100+
'title' => __('First Page Text', SH_PAGE_LINKS_DOMAIN),
85101
'type' => 'text',
86102
'valid' => 'formatted',
87103
'default' => __('First'),
88104
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
105+
),
106+
'firstpageclass' => array(
107+
'id' => 'firstpageclass',
108+
'title' => __('First Page Class', SH_PAGE_LINKS_DOMAIN),
109+
'type' => 'text',
110+
'valid' => 'formatted',
111+
'default' => '',
112+
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
89113
),
90114
'lastpage' => array(
91115
'id' => 'lastpage',
92-
'title' => '"'. __('lastpage', SH_PAGE_LINKS_DOMAIN) . '"',
116+
'title' => __('Last Page Text', SH_PAGE_LINKS_DOMAIN),
93117
'type' => 'text',
94118
'valid' => 'formatted',
95119
'default' => __('Last'),
96120
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
121+
),
122+
'lastpageclass' => array(
123+
'id' => 'lastpageclass',
124+
'title' => __('Last Page Class', SH_PAGE_LINKS_DOMAIN),
125+
'type' => 'text',
126+
'valid' => 'formatted',
127+
'default' => '',
128+
'callback' => array('SH_PageLinks_Options', 'settings_field_cb')
97129
),
98130
'elipsis' => array(
99131
'id' => 'elipsis',

addons/scrolling-pagination/scrolling-pagination.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ class SH_PageLinks_ScrollingPagination_Bootstrap
4545
protected static $default_options = array(
4646
'pages_to_scroll' => '3',
4747
'nextpagelink' => 'Next &rarr;',
48+
'nextpageclass' => '',
4849
'previouspagelink' => '&larr; Previous',
50+
'previouspageclass' => '&larr; Previous',
4951
'firstpage' => '',
52+
'firstpageclass' => '',
5053
'lastpage' => '',
54+
'lastpageclass' => '',
5155
'elipsis' => '',
5256
);
5357
/**

js/pagination_option_validation.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/pagination_option_validation.js

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,47 @@
1-
jQuery(document).ready(function($) {
2-
3-
$("#before-content").on('keyup', function() {
4-
if ($(this).val().indexOf("script") > -1)
5-
$(this).val($(this).val().replace("script", "span"));
6-
findTags($);
7-
}).on('keydown', function(e) {
8-
if (e.keyCode == 8) {
9-
if ($(this).val().indexOf("script") > -1)
10-
$(this).val($(this).val().replace("script", "span"));
11-
findTags($);
12-
}
13-
});
14-
15-
$("#wrapper-tag").on('keyup', function() {
16-
if ($(this).val().indexOf("script") > -1)
17-
$(this).val($(this).val().replace("script", "span"));
18-
}).on('keydown', function(e) {
19-
if (e.keyCode == 8)
20-
if ($(this).val().indexOf("script") > -1)
21-
$(this).val($(this).val().replace("script", "span"));
22-
});
23-
24-
$("#link-wrapper").on('keyup', function() {
25-
if ($(this).val().indexOf("script") > -1)
26-
$(this).val($(this).val().replace("script", "span"));
27-
}).on('keydown', function(e) {
28-
if (e.keyCode == 8)
29-
if ($(this).val().indexOf("script") > -1)
30-
$(this).val($(this).val().replace("script", "span"));
31-
});
1+
jQuery(document).ready(function ($) {
2+
3+
$("#before-content").on('keyup', function () {
4+
if ($(this).val().indexOf("script") > -1)
5+
$(this).val($(this).val().replace("script", "span"));
6+
findTags($);
7+
}).on('keydown', function (e) {
8+
if (e.keyCode == 8) {
9+
if ($(this).val().indexOf("script") > -1)
10+
$(this).val($(this).val().replace("script", "span"));
11+
findTags($);
12+
}
13+
});
14+
15+
$("#wrapper-tag").on('keyup', function () {
16+
if ($(this).val().indexOf("script") > -1)
17+
$(this).val($(this).val().replace("script", "span"));
18+
}).on('keydown', function (e) {
19+
if (e.keyCode == 8)
20+
if ($(this).val().indexOf("script") > -1)
21+
$(this).val($(this).val().replace("script", "span"));
22+
});
23+
24+
$("#link-wrapper").on('keyup', function () {
25+
if ($(this).val().indexOf("script") > -1)
26+
$(this).val($(this).val().replace("script", "span"));
27+
}).on('keydown', function (e) {
28+
if (e.keyCode == 8)
29+
if ($(this).val().indexOf("script") > -1)
30+
$(this).val($(this).val().replace("script", "span"));
31+
});
3232

3333
$("#wrapper-id").keydown(function (e) {
3434
if (e.keyCode == 32) { //32 - Space
3535
$(this).val($(this).val() + "-");
3636
return false;
3737
}
3838
}).change(function (e) {
39-
$(this).val(function (i, v) { return v.replace(" ", "-"); });
39+
$(this).val(function (i, v) {
40+
return v.replace(" ", "-");
41+
});
4042
});
4143

42-
$("#sh_pagelinks_options_form input").blur( function () {
44+
$("#sh_pagelinks_options_form input").blur(function () {
4345
processChanges($);
4446
});
4547

@@ -51,14 +53,14 @@ jQuery(document).ready(function($) {
5153

5254
function findTags($) {
5355

54-
openingTags = $("#before-content").val();
55-
tempElement = document.createElement('div');
56-
$(tempElement).append(openingTags);
56+
openingTags = $("#before-content").val();
57+
tempElement = document.createElement('div');
58+
$(tempElement).append(openingTags);
5759

58-
if ($(tempElement).html().indexOf(openingTags) > -1) {
59-
closingTags = $(tempElement).html().replace(openingTags, '');
60-
$("#after-content").val(closingTags);
61-
}
60+
if ($(tempElement).html().indexOf(openingTags) > -1) {
61+
closingTags = $(tempElement).html().replace(openingTags, '');
62+
$("#after-content").val(closingTags);
63+
}
6264

6365
}
6466

@@ -71,35 +73,35 @@ function processChanges($) {
7173
var wrapper = $("#wrapper-tag").val();
7274

7375
if (wrapper != "")
74-
changes += '<' + $("#wrapper-tag").val() + ' class="'+ $("#wrapper-class").val() +'" id="'+ $("#wrapper-id").val() +'">\n\t';
76+
changes += '<' + $("#wrapper-tag").val() + ' class="' + $("#wrapper-class").val() + '" id="' + $("#wrapper-id").val() + '">\n\t';
7577

7678
changes += $("#before-content").val();
77-
changes += '\n\t '+ processChangesAddLink('<a href="#">' + $("#firstpage").val() + '</a>') + ' ' + sep;
78-
changes += '\n\t '+ processChangesAddLink('<a href="#">'+ $("#link-before").val() + $("#previouspagelink").val() + $("#link-after").val() + '</a>') + ' ' + sep;
79-
changes += '\n\t '+ $("#elipsis").val() + ' ' + sep;
79+
changes += '\n\t ' + processChangesAddLink('<a href="#" class="' + $('#firstpageclass').val() + '">' + $("#firstpage").val() + '</a>') + ' ' + sep;
80+
changes += '\n\t ' + processChangesAddLink('<a href="#" class="' + $('#previouspageclass').val() + '">' + $("#link-before").val() + $("#previouspagelink").val() + $("#link-after").val() + '</a>') + ' ' + sep;
81+
changes += '\n\t ' + $("#elipsis").val() + ' ' + sep;
8082

81-
if ($("#pages-to-scroll-count").length>0)
83+
if ($("#pages-to-scroll-count").length > 0)
8284
numbers = $("#pages-to-scroll-count").val();
8385
else
8486
numbers = 3;
8587

8688
for (var i = 1; i <= numbers; i++) {
87-
changes += '\n\t '+ processChangesAddLink(processChangesAddNumber(i)) + ' ' + sep;
89+
changes += '\n\t ' + processChangesAddLink(processChangesAddNumber(i)) + ' ' + sep;
8890
};
8991

90-
changes += '\n\t '+ $("#elipsis").val() + ' ' + sep;
91-
changes += '\n\t '+ processChangesAddLink('<a href="#">'+ $("#link-before").val() + $("#nextpagelink").val() + $("#link-after").val() + '</a>') + ' ' + sep;
92-
changes += '\n\t '+ processChangesAddLink('<a href="#">' + $("#lastpage").val() + '</a>') + ' ';
92+
changes += '\n\t ' + $("#elipsis").val() + ' ' + sep;
93+
changes += '\n\t ' + processChangesAddLink('<a href="#" class="' + $('#nextpageclass').val() + '">' + $("#link-before").val() + $("#nextpagelink").val() + $("#link-after").val() + '</a>') + ' ' + sep;
94+
changes += '\n\t ' + processChangesAddLink('<a href="#" class="' + $('#lastpageclass').val() + '">' + $("#lastpage").val() + '</a>') + ' ';
9395

9496
if ($("#view-single-link").is(":checked"))
95-
changes += sep + '\n\t '+ processChangesAddLink('<a href="#">'+ $("#text-single-link").val() +'</a>');
97+
changes += sep + '\n\t ' + processChangesAddLink('<a href="#">' + $("#text-single-link").val() + '</a>');
9698

97-
changes += '\n\t '+$("#after-content").val();
99+
changes += '\n\t ' + $("#after-content").val();
98100

99101
if (wrapper != "")
100102
changes += '\n</' + $("#wrapper-tag").val() + '>\n';
101103

102-
changes = '<strong>Browser</strong><BR />' + changes.replace("\n","") + '<BR /><BR /><strong>HTML</strong><BR /><xmp style="width: 50%;">' + changes + '</xmp>';
104+
changes = '<strong>Browser</strong><BR />' + changes.replace("\n", "") + '<BR /><BR /><strong>HTML</strong><BR /><xmp style="width: 50%;">' + changes + '</xmp>';
103105

104106
$("div.anatomy_holder").html(changes);
105107

@@ -130,8 +132,8 @@ function processChangesAddNumber(page) {
130132
var changes = "";
131133
var format = jQuery("#pagelink").val();
132134

133-
format = format.replace("%page%",page);
134-
format = format.replace("%title%","Title");
135+
format = format.replace("%page%", page);
136+
format = format.replace("%title%", "Title");
135137
changes = '<a href="#">' + format + '</a>';
136138

137139
return changes;

page-links-options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ public function enqueue_scripts()
103103
wp_enqueue_script('jquery-ui', null, array('jquery'));
104104
wp_enqueue_script('jquery-ui-tabs', null, array('jquery'));
105105

106-
wp_register_script('admin-menu-current', plugins_url('js/admin-menu-current.min.js', __FILE__),array('jquery'));
107-
wp_register_script('pagination_option_validation', plugins_url('js/pagination_option_validation.min.js', __FILE__),array('jquery'));
106+
wp_register_script('admin-menu-current', plugins_url('js/admin-menu-current.min.js', __FILE__),array('jquery'),SH_PAGE_LINKS_VER);
107+
wp_register_script('pagination_option_validation', plugins_url('js/pagination_option_validation.min.js', __FILE__),array('jquery'), SH_PAGE_LINKS_VER);
108108

109109
wp_enqueue_script('admin-menu-current');
110110
wp_enqueue_script('pagination_option_validation');

page-links.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ function single_page_styles($links) {
4141
add_filter("plugin_action_links_$plugin", 'single_page_styles' );
4242

4343

44+
function sh_wp_link_page($i, $class = '', $attr = '') {
45+
46+
return str_replace('href=', $attr . ' class="'. $class .'" href=', _wp_link_page($i) );
47+
48+
}
49+
50+
4451
include_once 'page-links-install.php';
4552
include_once 'page-links-options.php';
4653
include_once 'single-view/single-view.php';

pages/page-plugin-options.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
</script>
293293
<div class="wrap">
294294

295-
<?php screen_icon(); ?>
296295
<h2>Page-Links Plus</h2>
297296
<div class="border"></div>
298297
<div id="logo-content">

0 commit comments

Comments
 (0)