You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
2.7 KiB
58 lines
2.7 KiB
$(function(){
|
|
// get current URL path and assign 'custom-active-link' class
|
|
var pathname = window.location.pathname,
|
|
origin = window.location.origin,
|
|
selected_link = $('div#main-view-menu ul.nav a[href="'+origin+""+pathname+'"]').parents().parents(),
|
|
selected_link_id = selected_link.prop("id");
|
|
var _this_list = $('div#main-view-menu .nav li');
|
|
_this_list.removeClass("custom-active-link")
|
|
_this_list.find('a[href="'+origin+""+pathname+'"]').parent().addClass("custom-active-link");
|
|
if(typeof selected_link_id != "undefined" && selected_link_id.length != 0) {
|
|
$("ul#" + selected_link_id).addClass("in").attr("aria-expanded", true);
|
|
$("li a[data-target='#" + selected_link_id + "']").attr("aria-expanded", true);
|
|
}
|
|
// end of setting up menu active link class
|
|
_initjs.prevent_page_load();
|
|
});
|
|
|
|
var _initjs = (function ($, window, jQuery) {
|
|
return {
|
|
"prevent_page_load" : function(){
|
|
var page_referrer = document.referrer;
|
|
var _cookie_data = decodeURIComponent(_initjs.getCookie("_sdllmea"));
|
|
if(_cookie_data.indexOf("logged_in") <= -1 && _cookie_data.indexOf("LeMondeBO") <= -1){
|
|
history.pushState(null, null, document.url);
|
|
//window.location.href = app.get_vars().baseurl;
|
|
}
|
|
if(page_referrer == "" || page_referrer.indexOf("home.php") != -1 || page_referrer.indexOf("auth.php") != -1 || page_referrer.indexOf("login.php") != -1){
|
|
history.pushState(null, null, document.url);
|
|
}
|
|
//history.pushState(null, null, document.url);
|
|
window.addEventListener('popstate', function (e) {
|
|
var referrer = document.referrer;
|
|
history.pushState(null, null, document.url);
|
|
var _cookie_data = decodeURIComponent(_initjs.getCookie("_sdllmea"));
|
|
|
|
if(_cookie_data.indexOf("logged_in") != -1 && _cookie_data.indexOf("LeMondeBO") != -1){
|
|
if(referrer.indexOf("auth") != -1) {
|
|
var currl = app.get_vars().currenturl;
|
|
if(typeof currl != "undefined"){
|
|
//window.location.href = referrer;
|
|
//window.location.href = app.get_vars().currenturl;
|
|
|
|
}else{
|
|
window.location.href = referrer;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
"getCookie" : function(name) {
|
|
var value = "; " + document.cookie;
|
|
var parts = value.split("; " + name + "=");
|
|
if (parts.length == 2) return parts.pop().split(";").shift();
|
|
}
|
|
};
|
|
// Pass in jQuery.
|
|
})(jQuery, this);
|