From a6d2680ba4b5aefa2fad5b14e40d4ebc24459d5a Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 9 Jan 2020 22:30:59 +0100 Subject: update slidy to upstream code as of 2014-05-28 --- slidy/slidy.css | 50 +++++++++++++++++++------------------- slidy/slidy.js | 74 ++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 76 insertions(+), 48 deletions(-) diff --git a/slidy/slidy.css b/slidy/slidy.css index 61effb6..c713c88 100644 --- a/slidy/slidy.css +++ b/slidy/slidy.css @@ -15,10 +15,6 @@ body height: 100%; color: black; background-color: white; - background-image: url(openlogo-nd-100.png); - background-attachment: fixed; - background-repeat: no-repeat; - background-position: 95% 5%; font-family: "Gill Sans MT", "Gill Sans", GillSans, sans-serif; font-size: 14pt; } @@ -47,7 +43,7 @@ div.initial_prompt { width: 100%; background-color: rgb(200,200,200); opacity: 0.35; - background-color: rgb(200,200,200, 0.35); + background-color: rgba(200,200,200, 0.35); cursor: pointer; } @@ -138,23 +134,21 @@ div.slide h1 { background: transparent; } -div.toc { - position: absolute; - top: auto; - bottom: 4em; - left: 4em; - right: auto; - width: 60%; - max-width: 30em; - height: 30em; - border: solid thin black; - padding: 1em; - background: rgb(240,240,240); - color: black; - z-index: 300; - overflow: auto; - display: block; - visibility: visible; +@media screen and (max-device-width: 1024px) +{ + div.slide { font-size: 100%; } +} + +@media screen and (max-device-width: 800px) +{ + div.slide { font-size: 200%; } + div.slidy_toc { + top: 1em; + left: 1em; + right: auto; + width: 80%; + font-size: 180%; + } } div.toc-heading { @@ -164,6 +158,10 @@ div.toc-heading { text-align: center; } +img { + image-rendering: optimize-quality; +} + pre { font-size: 80%; font-weight: bold; @@ -201,10 +199,10 @@ a:hover { color: red; text-decoration: underline } a:active { color: red; text-decoration: underline } a {text-decoration: none} -.navbar a:link {color: white} -.navbar a:visited {color: yellow} -.navbar a:active {color: red} -.navbar a:hover {color: red} +.toolbar a:link {color: blue} +.toolbar a:visited {color: blue} +.toolbar a:active {color: red} +.toolbar a:hover {color: red} ul { list-style-type: square; } ul ul { list-style-type: disc; } diff --git a/slidy/slidy.js b/slidy/slidy.js index 9c6d7b1..83723b4 100644 --- a/slidy/slidy.js +++ b/slidy/slidy.js @@ -1,5 +1,5 @@ -var w3c_slidy={ns_pos:(typeof window.pageYOffset!='undefined'),khtml:((navigator.userAgent).indexOf("KHTML")>=0?true:false),opera:((navigator.userAgent).indexOf("Opera")>=0?true:false),ipad:((navigator.userAgent).indexOf("iPad")>=0?true:false),iphone:((navigator.userAgent).indexOf("iPhone")>=0?true:false),android:((navigator.userAgent).indexOf("Android")>=0?true:false),ie:(typeof document.all!="undefined"&&!this.opera),ie6:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 6")!=-1),ie7:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 7")!=-1),ie8:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 8")!=-1),ie9:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 9")!=-1),last_tap:0,prev_tap:0,start_x:0,start_y:0,delta_x:0,delta_y:0,is_xhtml:/xml/.test(document.contentType),slide_number:0,slide_number_element:null,slides:[],notes:[],backgrounds:[],toolbar:null,title:null,last_shown:null,eos:null,toc:null,outline:null,selected_text_len:0,view_all:0,want_toolbar:true,mouse_click_enabled:true,scroll_hack:0,disable_slide_click:false,lang:"en",help_anchor:null,help_page:"http://www.w3.org/Talks/Tools/Slidy2/help/help.html",help_text:"Navigate with mouse click, space bar, Cursor Left/Right, "+"or Pg Up and Pg Dn. Use S and B to change font size.",size_index:0,size_adjustment:0,sizes:new Array("10pt","12pt","14pt","16pt","18pt","20pt","22pt","24pt","26pt","28pt","30pt","32pt"),last_width:0,last_height:0,objects:[],set_up:function(){var init=function(){w3c_slidy.init();};if(typeof window.addEventListener!="undefined") +var w3c_slidy={ns_pos:(typeof window.pageYOffset!='undefined'),khtml:((navigator.userAgent).indexOf("KHTML")>=0?true:false),opera:((navigator.userAgent).indexOf("Opera")>=0?true:false),ipad:((navigator.userAgent).indexOf("iPad")>=0?true:false),iphone:((navigator.userAgent).indexOf("iPhone")>=0?true:false),android:((navigator.userAgent).indexOf("Android")>=0?true:false),ie:(typeof document.all!="undefined"&&!this.opera),ie6:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 6")!=-1),ie7:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 7")!=-1),ie8:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 8")!=-1),ie9:(!this.ns_pos&&navigator.userAgent.indexOf("MSIE 9")!=-1),last_tap:0,prev_tap:0,start_x:0,start_y:0,delta_x:0,delta_y:0,is_xhtml:/xml/.test(document.contentType),slide_number:0,slide_number_element:null,slides:[],notes:[],backgrounds:[],observers:[],toolbar:null,title:null,last_shown:null,eos:null,toc:null,outline:null,selected_text_len:0,view_all:0,want_toolbar:true,mouse_click_enabled:true,scroll_hack:0,disable_slide_click:false,lang:"en",help_anchor:null,help_page:"http://www.w3.org/Talks/Tools/Slidy2/help/help.html",help_text:"Navigate with mouse click, space bar, Cursor Left/Right, "+"or Pg Up and Pg Dn. Use S and B to change font size.",size_index:0,size_adjustment:0,sizes:new Array("10pt","12pt","14pt","16pt","18pt","20pt","22pt","24pt","26pt","28pt","30pt","32pt"),last_width:0,last_height:0,objects:[],set_up:function(){var init=function(){w3c_slidy.init();};if(typeof window.addEventListener!="undefined") window.addEventListener("load",init,false);else window.attachEvent("onload",init);},hide_slides:function(){if(document.body&&!w3c_slidy.initialized) document.body.style.visibility="hidden";else @@ -13,7 +13,9 @@ else {this.last_shown=null;this.set_visibility_all_incremental("hidden");this.set_eos_status(!this.next_incremental_item(this.last_shown));} this.set_location();this.add_class(this.slides[0],"first-slide");w3c_slidy.show_slide(slide);} this.toc=this.table_of_contents();this.add_initial_prompt();if(!this.keyboardless) -this.add_listener(document.body,"click",this.mouse_button_click);this.add_listener(document,"keydown",this.key_down);this.add_listener(document,"keypress",this.key_press);this.add_listener(window,"resize",this.resized);this.add_listener(window,"scroll",this.scrolled);this.add_listener(window,"unload",this.unloaded);this.add_listener(document,"touchstart",this.touchstart);this.add_listener(document,"touchmove",this.touchmove);this.add_listener(document,"touchend",this.touchend);this.single_slide_view();this.resized();if(this.ie7) +{this.add_listener(document.body,"click",this.mouse_button_click);this.add_listener(document.body,"mousedown",this.mouse_button_down);} +this.add_listener(document,"keydown",this.key_down);this.add_listener(document,"keypress",this.key_press);this.add_listener(window,"resize",this.resized);this.add_listener(window,"scroll",this.scrolled);this.add_listener(window,"unload",this.unloaded);this.add_listener(document,"gesturechange",function() +{return false;});this.attach_touch_handers(this.slides);this.single_slide_view();this.resized();if(this.ie7) setTimeout(w3c_slidy.ie_hack,100);this.show_toolbar();setInterval(function(){w3c_slidy.check_location();},200);w3c_slidy.initialized=true;},table_of_contents:function(){var toc=this.create_element("div");this.add_class(toc,"slidy_toc hidden");var heading=this.create_element("div");this.add_class(heading,"toc-heading");heading.innerHTML=this.localize("Table of Contents");toc.appendChild(heading);var previous=null;for(var i=0;i100||abs_dy>100)) +var touch=e.touches[0];this.pageX=touch.pageX;this.pageY=touch.pageY;this.screenX=touch.screenX;this.screenY=touch.screenY;this.clientX=touch.clientX;this.clientY=touch.clientY;this.delta_x=this.delta_y=0;},touchmove:function(e) +{if(e.touches.length>1) +return;e.preventDefault();var touch=e.touches[0];this.delta_x=touch.pageX-this.pageX;this.delta_y=touch.pageY-this.pageY;},touchend:function(e) +{if(e.touches.length>1) +return;var delay=(new Date).getTime()-this.last_tap;var dx=this.delta_x;var dy=this.delta_y;var abs_dx=Math.abs(dx);var abs_dy=Math.abs(dy);if(delay<500&&(abs_dx>100||abs_dy>100)) {if(abs_dx>0.5*abs_dy) -{if(dx>0) +{e.preventDefault();if(dx<0) w3c_slidy.next_slide(true);else w3c_slidy.previous_slide(true);} else if(abs_dy>2*abs_dx) -{w3c_slidy.toggle_table_of_contents();}}},before_print:function(){this.show_all_slides();this.hide_toolbar();alert("before print");},after_print:function(){if(!this.view_all) +{e.preventDefault();w3c_slidy.toggle_table_of_contents();}}},before_print:function(){this.show_all_slides();this.hide_toolbar();alert("before print");},after_print:function(){if(!this.view_all) {this.single_slide_view();this.show_toolbar();} alert("after print");},print_slides:function(){this.before_print();window.print();this.after_print();},toggle_view:function(){if(this.view_all) {this.single_slide_view();this.show_toolbar();this.view_all=0;} @@ -134,8 +138,8 @@ w3c_slidy.fold(target);else w3c_slidy.unfold(target);} w3c_slidy.stop_propagation(e);e.cancel=true;e.returnValue=false;} return false;},add_initial_prompt:function(){var prompt=this.create_element("div");prompt.setAttribute("class","initial_prompt");var p1=this.create_element("p");prompt.appendChild(p1);p1.setAttribute("class","help");if(this.keyboardless) -p1.innerHTML="swipe right to move to next slide";else -p1.innerHTML="Space, Right Arrow or swipe right to move to "+"next slide, click help below for more details";this.add_listener(prompt,"click",function(e){document.body.removeChild(prompt);w3c_slidy.stop_propagation(e);if(e.cancel!=undefined) +p1.innerHTML="swipe left to move to next slide";else +p1.innerHTML="Space, Right Arrow or swipe left to move to "+"next slide, click help below for more details";this.add_listener(prompt,"click",function(e){document.body.removeChild(prompt);w3c_slidy.stop_propagation(e);if(e.cancel!=undefined) e.cancel=true;if(e.returnValue!=undefined) e.returnValue=false;return false;});document.body.appendChild(prompt);this.initial_prompt=prompt;setTimeout(function(){document.body.removeChild(prompt);},5000);},add_toolbar:function(){var counter,page;this.toolbar=this.create_element("div");this.toolbar.setAttribute("class","toolbar");if(this.ns_pos||!this.ie6) {var right=this.create_element("div");right.setAttribute("style","float: right; text-align: right");counter=this.create_element("span") @@ -155,8 +159,15 @@ w3c_slidy.mouse_button_click(e);};this.slide_number_element=counter;this.set_eos return;for(i=0;i0) w3c_slidy.time_left-=200;}},get_timer:function(){var timer="";if(w3c_slidy.time_left) {var mins,secs;secs=Math.floor(w3c_slidy.time_left/1000);mins=Math.floor(secs/60);secs=secs%60;timer=(mins?mins+"m":"")+secs+"s ";} return timer;},set_location:function(){var uri=w3c_slidy.page_address(location.href);var hash="#("+(w3c_slidy.slide_number+1)+")";if(w3c_slidy.slide_number>=0) -uri=uri+hash;if(w3c_slidy.ie&&(w3c_slidy.ie6||w3c_slidy.ie7)) +uri=uri+hash;if(typeof(history.pushState)!="undefined") +{document.title=w3c_slidy.title+" ("+(w3c_slidy.slide_number+1)+")";history.pushState(0,document.title,hash);w3c_slidy.show_slide_number();w3c_slidy.notify_observers();return;} +if(w3c_slidy.ie&&(w3c_slidy.ie6||w3c_slidy.ie7)) w3c_slidy.push_hash(hash);if(uri!=location.href) location.href=uri;if(this.khtml) hash="("+(w3c_slidy.slide_number+1)+")";if(!this.ie&&location.hash!=hash&&location.hash!="") -location.hash=hash;document.title=w3c_slidy.title+" ("+(w3c_slidy.slide_number+1)+")";w3c_slidy.show_slide_number();},page_address:function(uri){var i=uri.indexOf("#");if(i<0) +location.hash=hash;document.title=w3c_slidy.title+" ("+(w3c_slidy.slide_number+1)+")";w3c_slidy.show_slide_number();w3c_slidy.notify_observers();},notify_observers:function() +{var slide=this.slides[this.slide_number];for(var i=0;i'");doc.write("hello mum");doc.close();},find_slide_number:function(uri){var i=uri.indexOf("#");if(i<0) @@ -232,7 +254,10 @@ w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown)) else {w3c_slidy.set_visibility_all_incremental("visible");w3c_slidy.last_shown=w3c_slidy.previous_incremental_item(null);} w3c_slidy.set_eos_status(true);w3c_slidy.set_location();}},set_eos_status:function(state){if(this.eos) -this.eos.style.color=(state?"rgb(240,240,240)":"red");},goto_slide:function(num){var slide=w3c_slidy.slides[w3c_slidy.slide_number];w3c_slidy.hide_slide(slide);w3c_slidy.slide_number=num;slide=w3c_slidy.slides[w3c_slidy.slide_number];w3c_slidy.last_shown=null;w3c_slidy.set_visibility_all_incremental("hidden");w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));document.title=w3c_slidy.title+" ("+(w3c_slidy.slide_number+1)+")";w3c_slidy.show_slide(slide);w3c_slidy.show_slide_number();},show_slide:function(slide){this.sync_background(slide);window.scrollTo(0,0);this.remove_class(slide,"hidden");},hide_slide:function(slide){this.add_class(slide,"hidden");},sync_background:function(slide){var background;var bgColor;if(slide.currentStyle) +this.eos.style.color=(state?"rgb(240,240,240)":"red");},goto_slide:function(num){var slide=w3c_slidy.slides[w3c_slidy.slide_number];w3c_slidy.hide_slide(slide);w3c_slidy.slide_number=num;slide=w3c_slidy.slides[w3c_slidy.slide_number];w3c_slidy.last_shown=null;w3c_slidy.set_visibility_all_incremental("hidden");w3c_slidy.set_eos_status(!w3c_slidy.next_incremental_item(w3c_slidy.last_shown));document.title=w3c_slidy.title+" ("+(w3c_slidy.slide_number+1)+")";w3c_slidy.show_slide(slide);w3c_slidy.show_slide_number();},show_slide:function(slide){this.sync_background(slide);this.remove_class(slide,"hidden");setTimeout("window.scrollTo(0,0);",1);},hide_slide:function(slide){this.add_class(slide,"hidden");},set_focus:function(element) +{if(element) +element.focus();else +{w3c_slidy.help_anchor.focus();setTimeout(function(){w3c_slidy.help_anchor.blur();},1);}},sync_background:function(slide){var background;var bgColor;if(slide.currentStyle) bgColor=slide.currentStyle["backgroundColor"];else if(document.defaultView) {var styles=document.defaultView.getComputedStyle(slide,null);if(styles) bgColor=styles.getPropertyValue("background-color");else @@ -282,7 +307,7 @@ w3c_slidy.refresh_toolbar(200);}},scrolled:function(){if(w3c_slidy.toolbar&&!w3c w3c_slidy.remove_class(w3c_slidy.toolbar,"hidden");} w3c_slidy.scrollhack=0;try {if(!w3c_slidy.opera) -w3c_slidy.help_anchor.focus();} +w3c_slidy.set_focus();} catch(e) {}},toggle_toolbar:function(){if(!w3c_slidy.view_all) {if(w3c_slidy.has_class(w3c_slidy.toolbar,"hidden")) @@ -456,7 +481,11 @@ return document.getSelection().toString();if(document.selection) return document.selection.createRange().text;} catch(e) {} -return"";},mouse_button_up:function(e){w3c_slidy.selected_text_len=w3c_slidy.get_selected_text().length;},mouse_button_click:function(e){var rightclick=false;var leftclick=false;var middleclick=false;var target;if(!e) +return"";},mouse_button_up:function(e){w3c_slidy.selected_text_len=w3c_slidy.get_selected_text().length;},mouse_button_down:function(e){w3c_slidy.selected_text_len=w3c_slidy.get_selected_text().length;w3c_slidy.mouse_x=e.clientX;w3c_slidy.mouse_y=e.clientY;},mouse_button_click:function(e){if(!e) +var e=window.event;if(Math.abs(e.clientX-w3c_slidy.mouse_x)+ +Math.abs(e.clientY-w3c_slidy.mouse_y)>10) +return true;if(w3c_slidy.selected_text_len>0) +return true;var rightclick=false;var leftclick=false;var middleclick=false;var target;if(!e) var e=window.event;if(e.target) target=e.target;else if(e.srcElement) target=e.srcElement;if(target.nodeType==3) @@ -470,7 +499,8 @@ leftclick=true;if(w3c_slidy.selected_text_len>0) {w3c_slidy.stop_propagation(e);e.cancel=true;e.returnValue=false;return false;} w3c_slidy.hide_table_of_contents(false);var tag=target.nodeName.toLowerCase();if(w3c_slidy.mouse_click_enabled&&leftclick&&!w3c_slidy.special_element(target)&&!target.onclick) {w3c_slidy.next_slide(true);w3c_slidy.stop_propagation(e);e.cancel=true;e.returnValue=false;return false;} -return true;},special_element:function(e){var tag=e.nodeName.toLowerCase();return e.onkeydown||e.onclick||tag=="a"||tag=="embed"||tag=="object"||tag=="video"||tag=="audio"||tag=="input"||tag=="textarea"||tag=="select"||tag=="option";},slidy_chrome:function(el){while(el) +return true;},special_element:function(element){if(this.has_class(element,"non-interactive")) +return false;var tag=element.nodeName.toLowerCase();return element.onkeydown||element.onclick||tag=="a"||tag=="embed"||tag=="object"||tag=="video"||tag=="audio"||tag=="svg"||tag=="canvas"||tag=="input"||tag=="textarea"||tag=="select"||tag=="option";},slidy_chrome:function(el){while(el) {if(el==w3c_slidy.toc||el==w3c_slidy.toolbar||w3c_slidy.has_class(el,"outline")) return true;el=el.parentNode;} return false;},get_key:function(e) @@ -480,7 +510,7 @@ key=e.which;return key;},get_target:function(e){var target;if(!e) e=window.event;if(e.target) target=e.target;else if(e.srcElement) target=e.srcElement;if(target.nodeType!=1) -target=target.parentNode;return target;},is_block:function(elem){var tag=elem.nodeName.toLowerCase();return tag=="ol"||tag=="ul"||tag=="p"||tag=="li"||tag=="table"||tag=="pre"||tag=="h1"||tag=="h2"||tag=="h3"||tag=="h4"||tag=="h5"||tag=="h6"||tag=="blockquote"||tag=="address";},add_listener:function(element,event,handler){if(window.addEventListener) +target=target.parentNode;return target;},is_block:function(elem){var tag=elem.nodeName.toLowerCase();return tag=="ol"||tag=="ul"||tag=="p"||tag=="dl"||tag=="li"||tag=="table"||tag=="pre"||tag=="h1"||tag=="h2"||tag=="h3"||tag=="h4"||tag=="h5"||tag=="h6"||tag=="blockquote"||tag=="address";},add_listener:function(element,event,handler){if(window.addEventListener) element.addEventListener(event,handler,false);else element.attachEvent("on"+event,handler);},stop_propagation:function(event){event=event?event:window.event;event.cancelBubble=true;if(event.stopPropagation) event.stopPropagation();return true;},cancel:function(event){if(event) -- cgit v1.2.3