views: move inline javascript to app bundle.
This commit is contained in:
@@ -3,6 +3,7 @@ import Utility from './utility'
|
||||
import Hammer from 'hammerjs'
|
||||
import Cookie from './cookie'
|
||||
import Note from './notes'
|
||||
import Ugoira from './ugoira'
|
||||
import Rails from '@rails/ujs'
|
||||
|
||||
let Post = {};
|
||||
@@ -34,6 +35,7 @@ Post.initialize_all = function() {
|
||||
this.initialize_post_image_resize_links();
|
||||
this.initialize_post_image_resize_to_window_link();
|
||||
this.initialize_recommended();
|
||||
this.initialize_ugoira_player();
|
||||
|
||||
if (CurrentUser.data("always-resize-images") || (Utility.meta("viewport") && (window.screen.width <= 660))) {
|
||||
$("#image-resize-to-window-link").click();
|
||||
@@ -451,6 +453,16 @@ Post.initialize_post_sections = function() {
|
||||
});
|
||||
}
|
||||
|
||||
Post.initialize_ugoira_player = function() {
|
||||
if ($("#ugoira-controls").length) {
|
||||
let content_type = $("#image").data("ugoira-content-type");
|
||||
let frames = $("#image").data("ugoira-frames");
|
||||
let file_url = $("#image-container").data("file-url");
|
||||
|
||||
Ugoira.create_player(content_type, frames, file_url);
|
||||
}
|
||||
};
|
||||
|
||||
Post.resize_ugoira_controls = function() {
|
||||
var $img = $("#image");
|
||||
var width = Math.max($img.width(), 350);
|
||||
|
||||
Reference in New Issue
Block a user