From: Kim Nguyễn Date: Fri, 11 Oct 2013 14:09:28 +0000 (+0200) Subject: Small fixes: X-Git-Url: http://git.nguyen.vg/gitweb/?a=commitdiff_plain;h=9262e1c26fe53f5c68167eadbda074c5ddbb2658;p=hacks%2FsimpleWebSlides.git Small fixes: * implement touch events * fix the u-psud theme and default theme. --- diff --git a/simpleWebSlides.css b/simpleWebSlides.css index 7b6a76b..a42c85e 100644 --- a/simpleWebSlides.css +++ b/simpleWebSlides.css @@ -3,20 +3,16 @@ body { margin: 0 0 0 0; padding: 0 0 0 0; - overflow:hidden; -webkit-box-sizing: border-box; box-sizing: border-box; -moz-box-sizing: border-box; } -.sws-active-slide { - display: block; -} .sws-active-object { visibility: visible; } .sws-inactive-object { - visibility: hidden; + opacity: 0; } @@ -84,6 +80,9 @@ body > h1, body > h2, body > h3 { /****************************************/ +:root.sws-display body { + overflow:hidden; +} :root.sws-display .sws-canvas { width:133.3vh; @@ -138,7 +137,6 @@ body > h1, body > h2, body > h3 { :root.sws-print body { width: 297mm; height: 210mm; - overflow:hidden; padding: 0pt 0pt 0pt 0pt; margin: 0pt 0pt 0pt 0pt; diff --git a/simpleWebSlides.js b/simpleWebSlides.js index e73a1a2..89dea31 100644 --- a/simpleWebSlides.js +++ b/simpleWebSlides.js @@ -361,7 +361,6 @@ SWS.Presentation = new function () { else SWS.Config['sws-object-deactivate']($(this)); }); - var callbacks; if (callbacks = info.callbacks.at_frame[self.getCurrentFrame()]){ for (var k = 0; k < callbacks.length; k++) @@ -474,7 +473,6 @@ SWS.Presentation = new function () { ($("link.sws-theme[rel='stylesheet']")[0]).disabled = false; $(".sws-canvas").find("*").addBack().promise().done(function() { var percent = ((total_steps - steps) / total_steps) * 100; - console.log(percent); $("#sws-percent-progress").text(Math.round(percent)); SWS.Config['sws-slide-change'] = SWS.Templates.slideChange; self.refresh(); @@ -492,10 +490,24 @@ SWS.Presentation = new function () { } - self.inputHandler = function (event) { - if (_disable_input_events || _print_mode ) return; - switch (event.which) { + var xstart = 0; + self.inputHandler = function (event) { + if (_disable_input_events || _print_mode) return; + var code = 0; + switch (event.type) { + case 'touchstart': + xstart = event.changedTouches[0].clientX; + return; + case 'touchend': + var dist = event.changedTouches[0].clientX - xstart; + if (dist > 20) code = 39 + else if (dist < -20) code = 37 + else code = 67; + case 'keydown': + code = event.which; + }; + switch (code) { case 36:/* Home */ self.setCurrentSlide(self.firstSlide()); break; @@ -522,16 +534,16 @@ SWS.Presentation = new function () { self.previousSlide(); break; case 83: /* s */ - self.cycleStyle(); + self.cycleStyle(); return; case 67: /* c */ $("#sws-control-panel-canvas").toggle(); - + default: return; }; self.refresh(); - }; +}; @@ -564,7 +576,7 @@ SWS.Presentation = new function () { } }; - var specials = null; + var specials = $([]); slide.find('*[class*="sws-onframe-"]').each(function(_){ var cls = $(this).attr('class'); @@ -577,12 +589,10 @@ SWS.Presentation = new function () { for(var f in o) if (f > last_frame) last_frame = f; $(this).find("*").andSelf().each(function(_){ - if (!SWS.Utils.isEmpty(o)) + if (!SWS.Utils.isEmpty(o)){ $(this).data("sws-frame-set", o); - if (specials) - specials.add($(this)); - else - specials = $(this); + } + specials = specials.add($(this)); }); }; }); @@ -784,6 +794,8 @@ SWS.Presentation = new function () { else self.refresh(); $(document).keydown(self.inputHandler); + $(document).on('touchstart', self.inputHandler); + $(document).on('touchend', self.inputHandler); _initialized = true; }; diff --git a/themes/uPsud.css b/themes/uPsud.css index 0273a7e..df9f424 100644 --- a/themes/uPsud.css +++ b/themes/uPsud.css @@ -100,8 +100,12 @@ ul.empty { .hl { color: #92b938; +} +.done:after { + content: " ✔"; } + li { margin-top:0.5vh; } @@ -126,15 +130,28 @@ table.desc { margin: 0 0 0 0; } -.desc tr { - margin: 0 0 0 0; - padding: 0 0 0 0; +table.desc tr { } -.desc td { +table.desc td { vertical-align: top; text-align: justify; + padding-bottom: 3vh; } +table.desc tr:last-child td { + padding-bottom:0; +} + +table.desc td:first-child { + color: #92b938; +} + +table.desc td:first-child:after { + content: " : "; +} + + + .centerbox { text-align: center; } @@ -158,9 +175,47 @@ table.rounded { width: 100%; margin: 1em; } + table.btable { border-collapse: collapse; } + .btable td { border: solid 1pt #696968; +} + +dl { + padding: 1vh 1vh 1vh 1vh; +} + +dt { display: inline; + color: #92b938; + } + +dt:after { + display:inline; + content: " : "; +} + +dd { display:inline-block; + padding: 0 0 0 0; + text-indent: 0; + margin: 0 0 0 0; + } + +table.simple { + table-layout:fixed; + padding: 0 4% 0 4%; + text-align:left; + border-spacing: 2em 0; +} + +table.simple th{ + color: #92b938; + font-weight: normal; + text-align:left; +} +table.simple th, +table.simple tr { + vertical-align:top; } \ No newline at end of file