diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-08-16 19:20:55 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-09-14 10:10:43 +0300 |
commit | 4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba (patch) | |
tree | daf54b86e51f0b5e67c982a8406456ae25c4362e /phpBB/styles/prosilver/template | |
parent | 253890520d75190aa268c9ea6ce1dd757fb571ff (diff) | |
download | forums-4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba.tar forums-4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba.tar.gz forums-4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba.tar.bz2 forums-4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba.tar.xz forums-4c2aad4ca959d1806c1833a3d4dd141b5c9f50ba.zip |
[ticket/11795] Get rid of pagination JS variables
Move pagination variables to data attributes
Replace A_BASE_URL with BASE_URL and use TWIG to escape it
PHPBB3-11795
Diffstat (limited to 'phpBB/styles/prosilver/template')
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 20 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/overall_header.html | 4 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/pagination.html | 3 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/simple_header.html | 11 |
4 files changed, 20 insertions, 18 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 59c4fd1d80..992479e45e 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -25,8 +25,19 @@ function popup(url, width, height, name) { /** * Jump to page */ -function jumpto() { - var page = prompt(jump_page, on_page); +function jumpto(item) { + if (!item || !item.length) { + item = $('a.pagination-trigger[data-lang-jump-page]'); + if (!item.length) { + return; + } + } + + var jump_page = item.attr('data-lang-jump-page'), + on_page = item.attr('data-on-page'), + per_page = item.attr('data-per-page'), + base_url = item.attr('data-base-url'), + page = prompt(jump_page, on_page); if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) { if (base_url.indexOf('?') === -1) { @@ -307,6 +318,11 @@ jQuery(document).ready(apply_onkeypress_event); $(this.getAttribute('data-reset-on-edit')).val(''); }); + // Pagination + $('a.pagination-trigger').click(function() { + jumpto($(this)); + }); + // Adjust HTML code for IE8 and older versions var test = document.createElement('div'), oldBrowser = (typeof test.style.borderRadius == 'undefined'); diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 0c15ec80c7..8342136da3 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -26,10 +26,6 @@ <script type="text/javascript"> // <![CDATA[ - var jump_page = '{LA_JUMP_PAGE}{L_COLON}'; - var on_page = '{ON_PAGE}'; - var per_page = '{PER_PAGE}'; - var base_url = '{A_BASE_URL}'; <!-- IF S_USER_PM_POPUP and S_NEW_PM --> var url = '{UA_POPUP_PM}'; diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html index 1c8441a9fd..87c24f7ecb 100644 --- a/phpBB/styles/prosilver/template/pagination.html +++ b/phpBB/styles/prosilver/template/pagination.html @@ -1,5 +1,6 @@ + {% set l_jump_page %}{L_JUMP_PAGE}{L_COLON}{% endset %} - <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> • + <a href="#" class="pagination-trigger" title="{L_JUMP_TO_PAGE}" data-lang-jump-page="{{ l_jump_page|e('html_attr') }}" data-on-page="{ON_PAGE}" data-per-page="{PER_PAGE}" data-base-url="{{ BASE_URL|e('html_attr') }}">{{ PAGE_NUMBER }}</a> • <ul> <!-- BEGIN pagination --> <!-- IF pagination.S_IS_PREV --> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 9a8c77135e..08b212363e 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -7,17 +7,6 @@ {META} <title>{SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE}</title> -<script type="text/javascript"> -// <![CDATA[ - - var jump_page = '{LA_JUMP_PAGE}{L_COLON}'; - var on_page = '{ON_PAGE}'; - var per_page = '{PER_PAGE}'; - var base_url = '{A_BASE_URL}'; - -// ]]> -</script> - <link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" /> <link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> <link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" /> |