Google2Fa ready to upload
This commit is contained in:
parent
e3495be8b8
commit
73e38a006e
127 changed files with 2637 additions and 589 deletions
|
|
@ -279,46 +279,6 @@ function ajax_object_action(event, object, callback) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function update_modal_data_show(e, $ele) {
|
||||
e.preventDefault();
|
||||
|
||||
var ele = $ele,
|
||||
url = ele.data('url'),
|
||||
data = {id:ele.data('data')} ,
|
||||
contentType = 'application/x-www-form-urlencoded; charset=UTF-8';
|
||||
|
||||
/* console.log(data);
|
||||
console.log(url);*/
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: data,
|
||||
type: "POST",
|
||||
dataType: "html",
|
||||
cache: false,
|
||||
contentType: contentType,
|
||||
encode: true,
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
|
||||
},
|
||||
success: function(data) {
|
||||
// do what ever you want here. add content to <div> if it was not 1 .
|
||||
//console.log(data);
|
||||
$('#update-modal-content').html(data);
|
||||
$('.selectpicker').selectpicker(["refresh"]);
|
||||
$('.input-daterange').datepicker({toggleActive: true,format: 'dd.mm.yyyy'});
|
||||
// $.Nestable.init();
|
||||
$('#updateModalShow').modal('show');
|
||||
},
|
||||
error: function(xhr, status, errorThrown) {
|
||||
console.log(xhr);
|
||||
console.log(xhr.responseText);
|
||||
console.log(status);
|
||||
console.log("Sorry, there was a problem!");
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
function update_modal_data_load(e, $ele) {
|
||||
var ele = $ele,
|
||||
url = ele.data('url'),
|
||||
|
|
|
|||
269
public/js/summernote-iq-content-placeholders.js
Normal file
269
public/js/summernote-iq-content-placeholders.js
Normal file
|
|
@ -0,0 +1,269 @@
|
|||
(function(factory)
|
||||
{
|
||||
/* global define */
|
||||
if (typeof define === 'function' && define.amd)
|
||||
{
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
}
|
||||
else if (typeof module === 'object' && module.exports)
|
||||
{
|
||||
// Node/CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Browser globals
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function($)
|
||||
{
|
||||
|
||||
// Extends plugins for adding gallery.
|
||||
// - plugin is external module for customizing.
|
||||
$.extend($.summernote.plugins,
|
||||
{
|
||||
/**
|
||||
* @param {Object} context - context object has status of editor.
|
||||
*/
|
||||
'gallery': function(context)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
// ui has renders to build ui elements.
|
||||
// - you can create a button with `ui.button`
|
||||
var ui = $.summernote.ui;
|
||||
|
||||
// add gallery button
|
||||
context.memo('button.gallery', function()
|
||||
{
|
||||
// create button
|
||||
var button = ui.button(
|
||||
{
|
||||
contents: '<i class="fa fa-image"></i>',
|
||||
tooltip: 'Medien',
|
||||
click: function()
|
||||
{
|
||||
self.fillModal();
|
||||
self.$modal.modal();
|
||||
}
|
||||
});
|
||||
|
||||
// create jQuery object from button instance.
|
||||
$gallery = button.render();
|
||||
return $gallery;
|
||||
});
|
||||
|
||||
// This events will be attached when editor is initialized.
|
||||
this.events = {
|
||||
// This will be called after modules are initialized.
|
||||
'summernote.init': function(we, e)
|
||||
{
|
||||
self.editable = context.layoutInfo.editable; //contentEditable element
|
||||
self.editor = this;
|
||||
// get summernote onInit set parameters
|
||||
self.image_dialog_images_url = $(this).data('image_dialog_images_url');
|
||||
self.image_dialog_images_html = $(this).data('image_dialog_images_html');
|
||||
self.image_dialog_title = $(this).data('image_dialog_title');
|
||||
self.image_dialog_close_btn_text = $(this).data('image_dialog_close_btn_text');
|
||||
self.image_dialog_ok_btn_text = $(this).data('image_dialog_ok_btn_text');
|
||||
|
||||
self.fillModal = function()
|
||||
{
|
||||
//fill modal with images whether from url or given html
|
||||
if (typeof self.image_dialog_images_html !== "undefined")
|
||||
{
|
||||
self.setModalHtml(self.image_dialog_images_html)
|
||||
self.setEvents();
|
||||
}
|
||||
else if (typeof self.image_dialog_images_url !== "undefined")
|
||||
{
|
||||
var next = self.setEvents;
|
||||
self.getImagesFromUrl(next);
|
||||
}
|
||||
else
|
||||
{
|
||||
console.error("options image_dialog_images_html or image_dialog_images_url must be set");
|
||||
}
|
||||
|
||||
};
|
||||
self.setModalHtml = function(html)
|
||||
{ // set variabl parts to modal html
|
||||
var title = self.image_dialog_title;
|
||||
var close = self.image_dialog_close_btn_text;
|
||||
var ok = self.image_dialog_ok_btn_text;
|
||||
|
||||
if (self.image_dialog_title !== "undefined") self.$modal.find('.modal-title').html(title);
|
||||
if (self.image_dialog_close_btn_text !== "undefined") self.$modal.find('#modal_iq_close').html(close);
|
||||
if (self.image_dialog_ok_btn_text !== "undefined") self.$modal.find('#modal_iq_save').html(ok);
|
||||
|
||||
self.$modal.find('.modal-body').html(html);
|
||||
LFileManager.initFileManager(true);
|
||||
|
||||
};
|
||||
self.getImagesFromUrl = function(callback)
|
||||
{
|
||||
// get images html from url
|
||||
$.get(self.image_dialog_images_url, function(html)
|
||||
{
|
||||
self.setModalHtml(html);
|
||||
callback();
|
||||
|
||||
}).fail(function()
|
||||
{
|
||||
console.error("error loading from "+self.image_dialog_images_url);
|
||||
})
|
||||
};
|
||||
self.setEvents = function()
|
||||
{
|
||||
// images click event to select image
|
||||
/*self.$modal.find('img').click(function(event)
|
||||
{
|
||||
// $(this).toggleClass(self.select_class);
|
||||
});*/
|
||||
};
|
||||
// set the focus to the last focused element in the editor
|
||||
self.recoverEditorFocus = function ()
|
||||
{
|
||||
var last_focused_el = $(self.editor).data('last_focused_element');
|
||||
if(typeof last_focused_el !== "undefined")
|
||||
{
|
||||
var editor = self.editable;
|
||||
var range = document.createRange();
|
||||
var sel = window.getSelection();
|
||||
var cursor_position = last_focused_el.length;
|
||||
|
||||
range.setStart(last_focused_el, cursor_position);
|
||||
range.collapse(true);
|
||||
sel.removeAllRanges();
|
||||
sel.addRange(range);
|
||||
editor.focus();
|
||||
}
|
||||
};
|
||||
self.saveLastFocusedElement = function()
|
||||
{
|
||||
var focused_element = window.getSelection().focusNode;
|
||||
var parent = $(self.editable).get(0);
|
||||
if ($.contains(parent, focused_element))
|
||||
{
|
||||
$(self.editor).data('last_focused_element', focused_element)
|
||||
}
|
||||
};
|
||||
self.editorEvents = function () {
|
||||
$(self.editable).on('keypress, mousemove', function()
|
||||
{
|
||||
self.saveLastFocusedElement();
|
||||
})
|
||||
};
|
||||
self.editorEvents();
|
||||
self.fillModal();
|
||||
},
|
||||
// This will be called when user releases a key on editable.
|
||||
'summernote.keyup': function(we, e)
|
||||
{
|
||||
self.saveLastFocusedElement();
|
||||
}
|
||||
};
|
||||
|
||||
// This method will be called when editor is initialized by $('..').summernote();
|
||||
// You can create elements for plugin
|
||||
this.initialize = function()
|
||||
{
|
||||
var $modal = this.$modal = $('#modal_iq_assets').hide();
|
||||
// add selected images to summernote editor
|
||||
$modal.find("button#modal_iq_save").click(function(event)
|
||||
{
|
||||
var items = LFileManager.getSelectedItems();
|
||||
|
||||
$modal.modal('hide');
|
||||
|
||||
self.recoverEditorFocus();
|
||||
|
||||
items.forEach(function (item, index) {
|
||||
var insert = self.insertHTML(item);
|
||||
if(insert){
|
||||
context.invoke('editor.pasteHTML', insert);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
this.insertHTML = function(item){
|
||||
var title = 'Bildtitel ...';
|
||||
var description = '';
|
||||
var author_name = '';
|
||||
var img_title = '';
|
||||
|
||||
if(item.content !== null){
|
||||
if(item.content.title !== undefined && item.content.title){
|
||||
title = item.content.title;
|
||||
img_title = item.content.title;
|
||||
}
|
||||
if(item.content.description !== undefined && item.content.description){
|
||||
description = ' ' + item.content.description;
|
||||
}
|
||||
if(item.content.author_name !== undefined && item.content.author_name){
|
||||
author_name = 'Bildquelle: ' + item.content.author_name;
|
||||
if(img_title !== ''){
|
||||
img_title = img_title + " | " + author_name;
|
||||
}else{
|
||||
img_title = author_name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// console.log(item)
|
||||
var insert = '';
|
||||
|
||||
if(item.is_file && item.is_image){
|
||||
insert += '<div class="mediaA">'+
|
||||
'<img src="'+item.url+'" alt="'+title+'" class="img-responsive" title="'+img_title+'" data-slug="'+item.slug+'" width="auto" height="auto">' +
|
||||
'<div class="mediaInfo">\n' +
|
||||
'<p class="infotext">' + title + '</p>\n' +
|
||||
'</div>\n' +
|
||||
'</div>';
|
||||
return insert;
|
||||
}
|
||||
if(item.icon === "fab fa-youtube-square"){
|
||||
|
||||
|
||||
insert += '<div class="mediaA" itemprop="video" itemscope itemtype="http://schema.org/VideoObject">\n' +
|
||||
'<h2><span itemprop="name">'+ title +'</span></h2>\n' +
|
||||
'<meta itemprop="duration" content="'+item.content.duration+'" />\n' +
|
||||
'<meta itemprop="uploadDate" content="'+item.content.uploadDate+'"/>\n' +
|
||||
'<meta itemprop="thumbnailURL" content="'+item.content.thumbnailURL+'" />\n' +
|
||||
'<meta itemprop="embedURL" content="https://youtube.googleapis.com/v/'+item.content.id+'" />\n' +
|
||||
'<div class="video-container">\n' +
|
||||
'<iframe src="https://www.youtube.com/embed/'+item.content.id+'?rel=0&controls=0&showinfo=0" data-identifier="'+item.identifier+'" data-slug="'+item.slug+'" frameborder="0" allowfullscreen></iframe>\n' +
|
||||
'</div>\n' +
|
||||
'<div class="mediaInfo">\n' +
|
||||
'<p class="infotext" itemprop="description">' + description + '</p>\n' +
|
||||
'</div>\n' +
|
||||
'</div>';
|
||||
|
||||
return insert;
|
||||
}
|
||||
if(item.is_file){
|
||||
insert += '<a href="'+item.url+'" title="'+title+'" data-identifier="'+item.identifier+'">'+item.name+'</a>';
|
||||
if(description !== ''){
|
||||
insert += '<p>'+description+'</p>';
|
||||
}
|
||||
return insert;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// This methods will be called when editor is destroyed by $('..').summernote('destroy');
|
||||
// You should remove elements on `initialize`.
|
||||
this.destroy = function()
|
||||
{
|
||||
console.log("destroy");
|
||||
// this.$panel.remove();
|
||||
// this.$panel = null;
|
||||
};
|
||||
}
|
||||
});
|
||||
}));
|
||||
112
public/js/summernote-placeholders.js
Normal file
112
public/js/summernote-placeholders.js
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
(function(factory)
|
||||
{
|
||||
/* global define */
|
||||
if (typeof define === 'function' && define.amd)
|
||||
{
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
}
|
||||
else if (typeof module === 'object' && module.exports)
|
||||
{
|
||||
// Node/CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Browser globals
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function($)
|
||||
{
|
||||
|
||||
// Extends plugins for adding gallery.
|
||||
// - plugin is external module for customizing.
|
||||
$.extend($.summernote.plugins,
|
||||
{
|
||||
/**
|
||||
* @param {Object} context - context object has status of editor.
|
||||
*/
|
||||
'placeholders': function(context)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
var options = context.options.placeholderList;
|
||||
var defaultOptions = {
|
||||
label: "Platzhalter",
|
||||
tooltip: "Platzhalter einfügen",
|
||||
blockChar : '#',
|
||||
};
|
||||
for (var propertyName in defaultOptions) {
|
||||
if (options && propertyName && options.hasOwnProperty(propertyName) === false) {
|
||||
options[propertyName] = defaultOptions[propertyName];
|
||||
}
|
||||
}
|
||||
var ui = $.summernote.ui;
|
||||
|
||||
// add gallery button
|
||||
context.memo('button.placeholders', function()
|
||||
{
|
||||
|
||||
var placeholdersButton = ui.buttonGroup([
|
||||
ui.button({
|
||||
className: 'dropdown-toggle',
|
||||
contents: '<span class="template"/> ' + options.label + ' <span class="caret"></span>',
|
||||
tooltip: options.tooltip,
|
||||
data: {
|
||||
toggle: 'dropdown'
|
||||
},
|
||||
click: function () {
|
||||
console.log('placeholders button click');
|
||||
context.invoke('editor.saveRange');
|
||||
}
|
||||
}),
|
||||
ui.dropdown({
|
||||
className: 'dropdown-style',
|
||||
items: options.items,
|
||||
callback: function($dropdown) {
|
||||
//console.log('$dropdown callback');
|
||||
},
|
||||
click: function (event) {
|
||||
event.preventDefault();
|
||||
var $button = $(event.target);
|
||||
var value = $button.data('value');
|
||||
var text = options.blockChar + value + options.blockChar;
|
||||
context.invoke('editor.insertText', text);
|
||||
//console.log('$dropdown click : ' + options.blockChar + value + options.blockChar);
|
||||
},
|
||||
template: function(item)
|
||||
{
|
||||
var content = (typeof item === 'string') ? item : (item.content || item.value || '');
|
||||
return content;
|
||||
}
|
||||
})
|
||||
]).render();
|
||||
return placeholdersButton;
|
||||
});
|
||||
|
||||
// This events will be attached when editor is initialized.
|
||||
this.events = {
|
||||
// This will be called after modules are initialized.
|
||||
'summernote.init': function(we, e) {
|
||||
|
||||
//console.log('summernote initialized', we, e);
|
||||
},
|
||||
// This will be called when user releases a key on editable.
|
||||
'summernote.keyup': function(we, e) {
|
||||
|
||||
//console.log('summernote keyup', we, e);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// This methods will be called when editor is destroyed by $('..').summernote('destroy');
|
||||
// You should remove elements on `initialize`.
|
||||
this.destroy = function()
|
||||
{
|
||||
console.log("destroy");
|
||||
// this.$panel.remove();
|
||||
// this.$panel = null;
|
||||
};
|
||||
}
|
||||
});
|
||||
}));
|
||||
Loading…
Add table
Add a link
Reference in a new issue