mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
update
This commit is contained in:
parent
8819a287fa
commit
7ddce01f98
1 changed files with 230 additions and 225 deletions
|
@ -44,7 +44,7 @@ try {
|
|||
if (!height) {
|
||||
height = $('body').height();
|
||||
}
|
||||
parent.postMessage({height: height}, '*');
|
||||
parent.postMessage({ height: height }, '*');
|
||||
} else if (e.data.play) {
|
||||
var currentTime = e.data.play.currentTime;
|
||||
var muted = !empty(e.data.play.muted);
|
||||
|
@ -477,7 +477,7 @@ async function mouseEffect() {
|
|||
var gif = $(this).find(".thumbsGIF");
|
||||
var jpg = $(this).find(".thumbsJPG");
|
||||
try {
|
||||
gif.lazy({effect: 'fadeIn'});
|
||||
gif.lazy({ effect: 'fadeIn' });
|
||||
setTimeout(function () {
|
||||
gif.height(jpg.height());
|
||||
gif.width(jpg.width());
|
||||
|
@ -591,9 +591,9 @@ async function addViewFromCookie() {
|
|||
var addView_playerCurrentTime = Cookies.get('addView_playerCurrentTime');
|
||||
var addView_seconds_watching_video = Cookies.get('addView_seconds_watching_video');
|
||||
if (!addView_PHPSESSID || addView_PHPSESSID === 'false' ||
|
||||
!addView_videos_id || addView_videos_id === 'false' ||
|
||||
!addView_playerCurrentTime || addView_playerCurrentTime === 'false' ||
|
||||
!addView_seconds_watching_video || addView_seconds_watching_video === 'false') {
|
||||
!addView_videos_id || addView_videos_id === 'false' ||
|
||||
!addView_playerCurrentTime || addView_playerCurrentTime === 'false' ||
|
||||
!addView_seconds_watching_video || addView_seconds_watching_video === 'false') {
|
||||
return false;
|
||||
}
|
||||
//console.log('addViewFromCookie', addView_videos_id, addView_playerCurrentTime, addView_seconds_watching_video);
|
||||
|
@ -644,7 +644,7 @@ function getPlayerButtonIndex(name) {
|
|||
|
||||
async function copyToClipboard(text) {
|
||||
$('body').append('<textarea id="elementToCopyAvideo" style="filter: alpha(opacity=0);-moz-opacity: 0;-khtml-opacity: 0; opacity: 0;position: absolute;z-index: -9999;top: 0;left: 0;pointer-events: none;"></textarea>');
|
||||
$('#elementToCopyAvideo').css({'top': mouseY, 'left': 0}).fadeIn('slow');
|
||||
$('#elementToCopyAvideo').css({ 'top': mouseY, 'left': 0 }).fadeIn('slow');
|
||||
$('#elementToCopyAvideo').val(text);
|
||||
$('#elementToCopyAvideo').focus();
|
||||
$('#elementToCopyAvideo').select();
|
||||
|
@ -893,7 +893,7 @@ async function showMuteTooltip() {
|
|||
$("#mainVideo .vjs-volume-panel").attr("data-toggle", "tooltip");
|
||||
$("#mainVideo .vjs-volume-panel").attr("data-placement", "top");
|
||||
$("#mainVideo .vjs-volume-panel").attr("title", "Click to activate the sound");
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip({container: '.vjs-control-bar', html: true});
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip({ container: '.vjs-control-bar', html: true });
|
||||
$('#mainVideo .vjs-volume-panel[data-toggle="tooltip"]').tooltip('show');
|
||||
$("#mainVideo .vjs-volume-panel").click(function () {
|
||||
//console.log("remove unmute tooltip");
|
||||
|
@ -1043,9 +1043,9 @@ function formatBytes(bytes, decimals) {
|
|||
if (bytes == 0)
|
||||
return '0 Bytes';
|
||||
var k = 1024,
|
||||
dm = decimals <= 0 ? 0 : decimals || 2,
|
||||
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
dm = decimals <= 0 ? 0 : decimals || 2,
|
||||
sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
|
||||
i = Math.floor(Math.log(bytes) / Math.log(k));
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
|
@ -1199,31 +1199,31 @@ function isAutoplayEnabled() {
|
|||
consoleLog("isAutoplayEnabled always autoplay live contents");
|
||||
return true;
|
||||
} else
|
||||
if ($("#autoplay").length) {
|
||||
autoplay = $("#autoplay").is(":checked");
|
||||
consoleLog("isAutoplayEnabled #autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
setAutoplay(autoplay);
|
||||
return autoplay;
|
||||
} else if (
|
||||
typeof Cookies !== 'undefined' &&
|
||||
typeof Cookies.get('autoplay') !== 'undefined'
|
||||
) {
|
||||
if (Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true) {
|
||||
consoleLog("isAutoplayEnabled Cookie said Yes ");
|
||||
setAutoplay(true);
|
||||
return true;
|
||||
} else {
|
||||
consoleLog("isAutoplayEnabled Cookie said No ");
|
||||
setAutoplay(false);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (typeof autoplay !== 'undefined') {
|
||||
consoleLog("isAutoplayEnabled autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
if ($("#autoplay").length) {
|
||||
autoplay = $("#autoplay").is(":checked");
|
||||
consoleLog("isAutoplayEnabled #autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
setAutoplay(autoplay);
|
||||
return autoplay;
|
||||
} else if (
|
||||
typeof Cookies !== 'undefined' &&
|
||||
typeof Cookies.get('autoplay') !== 'undefined'
|
||||
) {
|
||||
if (Cookies.get('autoplay') === 'true' || Cookies.get('autoplay') == true) {
|
||||
consoleLog("isAutoplayEnabled Cookie said Yes ");
|
||||
setAutoplay(true);
|
||||
return true;
|
||||
} else {
|
||||
consoleLog("isAutoplayEnabled Cookie said No ");
|
||||
setAutoplay(false);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (typeof autoplay !== 'undefined') {
|
||||
consoleLog("isAutoplayEnabled autoplay said " + ((autoplay) ? "Yes" : "No"));
|
||||
setAutoplay(autoplay);
|
||||
return autoplay;
|
||||
}
|
||||
}
|
||||
}
|
||||
setAutoplay(false);
|
||||
consoleLog("isAutoplayEnabled Default is No ");
|
||||
return false;
|
||||
|
@ -1346,7 +1346,7 @@ function avideoAlertOnceForceConfirm(title, msg, type) {
|
|||
}
|
||||
|
||||
function _avideoToast(msg, icon) {
|
||||
var options = {text: msg, hideAfter: 7000};
|
||||
var options = { text: msg, hideAfter: 7000 };
|
||||
if (icon) {
|
||||
options.icon = icon;
|
||||
}
|
||||
|
@ -1540,7 +1540,7 @@ function avideoWindowIframe(url) {
|
|||
html += '</div>';
|
||||
html += '</div>';
|
||||
$('body').append(html);
|
||||
$("#draggable").draggable({handle: ".panel-heading", containment: "parent"});
|
||||
$("#draggable").draggable({ handle: ".panel-heading", containment: "parent" });
|
||||
//$( "div, p" ).disableSelection();
|
||||
$("#draggable").resizable();
|
||||
}
|
||||
|
@ -1720,14 +1720,14 @@ function avideoModalIframeRemove() {
|
|||
}
|
||||
}
|
||||
|
||||
function json_decode(jsonString){
|
||||
function json_decode(jsonString) {
|
||||
if (typeof jsonString === 'string') {
|
||||
try {
|
||||
return JSON.parse(jsonString);
|
||||
} catch (error) {
|
||||
console.error('Invalid JSON string:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
return jsonString;
|
||||
|
||||
}
|
||||
|
@ -1780,7 +1780,7 @@ function avideoTooltip(selector, text) {
|
|||
$(selector).attr('title', text);
|
||||
$(selector).attr('data-toggle', 'tooltip');
|
||||
$(selector).attr('data-original-title', text);
|
||||
$(selector).tooltip({html: true});
|
||||
$(selector).tooltip({ html: true });
|
||||
}
|
||||
|
||||
function fixAdSize() {
|
||||
|
@ -1788,8 +1788,8 @@ function fixAdSize() {
|
|||
if (ad_container.length) {
|
||||
height = ad_container.css('height');
|
||||
width = ad_container.css('width');
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'height': height });
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'width': width });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1911,11 +1911,11 @@ function clearCache(showPleaseWait, FirstPage, sessionOnly) {
|
|||
|
||||
function validURL(str) {
|
||||
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+:]*)*' + // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
||||
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
||||
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
||||
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
||||
'(\\:\\d+)?(\\/[-a-z\\d%_.~+:]*)*' + // port and path
|
||||
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
||||
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
||||
return !!pattern.test(str);
|
||||
}
|
||||
|
||||
|
@ -2184,11 +2184,11 @@ function removeDuplicatedGetParam(_url) {
|
|||
return _url;
|
||||
}
|
||||
var params = queryParam.split('&'),
|
||||
results = {};
|
||||
results = {};
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var temp = params[i].split('='),
|
||||
key = temp[0],
|
||||
val = temp[1];
|
||||
key = temp[0],
|
||||
val = temp[1];
|
||||
results[key] = val;
|
||||
}
|
||||
|
||||
|
@ -2206,11 +2206,11 @@ function removeGetParam(_url, parameter) {
|
|||
return _url;
|
||||
}
|
||||
var params = queryParam.split('&'),
|
||||
results = {};
|
||||
results = {};
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var temp = params[i].split('='),
|
||||
key = temp[0],
|
||||
val = temp[1];
|
||||
key = temp[0],
|
||||
val = temp[1];
|
||||
if (key !== parameter) {
|
||||
results[key] = val;
|
||||
}
|
||||
|
@ -2248,7 +2248,7 @@ function readFileCroppie(input, crop) {
|
|||
|
||||
function getCroppie(uploadCropObject, callback, width, height) {
|
||||
//console.log('getCroppie 1', uploadCropObject);
|
||||
var ret = uploadCropObject.croppie('result', {type: 'base64', size: {width: width, height: height}, format: 'png'}).then(function (resp) {
|
||||
var ret = uploadCropObject.croppie('result', { type: 'base64', size: { width: width, height: height }, format: 'png' }).then(function (resp) {
|
||||
////console.log('getCroppie 2 ' + callback, resp);
|
||||
eval(callback + "(resp);");
|
||||
}).catch(function (err) {
|
||||
|
@ -2258,31 +2258,36 @@ function getCroppie(uploadCropObject, callback, width, height) {
|
|||
//console.log('getCroppie 3', ret);
|
||||
}
|
||||
|
||||
let tooltipTimeout = null;
|
||||
|
||||
async function setToolTips() {
|
||||
var selector = '[data-toggle="tooltip"]';
|
||||
if (!$(selector).not('.alreadyTooltip').length) {
|
||||
return false;
|
||||
if (tooltipTimeout) {
|
||||
clearTimeout(tooltipTimeout);
|
||||
tooltipTimeout = null;
|
||||
}
|
||||
try {
|
||||
$(selector).not('.alreadyTooltip').tooltip({container: 'body', html: true});
|
||||
$(selector).not('.alreadyTooltip').on('click', function () {
|
||||
var t = this;
|
||||
setTimeout(function () {
|
||||
|
||||
tooltipTimeout = setTimeout(function () {
|
||||
const selector = '[data-toggle="tooltip"]';
|
||||
if (!$(selector).not('.alreadyTooltip').length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$(selector).not('.alreadyTooltip').tooltip({ container: 'body', html: true });
|
||||
$(selector).not('.alreadyTooltip').on('click', function () {
|
||||
const t = this;
|
||||
try {
|
||||
$(t).tooltip('hide');
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}, 2000);
|
||||
});
|
||||
$(selector).addClass('alreadyTooltip');
|
||||
} catch (e) {
|
||||
console.log('setToolTips', e);
|
||||
setTimeout(function () {
|
||||
setToolTips();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
} catch (e) { }
|
||||
});
|
||||
$(selector).addClass('alreadyTooltip');
|
||||
} catch (e) {
|
||||
console.log('setToolTips', e);
|
||||
setTimeout(function () {
|
||||
setToolTips();
|
||||
}, 1000);
|
||||
}
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function avideoSocketIsActive() {
|
||||
|
@ -2296,18 +2301,18 @@ function avideoSocketIsActive() {
|
|||
function isMediaSiteURL(url) {
|
||||
if (validURL(url)) {
|
||||
if (url.match(/youtube/i) ||
|
||||
url.match(/youtu\.be/i) ||
|
||||
url.match(/vimeo/i) ||
|
||||
url.match(/dailymotion/i) ||
|
||||
url.match(/metacafe/i) ||
|
||||
url.match(/vid\.me/i) ||
|
||||
url.match(/rutube\.ru/i) ||
|
||||
url.match(/ok\.ru/i) ||
|
||||
url.match(/streamable/i) ||
|
||||
url.match(/twitch/i) ||
|
||||
url.match(/evideoEmbed/i) ||
|
||||
url.match(/videoEmbed/i) ||
|
||||
url.match(/videoEmbeded/i)) {
|
||||
url.match(/youtu\.be/i) ||
|
||||
url.match(/vimeo/i) ||
|
||||
url.match(/dailymotion/i) ||
|
||||
url.match(/metacafe/i) ||
|
||||
url.match(/vid\.me/i) ||
|
||||
url.match(/rutube\.ru/i) ||
|
||||
url.match(/ok\.ru/i) ||
|
||||
url.match(/streamable/i) ||
|
||||
url.match(/twitch/i) ||
|
||||
url.match(/evideoEmbed/i) ||
|
||||
url.match(/videoEmbed/i) ||
|
||||
url.match(/videoEmbeded/i)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -2324,7 +2329,7 @@ function changeVideoStatus(videos_id, status) {
|
|||
modal.showPleaseWait();
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/videoStatus.json.php',
|
||||
data: {"id": [videos_id], "status": status},
|
||||
data: { "id": [videos_id], "status": status },
|
||||
type: 'post',
|
||||
success: function (response) {
|
||||
modal.hidePleaseWait();
|
||||
|
@ -2450,65 +2455,65 @@ function downloadURL(url, filename) {
|
|||
var loaded = 0;
|
||||
var contentLength = 0;
|
||||
fetch(url)
|
||||
.then(response => {
|
||||
avideoToastSuccess('Download Start');
|
||||
const contentEncoding = response.headers.get('content-encoding');
|
||||
const contentLength = response.headers.get(contentEncoding ? 'x-file-size' : 'content-length');
|
||||
if (contentLength === null) {
|
||||
throw Error('Response size header unavailable');
|
||||
}
|
||||
.then(response => {
|
||||
avideoToastSuccess('Download Start');
|
||||
const contentEncoding = response.headers.get('content-encoding');
|
||||
const contentLength = response.headers.get(contentEncoding ? 'x-file-size' : 'content-length');
|
||||
if (contentLength === null) {
|
||||
throw Error('Response size header unavailable');
|
||||
}
|
||||
|
||||
const total = parseInt(contentLength, 10);
|
||||
let loaded = 0;
|
||||
return new Response(
|
||||
new ReadableStream({
|
||||
start(controller) {
|
||||
const reader = response.body.getReader();
|
||||
read();
|
||||
function read() {
|
||||
reader.read().then(({ done, value }) => {
|
||||
if (done) {
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
loaded += value.byteLength;
|
||||
var percentageLoaded = Math.round(loaded / total * 100);
|
||||
////console.log(percentageLoaded);
|
||||
downloadModal.setProgress(percentageLoaded);
|
||||
downloadModal.setText('Downloading ... ' + percentageLoaded + '%');
|
||||
controller.enqueue(value);
|
||||
read();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
controller.error(error)
|
||||
})
|
||||
const total = parseInt(contentLength, 10);
|
||||
let loaded = 0;
|
||||
return new Response(
|
||||
new ReadableStream({
|
||||
start(controller) {
|
||||
const reader = response.body.getReader();
|
||||
read();
|
||||
function read() {
|
||||
reader.read().then(({ done, value }) => {
|
||||
if (done) {
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
})
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
const urlFromBlob = window.URL.createObjectURL(blob);
|
||||
console.log('downloadURL', url, filename, blob);
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = urlFromBlob;
|
||||
// the filename you want
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
downloadModal.hidePleaseWait();
|
||||
avideoToastSuccess('Download complete ' + filename);
|
||||
})
|
||||
.catch(function (err) {
|
||||
//avideoAlertError('Error on download ');
|
||||
console.log(err);
|
||||
addQueryStringParameter(url, 'download', 1);
|
||||
addQueryStringParameter(url, 'title', filename);
|
||||
document.location = url;
|
||||
});
|
||||
loaded += value.byteLength;
|
||||
var percentageLoaded = Math.round(loaded / total * 100);
|
||||
////console.log(percentageLoaded);
|
||||
downloadModal.setProgress(percentageLoaded);
|
||||
downloadModal.setText('Downloading ... ' + percentageLoaded + '%');
|
||||
controller.enqueue(value);
|
||||
read();
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
controller.error(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
})
|
||||
.then(response => response.blob())
|
||||
.then(blob => {
|
||||
const urlFromBlob = window.URL.createObjectURL(blob);
|
||||
console.log('downloadURL', url, filename, blob);
|
||||
const a = document.createElement('a');
|
||||
a.style.display = 'none';
|
||||
a.href = urlFromBlob;
|
||||
// the filename you want
|
||||
a.download = filename;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
downloadModal.hidePleaseWait();
|
||||
avideoToastSuccess('Download complete ' + filename);
|
||||
})
|
||||
.catch(function (err) {
|
||||
//avideoAlertError('Error on download ');
|
||||
console.log(err);
|
||||
addQueryStringParameter(url, 'download', 1);
|
||||
addQueryStringParameter(url, 'title', filename);
|
||||
document.location = url;
|
||||
});
|
||||
}
|
||||
|
||||
var downloadURLOrAlertErrorInterval;
|
||||
|
@ -2536,9 +2541,9 @@ function downloadURLOrAlertError(jsonURL, data, filename, FFMpegProgress) {
|
|||
avideoAlertInfo(response.msg);
|
||||
}
|
||||
if (
|
||||
isMobile()
|
||||
//|| /cdn.ypt.me/.test(response.url)
|
||||
) {
|
||||
isMobile()
|
||||
//|| /cdn.ypt.me/.test(response.url)
|
||||
) {
|
||||
console.log('downloadURLOrAlertError 2', response.url);
|
||||
window.open(response.url, '_blank');
|
||||
avideoToastInfo('Opening file');
|
||||
|
@ -2732,7 +2737,7 @@ function getCursorPos(input) {
|
|||
len++;
|
||||
}
|
||||
rng.setEndPoint("StartToStart", input.createTextRange());
|
||||
for (var pos = {start: 0, end: len}; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) {
|
||||
for (var pos = { start: 0, end: len }; rng.compareEndPoints("EndToStart", rng) > 0; rng.moveEnd("character", -1)) {
|
||||
pos.start++;
|
||||
pos.end++;
|
||||
}
|
||||
|
@ -2775,10 +2780,10 @@ function addAtMention(selector) {
|
|||
$(selector).on("keydown", function (event) {
|
||||
if (!$(this).autocomplete("instance").menu.active) {
|
||||
if (
|
||||
event.keyCode === SpaceKeyCode ||
|
||||
event.keyCode === $.ui.keyCode.TAB ||
|
||||
event.keyCode === $.ui.keyCode.ENTER ||
|
||||
event.keyCode === $.ui.keyCode.ESCAPE) {
|
||||
event.keyCode === SpaceKeyCode ||
|
||||
event.keyCode === $.ui.keyCode.TAB ||
|
||||
event.keyCode === $.ui.keyCode.ENTER ||
|
||||
event.keyCode === $.ui.keyCode.ESCAPE) {
|
||||
$(this).autocomplete("close");
|
||||
}
|
||||
} else {
|
||||
|
@ -2787,77 +2792,77 @@ function addAtMention(selector) {
|
|||
}
|
||||
}
|
||||
})
|
||||
.autocomplete({
|
||||
minLength: 2,
|
||||
source: function (request, response) {
|
||||
.autocomplete({
|
||||
minLength: 2,
|
||||
source: function (request, response) {
|
||||
|
||||
var pos = getCursorPos($(selector)[0]);
|
||||
stringStart = request.term.substring(0, pos.end);
|
||||
var pos = getCursorPos($(selector)[0]);
|
||||
stringStart = request.term.substring(0, pos.end);
|
||||
|
||||
var term = stringStart.split(/\s+/).pop();
|
||||
//console.log('autocomplete', request.term, term, AtMatcher.test(term));
|
||||
if (AtMatcher.test(term)) {
|
||||
$.ajax({
|
||||
url: webSiteRootURL + "objects/mention.json.php",
|
||||
data: {
|
||||
term: term
|
||||
},
|
||||
success: function (data) {
|
||||
response(data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
focus: function () {
|
||||
// prevent value inserted on focus
|
||||
var term = stringStart.split(/\s+/).pop();
|
||||
//console.log('autocomplete', request.term, term, AtMatcher.test(term));
|
||||
if (AtMatcher.test(term)) {
|
||||
$.ajax({
|
||||
url: webSiteRootURL + "objects/mention.json.php",
|
||||
data: {
|
||||
term: term
|
||||
},
|
||||
success: function (data) {
|
||||
response(data);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
},
|
||||
select: function (event, ui) {
|
||||
addAtMentionActive = true;
|
||||
}
|
||||
},
|
||||
focus: function () {
|
||||
// prevent value inserted on focus
|
||||
return false;
|
||||
},
|
||||
select: function (event, ui) {
|
||||
addAtMentionActive = true;
|
||||
setTimeout(function () {
|
||||
addAtMentionActive = false;
|
||||
}, 200);
|
||||
if (emojioneArea) {
|
||||
this.value = $(emojioneArea).data("emojioneArea").getText();
|
||||
}
|
||||
//console.log('addAtMention', this, this.value);
|
||||
var pos = getCursorPos($(selector)[0]);
|
||||
stringStart = this.value.substring(0, pos.end);
|
||||
stringEnd = this.value.substring(pos.end);
|
||||
|
||||
var terms = stringStart.split(/\s+/);
|
||||
// remove the current input
|
||||
var word = terms.pop();
|
||||
// add the selected item
|
||||
//terms.push('@' + ui.item.value);
|
||||
// add placeholder to get the comma-and-space at the end
|
||||
//terms.push("");
|
||||
replace = '@' + ui.item.value;
|
||||
|
||||
this.value = replaceLast(word, '@' + ui.item.value, stringStart) + stringEnd;
|
||||
if (emojioneArea) {
|
||||
$(emojioneArea).data("emojioneArea").setText(this.value);
|
||||
setTimeout(function () {
|
||||
addAtMentionActive = false;
|
||||
}, 200);
|
||||
if (emojioneArea) {
|
||||
this.value = $(emojioneArea).data("emojioneArea").getText();
|
||||
}
|
||||
//console.log('addAtMention', this, this.value);
|
||||
var pos = getCursorPos($(selector)[0]);
|
||||
stringStart = this.value.substring(0, pos.end);
|
||||
stringEnd = this.value.substring(pos.end);
|
||||
|
||||
var terms = stringStart.split(/\s+/);
|
||||
// remove the current input
|
||||
var word = terms.pop();
|
||||
// add the selected item
|
||||
//terms.push('@' + ui.item.value);
|
||||
// add placeholder to get the comma-and-space at the end
|
||||
//terms.push("");
|
||||
replace = '@' + ui.item.value;
|
||||
|
||||
this.value = replaceLast(word, '@' + ui.item.value, stringStart) + stringEnd;
|
||||
if (emojioneArea) {
|
||||
$(emojioneArea).data("emojioneArea").setText(this.value);
|
||||
setTimeout(function () {
|
||||
contentEditableElement = document.getElementsByClassName("emojionearea-editor")[0];
|
||||
range = document.createRange();//Create a range (a range is a like the selection but invisible)
|
||||
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
|
||||
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
|
||||
selection = window.getSelection();//get the selection object (allows you to change selection)
|
||||
selection.removeAllRanges();//remove any selections already made
|
||||
selection.addRange(range);//make the range you have just created the visible selection
|
||||
}, 50);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
create: function () {
|
||||
$(this).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||
return $('<li>' + item.label + '</li>').appendTo(ul); // customize your HTML
|
||||
};
|
||||
},
|
||||
position: {collision: "flip"}
|
||||
});
|
||||
contentEditableElement = document.getElementsByClassName("emojionearea-editor")[0];
|
||||
range = document.createRange();//Create a range (a range is a like the selection but invisible)
|
||||
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
|
||||
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
|
||||
selection = window.getSelection();//get the selection object (allows you to change selection)
|
||||
selection.removeAllRanges();//remove any selections already made
|
||||
selection.addRange(range);//make the range you have just created the visible selection
|
||||
}, 50);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
create: function () {
|
||||
$(this).data('ui-autocomplete')._renderItem = function (ul, item) {
|
||||
return $('<li>' + item.label + '</li>').appendTo(ul); // customize your HTML
|
||||
};
|
||||
},
|
||||
position: { collision: "flip" }
|
||||
});
|
||||
}
|
||||
/*
|
||||
async function selectAElements() {
|
||||
|
@ -3085,7 +3090,7 @@ function cleanHTML(str, nodes) {
|
|||
// Loop through each attribute
|
||||
// If it's dangerous, remove it
|
||||
let atts = elem.attributes;
|
||||
for (let {name, value} of atts) {
|
||||
for (let { name, value } of atts) {
|
||||
if (!isPossiblyDangerous(name, value))
|
||||
continue;
|
||||
elem.removeAttribute(name);
|
||||
|
@ -3206,8 +3211,8 @@ function fixAdSize() {
|
|||
if (ad_container.length) {
|
||||
height = ad_container.css('height');
|
||||
width = ad_container.css('width');
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'height': height});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({'width': width});
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'height': height });
|
||||
$($('#mainVideo_ima-ad-container div:first-child')[0]).css({ 'width': width });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3492,7 +3497,7 @@ function passStrengthCheck(selector) {
|
|||
} else {
|
||||
strengthMsg.push('Special chars');
|
||||
}
|
||||
return {strength: strength, strengthMsg: strengthMsg};
|
||||
return { strength: strength, strengthMsg: strengthMsg };
|
||||
}
|
||||
|
||||
function passStrengthCheckInput(selector) {
|
||||
|
@ -3637,7 +3642,7 @@ async function setVideoSuggested(videos_id, isSuggested) {
|
|||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
url: webSiteRootURL + 'objects/videoSuggest.php',
|
||||
data: {"id": videos_id, "isSuggested": isSuggested},
|
||||
data: { "id": videos_id, "isSuggested": isSuggested },
|
||||
type: 'post',
|
||||
success: function (data) {
|
||||
modal.hidePleaseWait();
|
||||
|
@ -3869,11 +3874,11 @@ async function sendAVideoMobileMessage(type, value) {
|
|||
if (typeof window.flutter_inappwebview !== 'undefined') {
|
||||
//console.log('sendAVideoMobileMessage flutter_inappwebview', typeof window.flutter_inappwebview, window.flutter_inappwebview);
|
||||
if (typeof window.flutter_inappwebview.callHandler == 'function') {
|
||||
response = await window.flutter_inappwebview.callHandler('AVideoMobileLiveStreamer3', {type: type, value: value, instanceIndex: 3});
|
||||
response = await window.flutter_inappwebview.callHandler('AVideoMobileLiveStreamer3', { type: type, value: value, instanceIndex: 3 });
|
||||
console.log('sendAVideoMobileMessage test', response);
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var name = 'AVideoMobileLiveStreamer' + i;
|
||||
response = await window.flutter_inappwebview.callHandler(name, {type: type, value: value, instanceIndex: i});
|
||||
response = await window.flutter_inappwebview.callHandler(name, { type: type, value: value, instanceIndex: i });
|
||||
if (response !== null) {
|
||||
console.log('sendAVideoMobileMessage executed', name, response, type, value);
|
||||
break;
|
||||
|
@ -3889,7 +3894,7 @@ async function sendAVideoMobileMessage(type, value) {
|
|||
}
|
||||
} else {
|
||||
//window.parent.postMessage({type: type, value: value}, '*');
|
||||
window.top.postMessage({type: type, value: value}, '*');
|
||||
window.top.postMessage({ type: type, value: value }, '*');
|
||||
}
|
||||
}
|
||||
window.addEventListener("flutterInAppWebViewPlatformReady", function (event) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue