Skip to content

Commit

Permalink
Merge pull request #40 from dcz/ticket/39
Browse files Browse the repository at this point in the history
[ticket/39] Add support for subsilver2
  • Loading branch information
dcz committed Sep 9, 2014
2 parents 5d5ea9d + be2f2f5 commit 08a7b50
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,22 @@ function pageJump(item) {
start_name = item.attr('data-start-name'),
anchor = '',
anchor_parts = base_url.split('#');

if ( anchor_parts[1] ) {
base_url = anchor_parts[0];
anchor = '#' + anchor_parts[1];
}

phpbb_seo.page = (page - 1) * per_page;

if ( phpbb_seo.page > 0 ) {
var phpEXtest = false;

if ( start_name !== 'start' || base_url.indexOf('?') >= 0 || ( phpEXtest = base_url.match("/\." + phpbb_seo.phpEX + "$/i"))) {
document.location.href = base_url.replace(/&/g, '&') + (phpEXtest ? '?' : '&') + start_name + '=' + phpbb_seo.page + anchor;
} else {
var ext = base_url.match(/\.[a-z0-9]+$/i);

if (ext) {
// location.ext => location-xx.ext
document.location.href = base_url.replace(/\.[a-z0-9]+$/i, '') + phpbb_seo.delim_start + phpbb_seo.page + ext + anchor;
Expand All @@ -51,15 +56,22 @@ function pageJump(item) {
*/
phpbb_seo.external_hrefs = function () {
var current_domain = document.domain.toLowerCase();
if (!current_domain || !document.getElementsByTagName) return;

if (!current_domain || !document.getElementsByTagName) {
return;
}

if (phpbb_seo.external_sub && current_domain.indexOf('.') >= 0) {
current_domain = current_domain.replace(new RegExp(/^[a-z0-9_-]+\.([a-z0-9_-]+\.([a-z]{2,6}|[a-z]{2,3}\.[a-z]{2,3}))$/i), '$1');
}

if (phpbb_seo.ext_classes) {
var extclass = new RegExp("(^|\s)(" + seo_ext_classes + ")(\s|$)");
}

if (phpbb_seo.hashfix) {
var basehref = document.getElementsByTagName('base')[0];

if (basehref) {
basehref = basehref.href;
var hashtest = new RegExp("^(" + basehref + "|)#[a-z0-9_-]+$");
Expand All @@ -68,25 +80,32 @@ phpbb_seo.external_hrefs = function () {
phpbb_seo.hashfix = false;
}
}

var hrefels = document.getElementsByTagName("a");
var hrefelslen = hrefels.length;

for (var i = 0; i < hrefelslen; i++) {
var el = hrefels[i];
var hrefinner = el.innerHTML.toLowerCase();

if (el.onclick || (el.href == '') || (el.href.indexOf('javascript') >=0 ) || (el.href.indexOf('mailto') >=0 ) || (hrefinner.indexOf('<a') >= 0) ) {
continue;
}

if (phpbb_seo.hashfix && el.hash && hashtest.test(el.href)) {
el.href = current_href + el.hash;
}

if (phpbb_seo.external) {

if ((el.href.indexOf(current_domain) >= 0) && !(phpbb_seo.ext_classes && extclass.test(el.className))) {
continue;
}
$(el).on('click', function () { window.open(this.href); return false; });
}
}
}

if (phpbb_seo.external || phpbb_seo.hashfix) {
$(document).ready(phpbb_seo.external_hrefs);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*
*/
-->
<!-- IF S_URL -->
<!-- IF S_URL -->
<dl style="clear: left;">
<dt><label for="url">URL:</label></dt>
<dt><label for="url">URL{L_COLON}</label></dt>
<dd><input type="text" name="url" id="url" size="45" maxlength="250" tabindex="2" value="{TOPIC_URL}" class="inputbox autowidth" /></dd>
</dl>
<!-- ENDIF -->
<!-- ENDIF -->
16 changes: 16 additions & 0 deletions styles/subsilver2/template/event/posting_editor_subject_after.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!--
/**
*
* @package Ultimate SEO URL phpBB SEO
* @version $$
* @copyright (c) 2014 www.phpbb-seo.com
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
-->
<!-- IF S_URL -->
<tr>
<td class="row1" width="22%"><b class="genmed">URL{L_COLON}</b></td>
<td class="row2" width="78%"><input class="post" style="width:450px" type="text" name="url" size="45" maxlength="250" tabindex="2" value="{TOPIC_URL}" /></td>
</tr>
<!-- ENDIF -->

0 comments on commit 08a7b50

Please sign in to comment.