Skip to content

Commit

Permalink
Version 3.6.1
Browse files Browse the repository at this point in the history
- Fix Chrome crossorigin script error.
- Fix "Clear Filter" quick action not reliably showing up.
- Detect power keywords after semi-colon and "or". (e.g. power7432 Master's Surge)
- Fix trap xp does not always drop to new line.
- <a> buttons no longer change colour after click.
- Change initial page title.
- Prevent "[Attack Technique]" from showing up in page title.
- Restore five 0gp items's fix.
- More precise consumable fix.
  • Loading branch information
Sheep-y committed Dec 31, 2017
2 parents eb33779 + 22496cd commit fe795de
Show file tree
Hide file tree
Showing 17 changed files with 72 additions and 55 deletions.
4 changes: 2 additions & 2 deletions README.md
@@ -1,6 +1,6 @@
# 4e Compendium Downloader #

## Version 3.6 ##
## Version 3.6.1 ##

[![3 min. intro video](https://raw.githubusercontent.com/Sheep-y/trpg-dnd-4e-db/master/res/img/Frontpage.jpg)](https://youtu.be/aNDze9Ok5fE)

Expand Down Expand Up @@ -31,7 +31,7 @@ This is a fan project and does not come with copyrighted data.

The downloader is tested with Sun Java 8 and 9.
If you use [OpenJDK](http://openjdk.java.net/), you also need [OpenJFX](http://openjdk.java.net/projects/openjfx/). <br/>
The viewer is tested on Chrome 62, Edge 15, Firefox 57, IE 11, Android Chrome 62, and Android Firefox 57. <br/>
The viewer is tested on Chrome 63, Edge 15, Firefox 57, IE 11, Android Chrome 63, Android Firefox 57, and Android UC Browser 11.5. <br/>
Mac and iOS cannot be supported. Walled garden is walled.

## Differences from Official Compendium ##
Expand Down
5 changes: 4 additions & 1 deletion html/action_about.html
Expand Up @@ -176,7 +176,10 @@ <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> <a href='https://github.com/Sheep-y/trpg-dnd-4e-db/releases/tag/release/3.6'>3.6 <time>2017-12-15</time></a> </dt>
<dt> <a href='https://github.com/Sheep-y/trpg-dnd-4e-db/releases/tag/release/3.6.1'>3.6.1 <time>2017-12-31</time></a> </dt>
<dd> Chrome cross origin request (CORS) script error and other bugs fixed. </dd>

<dt> <a href='https://github.com/Sheep-y/trpg-dnd-4e-db/releases/tag/release/3.6'>3.6.0 <time>2017-12-15</time></a> </dt>
<dd> Regroup Artifact, Lair, and Alchemical items. Add size and type column to companions and monsters. Add Artifact and Item Set rules.
Allow filtering empty columns. Exclude more flavour text from search. Better mobile support and UI.
Reduce file count to 446, supports LZMA+Base85 compression (57MB to 12MB). Allow exporting unfixed data and dumping fixed data.
Expand Down
39 changes: 21 additions & 18 deletions html/action_list.html
Expand Up @@ -231,7 +231,6 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>

<script><?coco-start js(minify) ?> 'use strict';(function action_list_init(){


od.action.list = {
'url' : /^list\b/,
'last_url' : null,
Expand Down Expand Up @@ -434,11 +433,11 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>
return _( '#act_list_txt_search' )[0].value;
},

'get_filters' : function act_list_get_filters () {
return _.ary( _( '.txt_filter' ) ).map( function ( txt ) {
'get_filters' : function act_list_get_filters ( table ) {
return _.ary( _( table, '.txt_filter' ) ).map( function ( txt ) {
return txt.value;
} ).filter( function ( val ) {
return val;
return val.trim().length;
} );
},

Expand Down Expand Up @@ -661,9 +660,7 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>
action.show_list( table );
table.addEventListener( 'click', action.table_click );
table.addEventListener( 'mousedown', action.table_mousedown );
table.addEventListener( 'keypress', function act_list_table_keypressed ( evt ) {
if ( evt.keyCode === 13 ) action.table_click( evt ); // Trigger a click when pressing Enter
});
table.addEventListener( 'input', action.table_click );
_.show( '#act_list_pnl_list' )[0].appendChild( table );
},

Expand Down Expand Up @@ -725,8 +722,12 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>
if ( filter && data.length )
data = data.filter( filter );
} );
var label = orig_len === data.length ? 'action.list.lbl_showing' : 'action.list.lbl_filter';
_.attr( '#act_list_lbl_showing', 'text', _.l( label, '%1/%2', data.length, orig_len ) );
if ( orig_len === data.length ) {
_.attr( '#act_list_lbl_showing', 'text', _.l( 'action.list.lbl_showing', '%1', orig_len ) );
} else {
_.attr( '#act_list_lbl_showing', 'text', _.l( 'action.list.lbl_filter', '%1/%2', data.length, orig_len ) );
_.time( '[List] Filtered ' + orig_len + ' rows' );
}
this.build_datalist( data );
return data;
},
Expand All @@ -737,10 +738,10 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>
var action = this, gui = od.gui;
var data = action.data, col = action.columns, cat = action.get_search_category();
var cl = col.length, idField = col[ 0 ];
_.info( '[List] Filter, sort, and display ' + data.length + ' rows' );

if ( ! table ) table = _( '#act_list_pnl_list table' )[0];
_.remove( table, 'tbody' );
_.time( "[List] Cleared previous list." );
var body = _.create( 'tbody' );

// Filter data and update displayed result count
Expand All @@ -750,29 +751,29 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>
if ( ! count ) {
gui.total_page = gui.page = 0;
html = '<tr><td rowspan=99 align=center>';
html += _.l( 'action.list.lbl_no_result', 'No result' );
html += _.l( 'action.list.lbl_no_result', 'No result. ' );
var actions = [];
if ( action.search_type === 'name' )
actions.push( _.l( 'action.list.switch_to_full_text', "<a onclick='od.action.list.search(\"full\");'>Full search</a>" ) );
if ( cat )
actions.push( _.l( 'action.list.switch_to_all', "<a onclick='od.action.list.a_category();'>Search All</a>" ) );
if ( action.get_search_term() )
actions.push( _.l( 'action.list.clear_search', "<a onclick='od.action.list.clear_search();'>Clear search</a>" ) );
if ( action.get_filters().length > 0 )
if ( action.get_filters( table ).length > 0 )
actions.push( _.l( 'action.list.clear_filter', "<a onclick='od.action.list.clear_filter();'>Clear filter</a>" ) );

var comma = _.l( 'gui.,', ', ' ), _or = _.l( 'gui.or', ' or ' ), mark = _.l( 'gui.?', '?' );
switch ( actions.length ) {
case 1:
html += actions[0] + _.l( 'gui.?', '?' ); break;
case 2:
html += actions[0] + _.l( 'gui.or', ' or ' ) + actions[1] + _.l( 'gui.?', '?' ); break;
case 3:
html += actions[0] + _.l( 'gui.,', ', ' ) + actions[1] + _.l( 'gui.or', ' or ' ) + actions[2] + _.l( 'gui.?', '?' ); break;
case 0 : break;
case 1 : html += actions[0] + mark; break;
default: html += actions.slice( 0, -1 ).join( comma ) + _or + actions[ actions.length-1 ] + mark;
}
od.action.view.siblings = [];

} else {
if ( action.sort_field && data[0][ action.sort_field ] !== undefined ) {
od.search.sort_data( data, action.sort_field, action.sort_asc ? 'asc' : 'desc' );
_.time( '[List] Sorted ' + data.length + ' rows' );
}

// Create highlight for each column
Expand Down Expand Up @@ -814,6 +815,8 @@ <h1 id='act_list_h_title' class='i18n'>action.list.title</h1>

if ( count )
_.time( '[List] Listed ' + ( end - start ) + ' / ' + count + ' results.' );
else
_.time( '[List] No data. Proposed ' + actions.length + ' quick actions.' );
},

/** Update paging state */
Expand Down
2 changes: 1 addition & 1 deletion html/action_view.html
Expand Up @@ -220,7 +220,7 @@ <h1 id="act_view_h_title"></h1>
div.innerHTML = od.gui.highlight( content );
// Find title
var h1 = content ? content.match( /<h1[^>]*>(.+?)<\/h1\s*>/ ) : null;
action.set_title( h1 ? h1[1].replace( /<(\w+)[^>]*>.*<\/\1>|<br\/?>/g, '' ) : idList.join(', ') );
action.set_title( h1 ? h1[1].replace( /<(\w+)[^>]*>.*<\/\1>|<br\/?>|\[Attack Technique\]/g, '' ).trim() : idList.join(', ') );
},

"update_nav_button" : function act_view_update_nav_button () {
Expand Down
2 changes: 1 addition & 1 deletion html/html_template.html
Expand Up @@ -69,7 +69,7 @@ <h1 lang='zh'> 請啟用 JavaScript </h1>
<div id="js_enable_pointer" style=""></div><!-- Points to 'Allow' button on IE. Rough position, not accurate, but enough. -->
</noscript>
<?coco file( "action_list.html", "action_view.html", "action_about.html" ) coco trim(xml) ?>
<script async crossorigin src="4e_database_files/res/script.js?<?coco var( time.last_modified ) ?>" onload="script_loaded()" onerror="script_error(error)"></script>
<script async src="4e_database_files/res/script.js?<?coco var( time.last_modified ) ?>" onload="script_loaded()" onerror="script_error()"></script>
</body></html><?coco-output "../res/4e_database.html" ?><?coco-end?><?coco-start?>
<?coco file( "images.css", "style_data.css") css(minify) ?>
<?coco-output "../res/style.css" ?><?coco-end?><?coco-start?>'use strict';
Expand Down
2 changes: 1 addition & 1 deletion html/lang_en.js
Expand Up @@ -51,7 +51,7 @@ _.l.set( 'gui', {
});

_.l.set( 'action.list', {
'title' : "Browse",
'title' : "4e Database",
'link_text' : "Browse",
'result_summary' : "Result",
'menu_filter_column' : 'Add %1 to filter',
Expand Down
2 changes: 1 addition & 1 deletion html/lang_zh.js
Expand Up @@ -86,7 +86,7 @@ _.l.set( 'gui', {
});

_.l.set( 'action.list', {
'title' : "瀏覽",
'title' : "四版資料庫",
'link_text' : "瀏覽",
'result_summary' : "結果",
'menu_filter_column' : '新增過濾:%1 ',
Expand Down
3 changes: 3 additions & 0 deletions html/style_data.css
Expand Up @@ -272,6 +272,9 @@
font-weight: bold;
margin-top: 1em;
}
.detail .thXP {
display: block;
}
.detail .trapblockbody {
display: block;
}
9 changes: 6 additions & 3 deletions html/style_gui.css
Expand Up @@ -28,15 +28,18 @@ html {
.i18n{ /* Dummy class to surpress warning, not actually styled */ }

a {
color: darkred;
color: #600;
text-decoration: none;
}
a:hover {
color: red;
color: #D00;
text-decoration: underline;
}
a:visited {
color: #822;
}

button, .button {
button, .button, .button:visited {
background-color: gold;
border-radius: 1ex;
border: 1px outset #888;
Expand Down
4 changes: 2 additions & 2 deletions java/db4e/Main.java
Expand Up @@ -33,8 +33,8 @@ public class Main {
}

static String TITLE = "Compendium downloader";
static String VERSION = "3.6";
static String UPDATE_TIME = "2017-12-16"; // Any release beyond this time is an update
static String VERSION = "3.6.1";
static String UPDATE_TIME = "2018-01-01"; // Any release beyond this time is an update

// Global log ang preference
public static final Logger log = Logger.getLogger( Main.class.getName() );
Expand Down
2 changes: 1 addition & 1 deletion java/db4e/converter/BackgroundConverter.java
Expand Up @@ -55,7 +55,7 @@ else if ( meta( CAMPAIGN ).equals( "Forgotten Realms" ) )
}

if ( find( regxAnyLang ) ) {
entry.setContent( regxAnyLang.replaceFirst( "Any language except " ) );
data( regxAnyLang.replaceFirst( "Any language except " ) );
fix( "consistency" );
}

Expand Down
10 changes: 7 additions & 3 deletions java/db4e/converter/Converter.java
Expand Up @@ -78,7 +78,7 @@ else if ( isOpen )
@Override protected void correctEntry () {
// Moves front-loaded level label to back for easier and consistent styling.
if ( find( regxTitleLevel ) )
entry.setContent( regxTitleLevel.replaceAll( "$1$3$2" ) );
data( regxTitleLevel.replaceAll( "$1$3$2" ) );

if ( Main.debug.get() ) {
if ( shortId.containsKey( entry.getId() ) )
Expand Down Expand Up @@ -415,19 +415,23 @@ protected final Set<String> appendList ( Set<String> list, String ... name ) {
}

protected final void swap ( CharSequence from, CharSequence to ) {
entry.setContent( data().replace( from, to ) );
data( data().replace( from, to ) );
test( TEXT, to );
}

protected final void swapFirst ( String from, String to ) {
entry.setContent( data().replaceFirst( from, to ) );
data( data().replaceFirst( from, to ) );
test( TEXT, to );
}

protected final String data () {
return entry.getContent();
}

protected final void data ( String data ) {
entry.setContent( data );
}

protected final String meta ( int index ) {
return entry.getSimpleField( index );
}
Expand Down
4 changes: 2 additions & 2 deletions java/db4e/converter/GlossaryConverter.java
Expand Up @@ -17,7 +17,7 @@ public GlossaryConverter ( Category category ) {
@Override protected void correctEntry () {
if ( entry.getId().startsWith( "skill" ) ) { // Fix skills missing "improvising with" title
if ( ! find( "IMPROVISING WITH" ) ) {
entry.setContent( regxFlavor.reset( data() ).replaceFirst( "<h3>IMPROVISING WITH "+entry.getName().toUpperCase()+"</h3><p class=flavor>" ) );
data( regxFlavor.reset( data() ).replaceFirst( "<h3>IMPROVISING WITH "+entry.getName().toUpperCase()+"</h3><p class=flavor>" ) );
test( TEXT, "<h3>IMPROVISING WITH " );
fix( "missing content" );
}
Expand All @@ -26,7 +26,7 @@ public GlossaryConverter ( Category category ) {
case "glossary381": // Concordance, change to Artifact
entry.setName( "Artifact" );
swap( "<h1 class=player>Concordance</h1><p class=flavor>", "<h3>Concordance</h3><p>" );
entry.setContent( "<h1 class=player>Artifact</h1>"
data( "<h1 class=player>Artifact</h1>"
+ "<p class=flavor>Artifacts have a level but no price - they can't be " +
"bought or crafted, and their temporary nature ensures that they don't have a long-term impact on a character's " +
"total wealth. As with normal magic items, an artifact's level measures the potency of its properties and " +
Expand Down
10 changes: 5 additions & 5 deletions java/db4e/converter/ItemConverter.java
Expand Up @@ -108,7 +108,7 @@ private void setArmorType ( Entry entry ) {
String type = regxType.group( 2 ).trim();
// Detect "Chain, cloth, hide, leather, plate or scale" and other variants
if ( type.split( ", " ).length >= 5 ) {
entry.setContent( regxType.replaceFirst( "<b>$1</b>: Any" ) );
data( regxType.replaceFirst( "<b>$1</b>: Any" ) );
test( TEXT, "</b>: Any" );
meta( TYPE, "Any" );
fix( "consistency" );
Expand Down Expand Up @@ -374,13 +374,13 @@ private void setCost ( Entry entry ) {

@Override protected void correctEntry () {
if ( ! find( regxPublished ) ) {
entry.setContent( data() + "<p class=publishedIn>Published in " + meta( SOURCE ) + ".</p>" );
data( data() + "<p class=publishedIn>Published in " + meta( SOURCE ) + ".</p>" );
test( TEXT, "<p class=publishedIn>Published in" );
fix( "missing published" );
}

if ( find( ", which is reproduced below." ) ) {
entry.setContent( regxWhichIsReproduced.reset( data() ).replaceFirst( "" ) );
data( regxWhichIsReproduced.reset( data() ).replaceFirst( "" ) );
test( TEXT, Pattern.compile( ".*(?!, which is reproduced below\\.)" ) );
fix( "consistency" );
}
Expand Down Expand Up @@ -516,7 +516,7 @@ private void setCost ( Entry entry ) {
case "item2469": // Shelter of Fate
case "item2533": // Slaying Stone of Kiris Dahn
case "item2995": // Vision of the Vizier
swapFirst( +0 gp", "" );
swapFirst( " 0 gp", "" );
meta( COST, "" );
fix( "consistency" );
break;
Expand Down Expand Up @@ -588,7 +588,7 @@ private void setCost ( Entry entry ) {
// Add "At-Will" to the ~150 items missing a power frequency.
// I checked each one and the exceptions are above.
if ( find( regxPowerFrequency ) ) {
entry.setContent( regxPowerFrequency.replaceAll( "✦ At-Will (" ) );
data( regxPowerFrequency.replaceAll( "✦ At-Will (" ) );
test( TEXT, "✦ At-Will (" );
fix( "missing power frequency" );
}
Expand Down
7 changes: 4 additions & 3 deletions java/db4e/converter/LeveledConverter.java
Expand Up @@ -125,13 +125,14 @@ else if ( level > 0 )
swap( ">Published in .<", ">Published in Dungeon Magazine 211.<" );
fix( "missing published" );
break;
case "poison03561": // Aboleth Slime Concentrate
case "poison03562": // Gibbering Grind
case "poison03563": // Grell Bile
case "poison03564": // Umber Dust
case "poison03565": // Heart of Mimic Powder
case "poison03566": // Mind Flayer Tentacle Extract
swap( " (Consumable)", "" );
// fallthrough
case "poison03561": // Aboleth Slime Concentrate
case "poison03563": // Grell Bile
case "poison03566": // Mind Flayer Tentacle Extract
swap( "(Consumable, ", "(" );
swap( " ✦ (", " ✦ Consumable (" );
fix( "missing power frequency" );
Expand Down
14 changes: 7 additions & 7 deletions java/db4e/converter/PowerConverter.java
Expand Up @@ -24,8 +24,8 @@ public PowerConverter ( Category category ) {
super.initialise();
}

private final Matcher regxKeywords = Pattern.compile( "✦     (<b>[\\w ]+</b>(?:, <b>[\\w ]+</b>)*)" ).matcher( "" );
private final Matcher regxLevel = Pattern.compile( "<span class=level>([^<]+) (Racial )?(Attack|Utility|Feature|Pact Boon|Cantrip)( \\d+)?" ).matcher( "" );
private final Matcher regxLevel = Pattern.compile( "<span class=level>([^<]+?) (Racial )?+(Attack|Utility|Feature|Pact Boon|Cantrip){1}+( \\d++)?" ).matcher( "" );
private final Matcher regxKeywords = Pattern.compile( "✦     (<b>[\\w ]++</b>(?:\\s*+(?:[;,]|or){1}+\\s*+<b>[\\w ]++</b>)*+)" ).matcher( "" );

@Override protected void convertEntry () {
Object[] fields = entry.getFields();
Expand All @@ -44,13 +44,13 @@ else if ( meta( CLASS ).equals( "Theme Power" ) ) {
}

// Set frequency part of power type, a new column
if ( entry.getContent().startsWith( "<h1 class=dailypower>" ) )
if ( data().startsWith( "<h1 class=dailypower>" ) ) {
meta( TYPE, "Daily" );
else if ( entry.getContent().startsWith( "<h1 class=encounterpower>" ) )
} else if ( data().startsWith( "<h1 class=encounterpower>" ) ) {
meta( TYPE, "Enc." );
else if ( entry.getContent().startsWith( "<h1 class=atwillpower>" ) )
} else if ( data().startsWith( "<h1 class=atwillpower>" ) ) {
meta( TYPE, "At-Will" );
else
} else
warn( "Power with unknown frequency" );

// Set type part of power type column
Expand All @@ -71,7 +71,7 @@ else if ( entry.getContent().startsWith( "<h1 class=atwillpower>" ) )
if ( find( regxKeywords ) ) {
Set<String> keywords = new HashSet<>(8); // Some power have multiple keyword lines.
do {
keywords.addAll( Arrays.asList( regxKeywords.group( 1 ).replaceAll( "</?b>", "" ).split( ", " ) ) );
keywords.addAll( Arrays.asList( regxKeywords.group( 1 ).replaceAll( "\\s*+([;,]|or)\\s*+", "," ).replaceAll( "</?b>", "" ).split( "," ) ) );
} while ( regxKeywords.find() );
meta( KEYWORDS, String.join( ", ", keywords.toArray( new String[ keywords.size() ] ) ) );
} else {
Expand Down
8 changes: 4 additions & 4 deletions launch4j.xml
Expand Up @@ -24,14 +24,14 @@
<maxHeapSize>1024</maxHeapSize>
</jre>
<versionInfo>
<fileVersion>3.6.0.0</fileVersion>
<fileVersion>3.6.1.0</fileVersion>
<txtFileVersion>4e Compendium Downloader</txtFileVersion>
<fileDescription>4e Compendium Downloader</fileDescription>
<copyright>2012-2017</copyright>
<productVersion>3.6.0.0</productVersion>
<txtProductVersion>3.6.0.0</txtProductVersion>
<productVersion>3.6.1.0</productVersion>
<txtProductVersion>3.6.1.0</txtProductVersion>
<productName>4e Compendium Downloader</productName>
<companyName></companyName>
<companyName>Sheepy</companyName>
<internalName>oddi</internalName>
<originalFilename>4e_compendium_downloader.exe</originalFilename>
<trademarks></trademarks>
Expand Down

0 comments on commit fe795de

Please sign in to comment.