<script>
if(window.self !== window.top){
// EDIT values to fit yours
document.domain = 'localhost'; // MANDATORY! // Set/Change this value to your domain (example: axew3.com (or leave localhost if on localhost))
var wordpress_url_page_forum = 'https://localhost/wp53/forums'; // MANDATORY! // (DO NOT ADD/INCLUDE final slash here) Url that point to your iframed wordpress forum page (the one you created blank in wp)
var w3all_scroll_top = 100; // To fit your theme header distance: change this value (pixels). This is the distance you want to scroll to by the WordPress Top header. The forum Top distance gap.
// END EDIT
var w3all_doc_domain = document.domain;
var w3allappend = false;
var boardU = "{BOARD_URL}";
// Lightbox correct scroll fix:
// https://www.axew3.com/w3/forums/viewtopic.php?f=13&t=885
// remove /* and */ to activate, also more below to complete ...
/*
$(".postimage").on("click", function(event) {
var pos = event.pageY - 100;
$(parent.window).scrollTop( 200 );
var el = document.getElementById("lightbox");
$("#lightboxOverlay").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lb-close").on("click", function() {
$(parent.window).scrollTop( pos );
});
$(".lightbox").on("click", function() {
$(parent.window).scrollTop( pos );
});
});
*/
function w3allNormalize_phpBBUrl(href){
// try to 'normalize' passed relative links: needed all after last slash /
// exception are kind of passed urls like: /phpbb323/app.php/help/faq
// and if SEO mods that may assign some different kind of links values
// by the way, SEO absolute urls http(s) should be (all?) already considered here ...
var phpbbRUrl = href.split(/^.+?(\w+.+)$/);
if( href.indexOf('app.php') > -1 ){ // since the previous not 'normalize' this type of passed value (and may miss something else)
phpbburl = href.split(/^.+?(app\.php.+)$/);
w3allappend = phpbburl[1];
} else if ( /^https?/ig.exec(href) !== null ){ // absolute http(s) passed: try to 'normalize' a possible seo mod
phpbburl = href.split(boardU);
w3allappend = phpbburl[1];
} else if ( phpbbRUrl[1] && phpbbRUrl[1].length > 1 ){ // 'normalize' any other
w3allappend = phpbbRUrl[1];
} else if ( phpbbRUrl[0].length > 1 ){
w3allappend = phpbbRUrl[0];
}
// ... if still not normalized
if(/^\W/ig.exec(w3allappend) !== null){
w3allappend = w3allappend.split(/^.+?(\w+.+)$/);
if(w3allappend[1]){
w3allappend = w3allappend[1];
}
if ( w3allappend[1] && w3allappend[1].charAt(0) == '/' ){
w3allappend = w3allappend[1].substr(1);
}
}
return w3allappend;
}
$(document).on("click", "a", function(e) {
var href = $(this).attr("href");
if( /[^-0-9A-Za-z\._#\:\?\/=&%]/ig.exec(href) !== null ){
return;
}
if( /\/adm\//ig.exec(href) !== null ){
e.preventDefault();
window.open(href,'_blank');
return;
}
if (href.indexOf('view=print') > -1 !== false){
e.preventDefault();
window.open(href,'_blank');
return;
}
if( /posting\.php\?mode=[reply|post|bump]/ig.exec(href) !== null || /mcp\.php\?/ig.exec(href) !== null ){
w3allappend = boardU;
}
// check if link point to external resource
if ((this.href.indexOf(boardU) > -1) != true){
if(/^(f|ht)tps?:\/\//i.test(href)){
e.preventDefault(); // prevent inside
parent.location.replace(href);
return;
}
}
// check for # short links like on FAQ page
if ( href.charAt(0) == '#' ){
return;
}
w3allappend = w3allNormalize_phpBBUrl(href);
var w3all_parent_element_id = $(this).parent().get( 0 ).id; // detect click x ... (ex: return ID smiley-box, onclick post smiles) ... // detect and avoid/allow certain behaviors
var w3all_onclick_smile = (w3all_parent_element_id.indexOf('smiley-box') > -1);
var w3all_onview_topic = (href.indexOf('viewtopic.php') > -1);
var w3all_onview_attach = (href.indexOf('file.php') > -1);
var w3all_onreview_post = /#[review]+/ig.exec(href);
var w3all_ck_quickmod = (href.indexOf('quickmod') > -1);
var w3all_onreply_topic = (href.indexOf('mode=reply') > -1);
var w3all_ck_onindex = (href.indexOf('index.php') > -1);
// Lightbox: if not working on repositioning img view
// complete Lightbox correct attachment display // activate removing /* and */
// also useful to open attachments in a new Tab
/*
if(w3all_onview_attach !== false){
e.preventDefault();
window.open(href,'_blank');
return;
} */
if ( href.indexOf('quickmod') > -1 ) {
if ('parentIFrame' in window) window.parentIFrame.scrollTo(0,w3all_scroll_top);
}
if ('parentIFrame' in window){
if( typeof w3allNOappend == 'undefined' ){
window.parentIFrame.sendMessage(w3allappend);
}
}
}); // END
///////////////////////////////////////////////////////////////////////////
// w3all Ajax UPDATES for phpBB events
var pmn = "{PRIVATE_MESSAGE_COUNT}";
var w3all_phpbb_u_logged = "{S_USER_LOGGED_IN}";
var hash = window.location.hash.substr(1);
location.hash = "#" + hash;
var w3all_lochash = '';
if( location.hash.length < 2 ){
w3all_lochash = 0;
} else if ( typeof ($(location.hash).offset() ) != 'undefined' ) { // #preview js error fix
w3all_lochash = $(location.hash).offset().top;
}
// to wp
var w3appendevents = '#w3all_phpbbpmcount=' + pmn + '#w3all_phpbb_u_logged=' + w3all_phpbb_u_logged + '#w3all_lochash=' + w3all_lochash;
if(w3appendevents.indexOf('w3allmchatif') == -1){
//if(parent.location.href.indexOf(wordpress_url_page_forum) > -1){
$( window ).on( "load", function() {
parent.w3all_ajaxup_from_phpbb(w3appendevents);
});
//}
}
// fix vertical iframe centered on viewtopic.php, preview or where # anchor etc (but skip on iOS)
var w3iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);
if(w3iOS == false){
$(window).on( "load", function() {
var bd = document.getElementsByTagName("body");
for (var i = 0; i < bd.length; i++) {
var bdID = bd[i].getAttribute("id");
}
var elt = document.getElementById(bdID);
elt.setAttribute("style", "position:fixed;top:0%;left:0%;width:100%;margin:0px;");
});
}
// If not using/applied the overall_header.html Javascript code, may un-comment this (may not)
/*
$( "a" ).contextmenu(function() {
var ohref = $(this).attr("href");
var href = this.href; // treath like an external because only open New tab or New window
d = w3allNormalize_phpBBUrl(href);
hrefEnc = window.btoa(unescape(encodeURIComponent(d)));
href1 = wordpress_url_page_forum + '/?w3=' + hrefEnc;
$(this).attr("href", href1); // send out encoded
$(this).mouseleave(function() { // reset (replaced 'mouseup')
$(this).attr("href", ohref);
});
});
*/
} // END if(window.self !== window.top){
</script>
<script type="text/javascript" src="https://localhost/phpBB3/iframeResizer.contentWindow.min.js" defer></script>