You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
$(document).ready(()=>{
|
|
|
|
var socket = io();
|
|
var baseUrl = 'http://' + window.location.hostname;
|
|
var urlString = window.location.href;
|
|
var sid = getParameterByName("sid", urlString);
|
|
|
|
tinymce.init({
|
|
selector: '.mce',
|
|
height: 200,
|
|
theme: 'modern',
|
|
menubar: false,
|
|
forced_root_block : '',
|
|
force_br_newlines : true,
|
|
pagebreak_separator: '%break%',
|
|
plugins: [
|
|
'advlist autolink pagebreak lists paste'
|
|
],
|
|
toolbar: 'bold italic underline | bullist numlist pagebreak | removeformat',
|
|
image_advtab: false,
|
|
content_css: [
|
|
'//fonts.googleapis.com/css?family=Montserrat:300,300i,400,400i',
|
|
]
|
|
});
|
|
|
|
var form = $('.send_message_form');
|
|
|
|
form.on('submit', function(e){
|
|
e.preventDefault();
|
|
|
|
var title = form.find('.title').val();
|
|
var text = form.find('.text').val().split('%break%');
|
|
|
|
var fullMessage = {
|
|
'title': title,
|
|
'short_text': text[0],
|
|
'long_text': text[1],
|
|
'image': '',
|
|
'sid': sid,
|
|
};
|
|
|
|
socket.emit('message', fullMessage);
|
|
parent.postMessage("cbClose", baseUrl);
|
|
|
|
});
|
|
|
|
|
|
function getParameterByName(name, url) {
|
|
if (!url) url = window.location.href;
|
|
name = name.replace(/[\[\]]/g, "\\$&");
|
|
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
|
|
results = regex.exec(url);
|
|
if (!results) return null;
|
|
if (!results[2]) return '';
|
|
return decodeURIComponent(results[2].replace(/\+/g, " "));
|
|
}
|
|
|
|
});
|
|
|