Adventure mode colouring now controlled by a CSS class
So that we can just toggle the class instead of having aiserver.py send back the entire story.
This commit is contained in:
parent
27c7baab92
commit
8fd8612cca
|
@ -705,7 +705,6 @@ def get_message(msg):
|
||||||
vars.adventure = msg['data']
|
vars.adventure = msg['data']
|
||||||
settingschanged()
|
settingschanged()
|
||||||
refresh_settings()
|
refresh_settings()
|
||||||
refresh_story()
|
|
||||||
elif(msg['cmd'] == 'importwi'):
|
elif(msg['cmd'] == 'importwi'):
|
||||||
wiimportrequest()
|
wiimportrequest()
|
||||||
|
|
||||||
|
@ -1328,8 +1327,7 @@ def refresh_story():
|
||||||
item = vars.actions[idx]
|
item = vars.actions[idx]
|
||||||
idx += 1
|
idx += 1
|
||||||
item = html.escape(item)
|
item = html.escape(item)
|
||||||
if vars.adventure: # Add special formatting to adventure actions
|
item = vars.acregex_ui.sub('<action>\\1</action>', item) # Add special formatting to adventure actions
|
||||||
item = vars.acregex_ui.sub('<action>\\1</action>', item)
|
|
||||||
text_parts.extend(('<chunk n="', str(idx), '" id="n', str(idx), '" tabindex="-1">', item, '</chunk>'))
|
text_parts.extend(('<chunk n="', str(idx), '" id="n', str(idx), '" tabindex="-1">', item, '</chunk>'))
|
||||||
emit('from_server', {'cmd': 'updatescreen', 'gamestarted': vars.gamestarted, 'data': formatforhtml(''.join(text_parts))}, broadcast=True)
|
emit('from_server', {'cmd': 'updatescreen', 'gamestarted': vars.gamestarted, 'data': formatforhtml(''.join(text_parts))}, broadcast=True)
|
||||||
|
|
||||||
|
@ -1356,8 +1354,7 @@ def update_story_chunk(idx: Union[int, Literal['last']]):
|
||||||
text = vars.actions[idx - 1]
|
text = vars.actions[idx - 1]
|
||||||
|
|
||||||
item = html.escape(text)
|
item = html.escape(text)
|
||||||
if vars.adventure: # Add special formatting to adventure actions
|
item = vars.acregex_ui.sub('<action>\\1</action>', item) # Add special formatting to adventure actions
|
||||||
item = vars.acregex_ui.sub('<action>\\1</action>', item)
|
|
||||||
|
|
||||||
chunk_text = f'<chunk n="{idx}" id="n{idx}" tabindex="-1">{formatforhtml(item)}</chunk>'
|
chunk_text = f'<chunk n="{idx}" id="n{idx}" tabindex="-1">{formatforhtml(item)}</chunk>'
|
||||||
emit('from_server', {'cmd': 'updatechunk', 'data': {'index': idx, 'html': chunk_text, 'last': (idx == (vars.actions.get_last_key() if len(vars.actions) else 0))}}, broadcast=True)
|
emit('from_server', {'cmd': 'updatechunk', 'data': {'index': idx, 'html': chunk_text, 'last': (idx == (vars.actions.get_last_key() if len(vars.actions) else 0))}}, broadcast=True)
|
||||||
|
|
|
@ -615,6 +615,11 @@ function setmodevisibility(state) {
|
||||||
|
|
||||||
function setadventure(state) {
|
function setadventure(state) {
|
||||||
adventure = state;
|
adventure = state;
|
||||||
|
if(state) {
|
||||||
|
game_text.addClass("adventure");
|
||||||
|
} else {
|
||||||
|
game_text.removeClass("adventure");
|
||||||
|
}
|
||||||
if(!memorymode){
|
if(!memorymode){
|
||||||
setmodevisibility(state);
|
setmodevisibility(state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,14 +6,14 @@ chunk {
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
}
|
}
|
||||||
|
|
||||||
action {
|
#gametext.adventure action {
|
||||||
color: #9ff7fa;
|
color: #9ff7fa;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk[contenteditable="true"]:focus, chunk[contenteditable="true"]:focus * {
|
chunk[contenteditable="true"]:focus, chunk[contenteditable="true"]:focus * {
|
||||||
color: #cdf;
|
color: #cdf !important;
|
||||||
font-weight: normal;
|
font-weight: normal !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
chunk, chunk * {
|
chunk, chunk * {
|
||||||
|
|
Loading…
Reference in New Issue