📄 announcements.js
字号:
//// Functions to help with the rendering and the management of the announcement// messages to be displayed at the top of the various community areas.// Load in the json from the blog feed as tickerData. The blog json template// will do this for you// <script type="text/javascript" src="http://blogs.madagascar.internal.fifeventures.co.uk:8888/rss.php?blogId=300000&profile=json"></script>dojo.require("dojo.parser");dojo.require("dijit.layout.ContentPane");dojo.require("dijit.layout.StackContainer");dojo.require("dijit.form.Button");dojo.require("dojo.fx");dojo.require("dijit.layout.StackContainer");dojo.require("dojox.layout.RadioGroup");//djConfig.searchIds.push("piazzaAnnouncementTabContainer");// Switch variable to decide if the announcements are playingvar play = true;// The time to display each announcementvar announcementTimeout = 10000;// The time to fade in and out buttonsvar announcementButtonFade = 750;// The maximum opaqueness of the buttons var announcemneEndFade = 1;// Plays the announcemnet by displaying the next announcement// and setting a timer to be called again.function playIt() { console.debug('playIt'); if (play) { var node = dijit.byId('piazzaAnnouncementTabContainer'); node.forward(); fadeOutButtons(); } setTimeout("playIt()", announcementTimeout); }// Stops announcements being playedfunction stopIt() { console.debug('stopIt'); play = false;}// Starts announcements being playedfunction startIt() { console.debug('startIt'); play = true;}// Mouse over on the announcement barfunction mouseOverAnnouncement() { console.debug('mouseOverAnnouncement'); play = false; fadeInButtons();}// Mouse out on the announcement barfunction mouseOutAnnouncement() { console.debug('mouseOutAnnouncement'); play = true;}// Mouse over on next/previous ... controlsfunction mouseOverControl() { console.debug('mouseOverControl'); play = false; fadeInButtons();}// Mouse out on next/previous ... controlsfunction mouseOutControl(node) { console.debug('mouseOutControl'); fadeOutButtons(); play = true;}function fadeOutButtons() { console.debug('fadeOutButtons'); var previousBtn = dojo.byId('piazzaAnnouncementPreviousButton'); var nextBtn = dojo.byId('piazzaAnnouncementNextButton'); dojo.fadeOut({ node: previousBtn, duration: announcementButtonFade}).play(); dojo.fadeOut({ node: nextBtn, duration: announcementButtonFade}).play();}function fadeInButtons() { console.debug('fadeInButtons'); var previousBtn = dojo.byId('piazzaAnnouncementPreviousButton'); var nextBtn = dojo.byId('piazzaAnnouncementNextButton'); dojo.fadeIn({ node: previousBtn, end: announcemneEndFade, duration: announcementButtonFade}).play(); dojo.fadeIn({ node: nextBtn, end: announcemneEndFade, duration: announcementButtonFade}).play();}function previousAnnouncement() { console.debug('previousAnnouncement'); dijit.byId('piazzaAnnouncementTabContainer').back();}function nextAnnouncement() { console.debug('nextAnnouncement'); dijit.byId('piazzaAnnouncementTabContainer').forward();}function makeButtonsVisible() { console.debug('makeButtonsVisible'); var previousBtn = document.getElementById('piazzaAnnouncementPreviousButton'); var nextBtn = document.getElementById('piazzaAnnouncementNextButton'); previousBtn.style.visibility = 'visible'; nextBtn.style.visibility = 'visible'; if (previousBtn.addEventListener){ previousBtn.addEventListener("mouseover", mouseOverControl, true); previousBtn.addEventListener("mouseout", mouseOutControl, true); previousBtn.addEventListener("click", previousAnnouncement, true); previousBtn.addEventListener("dblclick", previousAnnouncement, true); } else if (previousBtn.attachEvent){ previousBtn.attachEvent("onmouseover", mouseOverControl); previousBtn.attachEvent("onmouseout", mouseOutControl); previousBtn.attachEvent("onclick", previousAnnouncement); previousBtn.attachEvent("ondblclick", previousAnnouncement); } if (nextBtn.addEventListener){ nextBtn.addEventListener("mouseover", mouseOverControl, true); nextBtn.addEventListener("mouseout", mouseOutControl, true); nextBtn.addEventListener("click", nextAnnouncement, true); nextBtn.addEventListener("dblclick", nextAnnouncement, true); } else if (nextBtn.attachEvent){ nextBtn.attachEvent("onmouseover", mouseOverControl); nextBtn.attachEvent("onmouseout", mouseOutControl); nextBtn.attachEvent("onclick", nextAnnouncement); nextBtn.attachEvent("ondblclick", nextAnnouncement); }}function isset(variableName) { console.debug('isset'); return Boolean(typeof(variableName) != 'undefined');}// Builds up the announcements by adding the panels from the feed/tickerDatafunction buildAnnouncement() { console.debug('buildAnnouncement'); var node = dijit.byId('piazzaAnnouncementTabContainer'); // Check to see if tickerData is loaded yet if ((typeof(tickerData) != 'undefined') && node) { // Iterate over feed for (i = 0; i < tickerData.length; i++) { paneContent = '<div dojoType="dijit.layout.ContentPane" title="Dojo" class="piazzaAnnouncementPane dojoxPane" onMouseOver="mouseOverAnnouncement(this)" onMouseOut="mouseOutAnnouncement(this)"><a href="' + tickerData[i]['url'] + '">' + tickerData[i]['title'] + '</a></div>'; pane = new dijit.layout.ContentPane({ title: tickerData[i]['description'] } ); pane.setContent(paneContent); node.addChild(pane); } // Restart the StackPanel node.startup(); makeButtonsVisible(); fadeOutButtons(); // Setup the callback setTimeout("playIt()", announcementTimeout); } else { // The feed data has not been loaded. Try again soon. setTimeout("buildAnnouncement()", 500); }}// run buildAnnouncement once the feed has been loaded.dojo.addOnLoad(function(){ buildAnnouncement(); });
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -