Skip to content

Commit

Permalink
* Version 3.5.2.1
Browse files Browse the repository at this point in the history
- Add raw data export to HTML.
- Fix "Not on FX application thread" during download since Java 1.8.0.111.
- Fix script error on data list timeout.
- Fix Edge 14 error on Windows 10.
- Fix compatibility with Windows 10 high contrast theme on Firefox and Edge.
- Fix lookup popup does not show under some conditions.
  • Loading branch information
Sheep-y committed Dec 18, 2016
2 parents cf267fc + 03824b1 commit e1c6e24
Show file tree
Hide file tree
Showing 23 changed files with 438 additions and 180 deletions.
17 changes: 9 additions & 8 deletions README.md
@@ -1,6 +1,6 @@
# 4e Compendium Downloader #

## Version 3.5.2 ##
## Version 3.5.2.1 ##

![Screenshot of program](https://raw.githubusercontent.com/Sheep-y/trpg-dnd-4e-db/master/res/img/History%20-%20v3.5%20viewer.png)

Expand All @@ -13,14 +13,15 @@ This is a fan-made project and does not come with copyrighted data.
## How To Download Data ##

1. You need an active [Dungeons & Dragons Insider subscription](http://ddi.wizards.com/) to retrieve data.
1. This may be impossible since registration is closed. See [in-app help](http://htmlpreview.github.io/?https://github.com/Sheep-y/trpg-dnd-4e-db/blob/development/res/downloader_about.html#Troubleshoot) for links.
2. [Download](http://www.java.com/) and install Java (version 8 or above).
3. [Download](https://github.com/Sheep-y/trpg-dnd-4e-db/releases/) the downloader exe (Windows) or downloader jar (Linux/Mac).
4. Open a folder for the downloader, put it in, and run it.
5. Jar version: If double clicking the jar file does not work, open console and run "java -jar 4e_compendium_downloader.jar". Note that the downloader is a GUI program.
6. In the downloader, fill in DDI username and password, then click "Download".
7. Download can be stopped and resumed any time.
8. See in-downloader help for details and troubleshoots.
9. Once all data is downloaded, you can export the data to an HTML file, which can be opened in browsers.
1. Jar version: If double clicking the jar file does not work, open console and run "java -jar 4e_compendium_downloader.jar". Note that it is a GUI program.
5. In the downloader, fill in DDI username and password, then click "Download".
1. Download can be stopped and resumed any time.
2. See [in-app help](http://htmlpreview.github.io/?https://github.com/Sheep-y/trpg-dnd-4e-db/blob/development/res/downloader_about.html) for steps and troubleshoots.
6. Once all data is downloaded, you can export the data to an HTML file, which can be opened in browsers .

### Fixing compendium errors ###

Expand All @@ -47,12 +48,12 @@ If you find similar mistakes that aren't fixed, please [file an issue](https://g
* Viewer source code is in html folder.
* Downloader source code is in java folder, and use libraries in java_lib folder.
* Both use resources at the root (license) and in the resource folder.
* Use Ant (build.xml) to compile viewer and then downloader into an executable jar.
* Use Ant (build.xml) to 'make' an executable jar. The make_exe target depends on [Launch4j](http://launch4j.sourceforge.net/).
* The jar can also be extracted to a new project folder; use Ant to move the extracted files back to original structure.

The viewer is built with [CocoDoc](https://github.com/Sheep-y/CocoDoc/) app builder, which is bundled and must run in GUI.

Sqljet is used to access sqlite database, but the data cannot be read by other SQLite libraries.
[SQLJet](https://sqljet.com/) is used to access sqlite database, but the data cannot be read by other SQLite libraries.
It may be a sqljet issue.
Since it is very light and has no other issues, I'm keeping it and hoping someone can find what's wrong someday.

Expand Down
5 changes: 4 additions & 1 deletion html/action_about.html
Expand Up @@ -161,6 +161,9 @@ <h2> 3.5<sup>th</sup> Version </h2>
<h1 class='i18n'> action.about.h_version_history </h1>
<p class="i18n"> action.about.lbl_english_only </p>
<dl>
<dt> 3.5.2.1 <time>2016-12-19</time> </dt>
<dd> Add raw data export and high contrast theme (Windows). Fix new Java compatibility and other bugs. </dd>

<dt> 3.5.2 <time>2016-11-19</time> </dt>
<dd> Multi-thread export, reduce file count from 25k to 1.8k, linkify entry names, split items into four categories, show type of items (artifact, tattoo, standard), show theme prerequisite, show background benefits, split race ability, share favicon between viewer and downloader, internal lookup, keyboard next/prev. </dd>

Expand Down Expand Up @@ -201,7 +204,7 @@ <h1 class="i18n"> action.about.title </h1>

<section id='action_license'>
<article lang="en">
<?coco file( "../license_agpl.html" ) ?>
<?coco file( "../license_agpl.html" ) coco ?>
</article>
<header role="navigation">
<button class='i18n' onclick='od.gui.go("about")' accesskey='1'> action.about.link_text </button>
Expand Down
2 changes: 1 addition & 1 deletion html/action_view.html
Expand Up @@ -169,7 +169,7 @@ <h1 id="act_view_h_title"></h1>
var categories = {}, cat_count = 0;
for ( var i in ids ) {
var cat_id = data.category_name_of( ids[ i ] );
if ( categories[ cat_id ] ) return;
if ( categories[ cat_id ] ) continue;
var cat = categories[ cat_id ] = data.get( cat_id );
++cat_count;
cat.load_listing( function act_view_popup_links_pop () {
Expand Down
4 changes: 2 additions & 2 deletions html/data_model.js
Expand Up @@ -115,8 +115,8 @@ od.data.Category.prototype = {
var cat = this;
od.reader.read_data_listing( this.name, function data_Cat_load_listing_done() {
if ( cat.list.length <= 0 ) cat.build_listing(); // Skip if listing has been built
_.call( ondone );
}, _.callonce( onerror ) );
_.call( ondone, cat );
}, _.callonce( onerror, cat ) );
},

"load_index" : function data_Cat_load_index ( ondone, onerror ) {
Expand Down
4 changes: 2 additions & 2 deletions html/html_template.html
Expand Up @@ -38,8 +38,8 @@ <h1> 請升級瀏覽器。 </h1>
<script>
document.getElementById('action_script_error').style.display = 'block';
</script><noscript>
<h1>   Please enable JavaScript </h1>
<h1>   請啟用 JavaScript </h1>
<h1> Please enable JavaScript </h1>
<h1> 請啟用 JavaScript </h1>
<div style="color:red;font:96px 'Arial Unicode';position:fixed;left:68%;bottom:44px;"></div><!-- Points to 'Allow' button. Rough position, not accurate, but enough. -->
</noscript>
<script>
Expand Down
2 changes: 1 addition & 1 deletion html/lang_en.js
Expand Up @@ -31,7 +31,7 @@ _.l.set( 'data', {
});

_.l.set( 'error', {
'old_format' : "Data format is outdated. Please re-export this viewer or revert to 3.5.1",
'old_format' : "Data format is outdated. Please re-export this viewer.",
'inconsistent_category' : "Category '%1' has inconsistent data (%2). Please re-export this viewer."
});

Expand Down
1 change: 1 addition & 0 deletions html/lang_zh.js
Expand Up @@ -59,6 +59,7 @@ _.l.set( 'data', {
});

_.l.set( 'error', {
'old_format' : "數據版本過舊。請重新匯出此數據庫。",
'inconsistent_category' : "分類'%1'數據有錯誤(%2)。請重新匯出此數據庫。"
});

Expand Down
26 changes: 22 additions & 4 deletions html/sparrow.js
Expand Up @@ -289,7 +289,7 @@ _.ucword = function _ucword ( txt ) {
*/
_.pref = function _pref ( key, defaultValue ) {
if ( arguments.length <= 1 ) defaultValue = null;
if ( window.localStorage ) {
if ( _.pref.hasStorage() ) {
var store = localStorage;
if ( key === undefined ) {
return Array( store.length ).fill( undefined ).map( function _pref_list ( e, i ) {
Expand Down Expand Up @@ -336,7 +336,7 @@ _.pref = function _pref ( key, defaultValue ) {
* Otherwise will be stored as string or as json string.
*/
_.pref.set = function _pref_set ( key, value ) {
if ( window.localStorage ) {
if ( _.pref.hasStorage() ) {
var store = window.localStorage;
if ( _.is.literal( key ) ) {
setter( key, value );
Expand All @@ -362,6 +362,22 @@ _.pref.set = function _pref_set ( key, value ) {
}
};

/**
* Detect localStorage access.
*
* @returns {Boolean} true if localStorage exists and is accessible
*/
_.pref.hasStorage = function _pref_hasStorage () {
try {
if ( window.localStorage )
return localStorage.removeItem( '__dummy__' ) || true;
else
return false;
} catch ( err ) {
return false; // Edge issue Issue #8816771 - KB3176936 cause local storage access to throw Unspecified Error.
}
};

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Function Helpers
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -454,7 +470,8 @@ _.js = function _js ( option, onload ) {
if ( onload !== undefined ) option.onload = onload;

// Validate before doing anything, if pass then we are done
if ( option.validate && option.validate.call( null, url, option ) ) return _js_done( option.onload );
if ( option.validate && option.validate.call( null, url, option ) )
return _.setImmediate( function _js_valid () { _js_done( option.onload ); } );

var url = option.url;

Expand Down Expand Up @@ -555,7 +572,8 @@ _.html = function _html ( txt, html ) {
} catch ( err ) {
frag = range.createContextualFragment( '<body>' + txt + '</body>' );
}
return frag.childElementCount > 1 ? frag : frag.firstElementChild;
var children = frag.children /* Firefox/Chrome */ || frag.childNodes /* Edge */;
return children.length > 1 ? frag : children[0];
} else {
_.forEach( _.domList( txt ), function _html_each( e ) {
e.innerHTML = html;
Expand Down
6 changes: 3 additions & 3 deletions html/style_data.css
Expand Up @@ -9,15 +9,15 @@
or may be plain text without p (race).
So create a default padding for the text and let elements undo the paddings */
.detail {
font-size: 90%;
background-color: #F8F8F8;
border: 2px solid #666;
border-radius: 10px;
box-shadow: 1ex 1ex 2ex #888;
font-size: 90%;
line-height: 1.2em;
padding: 0 10px;
max-width: 800px;
margin: 50px auto 10px;
padding: 0 10px;
}

.detail * { /* Reset all margins and paddings */
Expand Down Expand Up @@ -236,8 +236,8 @@

.detail .trapblocktitle {
display: block;
margin-top: 1em;
font-weight: bold;
margin-top: 1em;
}
.detail .trapblockbody {
display: block;
Expand Down

0 comments on commit e1c6e24

Please sign in to comment.