-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
23 lines (18 loc) · 812 Bytes
/
script.js
File metadata and controls
23 lines (18 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var appDir=opera.io.filesystem.mountSystemDirectory('application'), dir=opera.io.filesystem.mountSystemDirectory('storage'), webserver=opera.io.webserver;
window.onload=function()
{
if(webserver)
{
webserver.addEventListener('_index',index,0);
webserver.addEventListener('new',_new,0);
}
};
function index(e){ widgetisePage(e, 'base'); }
function _new(e){ widgetisePage(e, 'new'); }
function widgetisePage(e, page)
{
var response=e.connection.response, request=e.connection.request;
if(!e.connection.isLocal){ response.write('Sorry, this is a local application.'); response.close(); return; }
if(request.queryItems.w){ widgetise.create( request.queryItems, function(widgetfile){ output.widget(response, widgetfile); } ); }
else{ output.page( response, page ); }
}