123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692 |
- </div>
- </div>
- <?php include "layout/sidebar.php"; ?>
- </div>
- </div>
- <?php
- $query = http_build_query(array_filter(array(
- //'instance' => ($instance == true ? $instance : false) ,
- 'user' => (isset($tl['user']) == true ? $tl['user'] : false) ,
- 'mode' => $tl['mode'],
- //'explicit' => ($nocookies == true ? $user_settings['explicit'] : false) ,
- )));
- ?>
- <div class="mobile" style="display:block; height:50px;"></div>
- <script src="vendor/jquery.min.js"></script>
- <script src="vendor/jqueryui.js"></script>
- <script src="js/scripts.js"></script>
- <script type="text/javascript">
-
- window.setInterval(function() {
- $( ".post > .replies_container" ).each(function() {
- var len = $(this).find('.reply').length;
- if(len > 0){
- var id = $(this).attr('id');
- var last = $(this).find('.reply').last().attr('id');
- $.get("action.php?a=true&replies=" + id + "&since="+last, function(data) {
- if (data !== ''){
- $( ".post > #"+id+".replies_container" ).append(data);
- }
- });
- }
- });
- }, 15000);
- window.setInterval(function() {
- var thread = getUrlParameter('thread');
- if (typeof thread == 'undefined') {
- return false;
- }
- $.get("action.php?a=true¬es=" + thread, function(data) {
- thread = getUrlParameter('thread');
- if (typeof thread == 'undefined') {
- return false;
- }
- $( ".post_notes" ).html(data);
- });
- }, 15000);
- <?php if ($logedin): ?>
- $('body').on('click', '.replyform', function(e) {
- e.preventDefault;
- $("#replyform").remove();
- $(".element").removeClass("element_pad");
- $(this).closest(".element").addClass("element_pad");
- var id = $(this).parents().eq(1).attr('id');
- var type = $(this).parents().eq(3).attr('mode').trim().replace(" ",".");
- console.log(type);
- $('#replyform').remove();
- var data = JSON.parse(document.getElementById('data-' + id).innerHTML);
- $.get("action.php?a=true&themefile=templates/replyform.txt", function(result) {
- result = result.replace(":content:", data.mentions)
- result = result.replace(":id:", data.id)
-
- if(type == 'post'){
- $('.'+type).find('#' + id+'.replies_container').prepend(result);
- } else {
- $('#' + id+'.'+type).after(result);
- }
- $('#replyform #' + data.scope).prop('selected', true);
- $('#' + id).fadeIn(400);
- });
- });
-
- $('body').on('click', '.compose', function(e) {
- $('#postform').toggle();
- });
-
- $('body').on('click', '.polloption:not(.fixed)', function(e) {
- if (typeof $(this).parent().attr('multiple') == 'undefined'){
- $('.polloption').removeClass('voted');
- }
- $(this).toggleClass('voted');
- });
-
- $('body').on('click', '.vote', function(e) {
- var id = $(this).attr('id');
- var c = 0;
- var choice = [];
- $('#'+id+'.poll .polloption').each(function(a){
- if ($(this).hasClass('voted')){
- console.log(c);
- choice.push(c);
- }
- c++;
- });
- var choices = choice.join(',');
- console.log(choices);
- $.get("action.php?a=true&vote="+id+"&choices="+choices, function(result) {
- $('#'+id+'.poll').html(result);
- });
- });
-
- $('body').on('click', '.searchform', function(e) {
- $(this).prev().toggle();
- });
- $('body').on('click', '.searchmobiletoggle', function(e) {
- $('#usermenu').off('hover');
- $('#usermenu').off('active');
- $('#searchmobile').toggle();
- });
- $("body").on("keydown", "form", function (e) {
- if (e.ctrlKey && e.keyCode === 13) {
- $(this).find('input[type="submit"]').click();
- }
- });
- $('.tlicon').click(function(){
- $('.tlicon').each(function(a){
- $( this ).removeClass('tiselected')
- });
- $( this ).addClass('tiselected');
- });
- $('body').on('click', '#send', function() {
- var form = $(this).closest('.form');
- $(form).find(".status").html('<span id="loading" class="animate-spin fontello"></span>');
- var status = $(form).find('textarea').val()
- var sensitive = $(form).find('input[name=sensitive]').prop('checked');
- var spoiler = $(form).find('input[name=spoiler]').val();
- var scope = $(form).find('select[name=scope]').val();
- var thread = $(form).find('input[name=thread]').val();
- var IDs = [];
- $(form).find(".uploadedImage").each(function(){ IDs.push(this.id); });
- var uploaded = IDs.join("|");
- $.post("action.php", {
- status: status,
- scope: scope,
- thread: thread,
- uploaded: uploaded,
- spoiler: spoiler,
- sensitive: sensitive
- },
- function(data) {
- $(form).closest('.element').find(".picker").css("display","none");
- if($(form).closest('.element').attr('id') == 'postform'){
- $(form).find('textarea').val('');
- $(form).find('.uploadBox').remove();
- $(form).find('input[name=sensitive]').prop('checked', false);
- $(form).find(".status").html('');
- $(form).find('input[name=spoiler]').val('');
- newPosts();
- } else {
- var parent = $(form).closest('.element').find('.post').first().attr('id');
- $('#replyform').remove();
- $('#'+parent+'.replies_container').append(data);
- }
- });
- });
-
- $('body').on('click', '.quickreply', function(e) {
- $(".notif.form").remove();
- $(this).closest('.notif').after('<div class="notif form"><div class="notifContents"><input type="hidden" name="thread" value="'+$(this).attr('id')+'"><input type="hidden" name="mentions" value="'+$(this).attr('data-mentions')+'"><textarea style="width:100%; height100%; border: 1px solid #ddd;"></textarea><input type="submit" id="quicksend" value="Send"></div></div>');
- });
-
- $('body').on('click', '#quicksend', function() {
-
- var form = $('#quicksend').closest('.form');
- var thread = $(form).find('input[name=thread]').val();
- var mentions = $(form).find('input[name=mentions]').val();
- var status = mentions + $(form).find('textarea').val();
- $(".notif.form").html('<span id="loading" class="animate-spin fontello"></span>');
- $.post("action.php", {
- status: status,
- thread: thread,
- },
- function(data) {
- $(".notif.form").remove();
- notificaton('Reply Sent!');
- });
- });
- $('body').on('click', '.badge', function() {
- $('#notifications').toggle();
- var notif = $('#hiddenside').children().first().attr('id');
- localStorage.setItem("notif", notif);
- $('#notifications').find('.container').children().removeClass('new');
- $('.alert').css('display','none');
- var title = document.title;
- document.title = title.replace("(*)", "");
- $("#favicon").attr("href","favicon.ico");
- });
-
- $('body').on('click', '#usermenu', function() {
- $('.mobilemenu').toggle();
- });
-
- $('body').on('click', '.link', function() {
- $('.mobilemenu').hide();
- });
-
- $('body').on('click', '.account', function() {
- $('.switcher').toggle();
- $('.account').toggle();
- });
-
- $('body').on('click', '.notif .ldr', function(e) {
- $('#notifications').find('.container').children().removeClass('new');
- $('#notifications').css('display','none');
- $('.alert').css('display','none');
- var title = document.title;
- document.title = title.replace("(*)", "");
- $("#favicon").attr("href","favicon.ico");
- });
-
- $('body').on('click', '.nloadmore', function() {
- var n = $('#notifications').find('.container').children().last().attr('id');
- $('#notifications').find('.container').children().last().after('<span id="loading" class="animate-spin fontello" style="color:black;"></span>');
- $.get("action.php?a=true&max=true¬if=" + n, function(data) {
- $('#loading').remove();
- $('#notifications').find('.container').append(data);
- });
- });
-
- window.setInterval(function() {
- var n = localStorage.getItem("notif");
- var f = $("#notifications").find('.container').children().first().attr('id');
- var nf;
- if (n < f) {
- nf = n;
- //$("#notifications").html('');
- } else {
- nf = f;
- }
- $.get("action.php?a=true¬if=" + f, function(data) {
- if (data) {
- var title = document.getElementsByTagName("title")[0].innerHTML;
- if (title.indexOf("(*)") < 0) {
- document.getElementsByTagName("title")[0].innerHTML = "(*) " + title;
- $("#favicon").attr("href","nfavicon.ico");
- }
- $('#notifications').find('.container').prepend(data);
- var cnt = $('#notifications .container div.new').length;
- var notif = $('#hiddenside').children().first().attr('id');
- localStorage.setItem("notif", notif);
- $.when($('#hiddenside').html('')).then(function() {
- $('.alert').css('display','block');
- $('#hiddenside').append(data);
- $('#hiddenside').children().each(function(index) {
- $(this).delay(4000 + (1000 * index)).fadeOut("slow");
- });
- });
- }
- });
- }, 15000);
- function notificaton(message){
- var notif = "<div class='notif error' style='border-left:3px solid red; background-color:pink;'> <div class='notifContents'> <div style='flex: 0 0 60px; background-size:cover; border-radius:5px;'></div> <div style='flex: 1; padding-left:5px; padding-right:5px; word-break: break-all; overflow:hidden;'> <span>"+message+"</span> </div> </div> </div>";
- $('#hiddenside').append(notif);
- $('#hiddenside').children().each(function(index) {
- $(this).delay(4000 + (1000 * index)).fadeOut("slow");
- });
- return false;
- };
- $('body').on('click', '.fav', function(e) {
- e.preventDefault;
- var id = $(this).parents().eq(1).attr('id');
- $("#"+id+".post_buttons .fav").switchClass("fav","unfav",200);
- $.get("action.php?a=true&mode=on&fav=" + id, function(data) {
- if (data == 'error') {
- $("#"+id+".post_buttons .unfav").switchClass("unfav","fav",200);
- } else {
- $("#"+id+".post_buttons .unfav").children().html(data);
- }
- });
- });
- $('body').on('click', '.unfav', function(e) {
- e.preventDefault;
- var id = $(this).parents().eq(1).attr('id');
- $("#"+id+".post_buttons .unfav").switchClass("unfav","fav",200);
- $.get("action.php?a=true&mode=off&fav=" + id, function(data) {
- if (data == 'error') {
- $("#"+id+".post_buttons .fav").switchClass("fav","unfav",200);
- } else {
- $("#"+id+".post_buttons .fav").children().html(data);
- }
- });
- });
-
- $('body').on('click', '.reblog', function(e) {
- e.preventDefault;
- var id = $(this).parents().eq(1).attr('id');
- $("#"+id+".post_buttons .reblog").switchClass("reblog","unreblog",200);
- $.get("action.php?a=true&mode=on&reblog=" + id, function(data) {
- if (data == 'error') {
- $("#"+id+".post_buttons .unreblog").switchClass("unreblog","reblog",200);
- } else {
- $("#"+id+".post_buttons .unreblog").children().html(data);
- }
- });
- });
- $('body').on('click', '.unreblog', function(e) {
- e.preventDefault;
- var id = $(this).parents().eq(1).attr('id');
- $("#"+id+".post_buttons .unreblog").switchClass("unreblog","reblog",200);
- $.get("action.php?a=true&mode=off&reblog=" + id, function(data) {
- if (data == 'error') {
- $("#"+id+".post_buttons .reblog").switchClass("reblog","unreblog",200);
- } else {
- $("#"+id+".post_buttons .reblog").children().html(data);
- }
- });
- });
-
- $('body').on('click', '.mute', function() {
- var id = $(this).attr('id');
- $.get("action.php?a=true&mode=true&mute=" + id, function(data) {
- $('#' + id + '.mute').switchClass("mute","unmute",200);
- $('#' + id + '.unmute').html('Unmute');
- });
- });
-
- $('body').on('click', '.softmute', function() {
- var id = $(this).attr('id');
- $.get("action.php?a=true&mode=true&softmute=" + id, function(data) {
- notificaton('User added to soft mute list!');
- });
- });
- $('body').on('click', '.unmute', function() {
- var id = $(this).attr('id');
- $.get("action.php?a=true&mode=off&mute=" + id, function(data) {
- $('#' + id + '.unmute').switchClass("unmute","mute",200);
- $('#' + id + '.mute').html('Mute');
- });
- });
-
- $('body').on('click', '.muteconv', function() {
- var id = $(this).attr('id');
- $.get("action.php?a=true&mode=true&thread=true&mute=" + id, function(data) {
- $('#' + id + '.muteconv').switchClass("muteconv","unmuteconv",200);
- $('#' + id + '.unmuteconv').html('Unmute Thread');
- console.log(data);
- });
- });
- $('body').on('click', '.unmuteconv', function() {
- var id = $(this).attr('id');
- $.get("action.php?a=true&mode=off&thread=true&mute=" + id, function(data) {
- $('#' + id + '.muteconv').switchClass("unmuteconv","muteconv",200);
- $('#' + id + '.muteconv').html('Mute Thread');
- console.log(data);
- });
- });
- $('body').on('click', '.menu', function(e) {
- $(this).next('span').slideToggle('left');
- });
- $('body').on('click', '.delete', function(e) {
- e.preventDefault;
- var id = $(this).attr('id');
- var post = $('#'+id+'.post').parent();
- var reply = $('#'+id+'.reply');
- $.get("action.php?a=true&delete=" + id, function(data) {
- if (data == '0') {
- post.css('opacity','0.5');
- reply.css('opacity','0.5');
- } else {
- $.when(post.fadeOut('slow')).then(function(){
- post.remove();
- reply.remove();
- });
- }
- });
- });
-
- $('body').on('click', '.delete', function(e) {
- e.preventDefault;
- var id = $(this).attr('id');
- $.get("action.php?a=true&bookmark=" + id, function(data) {
- notificaton('Post bookmarked!');
- });
- });
-
- $('body').on('click', '.quote', function(e) {
- e.preventDefault;
- var id = $(this).closest('.post').attr('id');
- console.log(id);
- var url = $("#"+id+".post .original").attr("href");
- console.log(url);
- $("#postform").find('textarea').val("> "+url+"\n\n");
- if ($("#postform").is(':visible')) {
- location.hash = "#top";
- } else {
- $('#postform').toggle();
- }
- });
-
- $('body').on('click', '.delpic', function(e) {
- var count = $(this).closest('#files').children().length;
- if (count == 1){
- $(this).closest('.uploadBox').remove();
- } else {
- count = count - 1;
- $(this).parent().fadeOut();
- $(this).parent().remove();
- }
- });
- /* paste to upload */
- document.onpaste = function(event){
- var items = (event.clipboardData || event.originalEvent.clipboardData).items;
- for (var i = 0 ; i < items.length ; i++) {
- var item = items[i];
- if (item.type.indexOf("image") != -1) {
- var file = item.getAsFile();
- upload_file_with_ajax(file,file_uploaded);
- }
- }
- }
- function upload_file_with_ajax(file, ajax_callback){
- $("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
- $.get("action.php?a=true&info=true", function(data) {
- const info = JSON.parse(data);
- var formData = new FormData();
- formData.append('file', file);
- $.ajax("https://"+info[1]+"/api/v2/media" , {
-
- type: 'POST',
- headers: {'Authorization': 'Bearer '+info[0]},
- contentType: false,
- processData: false,
- data: formData,
- error: function() {
- console.log('There was a problem uploading this file. Retrying with legacy mode.');
- $.ajax("upload.php" , {
- type: 'POST',
- headers: {'Authorization': 'Bearer '+info[0]},
- contentType: false,
- processData: false,
- data: formData,
- error: function() {
- notificaton('There was a problem uploading this file.');
- $("#postform .status").html('');
- },
- success: function (response) {
- if (typeof ajax_callback == 'function') {
- ajax_callback(JSON.parse(response));
- } else if (typeof ajax_callback == 'string') {
- if (ajax_callback != '') {
- eval(ajax_callback + '(response)');
- }
- }
- }
- });
- },
- success: function (response) {
- if (typeof ajax_callback == 'function') {
- ajax_callback(response);
- } else if (typeof ajax_callback == 'string') {
- if (ajax_callback != '') {
- eval(ajax_callback + '(response)');
- }
- }
- }
- });
- });
- }
-
- function file_uploaded(data) {
- //data = JSON.parse(data);
- if ($("#postform .uploadBox").length < 1){
- $("#postform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
- $( function() {
- $( "#files" ).sortable();
- $( "#files" ).disableSelection();
- } );
- }
- let file;
- switch (data.type) {
- case 'image':
- file = data.preview_url;
- break;
- case 'audio':
- file = 'img/aud.png';
- break;
- case 'video':
- file = 'img/vid.png';
- break;
- default:
- file = 'img/doc.png';
- break;
- }
- var nfiles = $("#postform .uploadBox").children().length;
- $("ul[id=files]").append('<li class="uploadedImage" id="'+data.id+'" style="position:relative; background-image:url('+file+')"><div class="fontello delpic"></div></li>');
- $("#postform .status").html('');
- }
- function upload_files() {
- $("#postform .status").html('<span id="loading" class="animate-spin fontello"></span>');
- $.get("action.php?a=true&info=true", function(data) {
- const info = JSON.parse(data);
- var fileUpload = $("#files_input_field").get(0);
- var files = fileUpload.files;
- if (files.length == 0) return;
- var data;
- for (var i = 0; i < files.length; i++) {
- data = new FormData();
- data.append('file', files[i]);
-
- $.ajax({
- type: "POST",
- headers: {'Authorization': 'Bearer '+info[0]},
- url: "https://"+info[1]+"/api/v2/media",
- contentType: false, //default: 'application/x-www-form-urlencoded; charset=UTF-8'
- processData: false, //default: data, other DOMDocument
- data: data, //Type: PlainObject or String or Array
- success: function(data) {
- console.log(data);
- if ($("#postform .uploadBox").length < 1){
- $("#postform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
- $( function() {
- $( "#files" ).sortable();
- $( "#files" ).disableSelection();
- } );
- }
- let file;
- switch (data.type) {
- case 'image':
- file = data.preview_url;
- break;
- case 'audio':
- file = 'img/aud.png';
- break;
- case 'video':
- file = 'img/vid.png';
- break;
- default:
- file = 'img/doc.png';
- break;
- }
-
- console.log(data.id);
- $("ul[id=files]").append('<li class="uploadedImage" id="'+data.id+'" style="position:relative; background-image:url('+file+')"><div class="fontello delpic"></div></li>');
- if(i === files.length){
- $("#postform .status").html('');
- }
- },
- error: function(jqXHR, e) {
- console.log(jqXHR);
- console.log('There was a problem uploading this file, trying again with legacy upload.');
- $("#postform .status").html('');
- // Attempt the upload again with upload.php
- $.ajax({
- type: "POST",
- headers: {'Authorization': 'Bearer '+info[0]},
- url: "upload.php",
- contentType: false,
- processData: false,
- data: data,
- success: function(data) {
- console.log(data);
- data = JSON.parse(data);
- if ($("#postform .uploadBox").length < 1){
- $("#postform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
- $( function() {
- $( "#files" ).sortable();
- $( "#files" ).disableSelection();
- } );
- }
- let file;
- switch (data.type) {
- case 'image':
- file = data.preview_url;
- break;
- case 'audio':
- file = 'img/aud.png';
- break;
- case 'video':
- file = 'img/vid.png';
- break;
- default:
- file = 'img/doc.png';
- break;
- }
-
- console.log(data.id);
- $("ul[id=files]").append('<li class="uploadedImage" id="'+data.id+'" style="position:relative; background-image:url('+file+')"><div class="fontello delpic"></div></li>');
- if(i === files.length){
- $("#postform .status").html('');
- }
- },
- error: function(jqXHR, e) {
- console.log(jqXHR);
- notificaton('There was a problem uploading this file.');
- }
- });
- }
- });
-
- }
-
- });
- }
-
- function upload_files_reply() {
- $("#replyform .status").html('<span id="loading" class="animate-spin fontello"></span>');
- $.get("action.php?a=true&info=true", function(data) {
- const info = JSON.parse(data);
- var fileUpload = $("#replyform #files_input_field").get(0);
- var files = fileUpload.files;
- if (files.length == 0) return;
- var data;
- for (var i = 0; i < files.length; i++) {
- data = new FormData();
- data.append('file', files[i]);
-
- $.ajax({
- type: "POST",
- headers: {'Authorization': 'Bearer '+info[0]},
- url: "https://"+info[1]+"/api/v2/media",
- contentType: false, //default: 'application/x-www-form-urlencoded; charset=UTF-8'
- processData: false, //default: data, other DOMDocument
- data: data, //Type: PlainObject or String or Array
- success: function(data) {
- console.log(data);
- if ($("#replyform .uploadBox").length < 1){
- $("#replyform #status").before('<div class="uploadBox"><ul id="files" style="margin:0px;"></ul></div>');
- $( function() {
- $( "#files" ).sortable();
- $( "#files" ).disableSelection();
- } );
- }
- let file;
- switch (data.type) {
- case 'image':
- file = data.preview_url;
- break;
- case 'audio':
- file = 'img/aud.png';
- break;
- case 'video':
- file = 'img/vid.png';
- break;
- default:
- file = 'img/doc.png';
- break;
- }
-
- console.log(data.id);
- $("#replyform #files").append('<li class="uploadedImage" id="'+data.id+'" style="position:relative; background-image:url('+file+')"><div class="fontello delpic"></div></li>');
- if(i === files.length){
- $("#postform .status").html('');
- }
- },
- error: function(jqXHR,e) {
- console.log(jqXHR);
- notificaton('There was a problem uploading this file.');
- $("#replyform .status").html('');
- }
- });
-
- }
-
- });
- }
- <?php endif; ?>
- </script>
-
- </body>
|