mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-26 04:51:08 -05:00
pip install jsbeautifier
This commit is contained in:
parent
4049cd4447
commit
366d79e5af
@ -41,7 +41,10 @@ ST.spamadmin = function() {
|
|||||||
$('.content .quick_remove').live('click', function(ev) {
|
$('.content .quick_remove').live('click', function(ev) {
|
||||||
var ip = $(ev.target).data('ip');
|
var ip = $(ev.target).data('ip');
|
||||||
if (confirm('Delete all pastes belonging to ' + ip + '?')) {
|
if (confirm('Delete all pastes belonging to ' + ip + '?')) {
|
||||||
$.post(base_url + 'spamadmin/' + ip, { 'confirm_remove': 'yes', 'block_ip': 1 }, function() {
|
$.post(base_url + 'spamadmin/' + ip, {
|
||||||
|
'confirm_remove': 'yes',
|
||||||
|
'block_ip': 1
|
||||||
|
}, function() {
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -56,7 +59,7 @@ ST.line_highlighter = function() {
|
|||||||
var second_line = false;
|
var second_line = false;
|
||||||
|
|
||||||
$('.text_formatted').on('mousedown', function(ev) {
|
$('.text_formatted').on('mousedown', function(ev) {
|
||||||
if(ev.which == 1){ // left mouse button has been clicked
|
if (ev.which == 1) { // left mouse button has been clicked
|
||||||
window.getSelection().removeAllRanges();
|
window.getSelection().removeAllRanges();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -64,16 +67,16 @@ ST.line_highlighter = function() {
|
|||||||
$('.text_formatted').on('click', 'li', function(ev) {
|
$('.text_formatted').on('click', 'li', function(ev) {
|
||||||
var $this = $(this);
|
var $this = $(this);
|
||||||
var li_num = ($this.index() + 1);
|
var li_num = ($this.index() + 1);
|
||||||
if(ev.shiftKey == 1){
|
if (ev.shiftKey == 1) {
|
||||||
second_line = li_num;
|
second_line = li_num;
|
||||||
} else {
|
} else {
|
||||||
first_line = li_num;
|
first_line = li_num;
|
||||||
second_line = false;
|
second_line = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(second_line){
|
if (second_line) {
|
||||||
// determine mark
|
// determine mark
|
||||||
if(first_line < second_line) {
|
if (first_line < second_line) {
|
||||||
sel_start = first_line;
|
sel_start = first_line;
|
||||||
sel_end = second_line;
|
sel_end = second_line;
|
||||||
} else {
|
} else {
|
||||||
@ -92,20 +95,20 @@ ST.line_highlighter = function() {
|
|||||||
|
|
||||||
ST.highlight_lines = function() {
|
ST.highlight_lines = function() {
|
||||||
var wloc = window.location.href;
|
var wloc = window.location.href;
|
||||||
if(wloc.indexOf('#') > -1) {
|
if (wloc.indexOf('#') > -1) {
|
||||||
$('.text_formatted .container li').css('background', 'none');
|
$('.text_formatted .container li').css('background', 'none');
|
||||||
|
|
||||||
var lines = wloc.split('#')[1];
|
var lines = wloc.split('#')[1];
|
||||||
if(lines.indexOf('-') > -1) {
|
if (lines.indexOf('-') > -1) {
|
||||||
var start_line = parseInt(lines.split('-')[0].replace('L', ''), 10);
|
var start_line = parseInt(lines.split('-')[0].replace('L', ''), 10);
|
||||||
var end_line = parseInt(lines.split('-')[1].replace('L', ''), 10);
|
var end_line = parseInt(lines.split('-')[1].replace('L', ''), 10);
|
||||||
for(var i=start_line; i<=end_line; i++) {
|
for (var i = start_line; i <= end_line; i++) {
|
||||||
$('.text_formatted .container li:nth-child(' + i + ')').css('background', '#F8EEC7');
|
$('.text_formatted .container li:nth-child(' + i + ')').css('background', '#F8EEC7');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var re = new RegExp('^L[0-9].*?$');
|
var re = new RegExp('^L[0-9].*?$');
|
||||||
var r = lines.match(re);
|
var r = lines.match(re);
|
||||||
if(r) {
|
if (r) {
|
||||||
var marked_line = lines.replace('L', '');
|
var marked_line = lines.replace('L', '');
|
||||||
$('.text_formatted .container li:nth-child(' + marked_line + ')').css('background', '#F8EEC7');
|
$('.text_formatted .container li:nth-child(' + marked_line + ')').css('background', '#F8EEC7');
|
||||||
}
|
}
|
||||||
@ -137,7 +140,7 @@ ST.crypto = function() {
|
|||||||
'reply': $('input[name=reply]').val()
|
'reply': $('input[name=reply]').val()
|
||||||
},
|
},
|
||||||
function(redirect_url) {
|
function(redirect_url) {
|
||||||
if(redirect_url.indexOf('invalid') > -1) {
|
if (redirect_url.indexOf('invalid') > -1) {
|
||||||
$('#create_encrypted').parent().html('<p>' + redirect_url + '#' + key + '</p>');
|
$('#create_encrypted').parent().html('<p>' + redirect_url + '#' + key + '</p>');
|
||||||
} else {
|
} else {
|
||||||
window.location.href = base_url + redirect_url + '#' + key;
|
window.location.href = base_url + redirect_url + '#' + key;
|
||||||
@ -149,11 +152,11 @@ ST.crypto = function() {
|
|||||||
|
|
||||||
// decryption routine
|
// decryption routine
|
||||||
w_href = window.location.href;
|
w_href = window.location.href;
|
||||||
if(w_href.indexOf('#') > -1) {
|
if (w_href.indexOf('#') > -1) {
|
||||||
key = w_href.split('#')[1];
|
key = w_href.split('#')[1];
|
||||||
var re = new RegExp('^L[0-9].*?$');
|
var re = new RegExp('^L[0-9].*?$');
|
||||||
var r = key.match(re);
|
var r = key.match(re);
|
||||||
if(key.indexOf('-') > -1 || r) {
|
if (key.indexOf('-') > -1 || r) {
|
||||||
// line highlighter
|
// line highlighter
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@ -182,12 +185,12 @@ ST.crypto = function() {
|
|||||||
// kick out potential dangerous and unnecessary stuff
|
// kick out potential dangerous and unnecessary stuff
|
||||||
$('.text_formatted').css('background', '#efe');
|
$('.text_formatted').css('background', '#efe');
|
||||||
$('.replies').hide();
|
$('.replies').hide();
|
||||||
for(var i=2; i<=7; i++) {
|
for (var i = 2; i <= 7; i++) {
|
||||||
$('.meta .detail:nth-child(' + i + ')').hide();
|
$('.meta .detail:nth-child(' + i + ')').hide();
|
||||||
}
|
}
|
||||||
$('.meta .spacer:first').hide();
|
$('.meta .spacer:first').hide();
|
||||||
$('.qr').hide();
|
$('.qr').hide();
|
||||||
} catch(e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,18 +199,66 @@ ST.crypto = function() {
|
|||||||
ST.crypto_generate_key = function(len) {
|
ST.crypto_generate_key = function(len) {
|
||||||
var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
var index = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
|
||||||
var key = '';
|
var key = '';
|
||||||
for(var i=0; i<len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
key += index[Math.floor(Math.random()*index.length)]
|
key += index[Math.floor(Math.random() * index.length)]
|
||||||
};
|
};
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ST.filereader = function() {
|
||||||
|
var options = {
|
||||||
|
// CSS Class to add to the drop element when a drag is active
|
||||||
|
dragClass: "drag",
|
||||||
|
|
||||||
|
// A string to match MIME types, for instance
|
||||||
|
accept: false,
|
||||||
|
|
||||||
|
// An object specifying how to read certain MIME types
|
||||||
|
// For example: {
|
||||||
|
// 'image/*': 'DataURL',
|
||||||
|
// 'data/*': 'ArrayBuffer',
|
||||||
|
// 'text/*' : 'Text'
|
||||||
|
// }
|
||||||
|
readAsMap: {},
|
||||||
|
|
||||||
|
// How to read any files not specified by readAsMap
|
||||||
|
readAsDefault: 'DataURL',
|
||||||
|
on: {
|
||||||
|
beforestart: function(e, file) {
|
||||||
|
// return false if you want to skip this file
|
||||||
|
},
|
||||||
|
loadstart: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
progress: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
load: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
error: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
loadend: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
abort: function(e, file) { /* Native ProgressEvent */ },
|
||||||
|
skip: function(e, file) {
|
||||||
|
// Called when a file is skipped. This happens when:
|
||||||
|
// 1) A file doesn't match the accept option
|
||||||
|
// 2) false is returned in the beforestart callback
|
||||||
|
},
|
||||||
|
groupstart: function(group) {
|
||||||
|
// Called when a 'group' (a single drop / copy / select that may
|
||||||
|
// contain multiple files) is receieved.
|
||||||
|
// You can ignore this event if you don't care about groups
|
||||||
|
},
|
||||||
|
groupend: function(group) {
|
||||||
|
// Called when a 'group' is finished.
|
||||||
|
// You can ignore this event if you don't care about groups
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$("textarea").fileReaderJS(opts);
|
||||||
|
}
|
||||||
|
|
||||||
ST.init = function() {
|
ST.init = function() {
|
||||||
ST.expand();
|
ST.expand();
|
||||||
ST.show_embed();
|
ST.show_embed();
|
||||||
ST.spamadmin();
|
ST.spamadmin();
|
||||||
ST.line_highlighter();
|
ST.line_highlighter();
|
||||||
ST.crypto();
|
ST.crypto();
|
||||||
|
ST.filereader();
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user