Add return to all onclicks, and ; to other javascript hooks.

This commit is contained in:
voussoir 2020-09-04 10:37:04 -07:00
parent 1f88b007cd
commit 295c9b4956
11 changed files with 47 additions and 47 deletions

View file

@ -133,7 +133,7 @@ h2, h3
data-is-input="1"
data-prompt="Album title"
data-cancel-class="gray_button"
data-onclick="create_child(event.target.input_source.value);"
data-onclick="return create_child(event.target.input_source.value);"
>
Create album
</button>
@ -184,7 +184,7 @@ ALBUM_ID = undefined;
<button
class="red_button button_with_confirm"
data-onclick="api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums)"
data-onclick="return api.albums.delete(ALBUM_ID, api.albums.callback_go_to_albums);"
data-prompt="Delete Album?"
data-cancel-class="gray_button"
>
@ -196,7 +196,7 @@ ALBUM_ID = undefined;
data-is-input="1"
data-prompt="Album title"
data-cancel-class="gray_button"
data-onclick="create_child(event.target.input_source.value);"
data-onclick="return create_child(event.target.input_source.value);"
>
Create child
</button>
@ -206,14 +206,14 @@ ALBUM_ID = undefined;
data-is-input="1"
data-prompt="Child ID"
data-cancel-class="gray_button"
data-onclick="add_child(event.target.input_source.value);"
data-onclick="return add_child(event.target.input_source.value);"
>
Add child
</button>
<button
class="green_button button_with_spinner"
onclick="api.albums.refresh_directories(ALBUM_ID, common.refresh);"
onclick="return api.albums.refresh_directories(ALBUM_ID, common.refresh);"
data-spinner-delay="500"
{% if not album.get_associated_directories() %}
title="No associated directories"
@ -300,8 +300,8 @@ ALBUM_ID = undefined;
{{clipboard_tray.clipboard_tray()}}
<div class="my_clipboard_tray_toolbox">
<button class="green_button" onclick="paste_photo_clipboard()">Add to this album</button>
<button class="red_button" onclick="unpaste_photo_clipboard()">Remove from this album</button>
<button class="green_button" onclick="return paste_photo_clipboard();">Add to this album</button>
<button class="red_button" onclick="return unpaste_photo_clipboard();">Remove from this album</button>
</div>
</div>
</body>

View file

@ -6,10 +6,10 @@
id="{{id}}"
class="album_card album_card_{{view}}"
data-id="{{album.id}}"
ondragstart="on_album_drag_start(event)"
ondragend="on_album_drag_end(event)"
ondragover="on_album_drag_over(event)"
ondrop="on_album_drag_drop(event)"
ondragstart="on_album_drag_start(event);"
ondragend="on_album_drag_end(event);"
ondragover="on_album_drag_over(event);"
ondrop="on_album_drag_drop(event);"
{% if album != "root" and draggable %}
draggable=true
{% endif %}
@ -26,7 +26,7 @@ draggable=true
{% if unlink_parent is not none %}
<button
class="remove_child_button button_with_confirm red_button"
data-onclick="api.albums.remove_child('{{unlink_parent.id}}', '{{album.id}}', common.refresh)"
data-onclick="return api.albums.remove_child('{{unlink_parent.id}}', '{{album.id}}', common.refresh);"
data-prompt="Remove child?"
data-holder-class="remove_child_button"
data-confirm-class="red_button"

View file

@ -77,7 +77,7 @@
<button
class="red_button button_with_confirm"
data-onclick="api.bookmarks.delete('{{bookmark.id}}', common.refresh)"
data-onclick="return api.bookmarks.delete('{{bookmark.id}}', common.refresh);"
data-prompt="Delete Bookmark?"
data-cancel-class="gray_button"
>
@ -89,7 +89,7 @@
<div class="new_bookmark_card">
<input id="new_bookmark_title" type="text" placeholder="title (optional)">
<input id="new_bookmark_url" type="text" placeholder="url">
<button id="new_bookmark_button" class="green_button" onclick="create_bookmark_form()">Create</button>
<button id="new_bookmark_button" class="green_button" onclick="return create_bookmark_form();">Create</button>
</div>
</div>
</div>

View file

