Skip to content

Commit

Permalink
Fixed script src in sideImages test, build new files with new MO5 ver…
Browse files Browse the repository at this point in the history
…sion, increased WSE version.
  • Loading branch information
jsteinbeck committed Jul 30, 2016
1 parent b349dd0 commit 5ef7fb6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 15 deletions.
44 changes: 37 additions & 7 deletions build/WebStoryEngine.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ var using = (function () {
var modules = {}, loadedScripts = {}, dependencies = {}, definitions = {}, dependingOn = {};
var runners = [], selectors = {}, runnersCheckInProgress = false;

var getAbsoluteUrl = (function () {

var a = document.createElement('a');

return function (url) {
a.href = url;
return a.href;
};
}());

function updateModule (moduleName) {

var deps = [], depNames = dependencies[moduleName], moduleResult;
Expand Down Expand Up @@ -257,7 +267,8 @@ var using = (function () {
function define (moduleName, callback) {

if (exists(moduleName)) {
throw new Error("Module '" + moduleName + "' is already defined.");
console.warn("Module '" + moduleName + "' is already defined.");
return capabilityObject;
}

definitions[moduleName] = callback;
Expand Down Expand Up @@ -312,20 +323,39 @@ var using = (function () {

using.loadScript = function (url) {

url = getAbsoluteUrl(url);

var script = document.createElement("script");
var scriptId = "using_script_" + url;

if (loadedScripts[url] || document.getElementById(scriptId)) {
if (loadedScripts[url] || scriptExists(url)) {
return;
}

script.setAttribute("id", scriptId);
script.setAttribute("data-inserted-by", "using.js");

script.src = url;
loadedScripts[url] = true;

document.body.appendChild(script);
};

function scriptExists (url) {

var exists = false;
var scripts = document.getElementsByTagName("script");

[].forEach.call(scripts, function (script) {

var src = script.getAttribute("src");

if (src && getAbsoluteUrl(src) === url) {
exists = true;
}
});

return exists;
}

return using;

}());
Expand Down Expand Up @@ -420,8 +450,8 @@ using.ajax = (function () {


/*
WebStory Engine dependencies (v2016.7.0-final.1607292134)
Build time: Fri, 29 Jul 2016 22:08:47 GMT
WebStory Engine dependencies (v2016.7.0-final.1607301311)
Build time: Sat, 30 Jul 2016 11:11:58 GMT
*/
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
/* global using, require */
Expand Down Expand Up @@ -9638,7 +9668,7 @@ define("WSE", function (DataBus, assets, commands, dataSources, functions) {

"use strict";

var WSE = {}, version = "2016.7.0-final.1607292134";
var WSE = {}, version = "2016.7.0-final.1607301311";

DataBus.inject(WSE);

Expand Down
12 changes: 6 additions & 6 deletions build/WebStoryEngine.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webstory-engine",
"version": "2016.7.0-final.1607292134",
"version": "2016.7.0-final.1607301311",
"description": "A web-based visual novel engine.",
"main": "index.html",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions_sideImages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<body>
<script src="../../build/WebStoryEngine.js"></script>
<script>
using.modules["WSE.extensions.sideImages"] = "../../js/extensions/side-images.js";
using.modules["WSE.extensions.sideImages"] = "../../src/extensions/side-images.js";
</script>
<script>
using("WSE.Game", "WSE.extensions.sideImages").run(function (Game, injectSideImages) {
Expand Down

0 comments on commit 5ef7fb6

Please sign in to comment.