-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbreadcrumb.js
55 lines (50 loc) · 1.49 KB
/
breadcrumb.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* jimdo-breadcrumb
* add breadcrumb navigation plugin widget for jimdo website.
*
* Author: hiromitz - http://hiromitz.jimdo.com
*/
(function(w, d, undefined) {
var jQuery;
/**
* Main script
*/
function main() {
jQuery(function($) {
if(0 < $('ul#mainNav1>li:first>a.current').length || 0 == $('a.current').length) return;
var $breadcrumb = $('<div id="jimdo-breadcrumb"/>').append($('ul#mainNav1>li:first').html());
if(0 < $('ul#mainNav1>li>a.parent').length) {
$breadcrumb.append(' > ').append($('ul#mainNav1>li>a.parent').clone());
}
if(0 < $('ul#mainNav2>li>a.parent').length) {
$breadcrumb.append(' > ').append($('ul#mainNav2>li>a.parent').clone());
}
$breadcrumb.append(' > ').append($('a.current').html());
$('#content_area').prepend($breadcrumb);
});
}
/**
* jQuery onLoad
*/
function scriptLoadHandler() {
jQuery = w.jQuery.noConflict(true);
main();
}
if (w.jQuery === undefined) {
// load jQuery
var js = d.createElement('script');
js.setAttribute("type","text/javascript");
js.setAttribute("src","http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js");
js.onload = scriptLoadHandler;
// onload for IE
js.onreadystatechange = function () {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
scriptLoadHandler();
}
};
(d.getElementsByTagName("head")[0] || d.documentElement).appendChild(js);
} else {
jQuery = w.jQuery;
main();
}
})(window, document);