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:
203
res/bin/any/xowa/addon/app/cfg/edit/bin/xo.cfg_edit.css
Normal file
203
res/bin/any/xowa/addon/app/cfg/edit/bin/xo.cfg_edit.css
Normal file
@@ -0,0 +1,203 @@
|
||||
/*----------------------------------
|
||||
user agent stylesheet overrides
|
||||
----------------------------------*/
|
||||
input, select, textarea {
|
||||
/* remove 3d border; also, use softer color */
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
input[type="text"] {
|
||||
/* add a little padding else text will be too close to borders */
|
||||
padding: 2px;
|
||||
}
|
||||
select{
|
||||
/* better vertical alignment (see Gui- Shortcuts) */
|
||||
box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
-webkit-box-sizing: content-box;
|
||||
}
|
||||
|
||||
/*----------------------------------
|
||||
page-level
|
||||
----------------------------------*/
|
||||
#xocfg_body {
|
||||
/* use entire width */
|
||||
width:100%;
|
||||
|
||||
/* auto-center */
|
||||
margin:0 auto;
|
||||
|
||||
/* reset line-height; mw-body-content sets line-height to 1.6 which throws off vertical centering */
|
||||
line-height: initial;
|
||||
}
|
||||
#xocfg_err {
|
||||
color:red;
|
||||
/* add v-space to give space for nav_select */
|
||||
margin: 10px 0px 10px;
|
||||
}
|
||||
#xocfg_nav_select {
|
||||
/* 28px to offset for help.toggle_all */
|
||||
width: calc(100% - 28px);
|
||||
}
|
||||
#xocfg_page_help {
|
||||
/* use same margin-top as h2 to symmetrically align vertically between dropdown above and h2 below */
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/*----------------------------------
|
||||
help row: note that this overrides the xohelp.css
|
||||
----------------------------------*/
|
||||
.xohelp_div {
|
||||
/*
|
||||
remove all borders except bottom for aesthetic reasons
|
||||
*/
|
||||
border: 0px;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.xohelp_msg {
|
||||
/*
|
||||
add bottom-spacer to center vertically
|
||||
*/
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
/*----------------------------------
|
||||
cfg row
|
||||
----------------------------------*/
|
||||
.xoimg_btn_x16 {
|
||||
/*
|
||||
remove margins which only exist because other pages do not correct "line-height:1.6" and use manual-pixel nudging
|
||||
note that this overrides the xocss.css
|
||||
*/
|
||||
margin: initial;
|
||||
}
|
||||
|
||||
.xocfg_row {
|
||||
/* take up 100% */
|
||||
width: 100%;
|
||||
|
||||
/* add some v-space between rows */
|
||||
margin: 2px 0px 2px;
|
||||
|
||||
/* add bottom border */
|
||||
border-bottom: 1px solid rgb(230,230,230);
|
||||
|
||||
/* add padding to give space for bottom border */
|
||||
padding: 0px 0px 4px;
|
||||
}
|
||||
.xocfg_itm_help {}
|
||||
.xocfg_itm_name {
|
||||
/* set width; will be used by data below */
|
||||
width: 120px; /* DRD.narrow */
|
||||
|
||||
/* add margins to separate from buttons on either side */
|
||||
margin: 0px 8px 0px 8px;
|
||||
|
||||
/* make bold; align-right*/
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
}
|
||||
.xocfg_itm_delete {
|
||||
/* add right margin to give space from data */
|
||||
margin: 0px 4px 0px 0px;
|
||||
}
|
||||
.xocfg_itm_hide {
|
||||
/* marker class to hide delete button */
|
||||
visibility: hidden;
|
||||
}
|
||||
.xocfg_itm_data {
|
||||
/* set width to use rest of page; note +40 for two buttons */
|
||||
width: calc(100% - 200px); /* DRD.narrow */
|
||||
}
|
||||
@media only screen and (min-width: 768px) {
|
||||
.xocfg_itm_name {
|
||||
/* set width; will be used by data below */
|
||||
width: 220px; /* DRD.narrow */
|
||||
}
|
||||
.xocfg_itm_data {
|
||||
/* set width to use rest of page; note +40 for two buttons */
|
||||
width: calc(100% - 300px); /* DRD.narrow */
|
||||
}
|
||||
}
|
||||
/*----------------------------------
|
||||
data
|
||||
----------------------------------*/
|
||||
.xocfg_data__str {
|
||||
width: 100%;
|
||||
}
|
||||
.xocfg_data__int {
|
||||
width: 75px;
|
||||
|
||||
text-align: right;
|
||||
}
|
||||
.xocfg_data__list {
|
||||
width: 200px;
|
||||
}
|
||||
.xocfg_data__memo {
|
||||
width: 100%;
|
||||
}
|
||||
@media only screen and (min-width: 768px) {
|
||||
.xocfg_data__str {
|
||||
width: 40%;
|
||||
}
|
||||
.xocfg_data__memo {
|
||||
width: 40%;
|
||||
}
|
||||
}
|
||||
|
||||
.xocfg_data__io_cmd__exe__txt {
|
||||
width: 400px;
|
||||
/* add space to bottom to separate from arg_box */
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.xocfg_data__io_cmd__arg__txt {
|
||||
width: 400px;
|
||||
}
|
||||
.xocfg_data__io_cmd__exe__btn {}
|
||||
|
||||
.xocfg_data__gui_binding__box {
|
||||
width: 120px;
|
||||
/* add padding to make it same size as nearby text box */
|
||||
padding: 1px;
|
||||
}
|
||||
.xocfg_data__gui_binding__ipt {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.xocfg_data__readonly {
|
||||
background-color:#F9F9F9;
|
||||
}
|
||||
|
||||
/*----------------------------------
|
||||
xocfg_pulse effect for confirm icon
|
||||
----------------------------------*/
|
||||
.xocfg_pulse {
|
||||
display: block;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 0 rgba(0, 128, 0, 0.8);
|
||||
animation: xocfg_pulse 2s;
|
||||
}
|
||||
@-webkit-keyframes xocfg_pulse {
|
||||
0% {
|
||||
-webkit-box-shadow: 0 0 0 0 rgba(0, 128, 0, 0.8);
|
||||
}
|
||||
70% {
|
||||
-webkit-box-shadow: 0 0 0 2px rgba(0, 128, 0, 0);
|
||||
}
|
||||
100% {
|
||||
-webkit-box-shadow: 0 0 0 0 rgba(0, 128, 0, 0);
|
||||
}
|
||||
}
|
||||
@keyframes xocfg_pulse {
|
||||
0% {
|
||||
-moz-box-shadow: 0 0 0 0 rgba(0, 128, 0, 0.8);
|
||||
box-shadow: 0 0 0 0 rgba(0, 128, 0, 0.4);
|
||||
}
|
||||
70% {
|
||||
-moz-box-shadow: 0 0 0 2px rgba(0, 128, 0, 0);
|
||||
box-shadow: 0 0 0 2px rgba(0, 128, 0, 0);
|
||||
}
|
||||
100% {
|
||||
-moz-box-shadow: 0 0 0 0 rgba(0, 128, 0, 0);
|
||||
box-shadow: 0 0 0 0 rgba(0, 128, 0, 0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<div id='cfg_grps'>
|
||||
<div>
|
||||
<p id='page_help_para'>{{{page_help}}}</p>
|
||||
</div>
|
||||
{{#grps}}
|
||||
<h2>{{{name}}}</h2>
|
||||
|
||||
{{#itms}}
|
||||
<div class="xocfg_row flex_div">
|
||||
<div class='xocfg_itm_help'>
|
||||
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("{{key}}")' title='view more info'> </span>
|
||||
</div>
|
||||
<div id='{{key}}__name' class='xocfg_itm_name'>{{{name}}}</div>
|
||||
<div id='{{key}}__undo' data-xocfg-type='{{type}}' class='xocfg_itm_delete{{^edited}} xocfg_itm_hide{{/edited}}'>
|
||||
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("{{key}}")' title="reset to "{{{dflt}}}""> </span>
|
||||
</div>
|
||||
<div class='xocfg_itm_data'>{{{html}}}</div>
|
||||
<input type='hidden' id='{{key}}__key_box' value='{{key}}'></input>
|
||||
<input type='hidden' id='{{key}}__ctx_box' value='{{{ctx}}}'></input>
|
||||
</div>
|
||||
<div id='{{key}}_help_div' class='xohelp_div'>
|
||||
<div id='{{key}}_help_msg' class='xohelp_msg'>{{{help}}}</div>
|
||||
</div>
|
||||
{{/itms}}
|
||||
{{/grps}}
|
||||
</div>
|
||||
277
res/bin/any/xowa/addon/app/cfg/edit/bin/xo.cfg_edit.js
Normal file
277
res/bin/any/xowa/addon/app/cfg/edit/bin/xo.cfg_edit.js
Normal file
@@ -0,0 +1,277 @@
|
||||
(function (xo) {
|
||||
xo.cfg_edit = new function() {
|
||||
this.debug = false;
|
||||
//{ util.elem
|
||||
this.elem__get = function(id) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem == null && xo.cfg_edit.debug) alert('elem__get failed: id=' + id);
|
||||
return elem;
|
||||
}
|
||||
this.elem__val = function(id) {
|
||||
var elem = document.getElementById(id);
|
||||
return elem == null ? null : elem.value;
|
||||
}
|
||||
this.elem__val_ = function(id, val) {
|
||||
var elem = document.getElementById(id);
|
||||
if (elem == null && xo.cfg_edit.debug) alert('elem__val failed: id=' + id);
|
||||
elem.value = val;
|
||||
}
|
||||
this.elems__get_by_atr = function(atr) {
|
||||
var rv = [];
|
||||
|
||||
// get all elems
|
||||
var elems = document.getElementsByTagName('*');
|
||||
var len = elems.length;
|
||||
|
||||
// loop all elems and add found to rv
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (elems[i].getAttribute(atr) !== null) // elem has atr
|
||||
rv.push(elems[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
//}
|
||||
|
||||
//{ util.xocfg
|
||||
this.err__clear = function() {xo.cfg_edit.err__write('');}
|
||||
this.err__write = function(s) {
|
||||
var elem = xo.elem.get('xocfg_err');
|
||||
if (elem)
|
||||
elem.innerHTML = s;
|
||||
}
|
||||
|
||||
this.cfg_val__set = function(type, key, val) {
|
||||
if (type === 'bool') {
|
||||
xo.cfg_edit.elem__get(key).checked = val == "y";
|
||||
}
|
||||
else if (type === 'io.cmd') {
|
||||
var flds = val.split("|");
|
||||
xo.cfg_edit.elem__val_(key + '-exe', flds[0]);
|
||||
xo.cfg_edit.elem__val_(key + '-arg', flds.length <= 1 ? "" : flds[1]);
|
||||
}
|
||||
else if (type === 'gui.binding') {
|
||||
var flds = val.split("|");
|
||||
// xo.cfg_edit.elem__val_(key + '-box', flds[0]);
|
||||
var box = xo.cfg_edit.elem__get(key + '-box');
|
||||
var len = box.options.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var opt = box.options[i];
|
||||
if (opt.text === flds[0]) {
|
||||
box.selectedIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
xo.cfg_edit.elem__val_(key + '-ipt', flds.length <= 1 ? "" : flds[1]);
|
||||
}
|
||||
else {
|
||||
xo.cfg_edit.elem__get(key).value = val;
|
||||
}
|
||||
}
|
||||
this.cfg_val__bind_all = function() {
|
||||
var elems = xo.cfg_edit.elems__get_by_atr('data-xocfg-key');
|
||||
var len = elems.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
elems[i].addEventListener('change', xo.cfg_edit.update__send_by_event);
|
||||
if (elems[i].tagName === 'BUTTON') {
|
||||
elems[i].addEventListener('click', xo.cfg_edit.update__send_by_event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.io_cmd__select = function(io_type, elem_id, msg) {
|
||||
// call xowa to launch file_dialog
|
||||
var file_path = xowa_exec('scripts_exec', 'app.gui.kit.ask_file("' + msg + '");');
|
||||
if (file_path == null || file_path == '') return; // nothing selected; exit
|
||||
|
||||
// update val
|
||||
var elem = xo.cfg_edit.elem__get(elem_id);
|
||||
elem.value = file_path;
|
||||
xo.cfg_edit.update__send(elem);
|
||||
}
|
||||
|
||||
this.gui_binding__remap_send = function change_binding(key, name, bnd) {
|
||||
try {
|
||||
xowa_exec('scripts_exec', "app.cfg.run('app', 'xowa.gui.shortcuts.show_remap_win', '" + key + "\n" + name + "\n" + xo.cfg_edit.elem__val(key + '-ipt') + "');");
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
this.gui_binding__remap_recv = function(msg_str) {
|
||||
try {
|
||||
// err.write
|
||||
var msg = JSON.parse(msg_str);
|
||||
|
||||
// update
|
||||
var ipt_elem = xo.cfg_edit.elem__get(msg.key + '-ipt');
|
||||
ipt_elem.value = msg.bnd;
|
||||
xo.cfg_edit.update__send(ipt_elem);
|
||||
|
||||
return true;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ update
|
||||
this.update__send_by_event = function(e) {xo.cfg_edit.update__send(e.target);}
|
||||
this.update__send = function(elem) {
|
||||
try {
|
||||
// init vars
|
||||
var key = elem.getAttribute("data-xocfg-key");
|
||||
var type = elem.getAttribute("data-xocfg-type");
|
||||
|
||||
// read val from ui
|
||||
var val = '';
|
||||
if (type === 'bool') {val = elem.checked ? "y" : "n";}
|
||||
else if (type === 'io.cmd-exe') {val = elem.value + '|' + xo.cfg_edit.elem__val(key + '-arg');}
|
||||
else if (type === 'io.cmd-arg') {val = xo.cfg_edit.elem__val(key + '-exe') + '|' + elem.value;}
|
||||
// else if (type === 'gui.binding-box') {val = elem.value + '|' + xo.cfg_edit.elem__val(key + '-ipt');}
|
||||
else if (type === 'gui.binding-box') {var box = xo.cfg_edit.elem__get(key + '-box'); val = box_text = box.options[box.selectedIndex].text + '|' + xo.cfg_edit.elem__val(key + '-ipt');}
|
||||
else if (type === 'gui.binding-ipt') {var box = xo.cfg_edit.elem__get(key + '-box'); val = box_text = box.options[box.selectedIndex].text + '|' + elem.value;}
|
||||
else {val = elem.value;}
|
||||
|
||||
// send to server
|
||||
xo.server.send_by_bridge('xo.cfg_edit', 'update',
|
||||
{ ctx: xo.cfg_edit.elem__val(key + '__ctx_box')
|
||||
, key: key
|
||||
, val: val
|
||||
, type: type
|
||||
});
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
this.update__fail = function(msg_str) {
|
||||
try {
|
||||
// err.write
|
||||
var msg = JSON.parse(msg_str);
|
||||
var name = xo.cfg_edit.elem__get(msg.key + '__name');
|
||||
xo.cfg_edit.err__write('<b>' + msg.new_val + '</b> is invalid for <b>' + name.textContent.trim() + '</b><br/>Error: ' + msg.err);
|
||||
|
||||
// revert val
|
||||
xo.cfg_edit.elem__val_(msg.key, msg.old_val);
|
||||
return true;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
this.update__pass = function(msg_str) {
|
||||
try {
|
||||
// err.clear
|
||||
var msg = JSON.parse(msg_str);
|
||||
xo.cfg_edit.err__clear();
|
||||
if (msg.type === 'btn') return true; // if button, exit
|
||||
|
||||
// show undo button
|
||||
var undo_elem = xo.cfg_edit.elem__get(msg.key + '__undo');
|
||||
undo_elem.classList.remove("xocfg_itm_hide");
|
||||
|
||||
// show confirm icon briefly
|
||||
var img = undo_elem.children[0];
|
||||
img.className = 'xoimg_btn_x16 xoimg_misc_ok xocfg_pulse';
|
||||
setTimeout(function() {
|
||||
img.className = 'xoimg_btn_x16 xoimg_list_undo';
|
||||
}, 1200);
|
||||
return true;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ delete
|
||||
this.delete__send = function(key) {
|
||||
try {
|
||||
xo.cfg_edit.err__clear();
|
||||
|
||||
// get type
|
||||
var undo_elem = xo.cfg_edit.elem__get(key + '__undo');
|
||||
var type = undo_elem.getAttribute("data-xocfg-type");
|
||||
|
||||
// send to server
|
||||
xo.server.send_by_bridge('xo.cfg_edit', 'delete',
|
||||
{ ctx: xo.cfg_edit.elem__val(key + '__ctx_box')
|
||||
, key: key
|
||||
, type: type
|
||||
});
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
this.delete__recv = function(msg_str) {
|
||||
try {
|
||||
var msg = JSON.parse(msg_str);
|
||||
|
||||
// hide icon
|
||||
var undo_elem = xo.cfg_edit.elem__get(msg.key + '__undo');
|
||||
var undo_img = undo_elem.children[0];
|
||||
undo_elem.classList.add("xocfg_itm_hide");
|
||||
|
||||
// set value
|
||||
var type = undo_elem.getAttribute("data-xocfg-type");
|
||||
xo.cfg_edit.cfg_val__set(type, msg.key, msg.val);
|
||||
return true;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ select
|
||||
this.select__by_keypress = function(e, target) {
|
||||
switch (e.keyCode) {
|
||||
case 38: // up
|
||||
case 40: // down;
|
||||
if (!e.altKey) // do not fire for alt+down which drops down menu
|
||||
this.select__send(target);
|
||||
break;
|
||||
case 33: // page_up
|
||||
case 34: // page_down;
|
||||
this.select__send(target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.select__send = function(elem) {
|
||||
try {
|
||||
if (elem == null) // occurs when View HTML for SWT Browser
|
||||
return;
|
||||
xo.cfg_edit.err__clear();
|
||||
var key = elem.options[elem.selectedIndex].value;
|
||||
xo.server.send_by_bridge('xo.cfg_edit', 'select',
|
||||
{ ctx: 'app' //xo.cfg_edit.elem__val(key + '__ctx_box')
|
||||
, key: key
|
||||
});
|
||||
|
||||
var options_elem = xo.elem.get('options_lnk');
|
||||
if (options_elem) // null on DRD
|
||||
options_elem.href = '/wiki/Special:XowaCfg?grp=' + key;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
this.select__recv = function(msg_str) {
|
||||
try {
|
||||
// write grp via template
|
||||
var msg = JSON.parse(msg_str);
|
||||
var grp = xo.elem.get('cfg_grps');
|
||||
xo.tmpl.fmt('xocfg.grps', grp, msg);
|
||||
|
||||
// bind update and popups
|
||||
xo.cfg_edit.cfg_val__bind_all();
|
||||
try {
|
||||
xowa_popups_bind_to_owner(document);
|
||||
} catch (err) {}
|
||||
return true;
|
||||
} catch (err) {alert(err);}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ help
|
||||
this.help__toggle_all = function() {
|
||||
var elems = document.getElementsByClassName('xohelp_div');
|
||||
var len = elems.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var elem = elems[i] ;
|
||||
var id = elem.id.replace('_help_div', '');
|
||||
xo.help.toggle(id);
|
||||
}
|
||||
}
|
||||
//}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
|
||||
//{ onpageload
|
||||
xo.cfg_edit.cfg_val__bind_all();
|
||||
xo.help.add_bottom_margin = false;
|
||||
setTimeout(function() { // wait for mustache to load files async
|
||||
var elem = xo.cfg_edit.elem__get('xocfg_nav_select');
|
||||
// auto-load group; deactivated because first group comes preloaded to have HTML
|
||||
xo.cfg_edit.select__send(elem);
|
||||
elem.focus();
|
||||
}, 0);
|
||||
//}
|
||||
@@ -0,0 +1,64 @@
|
||||
<div id='xocfg_body'>
|
||||
<!-- TEXT:err_msg -->
|
||||
<div id='xocfg_err'></div>
|
||||
{{#nav_exists}}
|
||||
<div>
|
||||
<!-- BTN:info -->
|
||||
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.cfg_edit.help__toggle_all()' title='toggle all help'> </span>
|
||||
|
||||
<!-- COMBO:cfg_grps -->
|
||||
<select id='xocfg_nav_select' onchange='xo.cfg_edit.select__send(this);' onkeyup='xo.cfg_edit.select__by_keypress(event, this);' accesskey='l'>
|
||||
{{#itms}}
|
||||
<option value='{{key}}' {{#selected}} selected='selected'{{/selected}}>{{text}}</option>
|
||||
{{/itms}}
|
||||
</select>
|
||||
|
||||
<!-- LINK:cfg_link -->
|
||||
{{^app_is_drd}}
|
||||
<div style='float:right;margin:2px 7px;'>
|
||||
<a id='options_lnk'>options link</a>
|
||||
</div>
|
||||
{{/app_is_drd}}
|
||||
</div>
|
||||
{{/nav_exists}}
|
||||
|
||||
<div id='cfg_grps'>
|
||||
<!-- TEXT:page_help -->
|
||||
<div>
|
||||
<p id='page_help_para'>{{{page_help}}}</p>
|
||||
</div>
|
||||
{{#grps}}
|
||||
<h2>{{{name}}}</h2>
|
||||
|
||||
{{#itms}}
|
||||
<div class="xocfg_row flex_div">
|
||||
<!-- BTN:help_item -->
|
||||
<div class='xocfg_itm_help'>
|
||||
<span class='xoimg_btn_x16 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("{{key}}")' title='view more info'> </span>
|
||||
</div>
|
||||
|
||||
<!-- TEXT:key -->
|
||||
<div id='{{key}}__name' class='xocfg_itm_name'>{{{name}}}</div>
|
||||
|
||||
<!-- BTN:undo -->
|
||||
<div id='{{key}}__undo' data-xocfg-type='{{type}}' class='xocfg_itm_delete{{^edited}} xocfg_itm_hide{{/edited}}'>
|
||||
<span class='xoimg_btn_x16 xoimg_list_undo' onclick='return xo.cfg_edit.delete__send("{{key}}")' title="reset to "{{{dflt}}}""> </span>
|
||||
</div>
|
||||
|
||||
<!-- TEXT:val -->
|
||||
<div class='xocfg_itm_data'>{{{html}}}</div>
|
||||
|
||||
<!-- HIDDEN:key,ctx -->
|
||||
<input type='hidden' id='{{key}}__key_box' value='{{key}}'></input>
|
||||
<input type='hidden' id='{{key}}__ctx_box' value='{{{ctx}}}'></input>
|
||||
</div>
|
||||
|
||||
<!-- DIV:help -->
|
||||
<div id='{{key}}_help_div' class='xohelp_div'>
|
||||
<div id='{{key}}_help_msg' class='xohelp_msg'>{{{help}}}</div>
|
||||
</div>
|
||||
{{/itms}}
|
||||
{{/grps}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
20
res/bin/any/xowa/addon/app/cfg/maint/bin/xo.cfg_maint.css
Normal file
20
res/bin/any/xowa/addon/app/cfg/maint/bin/xo.cfg_maint.css
Normal file
@@ -0,0 +1,20 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.label {
|
||||
display: inline-block;
|
||||
padding: 0px 0px 0px 10px;
|
||||
}
|
||||
.data {
|
||||
display: inline-block;
|
||||
width: calc(100% - 94px);
|
||||
padding: 0px 0px 0px 10px;
|
||||
}
|
||||
.button {
|
||||
display: inline-block;
|
||||
padding: 0px 10px 0px 10px;
|
||||
}
|
||||
16
res/bin/any/xowa/addon/app/cfg/maint/bin/xo.cfg_maint.js
Normal file
16
res/bin/any/xowa/addon/app/cfg/maint/bin/xo.cfg_maint.js
Normal file
@@ -0,0 +1,16 @@
|
||||
(function (xo) {
|
||||
xo.cfg_maint = new function() {
|
||||
this.get_elem_val = function(id) {
|
||||
var elem = document.getElementById(id);
|
||||
return elem == null ? null : elem.value;
|
||||
}
|
||||
this.itm__save = function(e) {
|
||||
var data = xo.cfg_maint.get_elem_val('data_box');
|
||||
xo.server.send_by_bridge('xo.cfg_maint', 'upsert',
|
||||
{ data: data
|
||||
});
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
document.getElementById('data_box').focus();
|
||||
document.getElementById('save_btn').addEventListener('click', xo.cfg_maint.itm__save);
|
||||
@@ -0,0 +1,25 @@
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
Work in progress
|
||||
</div>
|
||||
</div>
|
||||
<div class='main_body' id='main_body'>
|
||||
<div class='list_tbl'>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>Option Maintenance</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")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="xotbl_data_row flex_div">
|
||||
<div class='label'>Data
|
||||
</div>
|
||||
<div class='data'>
|
||||
<textarea id='data_box' rows='40' accesskey=','></textarea>
|
||||
</div>
|
||||
<div class='button'>
|
||||
<button id='save_btn' accesskey='s'>Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
BIN
res/bin/any/xowa/addon/app/cfg/xo.cfg.sqlite3
Normal file
BIN
res/bin/any/xowa/addon/app/cfg/xo.cfg.sqlite3
Normal file
Binary file not shown.
53
res/bin/any/xowa/addon/app/help/log/bin/xolog.css
Normal file
53
res/bin/any/xowa/addon/app/help/log/bin/xolog.css
Normal file
@@ -0,0 +1,53 @@
|
||||
.cur_head_text {
|
||||
display: flex; align-items: center;
|
||||
width: calc(100% - 180px);
|
||||
font-size: 1.1em;
|
||||
height: 100%;
|
||||
margin-left: 10px; /* match img_btn padding */
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 180px;
|
||||
}
|
||||
.log_div {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin: 0px; border: 0px; /* turn off default pre styles*/
|
||||
|
||||
overflow: auto;
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.date_combo_div {
|
||||
display: inline-block;
|
||||
}
|
||||
.date_combo_btn {
|
||||
display: flex; align-items: center;
|
||||
width: 100%;
|
||||
padding: 4px 0px 4px 4px;
|
||||
border: solid 1px #ddd;
|
||||
|
||||
background-color: white;
|
||||
cursor: pointer;
|
||||
}
|
||||
.date_combo_btn:hover, .dropbtn:focus {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
.date_combo_content {
|
||||
display: none;
|
||||
padding: 4px 4px 4px 4px;
|
||||
position: absolute;
|
||||
|
||||
background-color: #f9f9f9;
|
||||
text-align: left;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
|
||||
}
|
||||
.date_combo_content a {
|
||||
display: block;
|
||||
color: black;
|
||||
}
|
||||
.date_combo_content a:hover {
|
||||
background-color: #f1f1f1
|
||||
}
|
||||
.date_combo_content_show {
|
||||
display:block;
|
||||
}
|
||||
19
res/bin/any/xowa/addon/app/help/log/bin/xolog.js
Normal file
19
res/bin/any/xowa/addon/app/help/log/bin/xolog.js
Normal file
@@ -0,0 +1,19 @@
|
||||
(function (xo) {
|
||||
xo.xolog = new function() {
|
||||
this.date_combo_show = function() {
|
||||
document.getElementById("date_combo_id").classList.toggle("date_combo_content_show");
|
||||
}
|
||||
window.onclick = function(event) {
|
||||
if (!event.target.matches('.date_combo_clicker')) {
|
||||
var dropdowns = document.getElementsByClassName("date_combo_content");
|
||||
var i;
|
||||
for (i = 0; i < dropdowns.length; i++) {
|
||||
var dropdown = dropdowns[i];
|
||||
if (dropdown.classList.contains('date_combo_content_show')) {
|
||||
dropdown.classList.remove('date_combo_content_show');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
44
res/bin/any/xowa/addon/app/help/log/bin/xolog.mustache.html
Normal file
44
res/bin/any/xowa/addon/app/help/log/bin/xolog.mustache.html
Normal file
@@ -0,0 +1,44 @@
|
||||
<div class='main_div'>
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_inet_email'> </span><span class='xohelp_row_text'>Email the current log to the XOWA developer</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_delete'> </span><span class='xohelp_row_text'>Delete the current log</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_trash'> </span><span class='xohelp_row_text'>Delete all logs</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='cur_head_text'>
|
||||
<div class="date_combo_div">
|
||||
<div class="date_combo_btn">
|
||||
<div class="date_combo_clicker" onclick="xo.xolog.date_combo_show()">{{log_name}}▼</div>
|
||||
</div>
|
||||
<div id="date_combo_id" class="date_combo_content">
|
||||
{{#log_files}}
|
||||
<a href="/wiki/Special:XowaLog?cmd=show&file={{file}}">{{name}}</a>
|
||||
{{/log_files}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_inet_email' title='email' href='/wiki/Special:XowaLog?cmd=email&file={{log_file}}'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_list_delete' title='delete current log' href='javascript:void(0)'
|
||||
data_alertify_msg='Are you sure you want to delete this log: {{log_name}}?'
|
||||
data_alertify_ok='Delete'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_href='/wiki/Special:XowaLog?cmd=delete_one&file={{log_file}}'
|
||||
onclick='return xo.alertify.confirm_href(this);'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_fsys_trash' title='delete all logs' href='javascript:void(0)'
|
||||
data_alertify_msg='Are you sure you want to delete all logs?'
|
||||
data_alertify_ok='Delete All'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_href='/wiki/Special:XowaLog?cmd=delete_all'
|
||||
onclick='return xo.alertify.confirm_href(this);'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="xotbl_data_row">
|
||||
<pre class='log_div'>{{{log_data}}}</pre>
|
||||
</div>
|
||||
</div>
|
||||
57
res/bin/any/xowa/addon/app/help/log/test/xolog.test.html
Normal file
57
res/bin/any/xowa/addon/app/help/log/test/xolog.test.html
Normal file
@@ -0,0 +1,57 @@
|
||||
<!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/app/help/log/bin/xolog.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/addon/app/help/log/bin/xolog.js"></script>
|
||||
|
||||
<!-- mustache -->
|
||||
<script type="text/html" id="templates"></script>
|
||||
<script type="text/javascript">
|
||||
window.view = {
|
||||
log_files:
|
||||
[
|
||||
{name:'2016-03-06 01:02:03', file:'20160306_010203'},
|
||||
{name:'2016-03-05 01:02:03', file:'20160305_010203'},
|
||||
],
|
||||
log_name:'2016-03-06 01:02:03',
|
||||
log_file:'20160306_010203',
|
||||
log_data:'test data',
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("#templates").load("bin/any/xowa/addon/app/help/log/bin/xolog.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"></div>
|
||||
</body>
|
||||
<script>
|
||||
xo.alertify.log_by_str('{"msg":"test", "type":"success", "wait":3000}');
|
||||
</script>
|
||||
</html>
|
||||
28
res/bin/any/xowa/addon/app/maint/sql_exec/bin/xosql_exec.css
Normal file
28
res/bin/any/xowa/addon/app/maint/sql_exec/bin/xosql_exec.css
Normal file
@@ -0,0 +1,28 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
/* 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_input {
|
||||
display: inline-block;
|
||||
width: calc(100% - 140px);
|
||||
}
|
||||
36
res/bin/any/xowa/addon/app/maint/sql_exec/bin/xosql_exec.js
Normal file
36
res/bin/any/xowa/addon/app/maint/sql_exec/bin/xosql_exec.js
Normal file
@@ -0,0 +1,36 @@
|
||||
(function (xo) {
|
||||
xo.sql_exec = new function() {
|
||||
this.send = function(proc, args) {
|
||||
try {xo.server.send_by_bridge('xowa.app.maint.sql_exec', proc, args);}
|
||||
catch (err) {alert(err);}
|
||||
}
|
||||
this.run_sql = function() {
|
||||
try {
|
||||
xo.sql_exec.results__set('running');
|
||||
var data =
|
||||
{ domain: xo.elem.get_val_or_null('domain_box')
|
||||
, db: xo.elem.get_val_or_null('db_box')
|
||||
, sql: xo.elem.get_val_or_null('sql_box')
|
||||
};
|
||||
xo.sql_exec.send('exec', data);
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
}
|
||||
|
||||
this.results__set = function(msg) {
|
||||
var elem = document.getElementById('results_div');
|
||||
elem.innerHTML = msg;
|
||||
}
|
||||
this.results__recv = function(msg_str) {
|
||||
try {
|
||||
var msg = JSON.parse(msg_str);
|
||||
this.results__set(msg.msg_text);
|
||||
return true;
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
@@ -0,0 +1,59 @@
|
||||
<div id='xo_msg_box' style='width:100%; color:red'>
|
||||
</div>
|
||||
<!--
|
||||
<table class="metadata plainlinks ambox ambox-delete" style="">
|
||||
<tr>
|
||||
<td class="mbox-empty-cell">
|
||||
</td>
|
||||
<td class="mbox-text" style="">
|
||||
<span class="mbox-text-span">
|
||||
WARNING: THIS PAGE IS ONLY FOR DEVELOPER USE.<br/>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<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'> </span><span class='xohelp_row_text'><b>Domain</b>: Domain of the wiki. Also supports <code>[xowa.app]</code> and <code>[file]</code></span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Db</b>: Database. Currently, only <code>core</code> or <code>user</code>. Can use path if <code>[file]</code></span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>SQL</b>: SQL to run</span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Results</b>: Results of SQL</div>
|
||||
For more info, see <a href='/site/home/wiki/App/Personal_wikis/New_wiki'>the new wiki help page</a>
|
||||
</div>
|
||||
<b>Buttons</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_save'> </span><span class='xohelp_row_text'>Creates the wiki</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'>
|
||||
Run SQL
|
||||
</div>
|
||||
<a class='xoimg_btn_x24 xoimg_media_play' title='save changes' href='javascript:void(0)' accesskey='r'
|
||||
onclick='xo.sql_exec.run_sql();'> </a>
|
||||
<!-- <a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a> -->
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Domain</label>
|
||||
<input id='domain_box' type='text' value='{{domain}}' class='cur_data_input' placeholder='Enter a domain (For example: wiki.me.org)'></input>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>DB</label>
|
||||
<input id='db_box' type='text' value='{{db}}' class='cur_data_input' placeholder='Enter a db (For example: core)'></input>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row" >
|
||||
<label>SQL</label>
|
||||
<textarea id='sql_box' class='cur_data_input' accesskey='d' placeholder='Enter SQL (For example: SELECT * FROM xowa_cfg).'>SELECT * FROM xowa_cfg;</textarea>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Results</label>
|
||||
<pre id='results_div' class='cur_data_input'>waiting
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
67
res/bin/any/xowa/addon/app/update/bin/xoa_update.css
Normal file
67
res/bin/any/xowa/addon/app/update/bin/xoa_update.css
Normal file
@@ -0,0 +1,67 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.cur_data_row {
|
||||
padding: 4px 0px 4px;
|
||||
}
|
||||
.cur_data_cell0 {
|
||||
display: inline-block;
|
||||
width: 220px;
|
||||
margin: 0px 4px 0px 10px;
|
||||
vertical-align: top;
|
||||
align-self: flex-start;
|
||||
-webkit-align-self: flex-start;
|
||||
|
||||
font-weight: bold;
|
||||
}
|
||||
.cur_data_cell1 {
|
||||
display: inline-block;
|
||||
width: calc(100% - 240px);
|
||||
}
|
||||
.release_is_major {
|
||||
color: red;
|
||||
}
|
||||
.update_status {
|
||||
margin: 10px 0px 10px;
|
||||
}
|
||||
.update_status_anch {
|
||||
font-weight: bold;
|
||||
font-size: 125%;
|
||||
}
|
||||
|
||||
/* buttons */
|
||||
.buttons a, .buttons button{
|
||||
display:block;
|
||||
float:left;
|
||||
margin:0 7px 0 0;
|
||||
background-color:#f5f5f5;
|
||||
border:1px solid #dedede;
|
||||
border-top:1px solid #eee;
|
||||
border-left:1px solid #eee; font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;
|
||||
font-size:100%;
|
||||
line-height:130%;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
color:#565656;
|
||||
cursor:pointer;
|
||||
padding:5px 10px 6px 7px; /* Links */
|
||||
}
|
||||
.buttons button{
|
||||
width:auto;
|
||||
overflow:visible;
|
||||
padding:4px 10px 3px 7px; /* IE6 */
|
||||
}
|
||||
.buttons button[type]{
|
||||
padding:5px 10px 5px 7px; /* Firefox */
|
||||
line-height:17px; /* Safari */
|
||||
}
|
||||
*:first-child+html button[type]{
|
||||
padding:4px 10px 3px 7px; /* IE7 */
|
||||
}
|
||||
.buttons button img, .buttons a img{
|
||||
margin:-10px 0px;
|
||||
}
|
||||
45
res/bin/any/xowa/addon/app/update/bin/xoa_update.js
Normal file
45
res/bin/any/xowa/addon/app/update/bin/xoa_update.js
Normal file
@@ -0,0 +1,45 @@
|
||||
(function (xo) {
|
||||
xo.app_updater = new function() {
|
||||
var progbar = new xo.gui.progbars.Progbar('pbar-row', 'pbar-txt', 'pbar-bar');
|
||||
this.update = function(version_name) {
|
||||
try {
|
||||
xo.notify.elem_anchor = '#main_body';
|
||||
progbar.show();
|
||||
xo.server.send_by_bridge('app.updater', 'install', {version: version_name});
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
};
|
||||
this.skip = function(version_name) {
|
||||
try {
|
||||
xo.server.send_by_bridge('app.updater', 'skip', {version: version_name});
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
};
|
||||
this.download__prog = function(msg) {
|
||||
try {
|
||||
var args = JSON.parse(msg);
|
||||
if (args.done) {
|
||||
progbar.write('done', 100);
|
||||
return true;
|
||||
}
|
||||
|
||||
progbar.write_by_notify(args.task_type + ' app update', args.prog_data_cur, args.prog_data_end, args.prog_rate);
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
};
|
||||
this.write_status = function(msg) {
|
||||
try {
|
||||
var args = JSON.parse(msg);
|
||||
progbar.write_by_notify(args.msg);
|
||||
} catch (e) {
|
||||
alert(e);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
@@ -0,0 +1,82 @@
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_app_system' > </span><span class='xohelp_row_text'>Go to the options page</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_help_doc' > </span><span class='xohelp_row_text'>Go to the docs page</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_app_install' > </span><span class='xohelp_row_text'>Install latest XOWA update</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_misc_skip' > </span><span class='xohelp_row_text'>Skip reminders for this update</span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='main_body' id='main_body'>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>XOWA Version: {{current_version}} ({{current_date}})</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_app_system' title='go to options' href='/wiki/Special:XowaCfg?grp=xowa.app.update'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_doc' title='go to docs' href='/wiki/App/Setup/Update/In-app'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
{{#web_access_enabled}}
|
||||
{{#itms_exist}}
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<span class='cur_data_cell0'> </span>
|
||||
<div class='cur_data_cell1 update_status'>
|
||||
<div class='buttons'>
|
||||
<a class='update_status_anch' title='download latest update' href='javascript:void(0)'
|
||||
data_alertify_msg='Please confirm that you want to update to the latest XOWA version:<br/>{{version}} ({{date}}): {{summary}}'
|
||||
data_alertify_ok='Download and update'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_func='xo.app_updater.update("{{version}}");'
|
||||
accesskey='d'
|
||||
onclick='return xo.alertify.confirm_func(this);'><img class='xoimg_btn_x16 xoimg_app_install' /> Install latest
|
||||
</a>
|
||||
</div>
|
||||
<div class='buttons'>
|
||||
<a class='update_status_anch' title='skip current update' href='javascript:void(0)'
|
||||
data_alertify_msg='Please confirm that you want to ignore this update.<br/><br/>You can always return to this page by going to Help -> Update XOWA or navigating to <code>Special:XowaAppUpdate</code>'
|
||||
data_alertify_ok='Skip update'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_func='xo.app_updater.skip("{{version}}");'
|
||||
accesskey='d'
|
||||
onclick='return xo.alertify.confirm_func(this);'><img class='xoimg_btn_x16 xoimg_misc_skip' /> Skip this update
|
||||
</a>
|
||||
</div>
|
||||
<div class='pbar_row' id='pbar-row' style='float:right'>
|
||||
<div class='pbar_proc' id='pbar-txt'>downloading app update</div>
|
||||
<div class='pbar_div'>
|
||||
<div class="pbar_bar" id='pbar-bar'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#itms}}
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<span class='cur_data_cell0'>{{date}}: {{version}}</span>
|
||||
<div class='cur_data_cell1'><span {{#priority_is_major}} class='release_is_major'{{/priority_is_major}}>({{priority}}) {{summary}}</span><br/>
|
||||
{{{details}}}
|
||||
</div>
|
||||
</div>
|
||||
{{/itms}}
|
||||
{{/itms_exist}}
|
||||
{{^itms_exist}}
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<span class='cur_data_cell0'> </span>
|
||||
<span class='cur_data_cell1 update_status'>No updates available as of {{check_date}}</span>
|
||||
</div>
|
||||
{{/itms_exist}}
|
||||
{{/web_access_enabled}}
|
||||
{{^web_access_enabled}}
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<span class='cur_data_cell0'> </span>
|
||||
<div class='cur_data_cell1'>
|
||||
<span style='color:red'>Web access disabled.</span><br/>
|
||||
In order to use this page, please do the following:
|
||||
<ul>
|
||||
<li>Enable web access at <a href='/site/home/wiki/Options/Security'>Options/Security</a></li>
|
||||
<li>Reload this page</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{{/web_access_enabled}}
|
||||
</div>
|
||||
BIN
res/bin/any/xowa/addon/app/update/xoa_update.jar
Normal file
BIN
res/bin/any/xowa/addon/app/update/xoa_update.jar
Normal file
Binary file not shown.
73
res/bin/any/xowa/addon/bldr/central/bin/xobc.css
Normal file
73
res/bin/any/xowa/addon/bldr/central/bin/xobc.css
Normal 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;
|
||||
}
|
||||
128
res/bin/any/xowa/addon/bldr/central/bin/xobc.main.mustache.html
Normal file
128
res/bin/any/xowa/addon/bldr/central/bin/xobc.main.mustache.html
Normal 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'> </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'> </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'> </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'> </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'> </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'> </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'> </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'> </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'> </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'> </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'> </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'> </span>
|
||||
<span class='xohelp_row_text'>Start the queue</span>
|
||||
</div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_media_pause'> </span>
|
||||
<span class='xohelp_row_text'>Pause the queue</span>
|
||||
</div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_refresh'> </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'> </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"> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </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);'> </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>
|
||||
</div>
|
||||
<div>
|
||||
<button class='admin_btn' accesskey='d' id='admin__del_work__btn'>del work</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class='admin_btn' accesskey='r' id='admin__run_next__btn'>run next</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class='admin_btn' accesskey='p' id='admin__stop_cur__btn'>stop all</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -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}}");'> </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}}");'> </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}}");'> </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}}");'> </a>
|
||||
{{/row_is_done}}
|
||||
{{#row_is_head}}
|
||||
<div class="head_name">
|
||||
<span id='{{row_type}}:{{task_id}}:name'>{{{task_name}}}</span>
|
||||
<!-- ·<span id='{{row_type}}:{{task_id}}:size'>{{prog_data_end_str}}</span>-->
|
||||
<!--·<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}}");'> </a>
|
||||
{{/row_is_todo}}
|
||||
<a class='xoimg_btn_x24 xoimg_help_info' href='/site/home/wiki/Special:XowaDownloadCentralInfo?task_id={{task_id}}'> </a>
|
||||
{{/row_is_head}}
|
||||
</div>
|
||||
{{/row_is_work}}
|
||||
BIN
res/bin/any/xowa/addon/bldr/central/bldr_central.data_db.xowa
Normal file
BIN
res/bin/any/xowa/addon/bldr/central/bldr_central.data_db.xowa
Normal file
Binary file not shown.
@@ -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>
|
||||
33
res/bin/any/xowa/addon/bldr/central/js/test/xo.elem.test.js
Normal file
33
res/bin/any/xowa/addon/bldr/central/js/test/xo.elem.test.js
Normal 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);
|
||||
});
|
||||
39
res/bin/any/xowa/addon/bldr/central/js/xo.elem.js
Normal file
39
res/bin/any/xowa/addon/bldr/central/js/xo.elem.js
Normal 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 || {}));
|
||||
28
res/bin/any/xowa/addon/bldr/central/js/xo.notify.js
Normal file
28
res/bin/any/xowa/addon/bldr/central/js/xo.notify.js
Normal 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));
|
||||
33
res/bin/any/xowa/addon/bldr/central/js/xo.tmpl.js
Normal file
33
res/bin/any/xowa/addon/bldr/central/js/xo.tmpl.js
Normal 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 || {}));
|
||||
536
res/bin/any/xowa/addon/bldr/central/js/xobc.js
Normal file
536
res/bin/any/xowa/addon/bldr/central/js/xobc.js
Normal 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) + '% · ' + time_til_str + ' · ' + 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
|
||||
279
res/bin/any/xowa/addon/bldr/central/js/xobc.localfile.js
Normal file
279
res/bin/any/xowa/addon/bldr/central/js/xobc.localfile.js
Normal 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 || {}))
|
||||
114
res/bin/any/xowa/addon/bldr/central/js/xobc.util.js
Normal file
114
res/bin/any/xowa/addon/bldr/central/js/xobc.util.js
Normal 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 || {}));
|
||||
58
res/bin/any/xowa/addon/bldr/central/test/xobc.test.html
Normal file
58
res/bin/any/xowa/addon/bldr/central/test/xobc.test.html
Normal 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>
|
||||
44
res/bin/any/xowa/addon/bldr/info/bin/xobc_info.css
Normal file
44
res/bin/any/xowa/addon/bldr/info/bin/xobc_info.css
Normal 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;
|
||||
}
|
||||
54
res/bin/any/xowa/addon/bldr/info/bin/xobc_info.mustache.html
Normal file
54
res/bin/any/xowa/addon/bldr/info/bin/xobc_info.mustache.html
Normal 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'> </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'> </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'> </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'> </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'> </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")'> </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>
|
||||
63
res/bin/any/xowa/addon/bldr/info/test/xobc_info.test.html
Normal file
63
res/bin/any/xowa/addon/bldr/info/test/xobc_info.test.html
Normal 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>
|
||||
@@ -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>
|
||||
18
res/bin/any/xowa/addon/bldr/xodir/bin/xobc_xodir.css
Normal file
18
res/bin/any/xowa/addon/bldr/xodir/bin/xobc_xodir.css
Normal 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%;
|
||||
}
|
||||
@@ -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'> </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'> </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'> </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'> </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")'> </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")'> </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}}"
|
||||
> </a>
|
||||
{{/is_custom}}
|
||||
</div>
|
||||
{{/dirs}}
|
||||
</div>
|
||||
65
res/bin/any/xowa/addon/bldr/xodir/test/xobc_xodir.test.html
Normal file
65
res/bin/any/xowa/addon/bldr/xodir/test/xobc_xodir.test.html
Normal 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>
|
||||
@@ -0,0 +1,60 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 108px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 108px;
|
||||
}
|
||||
|
||||
/* 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_input {
|
||||
display: inline-block;
|
||||
width: calc(100% - 140px);
|
||||
}
|
||||
.cur_data_icon {
|
||||
margin-left: 7px;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
input[readonly]
|
||||
{
|
||||
background-color:#eff0f1;
|
||||
border:1px solid #ddd;
|
||||
}
|
||||
|
||||
.cur_actions_row {
|
||||
display: inline-block;
|
||||
margin: 0px 4px 0px 10px;
|
||||
vertical-align: top;
|
||||
align-self: flex-start;
|
||||
-webkit-align-self: flex-start;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
(function (xo) {
|
||||
xo.wiki_directory = new function() {
|
||||
this.item_send = function(proc, args) {
|
||||
try {xo.server.send_by_bridge('wiki.directory.item', proc, args);}
|
||||
catch (err) {alert(err);}
|
||||
}
|
||||
this.get_elem_val = function(id) {
|
||||
var elem = document.getElementById(id);
|
||||
return elem == null ? null : elem.value;
|
||||
}
|
||||
this.item__save = function() {
|
||||
xo.wiki_directory.notify__clear();
|
||||
var data =
|
||||
{
|
||||
id: this.get_elem_val('id_lbl')
|
||||
, domain: this.get_elem_val('domain_box')
|
||||
, name: this.get_elem_val('name_box')
|
||||
, dir: this.get_elem_val('dir_box')
|
||||
, mainpage: this.get_elem_val('mainpage_box')
|
||||
};
|
||||
xo.wiki_directory.item_send('save', data);
|
||||
}
|
||||
this.item__delete = function() {
|
||||
var data =
|
||||
{
|
||||
id: this.get_elem_val('id_lbl')
|
||||
, domain: this.get_elem_val('domain_box')
|
||||
};
|
||||
xo.wiki_directory.item_send('delete', data);
|
||||
}
|
||||
this.item__reindex_search = function() {
|
||||
xo.notify.elem_anchor = '#cur_help_div'; // moved here b/c of report of crash when New personal wiki is opened
|
||||
xo.wiki_directory.item_send('reindex_search', {domain:this.get_elem_val('domain_box')});
|
||||
}
|
||||
|
||||
this.io_cmd__select = function() {
|
||||
// call xowa to launch file_dialog
|
||||
var file_path = xowa_exec('scripts_exec', 'app.gui.kit.ask_dir("Please select a folder");');
|
||||
if (file_path == null || file_path == '') return; // nothing selected; exit
|
||||
|
||||
// update val
|
||||
var elem = document.getElementById('dir_box');
|
||||
elem.value = file_path;
|
||||
}
|
||||
|
||||
this.notify__clear = function() {
|
||||
var elem = document.getElementById('xo_msg_box');
|
||||
elem.innerHTML = "";
|
||||
}
|
||||
this.notify__recv = function(msg_str) {
|
||||
try {
|
||||
var msg = JSON.parse(msg_str);
|
||||
var elem_id = msg.elem_id;
|
||||
if (!elem_id) elem_id = 'xo_msg_box';
|
||||
var msg_text = msg.msg_text;
|
||||
|
||||
var elem = document.getElementById(elem_id);
|
||||
elem.innerHTML = elem.textContent + msg_text;
|
||||
return true;
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
@@ -0,0 +1,82 @@
|
||||
<div id='xo_msg_box' style='width:100%; color:red'>
|
||||
</div>
|
||||
<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'> </span><span class='xohelp_row_text'><b>Domain</b>: Domain of your wiki. Used for the URL bar. For example: <code>wiki.me.org</code>. Cannot be changed after wiki is created</span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Name</b>: Friendly name for the wiki. Shown in list of wikis. For example: <code>My wiki</code></span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Folder</b>: Folder for the wiki. A file with the domain name will be created in the folder: For example: <code>C:\personal\wiki.me.org</code>. Note that this will create a file called <code>C:\personal\wiki.me.org\wiki.me.org.xowa</code></span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Main Page</b>: The default start page for the wiki. For example, entering in <code>wiki.me.org</code> will navigate directly to <code>Main_Page</code>. Cannot be changed after wiki is created</span></div>
|
||||
For more info, see <a href='/site/home/wiki/App/Personal_wikis/New_wiki'>the new wiki help page</a>
|
||||
</div>
|
||||
<b>Buttons</b>
|
||||
<div>
|
||||
{{#mode_is_new}}
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_save'> </span><span class='xohelp_row_text'>Creates the wiki</span></div>
|
||||
{{/mode_is_new}}
|
||||
{{^mode_is_new}}
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_save'> </span><span class='xohelp_row_text'>Saves the current settings</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_delete'> </span><span class='xohelp_row_text'>Deletes the wiki from the list. Note that the file itself will not be deleted.</span></div>
|
||||
{{/mode_is_new}}
|
||||
</div>
|
||||
{{^mode_is_new}}
|
||||
<b>Commands</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'>Reindex pages for search bar. See <a href='/site/home/wiki/App/Personal_wikis/Search'>the search help page</a></span></div>
|
||||
</div>
|
||||
{{/mode_is_new}}
|
||||
</div>
|
||||
</div>
|
||||
<div class='main_body' id='main_body'>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>
|
||||
{{#mode_is_new}}Create a wiki{{/mode_is_new}}
|
||||
{{^mode_is_new}}Edit the wiki{{/mode_is_new}}
|
||||
</div>
|
||||
<a class='xoimg_btn_x24 xoimg_list_save' title='save changes' href='javascript:void(0)' accesskey='s'
|
||||
onclick='xo.wiki_directory.item__save();'> </a>
|
||||
{{^mode_is_new}}
|
||||
<a class='xoimg_btn_x24 xoimg_list_delete' title='remove wiki' href='javascript:void(0)'
|
||||
data_alertify_msg='Please confirm that you wish to remove the wiki from your list<br/>Note that the file itself will not be deleted'
|
||||
data_alertify_ok='Remove'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_func='xo.wiki_directory.item__delete();'
|
||||
onclick='return xo.alertify.confirm_func(this);'> </a>
|
||||
{{/mode_is_new}}
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Domain</label>
|
||||
<input id='domain_box' type='text' accesskey='d' value='{{domain}}' class='cur_data_input'{{#mode_is_new}} placeholder='Enter a domain (For example: wiki.me.org)'{{/mode_is_new}}{{^mode_is_new}} readonly{{/mode_is_new}}></input>
|
||||
<input id='id_lbl' type='hidden' value='{{id}}'></span>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Name</label>
|
||||
<input id='name_box' type='text' value='{{name}}' class='cur_data_input'{{#mode_is_new}} placeholder='Enter a name (For example: My wiki)'{{/mode_is_new}}></input>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Folder</label>
|
||||
<input id='dir_box' type='text' value='{{dir}}' class='cur_data_input'{{#mode_is_new}} placeholder='Enter a folder (For example: C:\personal\wiki.me.org). You can also click on the wrench at the far-right'{{/mode_is_new}}></input>
|
||||
<span class="xoimg_btn_x16 xoimg_app_configure cur_data_icon" onclick='xo.wiki_directory.io_cmd__select();'> </span>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Main Page</label>
|
||||
<input id='mainpage_box' type='text' value='{{mainpage}}' class='cur_data_input'{{#mode_is_new}} placeholder='Enter the name for the Main Page. (For example: Main_Page)'{{/mode_is_new}}{{^mode_is_new}} readonly{{/mode_is_new}}></input>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
{{^mode_is_new}}
|
||||
<div class='main_body' id='other_body'>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>
|
||||
Other actions
|
||||
</div>
|
||||
</div>
|
||||
<div class="xotbl_data_row">
|
||||
<div class='cur_actions_row'>
|
||||
<a class='' title='reindex' href='javascript:void(0)' accesskey='f' onclick='return xo.wiki_directory.item__reindex_search();'>Reindex pages for search bar</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/mode_is_new}}
|
||||
@@ -0,0 +1,476 @@
|
||||
Welcome to your personal wiki!
|
||||
|
||||
Personal wikis are new and will be in continual development! If you encounter issues, please report them through the [[xowa.home:Help/Feedback|Feedback page]].
|
||||
|
||||
== Quick start ==
|
||||
=== Editing this page ===
|
||||
* Switch to edit mode by pressing <code>Edit</code> near the top-right of the page
|
||||
* Edit the text by typing directly in the text box. For this example, enter <code>Hello, world!</code> at the top of the text box.
|
||||
* Save the page by pressing the <code>Save page</code> button at the bottom of the text box
|
||||
|
||||
Congratulations! You should see <code>Hello, world!</code> at the top of the page
|
||||
|
||||
=== Creating a new page ===
|
||||
* Navigate to a page by entering a page title in the url bar. For this example, enter <code>Test</code>.
|
||||
* A blank page will open in edit mode. Enter in some text in the text box. For this example, enter <code>Some text for the page</code>
|
||||
* Save the page.
|
||||
|
||||
Congratulations! You have just created a new page called <code>Test</code>
|
||||
|
||||
=== Linking to a page ===
|
||||
* Switch to edit mode.
|
||||
* Enter a link by entering text into the text box. For this example, use <code><nowiki>[[Test]]</nowiki></code>.
|
||||
* Save the page. The word <code><nowiki>Test</nowiki></code> will show and be highlighted in blue.
|
||||
* Click on the <code>Test</code> link. The <code>Test</code> page will open.
|
||||
|
||||
Congratulations! You have just linked to a page called <code>Test</code>
|
||||
|
||||
== Basic editing ==
|
||||
The best place to start is Wikipedia's guide for editing: https://en.wikipedia.org/wiki/Help:Getting_started
|
||||
|
||||
The table below is provided for reference. Note the following columns:
|
||||
* '''function''': the name of the function
|
||||
* '''example''': an example of the function as shown in HTML
|
||||
* '''wikitext''': the actual wikitext used to render the function
|
||||
* '''html''': an alternative way of rendering the same wikitext, but only with html.
|
||||
|
||||
=== HTML tags ===
|
||||
Most HTML tags are available.
|
||||
* '''HTML tags can be used as an alternative to wikitext.''': For example, <i>italicized text</i> can also be shown with <code><nowiki><i>italicized text</i></nowiki>
|
||||
* '''HTML tags are needed for other functions.''': For example, the following have no wikitext equivalent <code><nowiki><u>underline</u></nowiki></code>, <code><nowiki><s>strikethru</s></nowiki></code>, etc..
|
||||
|
||||
However, there are some notable exceptions:
|
||||
* '''anchor tags are not allowed''': Any <code><a></code> will be rendered literally. Instead, use an internal / external link. For example, <code><nowiki>[[Test]]</nowiki></code>
|
||||
* '''image tags are not allowed''': Any <code><img></code> will be rendered literally. Instead, use an internal link in the file namespace. For example, <code><nowiki>[[File:Image.png]]</nowiki></code>
|
||||
* '''javascript / events are not allowed''': All javascript and "onevent" blocks are removed.
|
||||
|
||||
{|class=wikitable style="background:white"
|
||||
|-
|
||||
! function
|
||||
! example
|
||||
! wikitext
|
||||
! html
|
||||
|-
|
||||
| italics
|
||||
| ''italicized text''
|
||||
| <code><nowiki>''italicized text''</nowiki></code>
|
||||
| <code><nowiki><i>italicized text</<i></nowiki></code>
|
||||
|-
|
||||
| bold
|
||||
| '''bold text'''
|
||||
| <code><nowiki>'''bold text'''</nowiki></code>
|
||||
| <code><nowiki><b>bold text</<b></nowiki></code>
|
||||
|-
|
||||
| bold and italics
|
||||
| '''''bold and italicized text'''''
|
||||
| <code><nowiki>'''''bold and italicized text'''''</nowiki></code>
|
||||
| <code><nowiki><b><i>bold and italicized text</i></b></nowiki></code>
|
||||
|-
|
||||
| underline
|
||||
| <u>underlined text</u>
|
||||
| <code><nowiki>N/A</nowiki></code>
|
||||
| <code><nowiki><u>underlined text</u></nowiki></code>
|
||||
|-
|
||||
| strike-thru
|
||||
| <s>strike-thru text</s>
|
||||
| <code><nowiki>N/A</nowiki></code>
|
||||
| <code><nowiki><s>strike-thru text</s></nowiki></code>
|
||||
|-
|
||||
| color
|
||||
| <span style='color:green'>colored text</span>
|
||||
| <code><nowiki>N/A</nowiki></code>
|
||||
| <code><nowiki><span style='color:green'>colored text</span></nowiki></code>
|
||||
|-
|
||||
| external url: url only
|
||||
| http://xowa.org
|
||||
| <code><nowiki>http://xowa.org</nowiki></code>
|
||||
| <code>N/A</code>
|
||||
|-
|
||||
| external url: url with name
|
||||
| [http://xowa.org xowa web site]
|
||||
| <code><nowiki>[http://xowa.org xowa web site]</nowiki></code>
|
||||
| <code>N/A</code>
|
||||
|-
|
||||
| external url: numbered
|
||||
| [http://xowa.org]
|
||||
| <code><nowiki>[http://xowa.org]</nowiki></code>
|
||||
| <code>N/A</code>
|
||||
|-
|
||||
| internal url: page only
|
||||
| [[Test]]
|
||||
| <code><nowiki>[[Test]]</nowiki></code>
|
||||
| <code>N/A</code>
|
||||
|-
|
||||
| internal url: page with name
|
||||
| [[Test|My test page]]
|
||||
| <code><nowiki>[[Test|My test page]]</nowiki></code>
|
||||
| <code>N/A</code>
|
||||
|-
|
||||
| paragraph<br/>
|
||||
|
|
||||
para 1
|
||||
|
||||
para 2
|
||||
|
|
||||
<pre>
|
||||
para 1
|
||||
|
||||
para 2
|
||||
</pre>
|
||||
<ref group='basics'>enter a completely blank line between paragraphs</ref>
|
||||
|
|
||||
<pre>
|
||||
<p>para 1</p>
|
||||
<p>para 2</p>
|
||||
</pre>
|
||||
|-
|
||||
| preformatted blocks
|
||||
|
|
||||
line 1
|
||||
line 2
|
||||
|
|
||||
<pre>
|
||||
line 1
|
||||
line 2
|
||||
</pre>
|
||||
<ref group='basics'>start a line with a space</ref>
|
||||
|
|
||||
<pre>
|
||||
<pre>
|
||||
line 1
|
||||
para 2
|
||||
</pre>
|
||||
</pre>
|
||||
|-
|
||||
| list: bulleted
|
||||
|
|
||||
* a
|
||||
** aa
|
||||
*** aaa
|
||||
* b
|
||||
* c
|
||||
** cc
|
||||
|
|
||||
<pre>
|
||||
* a
|
||||
** aa
|
||||
*** aaa
|
||||
* b
|
||||
* c
|
||||
** cc
|
||||
</pre>
|
||||
|
|
||||
<pre>
|
||||
<ul>
|
||||
<li>a
|
||||
<ul>
|
||||
<li>aa
|
||||
<ul>
|
||||
<li>aaa</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>b</li>
|
||||
<li>c
|
||||
<ul>
|
||||
<li>cc
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</pre>
|
||||
</pre>
|
||||
|-
|
||||
| list: numbered
|
||||
|
|
||||
# a
|
||||
## aa
|
||||
### aaa
|
||||
# b
|
||||
# c
|
||||
## cc
|
||||
|
|
||||
<pre>
|
||||
# a
|
||||
## aa
|
||||
### aaa
|
||||
# b
|
||||
# c
|
||||
## cc
|
||||
</pre>
|
||||
|
|
||||
<pre>
|
||||
<ol>
|
||||
<li>a
|
||||
<ol>
|
||||
<li>aa
|
||||
<ol>
|
||||
<li>aaa</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
<li>b</li>
|
||||
<li>c
|
||||
<ol>
|
||||
<li>cc
|
||||
</li>
|
||||
</ol>
|
||||
</li>
|
||||
</ol>
|
||||
</pre>
|
||||
|-
|
||||
| header
|
||||
|
|
||||
=== Basic editing: Test Level a3 ===
|
||||
==== Basic editing: Test Level a4 ====
|
||||
===== Basic editing: Test Level a5 =====
|
||||
=== Basic editing: Test Level b3 ===
|
||||
=== Basic editing: Test Level c3 ===
|
||||
==== Basic editing: Test Level c4 ====
|
||||
|
|
||||
<pre>
|
||||
=== Basic editing: Test Level a3 ===
|
||||
==== Basic editing: Test Level a4 ====
|
||||
===== Basic editing: Test Level a5 =====
|
||||
=== Basic editing: Test Level b3 ===
|
||||
=== Basic editing: Test Level c3 ===
|
||||
==== Basic editing: Test Level c4 ====
|
||||
</pre>
|
||||
|
|
||||
<pre>
|
||||
<h3> Basic editing: Test Level a3 </h3>
|
||||
<h4> Basic editing: Test Level a4 </h4>
|
||||
<h5> Basic editing: Test Level a5 </h5>
|
||||
<h3> Basic editing: Test Level b3 </h3>
|
||||
<h3> Basic editing: Test Level c3 </h3>
|
||||
<h4> Basic editing: Test Level c4 </h4>
|
||||
</pre>
|
||||
|-
|
||||
| table
|
||||
|
|
||||
{|class=wikitable
|
||||
|+ caption
|
||||
|-
|
||||
! header a
|
||||
! header b
|
||||
|-
|
||||
| cell 1a
|
||||
| cell 1b
|
||||
|-
|
||||
| cell 2a
|
||||
| cell 2b
|
||||
|}
|
||||
|
|
||||
<pre>
|
||||
{|class=wikitable
|
||||
|+ caption
|
||||
|-
|
||||
! header a
|
||||
! header b
|
||||
|-
|
||||
| cell 1a
|
||||
| cell 1b
|
||||
|-
|
||||
| cell 2a
|
||||
| cell 2b
|
||||
|}
|
||||
</pre>
|
||||
|
|
||||
<pre>
|
||||
<table class="wikitable">
|
||||
<caption>caption</caption>
|
||||
<tr>
|
||||
<th>header a</th>
|
||||
<th>header b</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cell 1a</td>
|
||||
<td>cell 1b</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>cell 2a</td>
|
||||
<td>cell 2b</td>
|
||||
</tr>
|
||||
</table>
|
||||
</pre>
|
||||
|}
|
||||
|
||||
=== Notes for Basics editing ===
|
||||
<references group='basics'>
|
||||
</references>
|
||||
|
||||
== Advanced editing ==
|
||||
=== Category ===
|
||||
Categories are supported. As a basic example, try the following:
|
||||
* Edit this page
|
||||
* Add the following text: <code><nowiki>[[Category:Test]]</nowiki></code>
|
||||
* Scroll down to the bottom of the page. You will see a <code><nowiki>Categories</nowiki></code> section and <code><nowiki>Test</nowiki></code> listed
|
||||
* Navigate to <code><nowiki>Category:Test</nowiki></code>. You will see the Main page listed
|
||||
|
||||
For more info, see https://en.wikipedia.org/wiki/Help:Category
|
||||
|
||||
=== Images ===
|
||||
Images are supported, but the process is slightly complicated due to the set-up of third-party software.
|
||||
|
||||
Here is a broad overview:
|
||||
* Set up imagemagick and inkscape on your machine. For more instructions, see http://xowa.org/home/wiki/App/Wiki_types/Wikia.com#Part_3c:_Setup_Imagemagick_and_Inkscape
|
||||
* Place your images in your wiki directory. Assuming your wiki is set up in <code>C:\your_wiki</code>, then you need to copy an image to <code>C:\your_wiki\file\orig</code>. As an example, do the following:
|
||||
** Download the image from <code><nowiki>https://upload.wikimedia.org/wikipedia/commons/9/97/The_Earth_seen_from_Apollo_17.jpg</nowiki></code>
|
||||
** Move the image to <code>C:\your_wiki\file\orig\The_Earth_seen_from_Apollo_17.jpg</nowiki></code>
|
||||
** Edit the page, and add the following text: <code><nowiki>[[File:The_Earth_seen_from_Apollo_17.jpg]]</nowiki></code>
|
||||
* Preview the page. You should see the image.
|
||||
|
||||
For more info, see https://en.wikipedia.org/wiki/Wikipedia:Picture_tutorial
|
||||
|
||||
=== Table of contents ===
|
||||
Table of contents (TOC) are automatically generated by XOWA if you have 4 headers (a header being something like <code><nowiki>== header ==</nowiki></code>)
|
||||
|
||||
If you have less than 4 headers, you can force a TOC by adding <code><nowiki>__TOC__</nowiki></code>
|
||||
|
||||
=== Math ===
|
||||
LaT<sub>E</sub>X formatting is available. For example, the following is the formula for the Pythagorean theorem: <math>a^2 + b^2 = c^2</math>
|
||||
|
||||
=== References ===
|
||||
Wikipedia-style references are supported. For example, this is a simple reference: <ref>Test footnote</ref>.
|
||||
|
||||
Note that you can hover over the reference number to get a tooltip preview
|
||||
|
||||
=== Sortable tables ===
|
||||
Wikipedia-style sortable tables are supported.
|
||||
|
||||
{|class='wikitable sortable'
|
||||
|-
|
||||
! String
|
||||
! Int
|
||||
! Date - months
|
||||
|-
|
||||
| c
|
||||
| 3
|
||||
| Mar 1 2012
|
||||
|-
|
||||
| b
|
||||
| 22
|
||||
| Feb 2 2011
|
||||
|-
|
||||
| a
|
||||
| 111
|
||||
| Jan 3 2010
|
||||
|}
|
||||
|
||||
=== Collapsible tables ===
|
||||
Wikipedia-style collapsible tables are supported.
|
||||
{| class="wikitable collapsible"
|
||||
! Data
|
||||
|-
|
||||
| A
|
||||
|-
|
||||
| B
|
||||
|-
|
||||
| C
|
||||
|}
|
||||
|
||||
=== More ===
|
||||
Other features are supported, including Tabviews, Timelines, Graphs, Hieroglyphics and Musical scores. For examples, see [[xowa.home:Diagnostics]]
|
||||
|
||||
== Expert editing ==
|
||||
=== Magic words ===
|
||||
Most magic words are supported, such as <code><nowiki>{{CURRENTTIME}}</nowiki></code> and <code><nowiki>{{lc:string}}</nowiki></code>. For more info, see https://en.wikipedia.org/wiki/Help:Magic_words
|
||||
|
||||
=== Parser functions ===
|
||||
Most parser functions are supported, such as <code><nowiki>{{#expr:2 + 2}}</nowiki></code>. For more info, see https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions
|
||||
|
||||
=== Templates ===
|
||||
Templates are supported, such as <code><nowiki>{{my_template|arg_1|arg_2|etc...}}</nowiki></code>. For more info, see https://en.wikipedia.org/wiki/Help:A_quick_guide_to_templates
|
||||
|
||||
Here's a brief example:
|
||||
* Create a page called <code>Template:Test</code> with the text <code><nowiki>Hello, from Template:Test -- {{{1|empty}}}</nowiki></code>
|
||||
* Edit any other page (like the <code>Main_Page</code>) and enter <code><nowiki>{{Test|argument 1}}</nowiki></code> in the text box.
|
||||
* Preview or Save the page. You will see <code>Hello, from Template:Test -- argument 1</code>
|
||||
|
||||
=== Modules ===
|
||||
Modules are supported, such as <code><nowiki>{{#invoke:my_module|my_function|arg_1|arg_2|etc...}}</nowiki></code>. For more info, see https://en.wikipedia.org/wiki/Wikipedia:Lua
|
||||
|
||||
Here's a brief example:
|
||||
* Create a page called <code>Module:Test</code> with the following text
|
||||
<pre>
|
||||
local p = {}
|
||||
|
||||
function p.test( frame )
|
||||
return "Hello from Module:Test -- " .. frame.args[1];
|
||||
end
|
||||
|
||||
return p
|
||||
</pre>
|
||||
* Edit any other page (like the <code>Main_Page</code>) and enter <code><nowiki>{{#invoke:Test|test|argument 1}}</nowiki></code> in the text box.
|
||||
* Preview or Save the page. You will see <code>Hello from Module:Test -- argument 1</code>
|
||||
|
||||
== Developer editing ==
|
||||
<table class="metadata plainlinks ambox ambox-delete" style="">
|
||||
<tr>
|
||||
<td class="mbox-empty-cell">
|
||||
</td>
|
||||
<td class="mbox-text" style="">
|
||||
<span class="mbox-text-span">
|
||||
NOTE: The techniques in this section may change in future versions.
|
||||
|
||||
If you use any of the editing techniques here, please check back occasionally to see if anything has changed.
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
=== CSS ===
|
||||
XOWA stores the CSS for each wiki in <code>/xowa/user/anonymous/wiki/your_wiki_name/html</code>. For example, if you're on Windows and your wiki is named <code>test</code>, then the CSS would be at <code>C:\xowa\user\anonymous\wiki\test\html\xowa_common.css</code>
|
||||
|
||||
Note that the upper-lefthand icon is also stored there as <code>logo.png</code>
|
||||
|
||||
You can change these files and XOWA will not overwrite them. However, as with any file, please make sure you always keep backups.
|
||||
|
||||
=== Page template ===
|
||||
XOWA stores the page template in <code>/xowa/bin/any/xowa/cfg/app/xowa.gfs</code>. The actual template is marked in a section called <code>page_read</code>.
|
||||
|
||||
Please note the following about changing the page:
|
||||
* The file is replaced on every application update. If you make updates to the file, they will be lost.
|
||||
** If you find that you need to edit this file, please contact me, and I will add a feature to make it configurable in a future release. Really, these instructions are only provided for users who want to experiment.
|
||||
* The file uses a custom language specific to XOWA called gfs. Always backup the file when making changes. If you make an invalid change, XOWA will not start
|
||||
* The file is only loaded at application start. Any changes will require a restart of the app
|
||||
|
||||
=== Scripting ===
|
||||
XOWA allows custom hooks through Javascript or Lua. For detailed instructions see [[xowa.home:App/Xtn/Scripting]]
|
||||
|
||||
== Keyboard shortcuts ==
|
||||
For a full list, see [[xowa.home:Special:XowaCfg?grp=xowa.gui.shortcuts]]
|
||||
{|class='wikitable'
|
||||
|-
|
||||
| <b>Alt + Shift + E</b> || Edit the page. Switches to edit mode
|
||||
|-
|
||||
| <b>Ctrl + S</b> || Quick save the page. Stays in edit mode
|
||||
|-
|
||||
| <b>Alt + Shift + P</b> || Preview the page. Stays in edit mode
|
||||
|-
|
||||
| <b>Alt + Shift + S</b> || Save the page. Switches to read mode
|
||||
|-
|
||||
| <b>Ctrl + F</b> || Find text in the page
|
||||
|-
|
||||
|
|
||||
<b>Ctrl + L</b> or <br/>
|
||||
<b>Alt + D</b> || Focus the URL bar
|
||||
|-
|
||||
| <b>Ctrl + T</b> || New tab
|
||||
|-
|
||||
| <b>Ctrl + Tab</b> || Switch to next tab
|
||||
|-
|
||||
| <b>Ctrl + Shift + Tab</b> || Switch to previous tab
|
||||
|-
|
||||
| <b>Ctrl + W</b> || Close tab
|
||||
|}
|
||||
|
||||
== Useful links ==
|
||||
* Wikipedia's guide for editing: https://en.wikipedia.org/wiki/Help:Getting_started
|
||||
* XOWA page on personal wikis: [[xowa.home:App/Personal wikis]]
|
||||
* XOWA help page: [[xowa.home:Help/Contents|Contents page]]
|
||||
|
||||
== Notes ==
|
||||
<references/>
|
||||
@@ -0,0 +1,12 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 40px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 40px;
|
||||
}
|
||||
|
||||
.domain_name {
|
||||
display: inline-block;
|
||||
width: calc(100% - 64px);
|
||||
padding: 0px 0px 0px 10px;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
(function (xo) {
|
||||
xo.wiki_directory = new function() {
|
||||
this.send = function(proc, args) {
|
||||
try {
|
||||
xo.server.send_by_bridge('wiki.directory.list', proc, args);
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
}
|
||||
|
||||
this.import_wiki = function() {
|
||||
try {
|
||||
// call xowa to launch file_dialog
|
||||
var url = xowa_exec('scripts_exec', 'app.gui.kit.ask_file("Please select an .xowa file", "*.xowa");');
|
||||
if (url == null || url == '') return; // nothing selected; exit
|
||||
|
||||
xo.notify.elem_anchor = '#main_body';
|
||||
xo.wiki_directory.send('import_wiki', {'url':url});
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
@@ -0,0 +1,34 @@
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<b>Buttons</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_add'> </span><span class='xohelp_row_text'>Create a new wiki</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_doc_import'> </span><span class='xohelp_row_text'>Import an existing wiki</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_doc_open'> </span><span class='xohelp_row_text'>Open the wiki</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_app_configure'> </span><span class='xohelp_row_text'>Configure wiki settings</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='main_body' id='main_body'>
|
||||
<div class='list_tbl'>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>List</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_list_add' title='add a new wiki' href='/site/home/wiki/Special:XowaWikiItem'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_doc_import' title='import an existing wiki' href='' onclick='return xo.wiki_directory.import_wiki()' accesskey='i'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
{{#itms}}
|
||||
<div class="xotbl_data_row flex_div">
|
||||
<a class='domain_name ' title='open' href='/site/{{domain}}/wiki/{{mainpage}}'>{{name}}</a>
|
||||
<div>
|
||||
<a class='xoimg_btn_x24 xoimg_doc_open' title='open' href='/site/{{domain}}/wiki/{{mainpage}}'> </a>
|
||||
</div>
|
||||
<div>
|
||||
<a class='xoimg_btn_x24 xoimg_app_configure' title='configure' href='/site/home/wiki/Special:XowaWikiItem?domain={{domain}}'> </a>
|
||||
</div>
|
||||
</div>
|
||||
{{/itms}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
.cur_data_row {
|
||||
padding: 4px 0px 4px;
|
||||
}
|
||||
.cur_data_row label {
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
margin: 0px 4px 0px 10px;
|
||||
vertical-align: top !important; /* !important needed else label will default to bottom b/c of element.style */
|
||||
align-self: flex-start;
|
||||
-webkit-align-self: flex-start;
|
||||
|
||||
font-weight: bold;
|
||||
}
|
||||
.cur_data_row label::after {
|
||||
content: ":";
|
||||
}
|
||||
.cur_data_input {
|
||||
display: inline-block;
|
||||
width: calc(100% - 170px);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
(function (xo) {
|
||||
xo.fulltext_indexer = new function() {
|
||||
this.send = function(proc, args) {
|
||||
try {xo.server.send_by_bridge('xowa.wiki.fulltext.indexer', proc, args);}
|
||||
catch (err) {alert(err);}
|
||||
}
|
||||
this.index = function() {
|
||||
try {
|
||||
var data =
|
||||
{ wikis: xo.elem.get_val_or_null('wikis_box')
|
||||
, ns_ids: xo.elem.get_val_or_null('ns_ids_box')
|
||||
, idx_opt: xo.elem.selectbox__selected_get("idx_opt")
|
||||
};
|
||||
xo.fulltext_indexer.send('index', data);
|
||||
document.getElementById('index_btn').focus();
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
}
|
||||
this.index_keydown = function(e) {
|
||||
if(e.keyCode === 13){
|
||||
e.preventDefault(); // Ensure it is only this code that runs
|
||||
xo.fulltext_indexer.index();
|
||||
}
|
||||
}
|
||||
this.status__note__recv = function(msg) {return xo.fulltext_indexer.status__note(JSON.parse(msg));}
|
||||
this.status__note = function(msg) {
|
||||
try {
|
||||
var note = msg.note;
|
||||
|
||||
xowa.js.doc.elem_append_above('note_last_div'
|
||||
, "<div style='width:100%'>"
|
||||
+ " <div>"
|
||||
+ note
|
||||
+ " </div>"
|
||||
+ "</div>"
|
||||
);
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.status__prog__recv = function(msg) {return xo.fulltext_indexer.status__prog(JSON.parse(msg));}
|
||||
this.status__prog = function(msg) {
|
||||
try {
|
||||
var prog = msg.prog;
|
||||
|
||||
var prog_div = document.getElementById('prog_div');
|
||||
prog_div.textContent = prog;
|
||||
} catch (err) {
|
||||
alert(err);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
xo.notify.elem_anchor = '#main_div';
|
||||
document.getElementById("wikis_box").focus();
|
||||
xo.elem.selectbox__selected_set('idx_opt');
|
||||
@@ -0,0 +1,40 @@
|
||||
<!-- message div -->
|
||||
<div id='xo_msg_box' style='width:100%; color:red'> </div>
|
||||
|
||||
<!-- help div -->
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_media_play'> </span><span class='xohelp_row_text'>Run index</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- main div -->
|
||||
<div id='main_div' style='width:100%'>
|
||||
<div class='cur_data_row' style='height:40px'>
|
||||
<label style='vertical-align:middle'>Index</label>
|
||||
<input id='wikis_box' type='text' value='{{wikis}}' style='width:80%' onkeydown='xo.fulltext_indexer.index_keydown(event)' accesskey="m" placeholder='Enter a wiki domain (For example: en.wikipedia.org)'></input>
|
||||
<a class='xoimg_btn_x24 xoimg_media_play' title='index' href='javascript:void(0)' onclick='return xo.fulltext_indexer.index()' id='index_btn'> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
<div class='cur_data_row'>
|
||||
<label style='vertical-align:middle'>Namespaces</label>
|
||||
<input id='ns_ids_box' type='text' value='{{ns_ids}}' style='width:80%' onkeydown='xo.fulltext_indexer.index_keydown(event)' placeholder='Enter a list of namespaces to index (For example: 0|4|14)'></input>
|
||||
</div>
|
||||
<div class='cur_data_row'>
|
||||
<label style='vertical-align:middle'>Index options</label>
|
||||
<select id='idx_opt' name='idx_opt' size='4' data-select-selected='{{idx_opt}}'>
|
||||
<option value='d'>Documents</option>
|
||||
<option value='df'>Documents / Frequencies</option>
|
||||
<option value='dfp'>Documents / Frequencies / Positions</option>
|
||||
<option value='dfpo'>Documents / Frequencies / Positions / Offsets</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id='status_div' style='width:100%'>
|
||||
<div id='prog_div'></div>
|
||||
<div id='note_div'>
|
||||
<div id='note_last_div'> </div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,191 @@
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* HELP */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.xo_help_div {
|
||||
margin-left:6px
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* SEARCH */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.xo_search_box {
|
||||
padding-right: 10px !important; /* DRD:else indicator will not be to far right */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* OPTIONS */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.xo_options_div {
|
||||
background-color:#f8f9fa; /* gray background */
|
||||
border:1px solid #c8ccd1; /* border */
|
||||
|
||||
/* margin / padding */
|
||||
margin-top:10px;
|
||||
margin-bottom:-8px;
|
||||
padding:4px;
|
||||
}
|
||||
.xo_options_divider {
|
||||
/* taken from mediawiki stylesheet via inspect element */
|
||||
clear: both;
|
||||
border-bottom: 1px solid #eaecf0;
|
||||
padding-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
.xo_options_ul {
|
||||
/* remove bullet and margins */
|
||||
padding: 0;
|
||||
margin: 0 !important;
|
||||
list-style: none !important; /* DRD: !important to overide default element css */
|
||||
}
|
||||
.xo_options_ul > li > div > label {
|
||||
margin-left: 10px;
|
||||
width:120px;
|
||||
}
|
||||
.xo_options_ul .xo_options_ipt {
|
||||
width:calc(100% - 140px);
|
||||
}
|
||||
.xo_options_ul input {
|
||||
/* DRD:needed else will be gray */
|
||||
background-color:white;
|
||||
border:1px solid #ddd;
|
||||
padding:2px;
|
||||
}
|
||||
.xo_options_toggle_div {
|
||||
margin: 0px 4px 0px 4px;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* RESULTS:WIKI */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.xo_results_wiki_div {
|
||||
background-color:rgb(187,187,255);
|
||||
padding:2px
|
||||
}
|
||||
.xo_results_wiki_toggle {
|
||||
margin:0 6px 0 6px;
|
||||
}
|
||||
.xo_results_wiki_paging_div {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.xo_results_wiki_paging_btn {
|
||||
margin:0px 10px 0px 10px
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* RESULTS:PAGE */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.xo_results_page_div {
|
||||
background-color:#d5ffd5;
|
||||
}
|
||||
.xo_results_page_toggle {
|
||||
margin:0 6px 0 8px;
|
||||
}
|
||||
.xo_results_page_ellipsis {
|
||||
align-self: flex-end;
|
||||
-webkit-align-self: flex-end;
|
||||
|
||||
display: inline-block;
|
||||
width: 16px; height: 13px; min-width: 16px; min-height: 13px; background-size: 16px 13px;
|
||||
background-repeat: no-repeat; background-position: center bottom;
|
||||
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* RESULTS:SNIP */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* add border between snips */
|
||||
.xo_results_snip_div:first-child {
|
||||
border-top: 1px solid #ddd;
|
||||
}
|
||||
.xo_results_snip_div {
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.xo_results_line_num {
|
||||
align-self: flex-start; /* vertically align at top */
|
||||
-webkit-align-self: flex-start;
|
||||
margin:1px 7px 1px 11px; /* top/bottom to give some space around border; */
|
||||
|
||||
/* standardize code across platforms (from Chrome / inspect) */
|
||||
color: #000;
|
||||
background-color: #f8f9fa;
|
||||
border: 1px solid #eaecf0;
|
||||
border-radius: 2px;
|
||||
padding: 1px 4px;
|
||||
}
|
||||
.snip_highlight {
|
||||
font-weight: bold; /* emulate Special:Search */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* PULSE */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
.search_cxl_pulse {
|
||||
animation: search_cxl_pulse 2s linear infinite;
|
||||
-ms-animation: search_cxl_pulse 2s linear infinite;
|
||||
-moz-animation: search_cxl_pulse 2s linear infinite;
|
||||
-webkit-animation: search_cxl_pulse 2s linear infinite;
|
||||
|
||||
/* make circle */
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
@keyframes "search_cxl_pulse" {
|
||||
0% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
50% {
|
||||
opacity: .1;
|
||||
background-color:rgba(255,255,255,1.0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@-moz-keyframes search_cxl_pulse {
|
||||
0% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
50% {
|
||||
opacity: .1;
|
||||
background-color:rgba(255,255,255,1.0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@-webkit-keyframes "search_cxl_pulse" {
|
||||
0% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
50% {
|
||||
opacity: .1;
|
||||
background-color:rgba(255,255,255,1.0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
}
|
||||
|
||||
@-ms-keyframes "search_cxl_pulse" {
|
||||
0% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
50% {
|
||||
opacity: .1;
|
||||
background-color:rgba(255,255,255,1.0);
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
background-color:rgba(0,255,0,1.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,453 @@
|
||||
(function (xo) {
|
||||
xo.fulltext_searcher = new function() {
|
||||
//{ SECTION:util
|
||||
this.send = function(proc, args) {
|
||||
args.page_guid = xo_page_guid;
|
||||
try {xo.server.send_by_bridge('xowa.wiki.fulltext.searcher', proc, args);}
|
||||
catch (err) {alert(err);}
|
||||
}
|
||||
|
||||
this.alerts_enabled = false;
|
||||
this.handle_err = function(s) {
|
||||
if (this.alerts_enabled) {
|
||||
alert(s);
|
||||
}
|
||||
else {
|
||||
console.log(s);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:document.onload
|
||||
this.loaded = false;
|
||||
this.onload = function(evt) {
|
||||
// onload fires multiple times on drd; only run once
|
||||
if (this.loaded) return;
|
||||
this.loaded = true;
|
||||
|
||||
// init notify anchor; focus search_btn
|
||||
xo.notify.elem_anchor = '#main_div';
|
||||
xo.elem.get('search_txt').focus();
|
||||
|
||||
// run search
|
||||
var query = xo.elem.get_val_or_null('search_txt');
|
||||
if (query && query.length > 0) {
|
||||
this.search_run();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:search_run
|
||||
this.search_is_running = false;
|
||||
this.search_run = function() {
|
||||
/*
|
||||
* runs search automatically when page is loaded
|
||||
* uses data from doc_elems...
|
||||
** visible; EX: search_txt
|
||||
** hidden; EX: qarg_wikis
|
||||
* Doc_elems are filled in when page is generated from...
|
||||
** query args; EX: &wikis=a|b
|
||||
** cfg; EX: xowa.addon.search.fulltext.special.show_all_snips
|
||||
|
||||
Note that code is involved b/c
|
||||
* need to have each search generate its own url b/c...
|
||||
** http_server
|
||||
** moving bwd / fwd through history)
|
||||
* want to minimize unnecessary qargs based on ...
|
||||
** implied scope; EX: &wikis=en.wikipedia.org when current wiki is en.wikipedia.org
|
||||
** cfg; EX: &show_all_snips=1
|
||||
*/
|
||||
try {
|
||||
// get search_text
|
||||
var search_text = xo.elem.get_val_or_null('search_txt');
|
||||
search_text = search_text.replace(/ /g, "_"); // replace " " with "_"; this replacement is done automatically in drd.WebView, but is done manually here with swt.swtbrowser for consistency
|
||||
|
||||
// get data specified by user
|
||||
var msg =
|
||||
{ search: xo.elem.get_val_or_null('search_txt')
|
||||
, cur_wiki: xo.elem.get_val_or_null('cur_wiki')
|
||||
};
|
||||
|
||||
// get data specified by qargs
|
||||
this.search_run__add_qarg_data(msg, this.qarg_keys);
|
||||
|
||||
// clear results; activate cancel; focus search box
|
||||
this.results__clear();
|
||||
this.search_cxl__show(true);
|
||||
xo.elem.get('search_btn').focus();
|
||||
|
||||
// send msg
|
||||
this.send('search_run', msg);
|
||||
this.search_is_running = true;
|
||||
} catch (err) {
|
||||
this.handle_err(err);
|
||||
}
|
||||
}
|
||||
this.search_run__add_qarg_data = function(msg, keys) {
|
||||
// adds qarg data to search_run msg
|
||||
var len = keys.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var key = 'qarg_' + keys[i];
|
||||
msg[key] = xo.elem.get_val_or_null(key); // relies on msg.key == elem.id
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:search_redirect
|
||||
this.qarg_keys = ['wikis', 'ns_ids', 'limits', 'offsets', 'expand_pages', 'expand_snips', 'show_all_snips'];
|
||||
this.search_redirect = function() {
|
||||
// redirects to new search page with new query args when search is pressed
|
||||
try {
|
||||
// get search_text
|
||||
var search_text = xo.elem.get_val_or_null('search_txt');
|
||||
|
||||
// if search_text has changed, reset offsets; EX: on 21-40 of 'earth'; changing search to 'moon' should start from 1, not 21
|
||||
if (search_text !== xo.elem.get_val_or_null('qarg_search')) {
|
||||
xo.elem.get('qarg_offsets').value = '0';
|
||||
}
|
||||
|
||||
// build url
|
||||
var path_prefix = xowa.app.mode == 'http_server'
|
||||
? '/'
|
||||
: '/site/';
|
||||
var url = path_prefix + xo.elem.get_val_or_null('cur_wiki') + '/wiki/Special:XowaSearch?search=' + search_text;
|
||||
var len = this.qarg_keys.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
url = this.search_redirect__add_to_url(url, this.qarg_keys[i]);
|
||||
}
|
||||
|
||||
// redirect
|
||||
window.navigate_to(url);
|
||||
} catch (err) {
|
||||
this.handle_err(err);
|
||||
}
|
||||
}
|
||||
this.search_redirect__add_to_url = function(url, key) {
|
||||
// only add qarg to url if it's been specified by user
|
||||
// get qarg / dflt values
|
||||
var qarg_val = xo.elem.get_val_or_null('qarg_' + key);
|
||||
var dflt_val = xo.elem.get_val_or_null('dflt_' + key);
|
||||
|
||||
// if qarg === dflt, return url
|
||||
if (qarg_val === dflt_val) {
|
||||
return url;
|
||||
}
|
||||
// else, qarg changed; append it to url
|
||||
else {
|
||||
return url + '&' + key + '=' + qarg_val;
|
||||
}
|
||||
}
|
||||
this.search_keydown = function(e) {
|
||||
if(e.keyCode === 13){
|
||||
e.preventDefault(); // squash further notifications
|
||||
this.search_redirect();
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:search_cxl
|
||||
this.search_cxl = function() {
|
||||
if (this.search_is_running) {
|
||||
this.send('search_cxl', {page_guid: xo.elem.get_val_or_null('page_guid')});
|
||||
xo.elem.get('search_cxl_msg').style.display = 'block';
|
||||
}
|
||||
}
|
||||
this.search_cxl__show = function(show) {
|
||||
if (show) {
|
||||
xo.elem.get('search_cxl_btn').classList.add('search_cxl_pulse');
|
||||
}
|
||||
else {
|
||||
xo.elem.get('search_cxl_btn').classList.remove('search_cxl_pulse');
|
||||
xo.elem.get('search_cxl_msg').style.display = 'none';
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:paging
|
||||
this.paging_fwd = function(wiki) {this.paging_dir(wiki, true);}
|
||||
this.paging_bwd = function(wiki) {this.paging_dir(wiki, false);}
|
||||
this.paging_dir = function(wiki, fwd) {
|
||||
try {
|
||||
// get wiki_idx for wiki from qarg_wikis; needed for offset / limit; EX: wikis=a|b offsets=0|20
|
||||
var wiki_idx = -1;
|
||||
var qarg_wikis_str = xo.elem.get_val_or_null('qarg_wikis');
|
||||
var qarg_wikis_ary = qarg_wikis_str.split('|');
|
||||
var qarg_wikis_len = qarg_wikis_ary.length;
|
||||
for (var i = 0; i < qarg_wikis_len; i++) {
|
||||
var qarg_wiki = qarg_wikis_ary[i];
|
||||
if (wiki === qarg_wiki) {
|
||||
wiki_idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (wiki_idx == -1) {
|
||||
this.handle_err('could not find wiki_idx; wiki=' + wiki + ' qargs=' + qarg_wikis_str);
|
||||
return;
|
||||
}
|
||||
|
||||
// get offset / limit
|
||||
var limit = this.paging_dir__get_val_or_0th(wiki_idx, 'qarg_limits');
|
||||
var old_offset = this.paging_dir__get_val_or_0th(wiki_idx, 'qarg_offsets');
|
||||
|
||||
// calc new_offset
|
||||
var new_offset = old_offset + limit * (fwd ? 1 : -1);
|
||||
if (new_offset < 0) {
|
||||
new_offset = 0; // handle negative offsets; EX: old_offset=20 -> limit changed to 30 -> new_offset=-10 -> new_offset=0
|
||||
if (old_offset == 0) // ignore noops at BOS; EX: old_offset=0 -> limit changed to 30 -> new_offset = -30 -> new_offset=0 -> don't reload page since new_offset = old_offset
|
||||
return;
|
||||
}
|
||||
|
||||
// set it and redirect
|
||||
this.paging_dir__set_val('qarg_offsets', wiki_idx, qarg_wikis_len, new_offset);
|
||||
this.search_redirect();
|
||||
} catch (err) {
|
||||
this.handle_err(err);
|
||||
}
|
||||
}
|
||||
this.paging_dir__get_val_or_0th = function(wiki_idx, key) {
|
||||
// get ary; EX: offset=0|20
|
||||
var ary = xo.elem.get_val_or_null(key).split('|');
|
||||
var ary_len = ary.length;
|
||||
|
||||
// get nth val based on wiki_idx
|
||||
var rv = wiki_idx < ary_len
|
||||
? ary[wiki_idx] // nth exists; EX: wikis=a|b offsets=0 wiki=a -> wiki_idx=0 -> return i
|
||||
: ary[ary_len - 1] // nth missing; EX: wikis=a|b offsets=0 wiki=b -> wiki_idx=1 -> return nth
|
||||
;
|
||||
return parseInt(rv);
|
||||
}
|
||||
this.paging_dir__set_val = function(key, wiki_idx, wikis_len, val) {
|
||||
// get ary; EX: offset=0|20
|
||||
var ary = xo.elem.get_val_or_null(key).split('|');
|
||||
var ary_len = ary.length;
|
||||
var s = '';
|
||||
|
||||
// concat new_val by iterating over old_val
|
||||
for (var i = 0; i < wikis_len; i++) {
|
||||
var item = '';
|
||||
// item is cur_wiki; use it
|
||||
if (i == wiki_idx) {
|
||||
item = val.toString();
|
||||
}
|
||||
else {
|
||||
// item is other_wiki; use nth if available, or else 0th
|
||||
item = i < ary_len ? ary[i] : ary[0];
|
||||
}
|
||||
if (i != 0) s+= '|';
|
||||
s += item;
|
||||
}
|
||||
|
||||
// set new val
|
||||
var elem = document.getElementById(key);
|
||||
elem.value = s;
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:results
|
||||
//{ SECTION:results_misc
|
||||
this.results__clear = function() {
|
||||
var elem = xo.elem.get('results_wikis');
|
||||
elem.innerHTML = "<div id='results_wikis_last'> </div>";
|
||||
}
|
||||
this.results__done__recv = function(msg) {return this.results__done(JSON.parse(msg));}
|
||||
this.results__done = function(msg) {
|
||||
this.search_cxl__show(false);
|
||||
this.search_is_running = false;
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:add procs
|
||||
this.results__wiki__add__recv = function(msg) {return this.results__wiki__add(JSON.parse(msg));}
|
||||
this.results__wiki__add = function(msg) {
|
||||
try {
|
||||
// set expand_pages vars
|
||||
var expand_pages = msg.expand_pages;
|
||||
msg.expand_pages_icon = expand_pages ? 'xoimg_toggle_hide' : 'xoimg_toggle_show';
|
||||
msg.expand_pages_style = expand_pages ? 'block' : 'none';
|
||||
|
||||
// create wiki-grp elem
|
||||
var div = xo.elem.make('results_wikis', 'div');
|
||||
xo.tmpl.fmt('xofts.wiki', div, msg);
|
||||
|
||||
// hide '(searching ###)' if lucene (only show for wikitext searches)
|
||||
if (msg.type_is_lucene) {
|
||||
elem = document.getElementById("results_wiki_" + msg.wiki + "_searched_div");
|
||||
elem.style.display = 'none';
|
||||
}
|
||||
} catch (err) {
|
||||
this.handle_err(err + " proc=results__wiki__add; msg=" + JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.results__page__add__recv = function(msg) {return this.results__page__add(JSON.parse(msg));}
|
||||
this.results__page__add = function(msg) {
|
||||
try {
|
||||
// get vars
|
||||
var wiki = msg.wiki;
|
||||
|
||||
// get vars for href.page
|
||||
var page_ttl = msg.page_ttl;
|
||||
msg.page_href = page_ttl.replace(/\'/g, '%27'); // escape apos, else will break "href=''"
|
||||
msg.page_name = page_ttl.replace(/_/g, " "); // replace _ for display purposes
|
||||
|
||||
// set expand_snips vars
|
||||
var expand_snips = msg.expand_snips;
|
||||
msg.expand_snips_icon = expand_snips ? 'xoimg_toggle_hide' : 'xoimg_toggle_show';
|
||||
msg.expand_snips_style = expand_snips ? 'block' : 'none';
|
||||
|
||||
// create wiki_div html
|
||||
var wiki_div_key = "results_wiki_" + wiki + "_content";
|
||||
// wiki_div sometimes doesn't exist when (a) XOWA-desktop is first starting; and (b) restoring a Search in 1st tab; if it doesn't exist, create it
|
||||
if (!xo.elem.get(wiki_div_key)) {
|
||||
this.results__wiki__add({wiki: wiki});
|
||||
}
|
||||
var div = xo.elem.make(wiki_div_key, 'div');
|
||||
xo.tmpl.fmt('xofts.page', div, msg);
|
||||
|
||||
// publish elem_add event for popups
|
||||
var page_elem_key = 'results_wiki_' + wiki + '_page_' + msg.page_id;
|
||||
var page_elem = xo.elem.get(page_elem_key);
|
||||
xo.elem.elem_add__pub(page_elem);
|
||||
} catch (err) {
|
||||
this.handle_err(err + " proc=results__page__add; msg=" + JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.results__line__add__recv = function(msg) {return this.results__line__add(JSON.parse(msg));}
|
||||
this.results__line__add = function(msg) {
|
||||
try {
|
||||
// make page_div key
|
||||
var wiki = msg.wiki;
|
||||
var page_id = msg.page_id;
|
||||
var div_key = 'results_wiki_' + wiki + '_page_' + page_id + '_content';
|
||||
|
||||
// generate html
|
||||
var div = xo.elem.make(div_key, 'div');
|
||||
xo.tmpl.fmt('xofts.snip', div, msg);
|
||||
} catch (err) {
|
||||
this.handle_err(err + " msg=" + JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:update procs
|
||||
this.results__wiki__update__recv = function(msg) {return this.results__wiki__update(JSON.parse(msg));}
|
||||
this.results__wiki__update = function(msg) {
|
||||
try {
|
||||
elem = document.getElementById("results_wiki_" + msg.wiki + "_searched");
|
||||
elem.textContent = msg.searched;
|
||||
|
||||
} catch (err) {
|
||||
this.handle_err(err + " proc=results__wiki__update msg=" + JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.results__page__update__recv = function(msg) {return this.results__page__update(JSON.parse(msg));}
|
||||
this.results__page__update = function(msg) {
|
||||
try {
|
||||
var wiki = msg.wiki;
|
||||
var page_id = msg.page_id;
|
||||
var found = msg.found;
|
||||
var show_all_snips = msg.show_all_snips;
|
||||
|
||||
var elem = document.getElementById("results_wiki_" + wiki + "_page_" + page_id + "_found");
|
||||
elem.textContent = found;
|
||||
|
||||
if (found > 1 && !show_all_snips) {
|
||||
var elem = document.getElementById('results_wiki_' + wiki + '_page_' + page_id + '_rest');
|
||||
elem.style.display = 'initial';
|
||||
}
|
||||
} catch (err) {
|
||||
this.handle_err(err + " msg=" + JSON.stringify(msg));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
//}
|
||||
|
||||
//{ SECTION:snips_show_all
|
||||
this.snips_show_all = function(qry_id, wiki, page_id) {
|
||||
try {
|
||||
// hide snips_show_allbutton
|
||||
var elem = document.getElementById('results_wiki_' + wiki + '_page_' + page_id + '_rest');
|
||||
elem.style.display = 'none';
|
||||
|
||||
// always expand toggle_page indicator
|
||||
this.show_div
|
||||
( xo.elem.get('results_wiki_' + wiki + '_page_' + page_id + '_content')
|
||||
, xo.elem.get('results_wiki_' + wiki + '_page_' + page_id + '_img')
|
||||
, true
|
||||
);
|
||||
|
||||
// remove focus to button
|
||||
document.activeElement.blur();
|
||||
|
||||
// send message
|
||||
var data =
|
||||
{ qry_id: qry_id
|
||||
, wiki: wiki
|
||||
, page_id: page_id
|
||||
};
|
||||
this.send('snips_show_all', data);
|
||||
} catch (err) {
|
||||
this.handle_err(err);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:options_save
|
||||
this.options_save = function() {
|
||||
try {
|
||||
this.send('options_save',
|
||||
{ 'expand_options': xo.elem.get('xo_options_list_container').style.display === 'block'
|
||||
});
|
||||
} catch (err) {
|
||||
this.handle_err(err);
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
//{ SECTION:toggle_div
|
||||
this.toggle_div = function(div_id, img_id) {
|
||||
var div_elem = document.getElementById(div_id);
|
||||
var img_elem = document.getElementById(img_id);
|
||||
var show = div_elem.style.display === "block";
|
||||
return this.show_div(div_elem, img_elem, !show);
|
||||
}
|
||||
this.show_div = function(div_elem, img_elem, show) {
|
||||
if (show) {
|
||||
div_elem.style.display = "block";
|
||||
img_elem.classList.remove("xoimg_toggle_show");
|
||||
img_elem.classList.add ("xoimg_toggle_hide");
|
||||
}
|
||||
else {
|
||||
div_elem.style.display = "none";
|
||||
img_elem.classList.remove("xoimg_toggle_hide");
|
||||
img_elem.classList.add ("xoimg_toggle_show");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}(window.xo = window.xo || {}));
|
||||
/*
|
||||
TOMBSTONE: onload does not work on droid where WM overrides onload
|
||||
if(window.onload) {
|
||||
var onload_old = window.onload;
|
||||
var onload_new = function(evt) {
|
||||
onload_old(evt);
|
||||
xo.fulltext_searcher.onload(evt);
|
||||
};
|
||||
window.onload = onload_new;
|
||||
} else {
|
||||
window.onload = xo.fulltext_searcher.onload;
|
||||
}
|
||||
*/
|
||||
window.onbeforeunload = function(event) {
|
||||
xo.fulltext_searcher.search_cxl();
|
||||
};
|
||||
setTimeout(function() { // wait for mustache to load files async
|
||||
xo.fulltext_searcher.onload({});
|
||||
}, 0); // was 400
|
||||
@@ -0,0 +1,236 @@
|
||||
<!-- help div -->
|
||||
{{#disabled}}
|
||||
<div>
|
||||
<p>Full-text search is not available</p>
|
||||
|
||||
<p>Please download a full-text search index for your wiki from Download Central</p>
|
||||
|
||||
<p>For more info, see <a href='http://xowa.org/home/wiki/App/Full-text_search/Lucene/Search_indexes/Getting'>http://xowa.org/home/wiki/App/Full-text_search/Lucene/Search_indexes/Getting</a></p>
|
||||
</div>
|
||||
{{/disabled}}
|
||||
{{^disabled}}
|
||||
<div class='xo_flex_div'>
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<b>Buttons</b>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_ellipsis' > </span><span class='xohelp_row_text'>Show all snips</b></span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_misc_cancel'> </span><span class='xohelp_row_text'>Cancel search</b></span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_toggle_show'> </span><span class='xohelp_row_text'>Expand section</b></span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_toggle_hide'> </span><span class='xohelp_row_text'>Collapse section</b></span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_paging_bwd' > </span><span class='xohelp_row_text'>Retrieve next page of results</b></span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_paging_fwd' > </span><span class='xohelp_row_text'>Retrieve previous page of results</b></span></div>
|
||||
<b>Options</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Wikis</b>: List wikis to search using a pipe (|) character; EX: <code>en.wikipedia.org|simple.wikipedia.org</code></span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Namespaces</b>: List namespaces to search using a comma character; EX: <code>0,4</code> </span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Results per page</b>: List number of results per page; EX: <code>50</code> </span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Expand pages</b>: Expand pages sections when retrieving results. If 'n', pages will be collapsed; if 'y', pages will be expanded </span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Expand snips</b>: Expand snips sections when retrieving results. If 'n', snips will be collapsed; if 'y', snips will be expanded </span></div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'><b>Show all snips</b>: Show all snips when retrieving results. If 'n', only the first snip will show; if 'y', all snips will show</span></div>
|
||||
</div>
|
||||
<b>Advanced notes</b>
|
||||
<div style='margin-left:15px'>
|
||||
For multiple wikis, options can be specified per wiki using the pipe character.<br/>
|
||||
For example:<br/>
|
||||
* If <code>Wikis</code> is <code>en.wikipedia.org|simple.wikipedia.org</code><br/>
|
||||
* And <code>Results per page</code> is <code>20|10</code><br/>
|
||||
* Then <code>en.wikipedia.org</code> will retrieve <code>20</code> results per page and <code>simple.wikipedia.org</code> will retrieve <code>10</code> results per page
|
||||
</div>
|
||||
{{^app_is_drd}}
|
||||
For more info, see <a href='/site/home/wiki/App/Full-text_search'>App/Full-text_search</a>
|
||||
{{/app_is_drd}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:main -->
|
||||
<div id='search_cxl_msg' style='display:none'>
|
||||
Canceling. Please wait...
|
||||
</div>
|
||||
<div id='main_div'>
|
||||
<div class="xo_flex_div oo-ui-fieldLayout-field">
|
||||
|
||||
<!-- DIV:search_text -->
|
||||
<div
|
||||
id="searchText"
|
||||
class="xo_flex_div oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-iconElement oo-ui-textInputWidget oo-ui-textInputWidget-type-text oo-ui-indicatorElement mw-widget-titleWidget oo-ui-lookupElement mw-widget-titleInputWidget mw-widget-searchInputWidget oo-ui-textInputWidget-type-search"
|
||||
data-ooui="" aria-disabled="false"
|
||||
>
|
||||
<input
|
||||
id="search_txt"
|
||||
placeholder="Enter search words (For example: earth)"
|
||||
accesskey="m"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
value="{{qarg_search}}"
|
||||
class="oo-ui-inputWidget-input xo_search_box"
|
||||
autocapitalize="off"
|
||||
|
||||
name="search"
|
||||
type="search"
|
||||
aria-disabled="false"
|
||||
tabindex="0"
|
||||
/>
|
||||
<span class="oo-ui-iconElement-icon oo-ui-icon-search xoimg_search"> </span>
|
||||
<span class="oo-ui-indicatorElement-indicator oo-ui-indicator-clear"> </span>
|
||||
</div>
|
||||
|
||||
<!-- DIV:search_btn -->
|
||||
<div
|
||||
class="xo_flex_div oo-ui-widget oo-ui-widget-enabled oo-ui-flaggedElement-progressive oo-ui-flaggedElement-primary oo-ui-inputWidget oo-ui-buttonElement oo-ui-buttonElement-framed oo-ui-labelElement oo-ui-buttonInputWidget"
|
||||
aria-disabled="false"
|
||||
>
|
||||
<button
|
||||
id="search_btn"
|
||||
onclick="return xo.fulltext_searcher.search_redirect()"
|
||||
class="oo-ui-inputWidget-input oo-ui-buttonElement-button"
|
||||
value="" aria-disabled="false" tabindex="0" type="submit"
|
||||
>
|
||||
<span class="oo-ui-iconElement-icon oo-ui-image-invert"> </span>
|
||||
<span class="oo-ui-labelElement-label">Search</span>
|
||||
<span class="oo-ui-indicatorElement-indicator oo-ui-image-invert"> </span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- DIV:search_cxl_btn -->
|
||||
<div class='xo_flex_div'>
|
||||
<div id="search_cxl_btn" style="opacity: 0.25;" class="xo_imgbtn_x24 xoimg_misc_cancel" title="cancel" onclick="xo.fulltext_searcher.search_cxl()"></div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:help_btn -->
|
||||
<div class='xo_flex_div xo_help_div'>
|
||||
<span onclick='return xo.help.toggle("cur")' title="view help" class="xo_imgbtn_x20 xoimg_help_tip"> </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:options_btn -->
|
||||
<div class="xo_options_div mw-search-profile-tabs">
|
||||
|
||||
<!-- DIV:options header -->
|
||||
<div class='xo_flex_div'>
|
||||
<div
|
||||
class='xo_options_toggle_div'
|
||||
onclick='xo.fulltext_searcher.toggle_div("xo_options_list_container", "xo_options_img"); xo.fulltext_searcher.options_save();'
|
||||
>
|
||||
<span
|
||||
id='xo_options_img'
|
||||
class='xo_imgbtn_x20 {{#expand_options}}xoimg_toggle_hide{{/expand_options}}{{^expand_options}}xoimg_toggle_show{{/expand_options}}'
|
||||
> </span>
|
||||
</div>
|
||||
<div class='xo_flex_text'>Options</div>
|
||||
|
||||
<div class='xo_flex_text'>
|
||||
|
||||
<a href='/wiki/Special:XowaCfg?grp=xowa.addon.fulltext_search' title='go to options page'>
|
||||
<span
|
||||
id='xo_options_cog'
|
||||
class='xo_imgbtn_x20 xoimg_cog'
|
||||
style='margin-left:10px'
|
||||
> </span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:options list -->
|
||||
<div id='xo_options_list_container' class='xo_options_list_container' style='display:{{#expand_options}}block{{/expand_options}}{{^expand_options}}none{{/expand_options}}'>
|
||||
<div class='xo_options_divider'></div>
|
||||
<ul class='xo_options_ul'>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Wikis</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_wikis"
|
||||
value="{{qarg_wikis}}"
|
||||
placeholder="Enter wikis separated by a pipe (For example: home|wiki.me.org)"
|
||||
autocapitalize="off"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Namespaces</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_ns_ids"
|
||||
value="{{qarg_ns_ids}}"
|
||||
placeholder="Enter namespaces separated by a pipe (For example: 0|4)"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Results per page</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_limits"
|
||||
value="{{qarg_limits}}"
|
||||
placeholder="Enter number of pages to show per search (For example: 100)"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Expand pages</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_expand_pages"
|
||||
value="{{qarg_expand_pages}}"
|
||||
placeholder="Enter y to expand; n to collapse"
|
||||
autocapitalize="off"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Expand snips</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_expand_snips"
|
||||
value="{{qarg_expand_snips}}"
|
||||
placeholder="Enter y to expand; n to collapse"
|
||||
autocapitalize="off"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
<div class='xo_flex_div'>
|
||||
<label>Show all snips</label>
|
||||
<input
|
||||
type="text"
|
||||
onkeydown="xo.fulltext_searcher.search_keydown(event)"
|
||||
id="qarg_show_all_snips"
|
||||
value="{{qarg_show_all_snips}}"
|
||||
placeholder="Enter y to show all snips; n to show first only"
|
||||
autocapitalize="off"
|
||||
/>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:wikis_list -->
|
||||
<div id='results_wikis'></div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:hidden inputs -->
|
||||
<div>
|
||||
<input type='hidden' id='page_guid' value='{{page_guid}}'></input>
|
||||
<input type='hidden' id='qarg_search' value='{{qarg_search}}'></input>
|
||||
<input type='hidden' id='qarg_offsets' value='{{qarg_offsets}}'></input>
|
||||
<input type='hidden' id='cur_wiki' value='{{cur_wiki}}'></input>
|
||||
<input type='hidden' id='dflt_wikis' value='{{dflt_wikis}}'></input>
|
||||
<input type='hidden' id='dflt_ns_ids' value='{{dflt_ns_ids}}'></input>
|
||||
<input type='hidden' id='dflt_limits' value='{{dflt_limits}}'></input>
|
||||
<input type='hidden' id='dflt_offsets' value='{{dflt_offsets}}'></input>
|
||||
<input type='hidden' id='dflt_expand_pages' value='{{dflt_expand_pages}}'></input>
|
||||
<input type='hidden' id='dflt_expand_snips' value='{{dflt_expand_snips}}'></input>
|
||||
<input type='hidden' id='dflt_show_all_snips' value='{{dflt_show_all_snips}}'></input>
|
||||
</div>
|
||||
{{/disabled}}
|
||||
@@ -0,0 +1,30 @@
|
||||
<div
|
||||
id='results_wiki_{{wiki}}_page_{{page_id}}'
|
||||
class='xo_flex_div;'
|
||||
>
|
||||
<!-- DIV:page results -->
|
||||
<div class='xo_flex_div xo_results_page_div'>
|
||||
|
||||
<!-- TOGGLE:page -->
|
||||
<span
|
||||
id="results_wiki_{{wiki}}_page_{{page_id}}_img"
|
||||
class='xo_imgbtn_x20 {{expand_snips_icon}} xo_results_page_toggle'
|
||||
onclick='xo.fulltext_searcher.toggle_div("results_wiki_{{wiki}}_page_{{page_id}}_content", "results_wiki_{{wiki}}_page_{{page_id}}_img"); return false;'
|
||||
> </span>
|
||||
|
||||
<!-- HREF:page -->
|
||||
<span class='xo_flex_div'><a href='/site/{{wiki}}/wiki/{{page_href}}'>{{page_name}}</a> (<span id='results_wiki_{{wiki}}_page_{{page_id}}_found'>{{found}}</span> found)</span>
|
||||
|
||||
<!-- BTN:get_snips -->
|
||||
<span
|
||||
id='results_wiki_{{wiki}}_page_{{page_id}}_rest'
|
||||
class='xoimg_ellipsis xo_results_page_ellipsis'
|
||||
onclick='xo.fulltext_searcher.snips_show_all("{{query_id}}", "{{wiki}}", "{{page_id}}");'
|
||||
style='display:none;'
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:SNIPS -->
|
||||
<div id='results_wiki_{{wiki}}_page_{{page_id}}_content' style='display:{{expand_snips_style}};'></div>
|
||||
@@ -0,0 +1,12 @@
|
||||
<div
|
||||
id='results_wiki_{{wiki}}_page_{{page_id}}_line_{{line}}'
|
||||
class='xo_flex_div xo_results_snip_div'
|
||||
>
|
||||
<!-- TEXT:line_num -->
|
||||
<div class='xo_results_line_num'>
|
||||
{{line}}
|
||||
</div>
|
||||
|
||||
<!-- TEXT:line_html -->
|
||||
<div>{{{html}}}</div>
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
<div id='results_wiki_{{wiki}}'>
|
||||
<div class='xo_flex_div xo_results_wiki_div'>
|
||||
<!-- TOGGLE:wiki -->
|
||||
<span
|
||||
id="results_wiki_{{wiki}}_img"
|
||||
class='xo_imgbtn_x20 {{expand_pages_icon}} xo_results_wiki_toggle'
|
||||
onclick='xo.fulltext_searcher.toggle_div("results_wiki_{{wiki}}_content", "results_wiki_{{wiki}}_img");'
|
||||
> </span>
|
||||
|
||||
<!-- HREF:wiki -->
|
||||
<div class='xo_flex_div'>
|
||||
<a href='/site/{{wiki}}/wiki/'>{{wiki}}</a>
|
||||
<div
|
||||
id='results_wiki_{{wiki}}_searched_div'
|
||||
class='xo_flex_text'
|
||||
>(<span id='results_wiki_{{wiki}}_searched'>0</span> searched)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:results -->
|
||||
<div class='xo_flex_div xo_results_wiki_paging_div'>
|
||||
|
||||
<!-- BTN:paging_bwd -->
|
||||
<span
|
||||
id="results_wiki_{{wiki}}_bwd"
|
||||
class='xo_imgbtn_x20 xoimg_paging_bwd xo_results_wiki_paging_btn'
|
||||
onclick='xo.fulltext_searcher.paging_bwd("{{wiki}}")'
|
||||
> </span>
|
||||
|
||||
<!-- TEXT:results; EX: "Results: 1 of 10" -->
|
||||
<div class='xo_flex_div'>
|
||||
Results: <div style='text-align:center;width:40px'>{{rng_bgn}}</div> - <div style='text-align:center;width:40px'>{{rng_end}}</div>
|
||||
</div>
|
||||
|
||||
<!-- BTN:paging_fwd -->
|
||||
<span
|
||||
id="results_wiki_{{wiki}}_fwd"
|
||||
class='xo_imgbtn_x20 xoimg_paging_fwd xo_results_wiki_paging_btn'
|
||||
onclick='xo.fulltext_searcher.paging_fwd("{{wiki}}")'
|
||||
> </span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- DIV:page list -->
|
||||
<div id='results_wiki_{{wiki}}_content' style='display:{{expand_pages_style}};'></div>
|
||||
</div>
|
||||
<div style='clear:both;display:none;'></div>
|
||||
38
res/bin/any/xowa/addon/wiki/import/bin/xow_import.css
vendored
Normal file
38
res/bin/any/xowa/addon/wiki/import/bin/xow_import.css
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 72px);
|
||||
|
||||
/* handle long paths */
|
||||
font-size: 1em !important;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 72px;
|
||||
}
|
||||
.fsys_go_up_offset {
|
||||
margin-top: -4px; /* nudge icon up to align with help */
|
||||
}
|
||||
|
||||
.cur_data_row {
|
||||
height: 50px;
|
||||
}
|
||||
.cur_link_btn {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.fsys_dir_txt {
|
||||
display: inline-block;
|
||||
align-self: center;
|
||||
}
|
||||
.fsys_fil_txt {
|
||||
display: inline-block;
|
||||
align-self: center;
|
||||
}
|
||||
.fsys_meta_txt {
|
||||
display: block;
|
||||
color: #828282;
|
||||
font-family: monospace;
|
||||
font-size: .8em;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class='main_div'>
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div>
|
||||
<b>Quick start</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xohelp_bullet'> </span><span class='xohelp_row_text'>Navigate to the directory containing the XOWA wiki. For example, choose 'storage' -> 'CARD-NAME' -> 'xowa' -> 'wiki' -> 'en.wikipedia.org'</span></div>
|
||||
</div>
|
||||
<b>Buttons</b>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_go_up'> </span><span class='xohelp_row_text'>Go up to the parent folder</span></div>
|
||||
{{#dir_cmd_exists}}
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_misc_ok'> </span><span class='xohelp_row_text'>Select current folder</span></div>
|
||||
{{/dir_cmd_exists}}
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_dir'> </span><span class='xohelp_row_text'>Open the folder</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_xowa'> </span><span class='xohelp_row_text'>Import the XOWA wiki</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_fil_blank'> </span><span class='xohelp_row_text'>Does nothing. Indicates the file is unselectable</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>{{path}}</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_fsys_go_up fsys_go_up_offset' href="/site/home/wiki/Special:XowaFileBrowser?path={{owner_dir_enc}}{{dir_cmd_arg}}"> </a>
|
||||
{{#dir_cmd_exists}}
|
||||
<a class='xoimg_btn_x24 xoimg_misc_ok fsys_go_up_offset' href="/site/home/wiki/Special:XowaFileBrowser?path={{path_enc}}{{dir_cmd_arg}}&selected=1"> </a>
|
||||
{{/dir_cmd_exists}}
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' href='javascript:void(0)' onclick='return xo.help.toggle("cur")' title='view help'> </a>
|
||||
</div>
|
||||
</div>
|
||||
{{#subs}}
|
||||
<div class='xotbl_data_row cur_data_row'>
|
||||
{{#is_dir}}
|
||||
<a
|
||||
class="link_btn_y cur_link_btn"
|
||||
href="/site/home/wiki/Special:XowaFileBrowser?path={{path_enc}}{{dir_cmd_arg}}"
|
||||
>
|
||||
<span class='xoimg_btn_x24 xoimg_fsys_dir'> </span>
|
||||
<span class='fsys_dir_txt'>{{name}}</span>
|
||||
</a>
|
||||
{{/is_dir}}
|
||||
{{^is_dir}}
|
||||
{{#is_core_xowa}}
|
||||
<a
|
||||
class="link_btn_y cur_link_btn"
|
||||
href='/site/home/wiki/Special:XowaWikis?cmd=add&file={{path_enc}}'
|
||||
>
|
||||
<span class='xoimg_btn_x24 xoimg_xowa'> </span>
|
||||
<span class='fsys_fil_txt'>
|
||||
<span>{{name}}</span>
|
||||
<span class='fsys_meta_txt'>{{date}} [{{size}}]</span>
|
||||
</span>
|
||||
</a>
|
||||
{{/is_core_xowa}}
|
||||
{{^is_core_xowa}}
|
||||
<div class="link_btn_n cur_link_btn">
|
||||
<span class='xoimg_btn_x24 xoimg_fsys_fil_blank'> </span>
|
||||
<span class='fsys_fil_txt'>
|
||||
<span>{{name}}</span>
|
||||
<span class='fsys_meta_txt'>{{date}} [{{size}}]</span>
|
||||
</span>
|
||||
</div>
|
||||
{{/is_core_xowa}}
|
||||
{{/is_dir}}
|
||||
</div>
|
||||
{{/subs}}
|
||||
</div>
|
||||
56
res/bin/any/xowa/addon/wiki/import/test/xow_import.test.html
Normal file
56
res/bin/any/xowa/addon/wiki/import/test/xow_import.test.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!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/wiki/import/bin/xow_import.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>
|
||||
|
||||
<!-- mustache -->
|
||||
<script type="text/html" id="templates"></script>
|
||||
<script type="text/javascript">
|
||||
window.view = {
|
||||
path : '/storage/sdcard1/xowa/wiki/',
|
||||
owner_dir_enc : 'owner',
|
||||
subs:
|
||||
[
|
||||
{is_dir:true , is_core_xowa:false, path_enc: 'a', name:'en.wikipedia.org'},
|
||||
{is_dir:true , is_core_xowa:false, path_enc: 'b', name:'simple.wikipedia.org'},
|
||||
{is_dir:false, is_core_xowa:true , path_enc: 'c', name:'simple.wikipedia.org-file-user.xowa' , date:'2015-12-20', size:'56 KB'},
|
||||
{is_dir:false, is_core_xowa:false, path_enc: 'd', name:'simple.wikipedia.org-file-user1.xowa', date:'2015-12-20', size:'56 KB'},
|
||||
{is_dir:false, is_core_xowa:false, path_enc: 'd', name:'simple.wikipedia.org-file-user2.xowa', date:'2015-12-20', size:'56 KB'},
|
||||
{is_dir:false, is_core_xowa:false, path_enc: 'd', name:'simple.wikipedia.org-file-user3.xowa', date:'2015-12-20', size:'56 KB'},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("#templates").load("bin/any/xowa/addon/wiki/import/bin/xow_import.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"></div>
|
||||
</body>
|
||||
</html>
|
||||
28
res/bin/any/xowa/addon/wiki/registry/info/bin/xow_info.css
Normal file
28
res/bin/any/xowa/addon/wiki/registry/info/bin/xow_info.css
Normal file
@@ -0,0 +1,28 @@
|
||||
.cur_head_text {
|
||||
width: calc(100% - 83px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 72px;
|
||||
}
|
||||
|
||||
/* Detail Tbl */
|
||||
.cur_data_row {
|
||||
padding: 4px 0px 4px;
|
||||
}
|
||||
.cur_data_row label {
|
||||
display: inline-block;
|
||||
width: 50px;
|
||||
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% - 70px);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<div class='main_div'>
|
||||
{{#wiki_info}}
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_list_delete'> </span><span class='xohelp_row_text'>Delete the wiki and all its files</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>Details</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_list_delete' title='delete wiki' href='javascript:void(0)'
|
||||
data_alertify_msg='Are you sure you want to delete {{wiki_domain}}?<br/>({{wiki_size}} will be deleted!)'
|
||||
data_alertify_ok='Delete'
|
||||
data_alertify_cancel='Cancel'
|
||||
data_alertify_href='/site/home/wiki/Special:XowaWikiInfo?cmd=delete&wiki={{wiki_domain}}'
|
||||
onclick='return xo.alertify.confirm_href(this);'>
|
||||
</a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Wiki</label>
|
||||
<span>{{wiki_domain}}</span>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Date</label>
|
||||
<span>{{wiki_date}}</span>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Path</label>
|
||||
<span>{{wiki_dir}}</span>
|
||||
</div>
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<label>Size</label>
|
||||
<span>{{wiki_size}}</span>
|
||||
</div>
|
||||
{{/wiki_info}}
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!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/wiki/registry/info/bin/xow_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>
|
||||
|
||||
<!-- mustache -->
|
||||
<script type="text/html" id="templates"></script>
|
||||
<script type="text/javascript">
|
||||
window.view = {
|
||||
wiki_info :
|
||||
{
|
||||
wiki_domain : 'en.wikipedia.org'
|
||||
, wiki_date : '2016-06-01'
|
||||
, wiki_dir : 'C:\\xowa\\wiki\\en.wikipedia.org'
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("#templates").load("bin/any/xowa/addon/wiki/registry/info/bin/xow_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"></div>
|
||||
</body>
|
||||
</html>
|
||||
29
res/bin/any/xowa/addon/wiki/registry/list/bin/xow_list.css
Normal file
29
res/bin/any/xowa/addon/wiki/registry/list/bin/xow_list.css
Normal file
@@ -0,0 +1,29 @@
|
||||
/* head row */
|
||||
.cur_head_text {
|
||||
width: calc(100% - 113px);
|
||||
}
|
||||
.cur_head_btns {
|
||||
width: 112px;
|
||||
}
|
||||
|
||||
/* wiki row */
|
||||
.cur_data_row {
|
||||
height: 44px;
|
||||
width: 100%;
|
||||
}
|
||||
.wiki_link_btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: calc(100% - 36px);
|
||||
height: 100%;
|
||||
}
|
||||
.wiki_domain {
|
||||
display: inline-block;
|
||||
width: calc(100% - 136px);
|
||||
}
|
||||
.wiki_date {
|
||||
display: inline-block;
|
||||
width: 100px;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class='main_div'>
|
||||
<div id='cur_help_div' class='xohelp_div'>
|
||||
<div id='cur_help_msg' class='xohelp_msg'>
|
||||
<div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_fsys_dir'> </span><span class='xohelp_row_text'>Import wikis from your device or SD card using a file browser</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_inet_download'> </span><span class='xohelp_row_text'>Download wikis from archive.org</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_xowa'> </span><span class='xohelp_row_text'>Open the wiki and go to its Main Page</span></div>
|
||||
<div class='xohelp_row'><span class='xoimg_help_x24 xoimg_help_info'> </span><span class='xohelp_row_text'>View more information about the wiki</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='xotbl_head_row'>
|
||||
<div class='xotbl_head_text cur_head_text'>Wikis</div>
|
||||
<div class='xotbl_head_btns cur_head_btns'>
|
||||
<a class='xoimg_btn_x24 xoimg_fsys_dir' title='add wiki' href="/wiki/Special:XowaFileBrowser?path={{import_root}}"> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_inet_download' title='download' href="/wiki/Special:XowaDownloadCentral"> </a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_tip' title='view help' href='javascript:void(0)' onclick='return xo.help.toggle("cur")'> </a>
|
||||
</div>
|
||||
</div>
|
||||
{{#subs}}
|
||||
<div class="xotbl_data_row cur_data_row">
|
||||
<a class="link_btn_y wiki_link_btn" href="/site/{{domain}}/wiki/">
|
||||
<span class='xoimg_btn_x24 xoimg_xowa'> </span>
|
||||
<span class='wiki_domain'>{{domain}}</span>
|
||||
<span class='wiki_date'>{{date}}</span>
|
||||
</a>
|
||||
<a class='xoimg_btn_x24 xoimg_help_info' href="/wiki/Special:XowaWikiInfo?wiki={{domain}}" title="info"> </a>
|
||||
</div>
|
||||
{{/subs}}
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
<!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/wiki/registry/list/bin/xow_list.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>
|
||||
|
||||
<!-- mustache -->
|
||||
<script type="text/html" id="templates"></script>
|
||||
<script type="text/javascript">
|
||||
window.view = {
|
||||
import_root:'/wiki/A',
|
||||
subs:
|
||||
[
|
||||
{date:'2016-03-06', domain:'en.wikipedia.org'},
|
||||
{date:'2016-03-05', domain:'simple.wikipedia.org'},
|
||||
],
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
$("#templates").load("bin/any/xowa/addon/wiki/registry/list/bin/xow_list.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"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user