⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slides.js

📁 Requirement =====================================================================================
💻 JS
📖 第 1 页 / 共 2 页
字号:
// S5 v1.1 slides.js -- released into the Public Domain// Modified for Docutils (http://docutils.sf.net) by David Goodger//// Please see http://www.meyerweb.com/eric/tools/s5/credits.html for// information about all the wonderful and talented contributors to this code!var undef;var slideCSS = '';var snum = 0;var smax = 1;var slideIDs = new Array();var incpos = 0;var number = undef;var s5mode = true;var defaultView = 'slideshow';var controlVis = 'visible';var isIE = navigator.appName == 'Microsoft Internet Explorer' ? 1 : 0;var isOp = navigator.userAgent.indexOf('Opera') > -1 ? 1 : 0;var isGe = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('Safari') < 1 ? 1 : 0;function hasClass(object, className) {	if (!object.className) return false;	return (object.className.search('(^|\\s)' + className + '(\\s|$)') != -1);}function hasValue(object, value) {	if (!object) return false;	return (object.search('(^|\\s)' + value + '(\\s|$)') != -1);}function removeClass(object,className) {	if (!object) return;	object.className = object.className.replace(new RegExp('(^|\\s)'+className+'(\\s|$)'), RegExp.$1+RegExp.$2);}function addClass(object,className) {	if (!object || hasClass(object, className)) return;	if (object.className) {		object.className += ' '+className;	} else {		object.className = className;	}}function GetElementsWithClassName(elementName,className) {	var allElements = document.getElementsByTagName(elementName);	var elemColl = new Array();	for (var i = 0; i< allElements.length; i++) {		if (hasClass(allElements[i], className)) {			elemColl[elemColl.length] = allElements[i];		}	}	return elemColl;}function isParentOrSelf(element, id) {	if (element == null || element.nodeName=='BODY') return false;	else if (element.id == id) return true;	else return isParentOrSelf(element.parentNode, id);}function nodeValue(node) {	var result = "";	if (node.nodeType == 1) {		var children = node.childNodes;		for (var i = 0; i < children.length; ++i) {			result += nodeValue(children[i]);		}			}	else if (node.nodeType == 3) {		result = node.nodeValue;	}	return(result);}function slideLabel() {	var slideColl = GetElementsWithClassName('*','slide');	var list = document.getElementById('jumplist');	smax = slideColl.length;	for (var n = 0; n < smax; n++) {		var obj = slideColl[n];		var did = 'slide' + n.toString();		if (obj.getAttribute('id')) {			slideIDs[n] = obj.getAttribute('id');		}		else {			obj.setAttribute('id',did);			slideIDs[n] = did;		}		if (isOp) continue;		var otext = '';		var menu = obj.firstChild;		if (!menu) continue; // to cope with empty slides		while (menu && menu.nodeType == 3) {			menu = menu.nextSibling;		}	 	if (!menu) continue; // to cope with slides with only text nodes		var menunodes = menu.childNodes;		for (var o = 0; o < menunodes.length; o++) {			otext += nodeValue(menunodes[o]);		}		list.options[list.length] = new Option(n + ' : '  + otext, n);	}}function currentSlide() {	var cs;	var footer_nodes;	var vis = 'visible';	if (document.getElementById) {		cs = document.getElementById('currentSlide');		footer_nodes = document.getElementById('footer').childNodes;	} else {		cs = document.currentSlide;		footer = document.footer.childNodes;	}	cs.innerHTML = '<span id="csHere">' + snum + '<\/span> ' + 		'<span id="csSep">\/<\/span> ' + 		'<span id="csTotal">' + (smax-1) + '<\/span>';	if (snum == 0) {		vis = 'hidden';	}	cs.style.visibility = vis;	for (var i = 0; i < footer_nodes.length; i++) {		if (footer_nodes[i].nodeType == 1) {			footer_nodes[i].style.visibility = vis;		}	}		}function go(step) {	if (document.getElementById('slideProj').disabled || step == 0) return;	var jl = document.getElementById('jumplist');	var cid = slideIDs[snum];	var ce = document.getElementById(cid);	if (incrementals[snum].length > 0) {		for (var i = 0; i < incrementals[snum].length; i++) {			removeClass(incrementals[snum][i], 'current');			removeClass(incrementals[snum][i], 'incremental');		}	}	if (step != 'j') {		snum += step;		lmax = smax - 1;		if (snum > lmax) snum = lmax;		if (snum < 0) snum = 0;	} else		snum = parseInt(jl.value);	var nid = slideIDs[snum];	var ne = document.getElementById(nid);	if (!ne) {		ne = document.getElementById(slideIDs[0]);		snum = 0;	}	if (step < 0) {incpos = incrementals[snum].length} else {incpos = 0;}	if (incrementals[snum].length > 0 && incpos == 0) {		for (var i = 0; i < incrementals[snum].length; i++) {			if (hasClass(incrementals[snum][i], 'current'))				incpos = i + 1;			else				addClass(incrementals[snum][i], 'incremental');		}	}	if (incrementals[snum].length > 0 && incpos > 0)		addClass(incrementals[snum][incpos - 1], 'current');	ce.style.visibility = 'hidden';	ne.style.visibility = 'visible';	jl.selectedIndex = snum;	currentSlide();	number = 0;}function goTo(target) {	if (target >= smax || target == snum) return;	go(target - snum);}function subgo(step) {	if (step > 0) {		removeClass(incrementals[snum][incpos - 1],'current');		removeClass(incrementals[snum][incpos], 'incremental');		addClass(incrementals[snum][incpos],'current');		incpos++;	} else {		incpos--;		removeClass(incrementals[snum][incpos],'current');		addClass(incrementals[snum][incpos], 'incremental');		addClass(incrementals[snum][incpos - 1],'current');	}}function toggle() {	var slideColl = GetElementsWithClassName('*','slide');	var slides = document.getElementById('slideProj');	var outline = document.getElementById('outlineStyle');	if (!slides.disabled) {		slides.disabled = true;		outline.disabled = false;		s5mode = false;		fontSize('1em');		for (var n = 0; n < smax; n++) {			var slide = slideColl[n];			slide.style.visibility = 'visible';		}	} else {		slides.disabled = false;		outline.disabled = true;		s5mode = true;		fontScale();		for (var n = 0; n < smax; n++) {			var slide = slideColl[n];			slide.style.visibility = 'hidden';		}		slideColl[snum].style.visibility = 'visible';	}}function showHide(action) {	var obj = GetElementsWithClassName('*','hideme')[0];	switch (action) {	case 's': obj.style.visibility = 'visible'; break;	case 'h': obj.style.visibility = 'hidden'; break;	case 'k':		if (obj.style.visibility != 'visible') {			obj.style.visibility = 'visible';		} else {			obj.style.visibility = 'hidden';		}	break;	}}// 'keys' code adapted from MozPoint (http://mozpoint.mozdev.org/)function keys(key) {	if (!key) {		key = event;		key.which = key.keyCode;	}	if (key.which == 84) {		toggle();		return;	}	if (s5mode) {		switch (key.which) {			case 10: // return			case 13: // enter				if (window.event && isParentOrSelf(window.event.srcElement, 'controls')) return;				if (key.target && isParentOrSelf(key.target, 'controls')) return;				if(number != undef) {					goTo(number);					break;				}			case 32: // spacebar			case 34: // page down			case 39: // rightkey			case 40: // downkey				if(number != undef) {					go(number);				} else if (!incrementals[snum] || incpos >= incrementals[snum].length) {					go(1);				} else {					subgo(1);				}				break;			case 33: // page up			case 37: // leftkey			case 38: // upkey				if(number != undef) {					go(-1 * number);				} else if (!incrementals[snum] || incpos <= 0) {					go(-1);				} else {					subgo(-1);				}				break;			case 36: // home

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -