fixed bad hash nav implementation
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_token_info()
|
||||||
|
*/
|
||||||
|
function token_test_token_info() {
|
||||||
|
$info['tokens']['node']['colons:in:name'] = array(
|
||||||
|
'name' => t('A test token with colons in the name'),
|
||||||
|
'description' => NULL,
|
||||||
|
);
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
@@ -155,7 +155,7 @@ function jeemod_preprocess_jeemod_share_links(&$vars){
|
|||||||
|
|
||||||
$sitetitle = variable_get('site_name', '');
|
$sitetitle = variable_get('site_name', '');
|
||||||
$nodetitle = $entity->title;
|
$nodetitle = $entity->title;
|
||||||
$nodeurl = $base_url . base_path() . "#principe-" . $entity->nid;
|
$nodeurl = $base_url . url('node/'.$entity->nid);//$base_url . base_path() . "#principe-" . $entity->nid;
|
||||||
|
|
||||||
$text = $nodetitle ." | ". $sitetitle . " - " . $nodeurl;
|
$text = $nodetitle ." | ". $sitetitle . " - " . $nodeurl;
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,15 @@
|
|||||||
2015
|
2015
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
jQuery(document).ready(function($) {
|
jQuery(document).ready(function($) {
|
||||||
// console.log('Hello Jee');
|
// console.log('Hello Jee');
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/2890898/preventing-mouse-emulation-events-ie-click-from-touch-events-in-mobile-safari
|
// http://stackoverflow.com/questions/2890898/preventing-mouse-emulation-events-ie-click-from-touch-events-in-mobile-safari
|
||||||
// FastClick.attach(document.body);
|
// FastClick.attach(document.body);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var _debug = false,
|
var _debug = false,
|
||||||
_avgDelay = 1,
|
_avgDelay = 1,
|
||||||
_lastDraw = new Date,
|
_lastDraw = new Date,
|
||||||
@@ -344,24 +347,33 @@ jQuery(document).ready(function($) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function initHashNav(){
|
function initHashNav(){
|
||||||
|
|
||||||
if(window.location.hash !== ''){
|
if(window.location.hash !== ''){
|
||||||
// console.log("hash = "+window.location.hash);
|
// console.log("hash = "+window.location.hash);
|
||||||
var p = window.location.hash.match('^#principe-([0-9]+)$');
|
var p = window.location.hash.match('^#principe-([0-9]+)$');
|
||||||
// console.log("p :", p);
|
// console.log("p :", p);
|
||||||
if(p){
|
if(p){
|
||||||
// console.log($('li.node-readmore a[href="/node/'+p[1]+'"]', 'section#node-'+p[1]));
|
var hash = $('li.node-readmore a', 'section#node-'+p[1]).attr('href');
|
||||||
setTimeout((function(nid){
|
updateHash(hash);
|
||||||
$('li.node-readmore a[href="/node/'+nid+'"]', 'section#node-'+nid).trigger('click').delay(1000).trigger('click');
|
|
||||||
}(p[1])), 500);
|
|
||||||
}else{
|
|
||||||
var h = window.location.hash.match('^#(.+)$');
|
|
||||||
// console.log("h :", h);
|
|
||||||
setTimeout((function(href){
|
|
||||||
$('a[href="'+href+'"]', '#block-menu-menu-footer-menu').trigger('click');
|
|
||||||
}(h[1])), 500);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var page = window.location.hash.match('^#/page/.+$');
|
||||||
|
var h = window.location.hash.match('^#(.+)$');
|
||||||
|
// console.log("h :", h);
|
||||||
|
if(page){
|
||||||
|
setTimeout((function(href){
|
||||||
|
$('a[href="'+href+'"]', '#block-menu-menu-footer-menu').trigger('click');
|
||||||
|
}(h[1])), 100);
|
||||||
|
}else{
|
||||||
|
setTimeout((function(href){
|
||||||
|
$('li.node-readmore a[href="'+href+'"]', 'section.node-chapitre').trigger('click').delay(1000).trigger('click');
|
||||||
|
}(h[1])), 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
_____ _____ _____ _____ _____ _____ _____
|
_____ _____ _____ _____ _____ _____ _____
|
||||||
@@ -427,6 +439,7 @@ jQuery(document).ready(function($) {
|
|||||||
this.e = e;
|
this.e = e;
|
||||||
this.$e = $(e);
|
this.$e = $(e);
|
||||||
this.nid = this.$e.attr("id").match(/^node-(\d+)/)[1];
|
this.nid = this.$e.attr("id").match(/^node-(\d+)/)[1];
|
||||||
|
this.hashref = $('li.node-readmore a', e).attr('href');
|
||||||
this.geom = {
|
this.geom = {
|
||||||
base_a:base_a,
|
base_a:base_a,
|
||||||
a:0,
|
a:0,
|
||||||
@@ -789,10 +802,10 @@ jQuery(document).ready(function($) {
|
|||||||
// |_____|__| |_____|_|___| |_____|__|__|__|__|__| |_| |_____|__|__|
|
// |_____|__| |_____|_|___| |_____|__|__|__|__|__| |_| |_____|__|__|
|
||||||
|
|
||||||
Chapter.prototype.loadNode = function(e){
|
Chapter.prototype.loadNode = function(e){
|
||||||
console.log("Chapter :: open : nid", this.nid);
|
console.log("Chapter :: open : e", e);
|
||||||
|
|
||||||
// change hash address bar
|
// change hash address bar
|
||||||
updateHash("principe-"+this.nid);
|
updateHash(this.hashref);
|
||||||
|
|
||||||
_$body.addClass('loading');
|
_$body.addClass('loading');
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,17 @@
|
|||||||
<!-- remove the no-js as fast as possible -->
|
<!-- remove the no-js as fast as possible -->
|
||||||
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/* redirect sub page to ajax loaded with hash */
|
||||||
|
function checkRedirect(){
|
||||||
|
var loc = window.location;
|
||||||
|
console.log(loc);
|
||||||
|
if(loc.pathname !== "/"){
|
||||||
|
window.location = loc.origin + "/#" + loc.pathname;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
checkRedirect();
|
||||||
|
</script>
|
||||||
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
|
||||||
Remove this if you use the .htaccess -->
|
Remove this if you use the .htaccess -->
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
|
|||||||
Reference in New Issue
Block a user