📄 slides.js
字号:
goTo(0); break; case 35: // end goTo(smax-1); break; case 67: // c showHide('k'); break; } if (key.which < 48 || key.which > 57) { number = undef; } else { if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return; if (key.target && isParentOrSelf(key.target, 'controls')) return; number = (((number != undef) ? number : 0) * 10) + (key.which - 48); } } return false;}function clicker(e) { number = undef; var target; if (window.event) { target = window.event.srcElement; e = window.event; } else target = e.target; if (target.href != null || hasValue(target.rel, 'external') || isParentOrSelf(target, 'controls') || isParentOrSelf(target,'embed') || isParentOrSelf(target, 'object')) return true; if (!e.which || e.which == 1) { if (!incrementals[snum] || incpos >= incrementals[snum].length) { go(1); } else { subgo(1); } }}function findSlide(hash) { var target = document.getElementById(hash); if (target) { for (var i = 0; i < slideIDs.length; i++) { if (target.id == slideIDs[i]) return i; } } return null;}function slideJump() { if (window.location.hash == null || window.location.hash == '') { currentSlide(); return; } if (window.location.hash == null) return; var dest = null; dest = findSlide(window.location.hash.slice(1)); if (dest == null) { dest = 0; } go(dest - snum);}function fixLinks() { var thisUri = window.location.href; thisUri = thisUri.slice(0, thisUri.length - window.location.hash.length); var aelements = document.getElementsByTagName('A'); for (var i = 0; i < aelements.length; i++) { var a = aelements[i].href; var slideID = a.match('\#.+'); if ((slideID) && (slideID[0].slice(0,1) == '#')) { var dest = findSlide(slideID[0].slice(1)); if (dest != null) { if (aelements[i].addEventListener) { aelements[i].addEventListener("click", new Function("e", "if (document.getElementById('slideProj').disabled) return;" + "go("+dest+" - snum); " + "if (e.preventDefault) e.preventDefault();"), true); } else if (aelements[i].attachEvent) { aelements[i].attachEvent("onclick", new Function("", "if (document.getElementById('slideProj').disabled) return;" + "go("+dest+" - snum); " + "event.returnValue = false;")); } } } }}function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName('a'); for (var i=0; i<anchors.length; i++) { var anchor = anchors[i]; if (anchor.getAttribute('href') && hasValue(anchor.rel, 'external')) { anchor.target = '_blank'; addClass(anchor,'external'); } }}function createControls() { var controlsDiv = document.getElementById("controls"); if (!controlsDiv) return; var hider = ' onmouseover="showHide(\'s\');" onmouseout="showHide(\'h\');"'; var hideDiv, hideList = ''; if (controlVis == 'hidden') { hideDiv = hider; } else { hideList = hider; } controlsDiv.innerHTML = '<form action="#" id="controlForm"' + hideDiv + '>' + '<div id="navLinks">' + '<a accesskey="t" id="toggle" href="javascript:toggle();">Ø<\/a>' + '<a accesskey="z" id="prev" href="javascript:go(-1);">«<\/a>' + '<a accesskey="x" id="next" href="javascript:go(1);">»<\/a>' + '<div id="navList"' + hideList + '><select id="jumplist" onchange="go(\'j\');"><\/select><\/div>' + '<\/div><\/form>'; if (controlVis == 'hidden') { var hidden = document.getElementById('navLinks'); } else { var hidden = document.getElementById('jumplist'); } addClass(hidden,'hideme');}function fontScale() { // causes layout problems in FireFox that get fixed if browser's Reload is used; same may be true of other Gecko-based browsers if (!s5mode) return false; var vScale = 22; // both yield 32 (after rounding) at 1024x768 var hScale = 32; // perhaps should auto-calculate based on theme's declared value? if (window.innerHeight) { var vSize = window.innerHeight; var hSize = window.innerWidth; } else if (document.documentElement.clientHeight) { var vSize = document.documentElement.clientHeight; var hSize = document.documentElement.clientWidth; } else if (document.body.clientHeight) { var vSize = document.body.clientHeight; var hSize = document.body.clientWidth; } else { var vSize = 700; // assuming 1024x768, minus chrome and such var hSize = 1024; // these do not account for kiosk mode or Opera Show } var newSize = Math.min(Math.round(vSize/vScale),Math.round(hSize/hScale)); fontSize(newSize + 'px'); if (isGe) { // hack to counter incremental reflow bugs var obj = document.getElementsByTagName('body')[0]; obj.style.display = 'none'; obj.style.display = 'block'; }}function fontSize(value) { if (!(s5ss = document.getElementById('s5ss'))) { if (!isIE) { document.getElementsByTagName('head')[0].appendChild(s5ss = document.createElement('style')); s5ss.setAttribute('media','screen, projection'); s5ss.setAttribute('id','s5ss'); } else { document.createStyleSheet(); document.s5ss = document.styleSheets[document.styleSheets.length - 1]; } } if (!isIE) { while (s5ss.lastChild) s5ss.removeChild(s5ss.lastChild); s5ss.appendChild(document.createTextNode('body {font-size: ' + value + ' !important;}')); } else { document.s5ss.addRule('body','font-size: ' + value + ' !important;'); }}function notOperaFix() { slideCSS = document.getElementById('slideProj').href; var slides = document.getElementById('slideProj'); var outline = document.getElementById('outlineStyle'); slides.setAttribute('media','screen'); outline.disabled = true; if (isGe) { slides.setAttribute('href','null'); // Gecko fix slides.setAttribute('href',slideCSS); // Gecko fix } if (isIE && document.styleSheets && document.styleSheets[0]) { document.styleSheets[0].addRule('img', 'behavior: url(ui/default/iepngfix.htc)'); document.styleSheets[0].addRule('div', 'behavior: url(ui/default/iepngfix.htc)'); document.styleSheets[0].addRule('.slide', 'behavior: url(ui/default/iepngfix.htc)'); }}function getIncrementals(obj) { var incrementals = new Array(); if (!obj) return incrementals; var children = obj.childNodes; for (var i = 0; i < children.length; i++) { var child = children[i]; if (hasClass(child, 'incremental')) { if (child.nodeName == 'OL' || child.nodeName == 'UL') { removeClass(child, 'incremental'); for (var j = 0; j < child.childNodes.length; j++) { if (child.childNodes[j].nodeType == 1) { addClass(child.childNodes[j], 'incremental'); } } } else { incrementals[incrementals.length] = child; removeClass(child,'incremental'); } } if (hasClass(child, 'show-first')) { if (child.nodeName == 'OL' || child.nodeName == 'UL') { removeClass(child, 'show-first'); if (child.childNodes[isGe].nodeType == 1) { removeClass(child.childNodes[isGe], 'incremental'); } } else { incrementals[incrementals.length] = child; } } incrementals = incrementals.concat(getIncrementals(child)); } return incrementals;}function createIncrementals() { var incrementals = new Array(); for (var i = 0; i < smax; i++) { incrementals[i] = getIncrementals(document.getElementById(slideIDs[i])); } return incrementals;}function defaultCheck() { var allMetas = document.getElementsByTagName('meta'); for (var i = 0; i< allMetas.length; i++) { if (allMetas[i].name == 'defaultView') { defaultView = allMetas[i].content; } if (allMetas[i].name == 'controlVis') { controlVis = allMetas[i].content; } }}// Key trap fix, new function body for trap()function trap(e) { if (!e) { e = event; e.which = e.keyCode; } try { modifierKey = e.ctrlKey || e.altKey || e.metaKey; } catch(e) { modifierKey = false; } return modifierKey || e.which == 0;}function startup() { defaultCheck(); if (!isOp) createControls(); slideLabel(); fixLinks(); externalLinks(); fontScale(); if (!isOp) { notOperaFix(); incrementals = createIncrementals(); slideJump(); if (defaultView == 'outline') { toggle(); } document.onkeyup = keys; document.onkeypress = trap; document.onclick = clicker; }}window.onload = startup;window.onresize = function(){setTimeout('fontScale()', 50);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -