Commit 43d97b8d authored by Romain Courteaud's avatar Romain Courteaud

Global gadget to display browser and preview

No interaction for now.
parent 079ec1a5
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="../hyperbrowser.js"></script>
<script type="text/javascript" src="../renderjs.js"></script>
<script type="text/javascript" src="filebrowser_and_preview.js"></script>
</head>
<body>
<noscript>
Please enable Javascript
</noscript>
</body>
</html>
/*global document, jQuery */
// filebrowser.html?file=browser%3A%2F%2Fbrowse%2Fls%2F
"use strict";
(function (document, $) {
var getParameter = function(searchString, paramName) {
var i, val, params = searchString.split("&");
for (i=0;i<params.length;i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return decodeURIComponent(val[1]);
}
}
return null;
};
var mapUrl = function (url) {
var searchString = url.href.split("?")[1],
fileToDisplay;
if (searchString) {
fileToDisplay = getParameter(searchString, "file");
if (fileToDisplay) {
$("body").html(
'<iframe src="' +
// XXX Hardcoded gadget to load
'filebrowser.html?file=' + fileToDisplay +
'">' +
'<p>Your browser does not support iframes.</p>' +
'</iframe">');
$("body").append(
'<iframe src="' +
// XXX Hardcoded gadget to load
'preview.html' +
'">' +
'<p>Your browser does not support iframes.</p>' +
'</iframe">');
} else {
$(this).text("No parameter found in url");
}
}
};
$(document).ready(function () {
mapUrl(window.location);
});
}(document, jQuery));
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment