1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00

Res: Add resources from xowa_app_windows_64_v4.5.26.1810

This commit is contained in:
gnosygnu
2018-11-02 09:58:55 -04:00
parent a672fd8340
commit 5721913241
6057 changed files with 1156950 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
.cur_head_text {
width: calc(100% - 32px);
}
.cur_head_btns {
width: 32px;
}
.cur_head_text_2 {
width: calc(100% - 64px);
}
.cur_head_btns_2 {
width: 64px;
}
.cur_head_text__available__caption {
width: calc(100% - 32px);
}
.cur_head_text__available__combo {
width: calc(100% - 120px);
}
.task_tbl {
width: 100%;
margin: 0px 0px 8px; /* vertical-space inbetween tables */
font-size: .85em;/* needed for kit-kat else text will overflow */
}
.head_name {
display: inline-block;
width: calc(100% - 32px);
font-weight: bold;
}
.task_name {
display: inline-block;
width: calc(100% - 32px);
}
.work_row {
display:block !important;
height: 100%;
}
.work_btn_disabled {opacity: .2;}
/* pbar */
.pbar_row {
width: 100%;
height: 100%; /* depend on auto-size */
padding: 2px 0 2px;
}
.pbar_row_1 {
margin: -4px 0px 2px;
}
.pbar_step {
padding: 0px 0px 0px 44px;
}
.pbar_proc {
padding: 0px 0px 0px 44px;
font-variant: small-caps;
}
.pbar_div {
height: 2px;
margin: 2px 4px 2px 44px;
width: calc(100% - 50px);
background-color: #f5f5f5;
border-radius: 4px;
}
.pbar_bar {
width: 0%;
height: 100%;
background-color: #5cb85c;
border-radius: 4px;
}

View File

@@ -0,0 +1,128 @@
<div id='cur_help_div' class='xohelp_div'>
<div id='cur_help_msg' class='xohelp_msg'>
<b>Quick start</b>
<div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_add'>&nbsp;</span><span class='xohelp_row_text'>Add <b>Simple Wikipedia - Articles</b> to the queue</span></div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_media_play'>&nbsp;</span><span class='xohelp_row_text'>Download <b>Simple Wikipedia - Articles</b></span></div>
{{#app_is_drd}}
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Choose XOWA from the menu and open "simple.wikipedia.org"</span></div>
{{/app_is_drd}}
{{^app_is_drd}}
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Reload the page, open the wikis menu in the left-hand nav and click "simple.wikipedia.org"</span></div>
{{/app_is_drd}}
</div>
<br/>
<b>Notes</b>
<div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Please make sure you are on Wi-Fi when downloading! Most wikis will be many MB or even GB.</span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Download Central supports pause and resume. Pause the task (or close the app) and resume later.</span></div>
</div>
<br/>
<b>Buttons</b>
<div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_dir'>&nbsp;</span><span class='xohelp_row_text'>Select a folder location for the wikis</span></div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_inet_download'>&nbsp;</span><span class='xohelp_row_text'>Download the latest list of wikis from archive.org</span></div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_add'>&nbsp;</span>
<span class='xohelp_row_text'>Move a task to the queue</span>
</div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_remove'>&nbsp;</span>
<span class='xohelp_row_text'>(In the queue table) Remove a task from the queue. All work will be lost</span>
</div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_remove'>&nbsp;</span>
<span class='xohelp_row_text'>(In the imported table) Remove the task from imported and place it back in the available table</span>
</div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_media_play'>&nbsp;</span>
<span class='xohelp_row_text'>Start the queue</span>
</div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_media_pause'>&nbsp;</span>
<span class='xohelp_row_text'>Pause the queue</span>
</div>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_refresh'>&nbsp;</span>
<span class='xohelp_row_text'>Restart a failed task from the last known step</span>
</div>
</div>
{{^app_is_drd}}
<br/>
<b>Links</b>
<div>
<div class='xohelp_row'><span class='xohelp_link'>&nbsp;</span><span class='xohelp_row_text'><b>Help</b>: <a href='{{link_help}}'>Information about Download Central</a></span></div>
</div>
{{/app_is_drd}}
</div>
</div>
<div class='main_body' id='main_body'>
<div class='task_tbl' data-name='work__tbl'>
<div class='xotbl_head_row'>
<div class='xotbl_head_text cur_head_text_2'>Queue</div>
<div class='xotbl_head_btns cur_head_btns_2'>
<a class='xoimg_btn_x24 xoimg_fsys_dir' title='select xowa folder' href="/site/home/wiki/Special:XowaRootDir">&nbsp;</a>
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'>&nbsp;</a>
</div>
</div>
<div id='head__row'></div>
<div id="work__tbl"></div>
</div>
<div class='task_tbl' data-name='todo__tbl'>
<div class='xotbl_head_row'>
<div class='xotbl_head_text cur_head_text__available__caption'>Available</div>
<div class='xotbl_head_btns cur_head_btns'>
<a class='xoimg_btn_x24 xoimg_inet_download' title='download database' href='javascript:void(0)'
data_alertify_msg='Please confirm that you want to download the latest list of wikis from archive.org.<br/><br/>Please note that updates are usually released on a weekly basis.'
data_alertify_ok='Download'
data_alertify_cancel='Cancel'
data_alertify_func='xo.bldr.todo.download_db__send();'
onclick='return xo.alertify.confirm_func(this);'>&nbsp;</a>
</div>
</div>
<div class='xotbl_head_row'>
<div class='xotbl_head_text'>Lang:
<select id='filter_langs' href='javascript:void(0)' onchange='xo.bldr.todo.filter__send();'>
<option value='*' selected='selected'>All</option>
<option value='en'>English</option>
<option value='de'>German</option>
<option value='fr'>French</option>
<option value='pl'>Polish</option>
<option value='ar'>Arabic</option>
<option value='cs'>Czech</option>
<option value='ht'>Haitian</option>
</select>
</div>
<div class='xotbl_head_text'>Type:
<select id='filter_types' href='javascript:void(0)' onchange='xo.bldr.todo.filter__send();'>
<option value='*' selected='selected'>All</option>
<option value='wikipedia'>Wikipedia</option>
<option value='wiktionary'>Wiktionary</option>
<option value='wikisource'>Wikisource</option>
<option value='wikivoyage'>Wikivoyage</option>
<option value='wikiquote'>Wikiquote</option>
<option value='wikibooks'>Wikibooks</option>
<option value='wikiversity'>Wikiversity</option>
<option value='wikinews'>Wikinews</option>
<option value='wikimisc'>Others</option>
</select>
</div>
</div>
<div id='todo__tbl'></div>
</div>
<div class='task_tbl' data-name='done__tbl'>
<div class='xotbl_head_row'>
<div class='xotbl_head_text cur_head_text'>Imported</div>
</div>
<div id='done__tbl'></div>
</div>
<div style='display:none;' data-name='test panel'>
<div id='xowa_err_div'></div>
<div style='padding-bottom:5px;'>
<button class='admin_btn' accesskey='a' id='admin__add_work__btn'>add work</button>&nbsp;
</div>
<div>
<button class='admin_btn' accesskey='d' id='admin__del_work__btn'>del work</button>&nbsp;
</div>
<div>
<button class='admin_btn' accesskey='r' id='admin__run_next__btn'>run next</button>&nbsp;
</div>
<div>
<button class='admin_btn' accesskey='p' id='admin__stop_cur__btn'>stop all</button>&nbsp;
</div>
</div>
</div>

View File

@@ -0,0 +1,45 @@
{{#row_is_work}}
<div class='xotbl_data_row work_row' id='{{row_type}}:{{task_id}}:row' data-sort='{{task_sort}}'>
<div class='flex_div'>
<a id='{{row_type}}:{{task_id}}:del_work' class='xoimg_btn_x24 xoimg_list_remove' href='javascript:void(0)' onclick='xo.bldr.work.del_work__send("{{task_id}}");'>&nbsp;</a>
<div class='task_name' id='{{row_type}}:{{task_id}}:name'>{{{task_name}}}</div>
</div>
<div class='pbar_row flex_div pbar_row_1' id='{{row_type}}:{{task_id}}:step-row'>
<span class='pbar_step' id='{{row_type}}:{{task_id}}:step-name'>{{{step.step_name}}}</span>
</div>
<div class='pbar_row' id='{{row_type}}:{{task_id}}:pbar-row'>
<div class='pbar_proc' id='{{row_type}}:{{task_id}}:pbar-txt'>{{{prog_msg}}}</div>
<div class='pbar_div'>
<div class="pbar_bar" id='{{row_type}}:{{task_id}}:pbar-bar'>
</div>
</div>
</div>
</div>
{{/row_is_work}}
{{^row_is_work}}
<div class='xotbl_data_row flex_div' id='{{row_type}}:{{task_id}}:row' data-sort='{{task_sort}}'>
{{#row_is_head}}
<a id='{{row_type}}:{{task_id}}:run_next' class='xoimg_btn_x24 xoimg_media_play work_btn_disabled' href='javascript:void(0)' onclick='xo.bldr.work.run_next__send("{{task_id}}");'>&nbsp;</a>
{{/row_is_head}}
{{#row_is_todo}}
<a id='{{row_type}}:{{task_id}}:add_work' class='xoimg_btn_x24 xoimg_list_add' href='javascript:void(0)' onclick='xo.bldr.todo.add_work__send("{{task_id}}");'>&nbsp;</a>
{{/row_is_todo}}
{{#row_is_done}}
<a id='{{row_type}}:{{task_id}}:del_done' class='xoimg_btn_x24 xoimg_list_remove' href='javascript:void(0)' onclick='xo.bldr.done.del_done__send("{{task_id}}");'>&nbsp;</a>
{{/row_is_done}}
{{#row_is_head}}
<div class="head_name">
<span id='{{row_type}}:{{task_id}}:name'>{{{task_name}}}</span>
<!--&nbsp;&middot;<span id='{{row_type}}:{{task_id}}:size'>{{prog_data_end_str}}</span>-->
<!--&middot;<span id='{{row_type}}:{{task_id}}:time'>{{prog_time_end_str}}</span>-->
</div>
{{/row_is_head}}
{{^row_is_head}}
<div class='task_name' id='{{row_type}}:{{task_id}}:name'>{{{task_name}}}</div>
{{#row_is_todo}}
<a id='{{row_type}}:{{task_id}}:add_work' class='xoimg_btn_x24 xoimg_list_remove' href='javascript:void(0)' onclick='xo.bldr.todo.del_todo__send("{{task_id}}");'>&nbsp;</a>
{{/row_is_todo}}
<a class='xoimg_btn_x24 xoimg_help_info' href='/site/home/wiki/Special:XowaDownloadCentralInfo?task_id={{task_id}}'>&nbsp;</a>
{{/row_is_head}}
</div>
{{/row_is_work}}

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>xo.elem</title>
<link rel="stylesheet" href="file:///C:/xowa/bin/any/xowa/html/res/lib/qunit/qunit-1.23.1.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="file:///C:/xowa/bin/any/xowa/html/res/lib/qunit/qunit-1.23.1.js"></script>
<script src='xo.elem.js'></script>
<script src='xo.elem.test.js'></script>
</body>
</html>

View File

@@ -0,0 +1,33 @@
/*jslint node: true */
"use strict";
var QUnit = window.QUnit;
var xo = window.xo;
QUnit.module("elem", {
beforeEach: function (assert) {
xo.mode_is_debug = false;
}
// afterEach: function( assert ) {}
});
QUnit.test("get.null", function (assert) {
assert.notOk(xo.elem.get('missing'));
});
QUnit.test("make.body", function (assert) {
var rslt = xo.elem.make(null, 'div', 'make_body_1');
assert.equal(rslt.nodeName, 'DIV');
assert.equal(rslt.id, 'make_body_1');
assert.equal(rslt.parentElement, document.documentElement);
assert.equal(rslt, document.getElementById('make_body_1'));
});
QUnit.test("make.owner", function (assert) {
var make_owner_1 = xo.elem.make(null, 'div', 'make_owner_1'),
make_owner_2 = xo.elem.make('make_owner_1', 'div', 'make_owner_2');
assert.equal(make_owner_2.id, 'make_owner_2');
assert.equal(make_owner_2.parentElement, make_owner_1);
assert.equal(make_owner_2, document.getElementById('make_owner_2'));
});
QUnit.test("bind", function (assert) {
var elem_1 = xo.elem.make(null, 'span', 'bind_1');
xo.elem.bind_onclick(function () {return 'test'; }, 'bind_1');
var actl = elem_1.onclick();
assert.equal('test', actl);
});

View File

@@ -0,0 +1,39 @@
(function (xo) {
"use strict";
xo.mode_is_debug = false;
xo.elem = new function () {
this.get = function (elem_id) {
var rv = document.getElementById(elem_id);
if (!rv && xo.mode_is_debug) {
alert('elem is null: ' + elem_id);
}
return rv;
};
this.make = function (owner_id, elem_type, elem_id) {
var rv = document.createElement(elem_type);
if (elem_id) {rv.id = elem_id; }
var owner_elem = owner_id ? this.get(owner_id) : document.documentElement;
if (!owner_elem && xo.mode_is_debug) {
alert('owner elem is null: ' + owner_id);
}
owner_elem.appendChild(rv);
return rv;
};
this.del = function (elem_id) {
xo.log.add(1, 'elem.del.bgn', 'elem_id', elem_id);
var elem = document.getElementById(elem_id);
elem.parentNode.removeChild(elem);
return true;
};
this.bind_onclick = function (func_obj, elem_id) {
this.bind(func_obj, 'onclick', elem_id);
}
this.bind = function (func_obj, func_name, elem_id) {
var elem = this.get(elem_id);
elem[func_name] = func_obj;
};
};
}(window.xo = window.xo || {}));

View File

@@ -0,0 +1,28 @@
(function (xo, $) {
xo.notify = new function() {
this.elem_anchor = '';
this.show = function(msg) {
$(this.elem_anchor).notify(msg, {className:'success', elementPosition:'top center', globalPosition:'top center', style:'xostyle'
, autoHideDelay: 3000
, showDuration: 500
, hideDuration: 500
});
}
this.init = function() {
$.notify.addStyle('xostyle', {
html: "<div><span data-notify-html/></div>",
classes: {
base: {
"margin-top":"40px",
"white-space": "nowrap",
"background-color": "#5cb85c",
"padding": "5px",
"color":"white",
"text-align": "center",
},
}
});
}
};
xo.notify.init();
}(window.xo = window.xo || {}, jQuery));

View File

@@ -0,0 +1,33 @@
(function (xo) {
xo.tmpl = new function () {
this.fmt = function (tmpl_elem_id, elem, data) {
var tmpl_elem = document.getElementById(tmpl_elem_id);
var fmt = tmpl_elem.textContent;
var html = Mustache.render(fmt, data);
elem.insertAdjacentHTML('beforebegin', html);
elem.parentNode.removeChild(elem);
return html;
}
this.load_many = function () {
var len = arguments.length;
var dir = arguments[0];
for (var i = 1; i < len; ++i) {
this.load(dir, arguments[i]);
}
};
this.load = function (dir, fmt_name) {
var path = dir + fmt_name + ".mustache.html";
var req = new XMLHttpRequest();
req.onload = function (e) {
var template = req.responseText;
var elem = document.createElement('script');
elem.id = fmt_name;
elem.type = 'text/mustache';
elem.textContent = template;
document.head.appendChild(elem);
}
req.open("GET", path, true); // 'false': synchronous.
req.send(null);
};
}
}(window.xo = window.xo || {}));

View File

@@ -0,0 +1,536 @@
xo.log.add(1, 'bldr.central:init');
(function (xo) {
xo.bldr = xo.bldr || {};
xo.bldr.core = new function() {
// list of all top-tasks and sub-tasks
this.regy = {};
this.rates = {};
this.STATUS = {
INIT : 1,
WORK : 2,
DONE : 4,
SUSPENDED : 16,
}
this.EXEC = {
RUN : 1,
STOP : 2,
REDO : 3,
}
/*
this.rates =
{ 'gplx.xowa.core.security.verify' : 1000000
}
*/
// utility functions
this.get_uid = function(tbl, task_id, type) {return tbl + ':' + task_id + ':' + type;}
this.get_elem = function(tbl, task_id, type) {return xo.elem.get(this.get_uid(tbl, task_id, type));}
this.send = function(proc, args) {
xo.server.send(
{ cmd: 'builder_central.exec'
, data:
{ proc: proc
, args: args
}
}
);
}
// reload work, todo, done data
this.reload__send = function() {this.send('reload', {});};
this.reload__recv = function(msg) {this.reload(JSON.parse(msg)); return true;};
this.reload = function(msg) {
xo.log.add(1, 'xo.bldr.core.reload:bgn');
this.reload_list(msg, 'work');
this.reload_list(msg, 'todo');
this.reload_list(msg, 'done');
this.init_filter(msg);
xo.log.add(1, 'xo.bldr.core.reload:end');
};
this.reload_list__recv = function(msg) {
var msg_as_json = JSON.parse(msg);
this.reload_list(msg_as_json, msg_as_json.lists.list_name);
return true;
};
this.reload_list = function(msg, list_name) {
var list = msg.lists[list_name];
var list_wkr = xo.bldr[list_name];
if (!list) return;
list_wkr.clear_list();
this.delete_subs(list_name + '__tbl');
var len = list.length;
xo.log.add(1, 'xo.bldr.core.reload:list', list_name, len);
for (var i = 0; i < len; ++i) {
var task = list[i];
this.regy[task.task_id] = task;
list_wkr.add_task(task);
}
}
this.delete_subs = function(elem_id) {
var elem = xo.elem.get(elem_id);
while (elem.lastChild) {
elem.removeChild(elem.lastChild);
}
}
this.init_filter = function(msg) {
document.getElementById("filter_types").value = msg.filters.types.active;
var filter_select = document.getElementById("filter_langs");
this.clear_select(filter_select);
var len = msg.langs.length;
for (var i = 0; i < len; i++) {
var lang_nde = msg.langs[i];
var opt = document.createElement('option');
opt.value = lang_nde.key;
opt.text = lang_nde.name;
filter_select.appendChild(opt);
}
return true;
};
this.clear_select = function(cbo) {
var len = cbo.options.length;
for (i = 0; i < len; i++) {
cbo.options[0] = null;
}
}
// create a row based on type and nde
this.create_row = function(type, nde) {
var row;
if (type == 'work') {
row = xo.elem.make('work__tbl', 'div');
nde.row_type = 'work';
nde.row_is_head = false;
nde.row_is_work = true;
nde.row_is_todo = false;
nde.row_is_done = false;
}
else if (type == 'head') {
row = xo.elem.make('head__row', 'div');
nde.row_type = 'head';
nde.row_is_head = true;
nde.row_is_work = false;
nde.row_is_todo = false;
nde.row_is_done = false;
nde.task_id = '0';
}
else if (type == 'todo') {
row = xo.elem.make('todo__tbl', 'div');
nde.row_type = 'todo';
nde.row_is_head = false;
nde.row_is_work = false;
nde.row_is_todo = true;
nde.row_is_done = false;
}
else if (type == 'done') {
row = xo.elem.make('done__tbl', 'div');
nde.row_type = 'done';
nde.row_is_head = false;
nde.row_is_work = false;
nde.row_is_todo = false;
nde.row_is_done = true;
}
xo.tmpl.fmt('xobc.row', row, nde);
return row;
}
// transfer node
this.transfer__recv = function(msg_str) {
var msg = JSON.parse(msg_str);
this.transfer(msg.src, msg.trg, msg.task);
return true;
}
this.transfer = function(src, trg, task) {
var task_id = task.task_id;
xo.log.add(1, 'xo.bldr.core.transfer:bgn', src, trg, task_id);
// del src
delete(xo.bldr[src].regy[task_id]);
xo.elem.del(xo.bldr.core.get_uid(src, task_id, 'row'));
xo.bldr[src].del_task(task);
// add trg
xo.bldr[trg].add_task(task);
// add to correct sort-order
if (trg != 'work') {// do not reorder work table; work has a sort based on add-order
// get trg row, trg_tbl
var trg_row = xo.bldr.core.get_elem(trg, task_id, 'row');
var trg_sort = parseInt(trg_row.getAttribute('data-sort'));
var trg_tbl = xo.elem.get(trg + '__tbl');
var trg_subs = trg_tbl.children;
var trg_subs_len = trg_subs.length;
if (trg_subs_len > 1) { // do not reorder if only 1 item;
// loop rows until trg_seqn found
for (var i = 0; i < trg_subs_len; i++) {
var tmp_row = trg_subs[i];
var tmp_sort = parseInt(tmp_row.getAttribute('data-sort'));
if (tmp_sort >= trg_sort) {
try {trg_row.parentNode.insertBefore(trg_row, tmp_row);}
catch (e) {alert(e);}
break;
}
}
}
}
xo.bldr.work.head__update();
xo.log.add(1, 'xo.bldr.core.transfer:end');
}
// get next active sub nde; currently used by make function
this.get_next_nde = function(nde) {
for (var sub_key in nde.subs) {
var sub = nde.subs[sub_key];
if ( sub.task_status == xo.bldr.core.STATUS.INIT
|| sub.task_status == xo.bldr.core.STATUS.WORK
|| sub.task_status == xo.bldr.core.STATUS.SUSPENDED
) {
return sub;
}
}
return null;
}
this.get_elem_height_in_px = function(elem_id) {
var elem = xo.elem.get(elem_id);
if (elem.offsetHeight) {
return elem.offsetHeight;
} else if (elem.style.pixelHeight) {
return elem.style.pixelHeight;
}
return -1;
}
this.count = function(o) {
var rv = 0;
for (k in o) {
if (o.hasOwnProperty(k)) {
++rv;
}
}
return rv;
}
};
xo.bldr.todo = new function() {
this.regy = {};
this.clear_list = function() {for (var itm in this.regy) delete this.regy[itm];}
this.add_task = function(task) {
xo.bldr['todo'].regy[task.task_id] = task;
xo.bldr.core.create_row('todo', task);
}
this.del_task = function(task) {}
this.add_work__send = function(task_id) {
var task = xo.bldr['todo'].regy[task_id];
// if (xo.app.mode === 'drd') {
// xo.alertify.confirm_show('This task will download a lot of data!<br/><br/>Please make sure you are on Wi-Fi,<br/>or you will incur data charges.<br/><br/>Are you sure you want to continue?', 'Continue', 'Cancel'
// , function() {xo.bldr.todo.add_work__send__confirm_y(task_id);});
// }
// else {
xo.bldr.todo.add_work__send__confirm_y(task_id);
// }
}
this.add_work__send__confirm_y = function(task_id) {
xo.log.add(1, 'xo.bldr.todo.add_work', task_id);
xo.bldr.core.send('add_work', {task_id: task_id});
};
this.del_todo__send = function(task_id) {
var task = xo.bldr['todo'].regy[task_id];
xo.bldr.core.send('del_todo', {task_id: task_id});
}
this.download_db__send = function() {
xo.bldr.core.send('download_db', {});
};
this.filter__send = function() {
var lang_key = document.getElementById("filter_langs").value;
var type_key = document.getElementById("filter_types").value;
xo.log.add(1, 'xo.bldr.todo.filter', lang_key);
xo.bldr.core.send('filter_todo', {'lang_key': lang_key, 'type_key': type_key});
};
};
xo.bldr.done = new function() {
this.regy = {};
this.clear_list = function() {for (var itm in this.regy) delete this.regy[itm];}
this.add_task = function(task) {
xo.bldr['done'].regy[task.task_id] = task;
xo.bldr.core.create_row('done', task);
}
this.del_task = function(task) {}
this.del_done__send = function(task_id) {
// xo.alertify.confirm_show('Are you sure you want to move this task back into the available list?', 'Yes', 'No'
// , function() {xo.bldr.done.del_done__send__confirm_y(task_id);});
xo.log.add(1, 'xo.bldr.done.del_done', task_id);
xo.bldr.core.send('del_done', {task_id: task_id});
}
this.del_done__send__confirm_y = function(task_id) {
// xo.log.add(1, 'xo.bldr.done.del_done', task_id);
// xo.bldr.core.send('del_done', {task_id: task_id});
};
};
xo.bldr.work = new function() {
this.regy = {};
// called by transfer
this.clear_list = function() {for (var itm in this.regy) delete this.regy[itm];}
this.add_task = function(task) {
xo.bldr['work'].regy[task.task_id] = task;
// var nde_nxt = xo.bldr.core.get_next_nde(nde);
var step = task.step;
var cmd = step.cmd;
var pct = (cmd.prog_data_cur * 100) / cmd.prog_data_end;
task.prog_msg = xo.bldr.work.prog__msg_make(cmd.cmd_name, pct, xo.time.to_dhms(cmd.prog_time_end), cmd);
xo.bldr.core.create_row('work', task);
xo.bldr.core.get_elem('work', task.task_id, 'pbar-bar').style.width = pct + '%';
this.run_btn__update(true, xo.bldr.core.EXEC.RUN);
}
this.del_task = function(task) {
if (xo.bldr.core.count(this.regy) === 0) {
this.run_btn__update(false, xo.bldr.core.EXEC.RUN);
}
}
// called by server when item is first added
this.init__recv = function(msg_str) {
var msg = JSON.parse(msg);
var task_id = msg.task_id;
var nde = xo.bldr.core.regy[task_id];
nde.task_status = xo.bldr.core.STATUS.INIT;
nde.prog_data_cur = 0;
return true;
}
// called when "-" clicked
this.del_work__send = function(task_id) {
var task = xo.bldr.work.regy[task_id];
if (task.task_status != xo.bldr.core.STATUS.INIT) {
xo.alertify.confirm_show('Are you sure you want to remove the task and lose all work?', 'Yes', 'No'
, function() {xo.bldr.work.del_work__send__confirm_y(task, task_id);});
}
else {
this.del_work__send__confirm_y(task, task_id);
}
}
this.del_work__send__confirm_y = function(task, task_id) {
task.task_status = xo.bldr.core.STATUS.INIT;
xo.bldr.core.send('del_work', {task_id: task_id});
}
this.run_next__send = function() {xo.bldr.core.send('run_next', {});}
this.redo_cur__send = function() {
xo.bldr.core.send('redo_cur', {});
}
this.stop_cur__send = function() {xo.bldr.core.send('stop_cur', {});}
this.stop_cur__recv = function(msg) {xo.bldr.work.stop_cur(JSON.parse(msg)); return true;}
this.stop_cur = function(args) {
var task_id = args.task_id;
this.run_btn__update(true, xo.bldr.core.EXEC.RUN);
this.del_btn__update(task_id, true);
}
// called when task started
this.prog__start__recv = function(task_str) {
var task = JSON.parse(task_str);
xo.bldr.work.regy[task.task_id] = task; // overwrite task with new cmd
xo.bldr.core.get_elem('work', task.task_id, 'step-name').innerHTML = task.step.step_name;
var msg_elem = xo.bldr.core.get_elem('work', task.task_id, 'pbar-txt');
msg_elem.style.backgroundColor = 'initial';
this.run_btn__update(task.step.cmd.cmd_suspendable, xo.bldr.core.EXEC.STOP);
this.del_btn__update(task.task_id, false);
return true;
}
this.run_btn__update = function(enabled, exec_type) {
var btn = xo.bldr.core.get_elem('head', '0', 'run_next');
btn.style.opacity = enabled ? '1.0' : '0.2';
switch (exec_type) {
case xo.bldr.core.EXEC.RUN:
btn.className = 'xoimg_btn_x24 xoimg_media_play';
btn.onclick = function() {return xo.bldr.work.run_next__send();};
break;
case xo.bldr.core.EXEC.STOP:
btn.className = 'xoimg_btn_x24 xoimg_media_pause';
btn.onclick = function() {return xo.bldr.work.stop_cur__send();};
break;
case xo.bldr.core.EXEC.REDO:
btn.className = 'xoimg_btn_x24 xoimg_list_refresh';
btn.onclick = function() {return xo.bldr.work.redo_cur__send();};
break;
}
}
this.del_btn__update = function(task_id, enabled) {
var btn = xo.bldr.core.get_elem('work', task_id, 'del_work');
btn.disabled = !enabled;
btn.style.opacity = enabled ? '1.0' : '0.2';
}
// update head row
this.head__update = function() {
// calculate stats
var head_item_len = 0;
var head_data_end = 0;
var head_time_cur = 0;
var head_time_end = 0;
for (var nde_key in this.regy) {
var nde = this.regy[nde_key];
head_item_len += 1;
head_data_end += nde.prog_data_end;
head_time_cur += nde.prog_time_end - nde.prog_time_cur;
head_time_end += nde.prog_time_end;
}
// update ui
xo.elem.get('head:0:name').textContent = head_item_len + ' item(s)';
// xo.elem.get('head:0:size').textContent = xo.iosize.to_str(head_data_end);
// xo.elem.get('head:0:time').textContent = xo.time.to_dhms(head_time_cur);
}
this.prog__update__recv = function(msg) {xo.bldr.work.prog__update(JSON.parse(msg)); return true;}
this.prog__update = function(args) {
// calc time_til
var prog_data_cur = args.prog_data_cur;
var prog_data_end = args.prog_data_end;
var cur_rate = args.prog_rate;
var time_til = (prog_data_end - prog_data_cur) / cur_rate;
var time_til_str = xo.time.to_dhms(Math.ceil(time_til));
// update cmd
var task_id = args.task_id;
var task = xo.bldr.work.regy[task_id];
var cmd = task.step.cmd;
cmd.prog_data_cur = prog_data_cur;
cmd.prog_time_cur = prog_data_cur / cur_rate;
// update pbar
var pct = (prog_data_cur / prog_data_end);
var prog_msg = xo.bldr.work.prog__msg_make(cmd.cmd_name, (pct * 100), time_til_str, cmd);
xo.bldr.core.get_elem('work', task_id, 'pbar-txt').innerHTML = prog_msg;
xo.bldr.core.get_elem('work', task_id, 'pbar-bar').style.width = (pct * 100) + '%';
/*
// update top_nde time;
var top_subs = top_nde.subs;
var top_subs_len = top_subs.length;
var top_time_cur = 0, top_time_end = 0;
for (var i = 0; i < top_subs_len; ++i) {
var sub_nde = top_subs[i];
top_time_cur += sub_nde.prog_time_cur;
top_time_end += sub_nde.prog_time_end;
}
top_nde.prog_time_cur = top_time_cur;
top_nde.prog_time_end = top_time_end;
*/
xo.bldr.work.head__update();
}
this.prog__msg_make = function(name, percent, time_til_str, cmd) {
var prog_data_cur_str = xo.iosize.to_str(cmd.prog_data_cur);
var prog_data_end_str = xo.iosize.to_str(cmd.prog_data_end);
return name + ': ' + (percent | 0) + '% &middot; ' + time_til_str + ' &middot; ' + prog_data_cur_str + ' / ' + prog_data_end_str;
}
this.prog__done__recv = function(msg) {xo.bldr.work.prog__done(JSON.parse(msg)); return true;}
this.prog__done = function(args) {
xo.log.add(1, 'prog__done.bgn', args);
var task_id = args.task_id;
var task_is_done = args.task_is_done;
var task = xo.bldr.work.regy[task_id];
var cmd = task.step.cmd;
task.task_status = xo.bldr.core.STATUS.INIT;
xo.notify.show(cmd.cmd_name + ' done');
// if last, show extra notification
if (task_is_done) {
xo.notify.show(task.task_name + ' done');
// this.run_btn__update(false, true);
}
xo.log.add(1, 'prog__done.end', args);
}
this.prog__fail__recv = function(msg) {xo.bldr.work.prog__fail(JSON.parse(msg)); return true;}
this.prog__fail = function(args) {
var task_id = args.task_id;
var err = args.err;
var resume = args.resume;
var task = xo.bldr.work.regy[task_id];
// update msg
var msg_elem = xo.bldr.core.get_elem('work', task.task_id, 'pbar-txt');
msg_elem.innerHTML = task.step.cmd.cmd_name + ' failed: ' + err;
if (resume)
this.run_btn__update(true, xo.bldr.core.EXEC.RUN);
else
this.run_btn__update(true, xo.bldr.core.EXEC.REDO);
this.del_btn__update(task.task_id, true);
};
this.prog__stat__recv = function(msg) {xo.bldr.work.prog__stat(JSON.parse(msg)); return true;}
this.prog__stat = function(args) {
var task_id = args.task_id;
var msg = args.msg;
var task = xo.bldr.work.regy[task_id];
// update msg
var msg_elem = xo.bldr.core.get_elem('work', task.task_id, 'pbar-txt');
msg_elem.innerHTML = task.step.cmd.cmd_name + ' status: ' + msg;
};
this.rate__update__recv = function(msg) {xo.bldr.work.rate__update(JSON.parse(msg)); return true;}
this.rate__update = function(args) {
xo.bldr.core.rates[args.task_type] = args.task_rate;
xo.bldr.work.head__update();
}
}
xo.admin = new function() {
this.add_work = function() {
for (var nde_key in xo.bldr.todo.regy) {
xo.bldr.todo.add_work__send(nde_key);
break;
}
}
this.del_work = function() {
for (var task_id in xo.bldr.work.regy) {
xo.bldr.work.del_work__send(task_id);
break;
}
}
this.run_next = function() {
xo.bldr.work.run_next__send();
}
this.stop_cur = function() {
xo.bldr.work.stop_cur__send();
}
}
}(window.xo = window.xo || {}));
// general init
setTimeout(function() { // wait for mustache to load files async
// initialize buttons
xo.log.add(2, 'bldr.central:init buttons');
xo.elem.bind_onclick(xo.admin.add_work, 'admin__add_work__btn');
xo.elem.bind_onclick(xo.admin.del_work, 'admin__del_work__btn');
xo.elem.bind_onclick(xo.admin.run_next, 'admin__run_next__btn');
xo.elem.bind_onclick(xo.admin.stop_cur, 'admin__stop_cur__btn');
// load head; note: must go before reload b/c reload updates head elements
xo.log.add(2, 'bldr.central:init head');
xo.bldr.core.create_row('head', {});
// request initialization
xo.log.add(2, 'bldr.central:init reload');
xo.bldr.core.reload__send();
xo.bldr.work.head__update();
// initialize notify
xo.log.add(2, 'bldr.central:init notify');
xo.notify.elem_anchor = '#head__row';
}, 0); // was 400

View File

@@ -0,0 +1,279 @@
(function (xo) {
xo.server.send = function(root) {
xo.log.add(1, 'xo.server', JSON.stringify(root));
var proc_name = root.data.proc;
if (proc_name == 'reload') {
xo.bldr.core.reload__recv(JSON.stringify(
{ lists:
{ todo:
[
{ task_type: 'gplx.xowa.bldr.wikis.copy_part'
, task_name: 'simple.wikipedia.org: file'
, task_id : 's.w-2016.03-file'
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
, subs:
[
{ task_type : 'xowa.core.http.download'
, task_name : 'download'
, task_id : 's.w-2016.03-file-download'
, task_top_uid : 's.w-2016.03-file'
, task_suspendable: true
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
, { task_type : 'gplx.xowa.core.security.verify'
, task_name : 'verify'
, task_id : 's.w-2016.03-file-verify'
, task_top_uid : 's.w-2016.03-file'
, task_suspendable: false
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
]
}
, { task_type: 'gplx.xowa.bldr.wikis.copy_part'
, task_name: 'simple.wikipedia.org: html'
, task_id : 's.w-2016.03-html'
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
, subs:
[
{ task_type : 'xowa.core.http.download'
, task_name : 'download'
, task_id : 's.w-2016.03-html-download'
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
, { task_type : 'gplx.xowa.core.security.verify'
, task_name : 'verify'
, task_id : 's.w-2016.03-html-unzip'
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
]
}
]
, done:
[
{ task_type: 'gplx.xowa.bldr.wikis.copy_part'
, task_name: 'simple.wikipedia.org: file'
, task_id : 's.w-2016.03-file'
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
, subs:
[
{ task_type : 'xowa.core.http.download'
, task_name : 'download'
, task_id : 's.w-2016.03-file-download'
, task_top_uid : 's.w-2016.03-file'
, task_suspendable: true
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
, { task_type : 'gplx.xowa.core.security.verify'
, task_name : 'verify'
, task_id : 's.w-2016.03-file-verify'
, task_top_uid : 's.w-2016.03-file'
, task_suspendable: false
, prog_status: 1
, prog_data_cur : 0
, prog_data_end : 1819264175
}
]
}
]
}
}
));
}
else if (proc_name == 'add_work') {
xo.bldr.core.transfer__recv(JSON.stringify(
{ src:'todo'
, trg:'work'
, task:
{ task_id:root.data.args.task_id
, task_name: 'test queue'
, step:
{
step_name: 'step name'
, cmd:
{ cmd_name: 'download'
, prog_data_cur: 0
, prog_data_end: 100
, prog_time_end: 0
}
}
}
}));
}
else if (proc_name == 'del_work') {
xo.server.wkr.remove();
xo.bldr.core.transfer__recv(JSON.stringify({src:'work',trg:'todo',uid:root.data.args.task_id}));
}
else if (proc_name == 'run_next') {
var task_id = root.data.args.task_id;
var nde = xo.bldr.work.regy['s.w-2016.03-file'];
if (nde.started) {
xo.server.wkr.resume();
}
else {
nde.started = true;
var sub_nde = nde.subs[0]; // TODO: get next active node
var msgs = [];
msgs = msgs.concat(
[
{ proc:'xo.bldr.work.pause__visibility'
, args:
{ task_id:'s.w-2016.03-file-download'
}
}
]
);
msgs = msgs.concat(xo.server.msgs.make
( 5
, { proc:'xo.bldr.work.prog__update'
, args:
{ task_id: sub_nde.task_id
, prog_data_cur: function(ctx, nde) {
return (((ctx.idx + 1) * nde.prog_data_end) / ctx.max) | 0;
}
, prog_data_end: sub_nde.prog_data_end
}
}
));
/*
msgs = msgs.concat(
[
{ proc:'xo.bldr.work.prog__error'
, args:
{ task_id: sub_nde.task_id
, err: 'hash failed: expd=ff3d064ddd8373d1bada6f1c666cd501 actl=ff3d064ddd8373d1bada6f1c666cd501z'
}
}
]
);
*/
msgs = msgs.concat(
[
{ proc:'xo.bldr.work.prog__finished'
, args:
{ task_id: sub_nde.task_id
, prog_data_cur: sub_nde.prog_data_end
, prog_data_end: sub_nde.prog_data_end
}
}
]
);
msgs = msgs.concat(
[
{ proc:'xo.bldr.work.pause__visibility'
, args:
{ task_id:'s.w-2016.03-file-verify'
}
}
]
);
sub_nde = nde.subs[1]; // TODO: get next active node
msgs = msgs.concat(
xo.server.msgs.make
( 10
, { proc:'xo.bldr.work.prog__update'
, args:
{ task_id: sub_nde.task_id
, prog_data_cur: function(ctx, nde) {
return (((ctx.idx + 1) * nde.prog_data_end) / ctx.max) ;
}
, prog_data_end: sub_nde.prog_data_end
}
}
)
);
/*
*/
xo.server.wkr.start(msgs)
}
xo.bldr.work.run_next__recv(JSON.stringify({task_id:task_id}));
}
else if (proc_name == 'work__pause__send') {
xo.server.wkr.pause();
xo.bldr.work.pause__recv(JSON.stringify({task_id:root.data.args.task_id}));
}
};
xo.server.wkr = new function() {
this.time_interval = 500;
this.msg_idx = 0;
this.msg_end = 0;
this.run_handle = null;
this.paused = false;
this.msgs = null;
this.on_run = function() {
var wkr = xo.server.wkr;
var msg = wkr.msgs[wkr.msg_idx];
xo.server.msgs.get_by_path(this, msg.proc)(msg.args);
++wkr.msg_idx;
if (wkr.paused || wkr.msg_idx >= wkr.msg_end) {
this.clearInterval(wkr.run_handle);
}
}
this.start = function(msgs) {
this.msg_idx = 0;
this.msgs = msgs;
this.msg_end = msgs.length;
this.resume();
}
this.resume = function() {
this.paused = false;
this.run_handle = window.setInterval(this.on_run, this.time_interval);
}
this.pause = function() {
this.paused = true;
}
this.remove = function() {
this.paused = true;
this.msg_idx = 0;
}
}
xo.server.msgs = new function() {
this.get_by_path = function(obj, path){
for (var i = 0, path = path.split('.'), len = path.length; i < len; ++i){
obj = obj[path[i]];
};
return obj;
};
this.make = function(max, proto) {
var rv = [];
for (var idx = 0; idx < max; ++idx) {
var clone = clone_deep({idx:idx,max:max}, proto, {});
rv.push(clone);
}
return rv;
}
function clone_deep(ctx, proto, clone) {
for (var proto_key in proto) {
var proto_val = proto[proto_key];
if (proto_val instanceof Function) {
clone[proto_key] = proto_val(ctx, proto);
}
else if (proto_val instanceof Object) {
clone[proto_key] = clone_deep(ctx, proto_val, {});
}
else {
clone[proto_key] = proto_val;
}
}
return clone;
}
}
}(window.xo = window.xo || {}))

View File

@@ -0,0 +1,114 @@
(function (xo) {
xo.time = new function() {
this.to_dhms = function(val, opts) {
var show_units = (opts && opts.show_units) ? opts.show_units : true;
var max_places = (opts && opts.max_places) ? opts.max_places : 2;
var rv = '';
var suffix = '';
var count = 0;
for (var i = 0; i < 4; ++i) {
// get factor and unit
var factor = 0;
var unit = '';
switch(i) {
case 0: unit = 'd'; factor = 86400; break;
case 1: unit = 'h'; factor = 3600; break;
case 2: unit = 'm'; factor = 60; break;
case 3: unit = 's'; factor = 1; break;
}
// calc cur and update val; EX: 3690 -> cur:1,mod:90
var cur = (val / factor) | 0;
val %= factor;
if (count == 0) { // no str yet
if ( cur == 0 // cur is 0; EX: 3690 and factor = 86400 -> 0 days; don't write anything
&& i != 3) // unless it is the seconds place; need to handle "0 s" specifically
continue;
suffix = unit; // set suffix
rv += cur; // write cur; note that this is not zero-padded
}
else { // str exists
if (cur < 10) rv += '0';
rv += cur; // write cur; note that this zero-padded; also, note will write "00" if cur == 0
}
if (++count == max_places) break; // stop if max-places reached; EX: 86400 should write 1:00, not 1:00:00:00
if (i != 3) // do not add ":" if seconds
rv += ':'
}
if (show_units) // add units; EX: " s" for seconds
rv += ' ' + suffix;
return rv;
}
/*
console.log(to_dhms(1));
console.log(to_dhms(30));
console.log(to_dhms(60));
console.log(to_dhms(600));
console.log(to_dhms(3600));
console.log(to_dhms(5025));
console.log(to_dhms(86400));
*/
}
xo.iosize = new function() {
this.to_str = function(val, opts) {
if (!val) return '0 B'; // handle undefined
var decimal_places = (opts && opts.decimal_places) ? opts.decimal_places : 2;
// init
var unit_idx = 0;
var mult = 1024;
var cur_val = val;
var cur_exp = 1;
var nxt_exp = mult;
// get 1024 mult; EX: 1512 -> 1024
for (unit_idx = 0; unit_idx < 6; ++unit_idx) {
if (cur_val < nxt_exp) break;
cur_exp = nxt_exp;
nxt_exp *= mult;
}
// calc integer / decimal values
var int_val = (val / cur_exp) | 0;
var dec_val = (val % cur_exp) | 0;
if (decimal_places == 0) { // if 0 decimal places, round up
if (dec_val >= .5) ++int_val;
dec_val = 0;
}
else {// else, calculate decimal value as integer; EX: 549 -> .512 -> 512
var dec_factor = 0;
switch (decimal_places) {
case 1: dec_factor = 10; break;
case 2: dec_factor = 100; break;
default:
case 3: dec_factor = 1000; break;
}
dec_val = ((dec_val * dec_factor) / cur_exp) | 0;
}
// calc unit_str
var unit_str = "";
switch (unit_idx) {
case 0: unit_str = " b"; break;
case 1: unit_str = " kb"; break;
case 2: unit_str = " mb"; break;
case 3: unit_str = " gb"; break;
case 4: unit_str = " pb"; break;
case 5:
default: unit_str = " eb"; break;
}
// build string
var rv = int_val;
if (decimal_places > 0 && unit_idx != 0) {
rv += '.' + dec_val;
}
rv += unit_str;
return rv;
}
/*
console.log(to_str((1024 * 1024) + 536871, {decimal_places : 1}));
console.log(to_str((1024 * 1024) + 536871, {decimal_places : 2}));
console.log(to_str((1024 * 1024) + 536871, {decimal_places : 3}));
*/
}
}(window.xo = window.xo || {}));

View File

@@ -0,0 +1,58 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<!--
NOTE: this page loads local files
- Chrome is the easiest browser for local files; Use "chrome.exe --disable-web-security"
- Change C:/xowa/ to wherever it is on your system
-->
<!-- base -->
<base href="file:///C:/xowa/" target="_blank">
<!-- css -->
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.core.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.bootstrap.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xocss_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xoimg_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/addon/bldr/central/js/xo.log.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/addon/bldr/central/bin/xobc.css">
<!-- js -->
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/alertify-0.3.11.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/xo-alertify-0.0.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/mustache/mustache-2.2.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/jquery/jquery-1.11.3.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/notifyjs/notifyjs-0.3.1.js"></script>
</head>
<body>
<div id='bldr_body' class='bldr_body'></div>
</body>
<!-- js -->
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.log.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.app.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.app.swt.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.elem.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.tmpl.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.notify.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xo.server.js"></script>
<script>
xo.app.mode = 'swt';
</script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xobc.util.js"></script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xobc.localfile.js"></script>
<script>
xo.mode_is_debug = true;
xo.tmpl.load_many('bin/any/xowa/addon/bldr/central/bin/', 'xobc.main', 'xobc.row');
setTimeout(function() {
xo.tmpl.fmt('xobc.main', xo.elem.get('bldr_body'), {});
}, 0);
setTimeout(function() {
xo.bldr.core.reload__send();
// xo.bldr.todo.add_work__send('s.w-2016.03-file');
}, 600);
</script>
<script type="text/javascript" src="bin/any/xowa/addon/bldr/central/js/xobc.js"></script>
</html>

View File

@@ -0,0 +1,44 @@
.cur_head_text {
width: calc(100% - 47px);
}
.cur_head_btns {
width: 36px;
}
/* Detail Tbl */
.cur_data_row {
padding: 4px 0px 4px;
}
.cur_data_row label {
display: inline-block;
width: 90px;
margin: 0px 4px 0px 10px;
vertical-align: top;
align-self: flex-start;
-webkit-align-self: flex-start;
font-weight: bold;
}
.cur_data_row label::after {
content: ":";
}
.cur_data_row span {
display: inline-block;
width: calc(100% - 110px);
}
.files_table th {
border-bottom: 1px solid #ddd;
}
.files_table_url, .files_table_size, .files_table_md5 {
border-bottom: 1px solid #ddd;
padding: 4px;
}
.files_table_url {
}
.files_table_size {
text-align:right;
padding:0px 25px 0px 25px; /* use padding to add space between left and right cols */
}
.files_table_md5 {
font-family:Courier New;
}

View File

@@ -0,0 +1,54 @@
<div id='cur_help_div' class='xohelp_div'>
<div id='cur_help_msg' class='xohelp_msg'>
<b>Info</b>
<div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'><b>Wiki URL</b>: Internet URL of the wiki</span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'><b>Wiki folder</b>: Location where the .xowa files should be placed. For example: <code>C:\xowa\wiki\simple.wikipedia.org\simple.wikipedia.org-core.xowa</code></span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'><b>Total size</b>: Total size of all files on disk (not downloaded size)</span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'><b>Torrent</b>: Torrent link for use in your torrent program. Note that you will need to manually exclude files</span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'><b>Download URLs</b>: URLs for use in your download manager / accelerator</span></div>
</div>
</div>
</div>
<div class='main_body' id='main_body'>
<div class='xotbl_head_row'>
<div class='xotbl_head_text cur_head_text'>Task info</div>
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'>&nbsp;</a>
</div>
</div>
<div class="xotbl_data_row cur_data_row">
<label>Wiki URL</label>
<span><a href='https://{{wiki_domain}}' class='external'>https://{{wiki_domain}}</a></span>
</div>
<div class="xotbl_data_row cur_data_row">
<label>Wiki folder</label>
<span>{{wiki_dir}}</span>
</div>
<div class="xotbl_data_row cur_data_row">
<label>Total size</label>
<span>{{task_size}}</span>
</div>
<div class="xotbl_data_row cur_data_row">
<label>Torrent</label>
<span><a href='{{torrent_fil}}'>{{torrent_fil}}</a></span>
</div>
<div class="xotbl_data_row cur_data_row">
<label>Files</label>
<span>
<table class='files_table' cellspacing='0' cellpadding='0'>
<tr>
<th>URL</th>
<th>Size</th>
<th>MD5</th>
</tr>
{{#urls}}
<tr>
<td class='files_table_url'><a href='{{url}}'>{{url}}</a></td>
<td class='files_table_size'>{{size}}</td>
<td class='files_table_md5'>{{md5}}</td>
</tr>
{{/urls}}
</table>
</span>
</div>
</div>

View File

@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<!--
NOTE: this page loads local files
- Chrome is the easiest browser for local files; Use "chrome.exe --disable-web-security"
- Change C:/xowa/ to wherever it is on your system
-->
<!-- base -->
<base href="file:///C:/xowa/" target="_blank">
<!-- css -->
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.core.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.bootstrap.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xocss_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xoimg_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/addon/bldr/info/bin/xobc_info.css">
<!-- js -->
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/alertify-0.3.11.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/xo-alertify-0.0.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/mustache/mustache-2.2.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/jquery/jquery-1.11.3.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.js"></script>
<script type="text/html" id="templates"></script>
<script type="text/javascript">
window.view = {
wiki_dir : 'wiki_dir'
, torrent : 'torrent_link'
, urls :
[
{ url : 'url1'
, size : '123 MB'
}
,
{ url : 'url2'
, size : '234 MB'
}
,
{ url : 'url3'
, size : '345 MB'
}
,
{ url : 'url4'
, size : '456 MB'
}
]
};
</script>
<script>
$("#templates").load("bin/any/xowa/addon/bldr/info/bin/xobc_info.mustache.html", function(response_txt, status_txt, xhr){
var template = response_txt;
var output = Mustache.render(template, window.view);
document.getElementById('main').innerHTML = output;
});
</script>
</head>
<body>
<div id='main' class='bldr_body'></div>
</body>
</html>

View File

@@ -0,0 +1,71 @@
== Overview ==
This page describes how to set up {{language}} wikis on your machine.
The following two options are available:
=== Download pre-built wikis from archive.org ===
* '''Faster''': The build process is skipped completely. All you have to do is download the wikis
* '''Simpler''': The wikis are pre-compiled HTML, so you don't have to set-up Wikidata or other pre-requisites. Since the wiki is just being downloaded, not built, there are less things that can go wrong
* '''Less recent''': The wikis need to be manually generated and uploaded by me. If you find that the wikis below are out of date, you can create an issue at github.org or try building them yourself.
=== Build wikis using the database dumps at wikimedia.org ===
* '''Slower''': It takes an extra few hours to build the wiki
* '''Slightly harder''': These wikis work best with Wikidata on your machine. See [[App/Wiki types/Wikidata]]. In additon, the build process may not work on certain low-end machines like Raspberry Pi
* '''Always recent''': The wikis will be built using the latest dump from Wikimedia at https://dumps.wikimedia.org/backup-index.html
In addition, both options have an '''automatic''' and a '''manual''' route. More detail is provided below.
__TOC__
== Download pre-built wikis from archive.org ==
=== Automatic ===
* Go to [[Special:XowaDownloadCentral]]
* In the '''Available''' table, add any of the following task names
{{#wikis}}
{{#tasks}}
:: {{task_full_name}}
{{/tasks}}
{{/wikis}}
* In the '''Queue''' table, click the Play button
* Wait for the Queue to process. When it is done, enter the wiki URL in the bar. For example, <code>{{wikis__1st}}</code>
=== Manual ===
* Download the urls below. Note that they are listed in two formats:
** Urls by wiki / type: In case you want only one wiki (wiktionary) or one type (articles)
** All urls (for copying into a download manager)
* Unzip them and move the .xowa file to the proper wiki directory. For example, for {{wikis__1st}}, move the files to <code>C:\xowa\wiki\{{wikis__1st}}</code>
* Start XOWA and enter the wiki URL in the bar. For example, <code>{{wikis__1st}}</code>
== Build wikis using the database dumps at wikimedia.org ==
=== Automatic ===
* Go to [[Dashboard/Import/Online]]
* Find your wiki in the list
* Click the <code>download</code> link.
* Wait for the wiki to build. When it is done, it will automatically load the Main Page
=== Manual ===
* Download your dump from https://dumps.wikimedia.org/backup-index.html
* Go to [[Dashboard/Import/Offline]]
* Select the dump and import it
----
== URLS ==
{{#wikis}}
=== {{wiki_domain}} ===
{{#tasks}}
==== {{wiki_domain}} {{task_name}} ({{task_date}}) ====
<ul>
{{#files}}
* {{file_href}}
{{/files}}
</ul>
{{/tasks}}
{{/wikis}}
=== All links ===
<pre style='height: 10pc; overflow-y: scroll;'>
{{url_list}}
</pre>

View File

@@ -0,0 +1,18 @@
.cur_head_text {
width: calc(100% - 47px);
}
.cur_head_btns {
width: 36px;
}
/* Detail Tbl */
.cur_data_row {
height: 44px;
width: 100%;
}
.xdir_link_btn {
display: flex;
align-items: center;
width: calc(100% - 36px);
height: 100%;
}

View File

@@ -0,0 +1,48 @@
<div id='cur_help_div' class='xohelp_div'>
<div id='cur_help_msg' class='xohelp_msg'>
<b>Info</b>
<div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Select the default folder to save your Download Central wikis</span></div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Note that XOWA tries to default to your external SD card, but you may need to manually choose it</span></div>
</div>
<b>Buttons</b>
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_dir'>&nbsp;</span><span class='xohelp_row_text'>Select a custom folder for XOWA</span></div>
<b>Debug info</b>
<div>
<div class='xohelp_row'><span class='xohelp_bullet'>&nbsp;</span><span class='xohelp_row_text'>Current app root: {{app_root_dir}}</span></div>
</div>
</div>
</div>
<div class='main_body' id='main_body'>
<div class='xotbl_head_row'>
<div class='xotbl_head_text cur_head_text'>Select XOWA Folder</div>
<div class='xotbl_head_btns cur_head_btns'>
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'>&nbsp;</a>
</div>
</div>
{{#dirs}}
<div class='xotbl_data_row cur_data_row'>
<!--
<a
class="link_btn_y xdir_link_btn"
href="/site/home/wiki/Special:XowaRootDir?path={{path}}"
>
-->
<a
class="link_btn_y xdir_link_btn"
data_alertify_msg='Please confirm you wish to change the folder.<br/><b>Note that you must restart the app in order for the changes to take effect.</b>'
data_alertify_ok='Select'
data_alertify_cancel='Cancel'
data_alertify_href="/site/home/wiki/Special:XowaRootDir?path={{path}}"
onclick='return xo.alertify.confirm_href(this);'>
<span class='xoimg_btn_x24 {{#is_selected}}xoimg_misc_ok{{/is_selected}}' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'>&nbsp;</span>
<span class='dir_text'>{{path}}</span>
</a>
{{#is_custom}}
<a class='xoimg_btn_x24 xoimg_fsys_dir link_btn_y' title='select custom folder'
href="/site/home/wiki/Special:XowaFileBrowser?dir_cmd=xodir&path={{import_root}}"
>&nbsp;</a>
{{/is_custom}}
</div>
{{/dirs}}
</div>

View File

@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<!--
NOTE: this page loads local files
- Chrome is the easiest browser for local files; Use "chrome.exe --disable-web-security"
- Change C:/xowa/ to wherever it is on your system
-->
<!-- base -->
<base href="file:///C:/xowa/" target="_blank">
<!-- css -->
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.core.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/lib/alertify/themes/alertify.bootstrap.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xocss_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/core/xoimg_core-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.css">
<link type="text/css" rel="stylesheet" href="bin/any/xowa/addon/bldr/xodir/bin/xobc_xodir.css">
<!-- js -->
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/alertify-0.3.11.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/alertify/lib/xo-alertify-0.0.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/mustache/mustache-2.2.1.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/lib/jquery/jquery-1.11.3.js"></script>
<script type="text/javascript" src="bin/any/xowa/html/res/src/xowa/xocss/help/xohelp-0.0.1.js"></script>
<script type="text/html" id="templates"></script>
<script type="text/javascript">
window.view = {
dirs :
[
{ path : '/storage/Android/717F-03BD/data/org.xowa'
, is_internal : false
, is_custom : false
}
,
{ path : '/storage/emulated/0/Android/data/org.xowa'
, is_internal : true
, is_custom : false
}
,
{ path : '/storage/emulated/1/Android/data/org.xowa'
, is_internal : true
, is_custom : false
}
,
{ path : '(choose your own folder)'
, is_internal : false
, is_custom : true
}
]
};
</script>
<script>
$("#templates").load("bin/any/xowa/addon/bldr/xodir/bin/xobc_xodir.mustache.html", function(response_txt, status_txt, xhr){
var template = response_txt;
var output = Mustache.render(template, window.view);
document.getElementById('main').innerHTML = output;
});
</script>
</head>
<body>
<div id='main' class='bldr_body'></div>
</body>
</html>