@ -99,7 +99,7 @@
<div id="content_body" class="sticky_side_right">
<div id="left">
<div class="panel">The clipboard contains <span class="clipboard_count">0</span> items.
<button id="clear_clipboard_button" class="red_button" onclick="photo_clipboard.clear_clipboard()">Clear it.</button>
<button id="clear_clipboard_button" class="red_button" onclick="return photo_clipboard.clear_clipboard();">Clear it.</button>
</div>
<div id="photo_card_holder">
@ -109,25 +109,25 @@
<div id="toolbox">
<div id="add_tag_area">
<input type="text" id="add_tag_textbox" list="tag_autocomplete_datalist">
<button class="add_tag_button green_button" id="add_tag_button" onclick="add_tag_form();">Add tag</button>
<button class="add_tag_button green_button" id="add_tag_button" onclick="return add_tag_form();">Add tag</button>
</div>
<div id="remove_tag_area">
<input type="text" id="remove_tag_textbox" list="tag_autocomplete_datalist">
<button class="red_button" id="remove_tag_button" onclick="remove_tag_form();">Remove tag</button>
<button class="red_button" id="remove_tag_button" onclick="return remove_tag_form();">Remove tag</button>
</div>
<div id="refresh_metadata_area">
<button class="green_button button_with_spinner" id="refresh_metadata_button" data-spinner-delay="500" onclick="refresh_metadata_form();">Refresh metadata</button>
<button class="green_button button_with_spinner" id="refresh_metadata_button" data-spinner-delay="500" onclick="return refresh_metadata_form();">Refresh metadata</button>
</div>
<div id="searchhidden_area">
<button class="yellow_button" id="set_searchhidden_button" onclick="set_searchhidden_form()">Searchhide</button>
<button class="yellow_button" id="unset_searchhidden_button" onclick="unset_searchhidden_form()">Unhide</button>
<button class="yellow_button" id="set_searchhidden_button" onclick="return set_searchhidden_form();">Searchhide</button>
<button class="yellow_button" id="unset_searchhidden_button" onclick="return unset_searchhidden_form();">Unhide</button>
</div>
<div id="download_zip_area">
<button class="yellow_button" id="download_zip_button" onclick="download_zip_form()">Download .zip</button>
<button class="yellow_button" id="download_zip_button" onclick="return download_zip_form();">Download .zip</button>
</div>
</div>

View file

@ -3,13 +3,13 @@
<button
id="clipboard_tray_expandbutton"
class="yellow_button"
onclick="photo_clipboard.clipboard_tray_collapse_toggle()"
onclick="return photo_clipboard.clipboard_tray_collapse_toggle();"
>Clipboard: <span class="clipboard_count">0</span> items</button>
<div id="clipboard_tray_body" class="hidden">
<div id="clipboard_tray_toolbox">
<span id="clipboard_tray_toolbox_firstline">
<a target="_blank" href="/clipboard">Full clipboard</a>
<button id="clear_clipboard_button" class="red_button" onclick="photo_clipboard.clear_clipboard()">Clear</button>
<button id="clear_clipboard_button" class="red_button" onclick="return photo_clipboard.clear_clipboard();">Clear</button>
</span>
<!--
If the page contains a div with the class `my_clipboard_tray_toolbox`,

View file

@ -5,7 +5,7 @@
<a class="header_element" href="/tags">Tags</a>
{% if session.user %}
<a class="header_element" href="/user/{{session.user.username}}">{{session.user.display_name}}</a>
<button class="header_element" onclick="api.users.logout(common.refresh);" style="flex:0">Logout</button>
<button class="header_element" onclick="return api.users.logout(common.refresh);" style="flex:0">Logout</button>
{% else %}
<a class="header_element" href="/login">Log in</a>
{% endif %}

View file

@ -70,7 +70,7 @@ form h2
<h2>Log in</h2>
<input type="text" id="login_input_username" name="username" placeholder="username" autofocus>
<input type="password" id="login_input_password" name="password" placeholder="password">
<button type="submit" id="login_submit_button" class="green_button" onclick="login_form(event)">Log in</button>
<button type="submit" id="login_submit_button" class="green_button" onclick="return login_form(event);">Log in</button>
</form>
<form id="register_form" class="panel" action="/register" method="post">
<h2>Register</h2>
@ -78,7 +78,7 @@ form h2
<input type="text" id="register_input_display_name" name="display_name" placeholder="display name (optional)">
<input type="password" id="register_input_password_1" name="password_1" placeholder="password (at least {{min_password_length}})">
<input type="password" id="register_input_password_2" name="password_2" placeholder="password again">
<button type="submit" id="register_input_button" class="green_button" onclick="register_form(event)">Register</button>
<button type="submit" id="register_input_button" class="green_button" onclick="return register_form(event);">Register</button>
</form>
<div id="message_area">
</div>

View file

