Template:USTC-Software/header/js

From 2013.igem.org

(Difference between revisions)
 
(7 intermediate revisions not shown)
Line 1: Line 1:
-
if (typeof(Reuters) == 'undefined' || Reuters == null) {
+
/*if (typeof(Reuters) == 'undefined' || Reuters == null) {
Reuters = new Object();
Reuters = new Object();
}
}
Line 28: Line 28:
}
}
-
/* Nav Dropdown */
+
 
 +
Nav Dropdown */
$("li.nav-item").hover(
$("li.nav-item").hover(
         function () {
         function () {
$(this).addClass("hover");
$(this).addClass("hover");
-
$(this).children(".subnav").stop(true,true).delay(50).slideDown(50, function(){    <!--50控制菜单下拉时间-->
+
$(this).children(".subnav").stop(true,true).delay(20).slideDown(20, function(){    <!--50控制菜单下拉时间-->
if($.fn.bgiframe && ($("select").length > 0)){
if($.fn.bgiframe && ($("select").length > 0)){
$(this).bgiframe({opacity: false});
$(this).bgiframe({opacity: false});
Line 40: Line 41:
         },function(){
         },function(){
$(this).removeClass("hover");
$(this).removeClass("hover");
-
$(this).children(".subnav").stop(true,true).delay(50).slideUp(50);      <!--slideup调节菜单返回所需时间-->
+
$(this).children(".subnav").stop(true,true).delay(20).slideUp(20);      <!--slideup调节菜单返回所需时间-->
});
});
Line 62: Line 63:
-
/*Edition Dropdown*/
 
-
// for header
+
 
 +
$('#editionSwitchTop li').hover(function() {
$('#editionSwitchTop li').hover(function() {
$(this)
$(this)
Line 90: Line 91:
});
});
-
// for footer
+
$(document).ready(function() {
$(document).ready(function() {
$('#editionSwitchFooter li').hover(function() {
$('#editionSwitchFooter li').hover(function() {
Line 120: Line 121:
});
});
-
/*Search Cleanup*/
+
 
if($("#searchForm").attr("action") == '/search') {
if($("#searchForm").attr("action") == '/search') {
$("#searchForm").attr("action", Reuters.nav.PRIMARY_SITE_URL +'/search');
$("#searchForm").attr("action", Reuters.nav.PRIMARY_SITE_URL +'/search');
}
}
-
 
-
/* Hack in opening in new window
 
-
 
-
$('#nav-strip a').each(function(ind) {
 
-
if (this.href.search(/\.reuters.com/i) == -1) {
 
-
this.target = "_self";
 
-
}
 
-
});*/
 

Latest revision as of 05:50, 27 October 2013

/*if (typeof(Reuters) == 'undefined' || Reuters == null) { Reuters = new Object(); }

if (typeof(Reuters.nav) == 'undefined' || Reuters.nav == null) { Reuters.nav = new Object(); }

if (typeof(Reuters.info) == 'undefined' || Reuters.info == null) { Reuters.info = new Object(); }

if (typeof Reuters.info.edition == "undefined") { Reuters.info.edition = "BETAUS"; }

if (typeof(Reuters.nav.baseUrlPrefix) == 'undefined') { Reuters.nav.baseUrlPrefix = ; }

if (typeof(Reuters.nav.PRIMARY_SITE_URL) == 'undefined') { Reuters.nav.PRIMARY_SITE_URL = 'http://www.reuters.com'; } if(Reuters.info.edition == 'BETAUS' || Reuters.info.edition == 'US') { Reuters.nav.PRIMARY_SITE_URL = 'http://www.reuters.com'; } else { Reuters.nav.PRIMARY_SITE_URL = 'http://'+(Reuters.info.edition).toLowerCase()+'.reuters.com'; }


Nav Dropdown */

$("li.nav-item").hover(

       function () {

$(this).addClass("hover"); $(this).children(".subnav").stop(true,true).delay(20).slideDown(20, function(){ if($.fn.bgiframe && ($("select").length > 0)){ $(this).bgiframe({opacity: false}); } });

       },function(){

$(this).removeClass("hover"); $(this).children(".subnav").stop(true,true).delay(20).slideUp(20); });

$('#nav-strip a').click(function() { var theParent = $(this).closest('.nav-item'); var theParentText= $('a .primary-link', theParent).text(); var linkText = $(this).text(); linkText = (linkText == theParentText)? linkText : theParentText + " - " + linkText; var destLink = $(this).attr('href'); if (typeof(dcsMultiTrack) == "function") { dcsMultiTrack('DCSext.DartZone',,'DCSext.ModID',,'DCSext.ModImp','0','DCSext.VirtualEvent', '1','DCSext.rNavChannel',theParentText,'DCSext.NavSection',linkText,'DCSext.NavURL',destLink,'WT.z_navtest', '1'); } });

$('#masthead a').click(function() { var destLink = $(this).attr('href'); if (typeof(dcsMultiTrack) == "function") { DcsMultiTrack('DCSext.DartZone',,'DCSext.ModID',,'DCSext.ModImp','0','DCSext.VirtualEvent','1','DCSext.rNavChannel','Other','DCSext.NavURL',destLink,'WT.z_navtest','1'); } });



$('#editionSwitchTop li').hover(function() { $(this) .find('ul') .stop(true,true); },function () { $(this) .find('ul') .stop(true, true) .delay(500) .slideUp(50); }); $("#editionSwitchTop li").click(function(event) { if($(this).find('ul').css('display') == 'none'){ $(this) .find('ul') .stop(true, true) .slideDown(75); } else if($(this).find('ul').css('display') == 'block'){ $(this) .find('ul') .stop(true, true) .slideUp(50); } });


$(document).ready(function() { $('#editionSwitchFooter li').hover(function() { $(this) .find('ul') .stop(true,true); },function () { $(this) .find('ul') .stop(true, true) .delay(500) .slideUp(50); }); $(function() { $("#editionSwitchFooter li").click(function(event) { if($(this).find('ul').css('display') == 'none'){ $(this) .find('ul') .stop(true, true) .slideDown(75); } else if($(this).find('ul').css('display') == 'block'){ $(this) .find('ul') .stop(true, true) .slideUp(50); } }); }); });


if($("#searchForm").attr("action") == '/search') { $("#searchForm").attr("action", Reuters.nav.PRIMARY_SITE_URL +'/search'); }