projects
/
hacks
/
simpleWebSlides.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use the new flex-box et border-sizing.
[hacks/simpleWebSlides.git]
/
simpleWebSlides.js
diff --git
a/simpleWebSlides.js
b/simpleWebSlides.js
index
6229a74
..
e73a1a2
100644
(file)
--- a/
simpleWebSlides.js
+++ b/
simpleWebSlides.js
@@
-105,7
+105,6
@@
SWS.Templates = new function () {
self.objectActivate = function (o) {
if (!(o.hasClass("sws-active-object"))){
o.removeClass("sws-inactive-object").addClass("sws-active-object");
self.objectActivate = function (o) {
if (!(o.hasClass("sws-active-object"))){
o.removeClass("sws-inactive-object").addClass("sws-active-object");
- o.css({'visibility':'visible'});
return true;
};
return false;
return true;
};
return false;
@@
-153,8
+152,11
@@
SWS.Effects = new function () {
var self = this;
self.objectDeactivateFadeOut = function (o) {
var self = this;
self.objectDeactivateFadeOut = function (o) {
- o.animate({'opacity': '0.1'}, 200,
- function () { SWS.Templates.objectDeactivate(o)});
+ o.animate({'opacity': '0'}, 200,
+ function () {
+
+ SWS.Templates.objectDeactivate(o);
+ });
};
self.objectActivateFadeIn = function (o) {
};
self.objectActivateFadeIn = function (o) {
@@
-168,11
+170,11
@@
SWS.Effects = new function () {
self.slideChangeHorizontalFlip = function (from, to){
var f = SWS.Presentation.getSlide(from);
var t = SWS.Presentation.getSlide(to);
self.slideChangeHorizontalFlip = function (from, to){
var f = SWS.Presentation.getSlide(from);
var t = SWS.Presentation.getSlide(to);
- f.animate({ 'left': '50%', 'width': '0pt', 'opacity':'0
.2
' }, 150,
+ f.animate({ 'left': '50%', 'width': '0pt', 'opacity':'0' }, 150,
function () {
SWS.Templates.slideDeactivate(f);
f.css({'left':'0%', 'width': '100%'});
function () {
SWS.Templates.slideDeactivate(f);
f.css({'left':'0%', 'width': '100%'});
- t.css({ 'left': '50%', 'width': '0pt','opacity':'0
.3
' });
+ t.css({ 'left': '50%', 'width': '0pt','opacity':'0' });
SWS.Templates.slideActivate(t);
t.animate({'left':'0%', 'width': '100%','opacity':'1'});
});
SWS.Templates.slideActivate(t);
t.animate({'left':'0%', 'width': '100%','opacity':'1'});
});
@@
-180,10
+182,10
@@
SWS.Effects = new function () {
self.slideChangeFadeOutIn = function (from, to) {
var f = SWS.Presentation.getSlide(from);
var t = SWS.Presentation.getSlide(to);
self.slideChangeFadeOutIn = function (from, to) {
var f = SWS.Presentation.getSlide(from);
var t = SWS.Presentation.getSlide(to);
- f.animate({ 'opacity': '0
.4
'}, 150,
+ f.animate({ 'opacity': '0'}, 150,
function () { SWS.Templates.slideDeactivate(f);
SWS.Templates.slideActivate(t);
function () { SWS.Templates.slideDeactivate(f);
SWS.Templates.slideActivate(t);
- t.css('opacity', '0
.5
');
+ t.css('opacity', '0');
t.animate({ 'opacity': '1'}, 150);
});
};
t.animate({ 'opacity': '1'}, 150);
});
};
@@
-195,14
+197,14
@@
SWS.Effects = new function () {
t.css('opacity', '1');
SWS.Templates.slideActivate(t);
f.animate({ 'left': '-100%' }, 250, function () { SWS.Templates.slideDeactivate(f);
t.css('opacity', '1');
SWS.Templates.slideActivate(t);
f.animate({ 'left': '-100%' }, 250, function () { SWS.Templates.slideDeactivate(f);
- f.css('opacity', '0
.6
');
+ f.css('opacity', '0');
t.animate({ 'left': '0%' }, 250);
});
} else {
t.css('left', '-100%');
SWS.Templates.slideActivate(t);
f.animate({ 'left': '100%' }, 250, function () { SWS.Templates.slideDeactivate(f);
t.animate({ 'left': '0%' }, 250);
});
} else {
t.css('left', '-100%');
SWS.Templates.slideActivate(t);
f.animate({ 'left': '100%' }, 250, function () { SWS.Templates.slideDeactivate(f);
- f.css('opacity', '0
.7
');
+ f.css('opacity', '0');
});
t.css('opacity', '1');
t.animate({ 'left': '0%' }, 250);
});
t.css('opacity', '1');
t.animate({ 'left': '0%' }, 250);
@@
-398,7
+400,6
@@
SWS.Presentation = new function () {
$(".sws-canvas").each(function(i) {
var canvas = $($(".sws-canvas")[i]);
var infos = canvas.data("sws-frame-info");
$(".sws-canvas").each(function(i) {
var canvas = $($(".sws-canvas")[i]);
var infos = canvas.data("sws-frame-info");
- console.log(infos);
_total_steps += infos.last + 1;
});
return _total_steps;
_total_steps += infos.last + 1;
});
return _total_steps;
@@
-469,13
+470,15
@@
SWS.Presentation = new function () {
var loop;
loop = function () {
if (steps >= 0) {
var loop;
loop = function () {
if (steps >= 0) {
+ //Crazy workaround for chromium
+ ($("link.sws-theme[rel='stylesheet']")[0]).disabled = false;
$(".sws-canvas").find("*").addBack().promise().done(function() {
var percent = ((total_steps - steps) / total_steps) * 100;
$(".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-percent-progress").text(Math.round(percent));
- console.log ("Step: " + steps);
SWS.Config['sws-slide-change'] = SWS.Templates.slideChange;
self.refresh();
SWS.Config['sws-slide-change'] = SWS.Templates.slideChange;
self.refresh();
- $($(".sws-canvas")[self.getCurrentSlide()]).css(
{ 'opacity': 1 }
);
+ $($(".sws-canvas")[self.getCurrentSlide()]).css(
'opacity', 1
);
self.next();
steps--;
loop();
self.next();
steps--;
loop();
@@
-483,7
+486,6
@@
SWS.Presentation = new function () {
} else {
$("#sws-percent-progress").text(100);
progress.remove();
} else {
$("#sws-percent-progress").text(100);
progress.remove();
- window.print();
}
};
loop();
}
};
loop();
@@
-492,6
+494,7
@@
SWS.Presentation = new function () {
self.inputHandler = function (event) {
if (_disable_input_events || _print_mode ) return;
self.inputHandler = function (event) {
if (_disable_input_events || _print_mode ) return;
+
switch (event.which) {
case 36:/* Home */
self.setCurrentSlide(self.firstSlide());
switch (event.which) {
case 36:/* Home */
self.setCurrentSlide(self.firstSlide());
@@
-500,7
+503,6
@@
SWS.Presentation = new function () {
case 35:/* End */
self.setCurrentSlide(self.lastSlide());
break;
case 35:/* End */
self.setCurrentSlide(self.lastSlide());
break;
-
case 32: /* space */
case 34: /* PgDown */
case 39: /* -> */
case 32: /* space */
case 34: /* PgDown */
case 39: /* -> */
@@
-524,6
+526,7
@@
SWS.Presentation = new function () {
return;
case 67: /* c */
$("#sws-control-panel-canvas").toggle();
return;
case 67: /* c */
$("#sws-control-panel-canvas").toggle();
+
default:
return;
};
default:
return;
};
@@
-601,11
+604,14
@@
SWS.Presentation = new function () {
};
/* Forces redrawing the page without reloading */
};
/* Forces redrawing the page without reloading */
- self.redraw = function () {
- $("body").hide();
- $("body").show();
+ self.redraw = function (f) {
+ if (SWS.Utils.isUndefined(f))
+ $("body").hide().show(400, function () {
+ $("body").css("display","block");
+ if (!SWS.Utils.isUndefined(f))
+ f();
+ });
};
};
-
self.changeAspect = function() {
$("html").removeClass("sws-aspect-4-3")
.removeClass("sws-aspect-16-9")
self.changeAspect = function() {
$("html").removeClass("sws-aspect-4-3")
.removeClass("sws-aspect-16-9")
@@
-614,6
+620,14
@@
SWS.Presentation = new function () {
self.redraw();
};
self.redraw();
};
+ self.getCurrentTheme = function () {
+ var l = $("link.sws-theme[rel='stylesheet']")[0];
+
+ if (l) {
+ return l.title;
+ } else
+ return ""
+ };
self.changeTheme = function (name) {
var theme_name;
self.changeTheme = function (name) {
var theme_name;
@@
-621,26
+635,27
@@
SWS.Presentation = new function () {
theme_name = $("#sws-theme-select").val()
else
theme_name = name;
theme_name = $("#sws-theme-select").val()
else
theme_name = name;
+
_current_theme = theme_name;
$("link.sws-theme").each (function (i) {
_current_theme = theme_name;
$("link.sws-theme").each (function (i) {
- var e =
$(this)
;
- var title = e.
attr("title")
;
+ var e =
this
;
+ var title = e.
title
;
if (title == theme_name) {
if (title == theme_name) {
- e[0].rel = "stylesheet";
- e[0].disabled = false;
- e[0].media="all";
-
+ e.rel = "stylesheet";
+ e.disabled = false;
+ e.media="all";
} else {
} else {
- e
[0]
.rel = "alternate stylesheet";
- e
[0]
.disabled = true;
- e
[0]
.media="all";
+ e.rel = "alternate stylesheet";
+ e.disabled = true;
+ e.media="all";
};
});
self.redraw();
};
});
self.redraw();
+
};
self.openPrint = function () {
};
self.openPrint = function () {
- window.open
("?mode=print&theme=" + _current_theme
);
+ window.open
("?mode=print&theme=" + self.getCurrentTheme()
);
}
var _fullscreen_icon_on = "";
var _fullscreen_icon_off = "";
}
var _fullscreen_icon_on = "";
var _fullscreen_icon_off = "";
@@
-674,35
+689,36
@@
SWS.Presentation = new function () {
$("html").addClass("sws-display");
$("html").addClass("sws-display");
- $(window).resize(self.redraw);
+
//
$(window).resize(self.redraw);
- $(window).bind('storage', function (e) {
- console.log(e);
- });
_total_slides = $(".sws-slide").length;
_total_slides = $(".sws-slide").length;
-
$(document).keydown(self.inputHandler
);
+
var cur = self.getCurrentSlide(
);
+ $(".sws-slide").each(function (i) {
- var cur = self.getCurrentSlide();
- $(".sws-slide").each (function (i) {
var par = $(this).parent();
var par = $(this).parent();
+
$(this).remove();
var canvas = $('<div class="sws-canvas"/>');
if (!($(this).hasClass("sws-option-noheader"))) {
$(this).remove();
var canvas = $('<div class="sws-canvas"/>');
if (!($(this).hasClass("sws-option-noheader"))) {
- canvas.append($('<div class="sws-header"/>
<br/>
'));
+ canvas.append($('<div class="sws-header"/>'));
};
};
-
+ if (!$(this).hasClass("sws-cover")) {
+ var title = $($(this).find("h1")[0]);
+ var title_div = $('<div class="sws-title" />');
+ title_div.append(title);
+ canvas.append(title_div);
+ }
var inner = $('<div class="sws-inner-canvas"/>');
var content = $('<div class="sws-content"/>');
$(this).find('script[type="text/javascript"]').remove();
content.append($(this));
inner.append(content);
var inner = $('<div class="sws-inner-canvas"/>');
var content = $('<div class="sws-content"/>');
$(this).find('script[type="text/javascript"]').remove();
content.append($(this));
inner.append(content);
- inner.append($('<span class="sws-vertical-align"> </span><br/>'));
canvas.append(inner);
if (!($(this).hasClass("sws-option-nofooter"))) {
canvas.append(inner);
if (!($(this).hasClass("sws-option-nofooter"))) {
@@
-724,8
+740,6
@@
SWS.Presentation = new function () {
});
});
-
-
// Initialize the control panel
$("body").append($(SWS.Templates.controlPanel));
// Fill the theme switcher
// Initialize the control panel
$("body").append($(SWS.Templates.controlPanel));
// Fill the theme switcher
@@
-756,22
+770,24
@@
SWS.Presentation = new function () {
_update_ui();
_slide_callbacks = null; /* avoid a leak */
_update_ui();
_slide_callbacks = null; /* avoid a leak */
-
var passed_theme = SWS.Utils.getParameterByName("theme");
var passed_theme = SWS.Utils.getParameterByName("theme");
- if (passed_theme == "")
- self.changeTheme();
- else
- self.changeTheme(passed_theme);
-
- if (SWS.Utils.getParameterByName("mode") == "print") {
-
self.printMode(
);
- }
- else
- self.refresh();
-
-
_initialized = true
;
-
+ //workaround weird chrome CSS loading bug
+ var f =
+ function () {
+ if (passed_theme == "")
+ self.changeTheme();
+ else
+
self.changeTheme(passed_theme
);
+ if (SWS.Utils.getParameterByName("mode") == "print") {
+ self.printMode();
+ }
+ else
+
self.refresh()
;
+ $(document).keydown(self.inputHandler);
+ _initialized = true;
+ };
+ setTimeout(f, 100);
};
};
};
};