@ -160,7 +160,7 @@
<ul id="this_tags">
<li>
<input id="add_tag_textbox" type="text" list="tag_autocomplete_datalist" autofocus>
<button id="add_tag_button" class="green_button" onclick="add_photo_tag_form();">add</button>
<button id="add_tag_button" class="green_button" onclick="return add_photo_tag_form();">add</button>
</li>
{% set tags = photo.get_tags()|sort_tags %}
{% for tag in tags %}
@ -168,7 +168,7 @@
{{tag_object.tag_object(tag, with_alt_description=True)}}<!--
--><button
class="remove_tag_button red_button"
onclick="remove_photo_tag_form('{{photo.id}}', '{{tag.name}}');">
onclick="return remove_photo_tag_form('{{photo.id}}', '{{tag.name}}');">
</button>
</li>
{% endfor %}
@ -194,8 +194,8 @@
{% endif %}
<li><a href="{{photo|file_link}}?download=true&original_filename=true">Download as original filename</a></li>
<li><a href="{{photo|file_link}}?download=true">Download as {{photo.id}}.{{photo.extension}}</a></li>
<li><button id="refresh_metadata_button" class="green_button button_with_spinner" onclick="refresh_metadata_form();">refresh</button></li>
<li><label class="photo_card" data-id="{{photo.id}}"><input type="checkbox" class="photo_card_selector_checkbox" onclick="photo_clipboard.on_photo_select(event)"/>Clipboard</label></li>
<li><button id="refresh_metadata_button" class="green_button button_with_spinner" onclick="return refresh_metadata_form();">refresh</button></li>
<li><label class="photo_card" data-id="{{photo.id}}"><input type="checkbox" class="photo_card_selector_checkbox" onclick="return photo_clipboard.on_photo_select(event);"/>Clipboard</label></li>
</ul>
@ -223,7 +223,7 @@
<div id="right">
<!-- THE PHOTO ITSELF -->
<div id="photo_viewer" class="photo_viewer_{{photo.simple_mimetype}}" {%if photo.simple_mimetype == "image"%}onclick="toggle_hoverzoom(event)"{%endif%}>
<div id="photo_viewer" class="photo_viewer_{{photo.simple_mimetype}}" {%if photo.simple_mimetype == "image"%}onclick="return toggle_hoverzoom(event);"{%endif%}>
{% if photo.simple_mimetype == "image" %}
<img src="{{photo|file_link}}" alt="{{photo.basename}}" onload="this.style.opacity=0.99">
@ -245,11 +245,11 @@
</div>
<div id="hovering_tools">
{% if photo.simple_mimetype == "video" %}
<button id="generate_thumbnail_button" class="green_button button_with_spinner" onclick="generate_thumbnail_for_video(event)">Capture thumbnail</button>
<button id="generate_thumbnail_button" class="green_button button_with_spinner" onclick="return generate_thumbnail_for_video(event);">Capture thumbnail</button>
{% endif %}
<button
class="red_button button_with_confirm"
data-onclick="api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search)"
data-onclick="return api.photos.delete(PHOTO_ID, false, api.photos.callback_go_to_search);"
data-prompt="Delete photo, keep file?"
data-cancel-class="gray_button"
>
@ -258,7 +258,7 @@
<button
class="red_button button_with_confirm"
data-onclick="api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search)"
data-onclick="return api.photos.delete(PHOTO_ID, true, api.photos.callback_go_to_search);"
data-prompt="Delete file on disk?"
data-cancel-class="gray_button"
>

View file

@ -26,7 +26,7 @@
{% endif -%}
<div class="photo_card photo_card_{{view}} photo_card_unselected" data-id="{{photo.id}}">
<input type="checkbox" class="photo_card_selector_checkbox" onclick="photo_clipboard.on_photo_select(event)"/>
<input type="checkbox" class="photo_card_selector_checkbox" onclick="return photo_clipboard.on_photo_select(event);"/>
<div class="photo_card_filename"><a target="_blank" href="/photo/{{photo.id}}">{{photo.basename}}</a></div>
<span class="photo_card_metadata">
{{- metadata_inner|safe -}}

View file

