updates
This commit is contained in:
12
assets/js/app.min.js
vendored
12
assets/js/app.min.js
vendored
File diff suppressed because one or more lines are too long
11
assets/js/plugins.min.js
vendored
Normal file
11
assets/js/plugins.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,124 +0,0 @@
|
||||
$(document).ready(function() {
|
||||
$(document).pjax('a', '#main');
|
||||
});
|
||||
|
||||
$(document).on('ready pjax:success', function() {
|
||||
$('textarea.auto-size').textareaAutoSize();
|
||||
// Starts the perfect scroolbar plugin
|
||||
$('.scroll').perfectScrollbar();
|
||||
|
||||
// Toggles between preview and editing mode
|
||||
$("#preview").click(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var preview = $("#preview-area"),
|
||||
editor = $('.editor textarea');
|
||||
|
||||
if ($(this).data("previewing") == "true") {
|
||||
preview.hide();
|
||||
editor.fadeIn();
|
||||
$(this).data("previewing", "false");
|
||||
|
||||
notification({
|
||||
text: "Think, relax and do the better you can!",
|
||||
type: 'information',
|
||||
timeout: 2000
|
||||
});
|
||||
} else {
|
||||
var converter = new showdown.Converter(),
|
||||
text = editor.val(),
|
||||
html = converter.makeHtml(text);
|
||||
|
||||
editor.hide();
|
||||
preview.html(html).fadeIn();
|
||||
$(this).data("previewing", "true");
|
||||
|
||||
notification({
|
||||
text: "This is how your post looks like.",
|
||||
type: 'information',
|
||||
timeout: 2000
|
||||
});
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
if ($('#content-area')[0]) {
|
||||
var myCodeMirror = CodeMirror.fromTextArea($('#content-area')[0], {
|
||||
mode: 'markdown',
|
||||
theme: 'mdn-like',
|
||||
lineWrapping: true,
|
||||
lineNumbers: false,
|
||||
scrollbarStyle: null
|
||||
});
|
||||
}
|
||||
|
||||
// Submites any form in the page in JSON format
|
||||
$('form').submit(function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var data = JSON.stringify($(this).serializeJSON()),
|
||||
button = $(this).find("input[type=submit]:focus");
|
||||
|
||||
console.log(data)
|
||||
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: window.location,
|
||||
data: data,
|
||||
headers: {
|
||||
'X-Regenerate': button.data("regenerate"),
|
||||
'X-Content-Type': button.data("type")
|
||||
},
|
||||
dataType: 'json',
|
||||
encode: true,
|
||||
}).done(function(data) {
|
||||
notification({
|
||||
text: button.data("message"),
|
||||
type: 'success',
|
||||
timeout: 5000
|
||||
});
|
||||
}).fail(function(data) {
|
||||
notification({
|
||||
text: 'Something went wrong.',
|
||||
type: 'error'
|
||||
});
|
||||
console.log(data);
|
||||
});
|
||||
});
|
||||
|
||||
// Log out the user sending bad credentials to the server
|
||||
$("#logout").click(function(e) {
|
||||
e.preventDefault();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/admin",
|
||||
async: false,
|
||||
username: "username",
|
||||
password: "password",
|
||||
headers: {
|
||||
"Authorization": "Basic xxx"
|
||||
}
|
||||
}).fail(function() {
|
||||
window.location = "/";
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
// Adds one more field to the current group
|
||||
// TODO: improve this function. add group/field/array/obj
|
||||
$(".add").click(function(e) {
|
||||
e.preventDefault();
|
||||
fieldset = $(this).closest("fieldset");
|
||||
fieldset.append("<input name=\"" + fieldset.attr("name") + "\" id=\"" + fieldset.attr("name") + "\" value=\"\"></input><br>");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('pjax:send', function() {
|
||||
$('#loading').fadeIn()
|
||||
})
|
||||
$(document).on('pjax:complete', function() {
|
||||
$('#loading').fadeOut()
|
||||
})
|
||||
@@ -1,71 +0,0 @@
|
||||
$.noty.themes.admin = {
|
||||
name: 'admin',
|
||||
helpers: {},
|
||||
modal: {
|
||||
css: {
|
||||
position: 'fixed',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
backgroundColor: '#000',
|
||||
zIndex: 10000,
|
||||
opacity: 0.6,
|
||||
display: 'none',
|
||||
left: 0,
|
||||
top: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$.noty.defaults = {
|
||||
layout: 'topRight',
|
||||
theme: 'admin',
|
||||
dismissQueue: true,
|
||||
animation: {
|
||||
open: 'animated bounceInRight',
|
||||
close: 'animated fadeOut',
|
||||
easing: 'swing',
|
||||
speed: 500 // opening & closing animation speed
|
||||
},
|
||||
timeout: false, // delay for closing event. Set false for sticky notifications
|
||||
force: false, // adds notification to the beginning of queue when set to true
|
||||
modal: false,
|
||||
maxVisible: 5, // you can set max visible notification for dismissQueue true option,
|
||||
killer: false, // for close all notifications before show
|
||||
closeWith: ['click'], // ['click', 'button', 'hover', 'backdrop'] // backdrop click will close all notifications
|
||||
callback: {
|
||||
onShow: function() {},
|
||||
afterShow: function() {},
|
||||
onClose: function() {},
|
||||
afterClose: function() {},
|
||||
onCloseClick: function() {},
|
||||
},
|
||||
buttons: false // an array of buttons
|
||||
};
|
||||
|
||||
notification = function(options) {
|
||||
var icon;
|
||||
|
||||
switch (options.type) {
|
||||
case "success":
|
||||
icon = '<i class="fa fa-check"></i>';
|
||||
break;
|
||||
case "error":
|
||||
icon = '<i class="fa fa-times"></i>';
|
||||
break;
|
||||
case "warning":
|
||||
icon = '<i class="fa fa-exclamation"></i>';
|
||||
break;
|
||||
case "information":
|
||||
icon = '<i class="fa fa-info"></i>';
|
||||
break;
|
||||
default:
|
||||
icon = '<i class="fa fa-bell"></i>';
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
template: '<div class="noty_message"><span class="noty_icon">' + icon + '</span><span class="noty_text"></span></div>'
|
||||
}
|
||||
|
||||
options = $.extend({}, defaults, options);
|
||||
noty(options);
|
||||
}
|
||||
Reference in New Issue
Block a user