1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/assets/javascripts/application.js

54 lines
1 KiB
JavaScript
Raw Normal View History

2018-11-22 14:33:08 -05:00
//= require rails-ujs
//= require activestorage
//= require turbolinks
2018-11-23 14:20:56 -05:00
//= require jquery3
//= require popper
//= require bootstrap-sprockets
2018-12-02 08:20:22 -05:00
//= require viewerjs/dist/viewer
//= require jquery-viewer/dist/jquery-viewer
2018-11-22 14:33:08 -05:00
//= require_tree .
2018-12-02 08:20:22 -05:00
$(document).ready(function() {
2018-12-02 15:00:44 -05:00
$('#image').passportImageViewer()
$("input[name='passport[images]']").change(function() {
if (!this.files) { return }
var file = this.files[0]
if (!file) { return }
var reader = new FileReader()
reader.onload = function(e) {
$('#image').attr('src', e.target.result)
$('#image').passportImageViewer()
}
reader.readAsDataURL(file)
})
})
$.fn.passportImageViewer = function() {
$(this).viewer('destroy')
$(this).viewer({
2018-12-02 08:20:22 -05:00
inline: true,
2018-12-02 08:47:42 -05:00
title: false,
2018-12-02 08:47:02 -05:00
navbar: false,
2018-12-02 08:51:20 -05:00
toolbar: {
zoomIn: true,
zoomOut: true,
oneToOne: true,
reset: true,
prev: false,
play: false,
next: false,
rotateLeft: true,
rotateRight: true,
flipHorizontal: true,
flipVertical: true,
},
2018-12-02 08:20:22 -05:00
})
2018-12-02 15:00:44 -05:00
}