@ -154,7 +154,7 @@
{% macro create_orderby_li(selected_column, selected_sorter) %}
<li class="search_builder_orderby_li">
<select onchange="orderby_hide_direction_hook(event)">
<select onchange="orderby_hide_direction_hook(event);">
<option value="created" {{"selected" if selected_column=="created" else ""}} >Creation date</option>
<option value="area" {{"selected" if selected_column=="area" else ""}} >Area</option>
<option value="width" {{"selected" if selected_column=="width" else ""}} >Width</option>
@ -169,7 +169,7 @@
<option value="desc" {{"selected" if selected_sorter=="desc" else ""}} >Descending</option>
<option value="asc" {{"selected" if selected_sorter=="asc" else ""}} >Ascending</option>
</select>
<button class="remove_tag_button_perm red_button" onclick="orderby_remove_hook(this);"></button>
<button class="remove_tag_button_perm red_button" onclick="return orderby_remove_hook(this);"></button>
</li>
{% endmacro %}
</head>
@ -189,7 +189,7 @@
<li class="search_builder_{{tagtype}}_inputted">
<span class="tag_object">{{tagname}}</span>{{-''-}}
<button class="remove_tag_button red_button"
onclick="remove_searchtag(ul_{{tagtype}}, '{{tagname}}', inputted_{{tagtype}});"></button>
onclick="return remove_searchtag(ul_{{tagtype}}, '{{tagname}}', inputted_{{tagtype}});"></button>
</li>
{% endfor %}
{% endif %}
@ -216,7 +216,7 @@
{% else %}
{{ create_orderby_li(selected_column=0, selected_sorter=0) }}
{% endif %}
<li id="search_builder_orderby_newrow"><button class="green_button" onclick="add_new_orderby()">+</button></li>
<li id="search_builder_orderby_newrow"><button class="green_button" onclick="return add_new_orderby();">+</button></li>
</ul>
</div>
<br>
@ -310,21 +310,21 @@
{{tag_object.tag_object(
tag,
link=None,
onclick="tags_on_this_page_add_must(event, '" + tag.name + "');",
onclick="return tags_on_this_page_add_must(event, '" + tag.name + "');",
innertext="(+)",
)}}
{{tag_object.tag_object(
tag,
link=None,
onclick="tags_on_this_page_add_may(event, '" + tag.name + "');",
onclick="return tags_on_this_page_add_may(event, '" + tag.name + "');",
innertext="(~)",
)}}
{{tag_object.tag_object(
tag,
link=None,
onclick="tags_on_this_page_add_forbid(event, '" + tag.name + "');",
onclick="return tags_on_this_page_add_forbid(event, '" + tag.name + "');",
innertext="(x)",
)}}

View file

@ -98,7 +98,7 @@ h2, h3
<div id="right">
<div id="editor_area">
<input type="text" id="add_tag_textbox" autofocus>
<button class="add_tag_button green_button" id="add_tag_button" onclick="easybake_form();">bake</button>
<button class="add_tag_button green_button" id="add_tag_button" onclick="return easybake_form();">bake</button>
</div>
<div id="message_area">
</div>
@ -130,7 +130,7 @@ h2, h3
<button
class="red_button button_with_confirm"
data-onclick="api.tags.delete('{{specific_tag.name}}', api.tags.callback_go_to_tags);"
data-onclick="return api.tags.delete('{{specific_tag.name}}', api.tags.callback_go_to_tags);"
data-prompt="Delete Tag?"
data-confirm="Delete"
data-cancel-class="gray_button"
@ -173,7 +173,7 @@ h2, h3
{{tag_object.tag_object(tag, link='search', innertext=qualified_name, with_alt_description=True)-}}
<button
class="remove_tag_button red_button button_with_confirm"
data-onclick="api.tags.remove_child('{{qualified_name.split('.')[-2]}}', '{{tag.name}}', tag_action_callback);"
data-onclick="return api.tags.remove_child('{{qualified_name.split('.')[-2]}}', '{{tag.name}}', tag_action_callback);"
data-prompt="Unlink Tags?"
data-confirm="Unlink"
data-confirm-class="remove_tag_button_perm red_button"
@ -188,7 +188,7 @@ h2, h3
{{tag_object.tag_object(tag, link='search', innertext=qualified_name, with_alt_description=True)-}}
<button
class="remove_tag_button red_button button_with_confirm"
data-onclick="api.tags.delete('{{qualified_name}}', tag_action_callback);"
data-onclick="return api.tags.delete('{{qualified_name}}', tag_action_callback);"
data-prompt="Delete Tag?"
data-confirm="Delete"
data-confirm-class="remove_tag_button_perm red_button"
@ -206,7 +206,7 @@ h2, h3
{{tag_object.tag_object(tag, link='search', innertext=qualified_name + '+' + synonym)-}}
<button
class="remove_tag_button red_button button_with_confirm"
data-onclick="api.tags.remove_synonym('{{tag.name}}', '{{synonym}}', tag_action_callback);"
data-onclick="return api.tags.remove_synonym('{{tag.name}}', '{{synonym}}', tag_action_callback);"
data-prompt="Remove Synonym?"
data-confirm="Remove"
data-confirm-class="remove_tag_button_perm red_button"