forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add content warnings for videos/links (#457)
- Loading branch information
Showing
13 changed files
with
216 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
function createOverlay(container) { | ||
const warningText = $( | ||
"<span><h3>Content Warning</h3><p>This video may be disturbing for some viewers</p></span>" | ||
) | ||
const hide = $('<button type="button" class="btn btn-lg">Show video</button>') | ||
hide.click(() => overlay.css("display", "none")) | ||
|
||
const wrapper = $("<div>") | ||
wrapper.append(warningText) | ||
wrapper.append(hide) | ||
|
||
const overlay = $('<div class="overlay">') | ||
overlay.append(wrapper) | ||
container.append(overlay) | ||
} | ||
|
||
$(document).ready(() => { | ||
$(".video-container").each((index, element) => { | ||
const container = $(element) | ||
if (container.data("has-content-warning")) { | ||
createOverlay(container) | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
OpenOversight/migrations/versions/2024-06-05-0203_939ea0f2b26d_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"""Add has_content_warning column to link model | ||
Revision ID: 939ea0f2b26d | ||
Revises: 52d3f6a21dd9 | ||
Create Date: 2024-06-05 02:03:29.168771 | ||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
|
||
revision = "939ea0f2b26d" | ||
down_revision = "52d3f6a21dd9" | ||
|
||
|
||
def upgrade(): | ||
# This is not expected to impact performance: https://dba.stackexchange.com/a/216153 | ||
with op.batch_alter_table("links", schema=None) as batch_op: | ||
batch_op.add_column( | ||
sa.Column( | ||
"has_content_warning", | ||
sa.Boolean(), | ||
nullable=False, | ||
server_default="false", | ||
) | ||
) | ||
|
||
|
||
def downgrade(): | ||
with op.batch_alter_table("links", schema=None) as batch_op: | ||
batch_op.drop_column("has_content_warning") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters