/* * * Global Header, Helper and Utility functions * version 1 */ function get_relative_path() { var loc = document.location.href; var tmp = loc.substring(loc.indexOf("//")+2); tmp = tmp.substring(tmp.indexOf("/")+1); return tmp.split('?')[0]; } function get_url_args(url) { var path = url || get_relative_path(); return path.split('/'); } function get_ad_par() { var path = url_q || get_relative_path(); path = path || 'home'; for (var pattern in WMG.Ads.urlsMap) { var re = new RegExp("^" + pattern + "$","ig"); if (re.test(path)) { return WMG.Ads.urlsMap[pattern]; } } return 'miscellaneous'; } function set_page_section_title(selector) { var wmg_show_section_title = true; var wmg_use_artist_name = true; url_args = get_url_args(); if (url_args[0]) { switch (url_args[0]) { case 'blogs': case 'blog': page_section_title = 'Blog'; break; case 'video': page_section_title = 'Videos'; break; case 'photo': page_section_title = 'Photos'; break; case 'music': page_section_title = 'Music'; break; case 'album': case 'albums': page_section_title = 'Albums'; break; case 'tour-dates': page_section_title = 'Tour Dates'; break; case 'bio': page_section_title = 'Bio'; break; case 'community_landing': page_section_title = 'Community'; break; case 'forum': case 'forums': page_section_title = 'Discussion'; break; case 'search-landing': page_section_title = 'Search Results'; break; case 'page-not-found': page_section_title = '- Page Not Found'; break; case 'contact-us': page_section_title = 'Contact Us'; wmg_use_artist_name = false; break; case 'twitter': page_section_title = 'Twitter'; wmg_use_artist_name = false; break; case 'member': if (!url_args[1]) { wmg_use_artist_name = false; page_section_title = 'Fans'; } else { wmg_show_section_title = false; } break; default: if (jQuery('body').hasClass('page-node-1191')) { page_section_title = '- Page Not Found'; } else { wmg_show_section_title = false; } break; } } else { wmg_show_section_title = false; } if (wmg_show_section_title) { jQuery(selector).html((wmg_use_artist_name ? WMG.artistname : '') + ' ' + page_section_title); } return page_section_title; } // Script out of doc ready block, so we can do something facter or before events attachment // define global vars var url_q = get_relative_path(); var url_args = get_url_args(url_q); var wmg_ad_url = get_ad_par(); var page_section_title = 'Site'; // Additional class for user profile var re = new RegExp("^user/([0-9]+)/.*$","ig"); if (jQuery('body.page-user').length && !re.test(url_q)) { //(url_args[0] == 'member' && typeof url_args[1] != 'undefined') { jQuery("body").addClass('page-user-3column'); } if (url_args[0] == 'member' && typeof url_args[1] != 'undefined') { jQuery("body").addClass('page-user-view-profile'); } jQuery(document).ready(function() { // changing layout via JS var wmg_body_layout = jQuery('body.page-user-3column, body.page-photo.body-layout-fixed-ca, body.page-video.body-layout-fixed-ca, body.page-photo.body-layout-fixed-ac, body.page-video.body-layout-fixed-ac, body.page-forum.body-layout-fixed-ca, body.page-forums.body-layout-fixed-ac, body.page-forum-category.body-layout-fixed-ca, body.page-forum-category.body-layout-fixed-ac'); if (wmg_body_layout.length) { wmg_body_layout.removeClass('body-layout-fixed-ca'); wmg_body_layout.removeClass('body-layout-fixed-ac'); wmg_body_layout.addClass('body-layout-fixed-acb'); jQuery('#sidebar-b').removeClass('element-invisible'); jQuery('#sidebar-b').removeClass('tb-hidden'); } });