Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
feat(scripts): working on inline scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
fabianmoronzirfas committed Sep 13, 2016
1 parent 7f8e2bd commit 287aaea
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
53 changes: 53 additions & 0 deletions src/views/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,58 @@ const padStart = require('lodash.padStart');
const drag = require('electron-drag');
const smalltalk = require('smalltalk');
let dimensions = false;
// from here
// let exec_body_scripts = function(body_el) {
// // Finds and executes scripts in a newly added element's body.
// // Needed since innerHTML does not run scripts.
// //
// // Argument body_el is an element in the dom.

// function nodeName(elem, name) {
// return elem.nodeName && elem.nodeName.toUpperCase() ===
// name.toUpperCase();
// }

// function evalScript(elem) {
// var data = (elem.text || elem.textContent || elem.innerHTML || ''),
// head = document.getElementsByTagName('head')[0] ||
// document.documentElement,
// script = document.createElement('script');

// script.type = 'text/javascript';
// try {
// // doesn't work on ie...
// script.appendChild(document.createTextNode(data));
// } catch(e) {
// // IE has funky script nodes
// script.text = data;
// }

// head.insertBefore(script, head.firstChild);
// head.removeChild(script);
// }

// // main section of function
// var scripts = [],
// script,
// children_nodes = body_el.childNodes,
// child,
// i;

// for (i = 0; children_nodes[i]; i++) {
// child = children_nodes[i];
// if (nodeName(child, 'script') &&
// (!child.type || child.type.toLowerCase() === 'text/javascript')) {
// scripts.push(child);
// }
// }

// for (i = 0; scripts[i]; i++) {
// script = scripts[i];
// if (script.parentNode) {script.parentNode.removeChild(script);}
// evalScript(scripts[i]);
// }
// };

function showDimensions() {
let ele = document.getElementById('dimensions');
Expand Down Expand Up @@ -107,6 +159,7 @@ window.onload = () => {
currentSlide: padStart(currentSlide + 1, String(content.msg.length).length, '0'),
currentSlidesLength: content.msg.length}
});
// exec_body_scripts(element);
}
}
});
Expand Down
9 changes: 3 additions & 6 deletions src/views/slides.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@
</script>
<script type="text/javascript">
/* global window */
const $ = require('jquery');
// const $ = require('jquery');
// paste this code under the head tag or in a separate js file.
// Wait for window load
$(window).on('load', function() {
// Animate loader off screen
// console.log('on load fade off');
// $('.se-pre-con').fadeOut('slow');
});
// $(window).on('load', function() {
// });
</script>
</body>
</html>
Expand Down

0 comments on commit 287aaea

Please sign in to comment.