structure changes

This commit is contained in:
Henrique Dias
2016-03-06 20:37:49 +00:00
parent 3f36200862
commit 1375038a66
43 changed files with 405 additions and 392 deletions

View File

@@ -1,589 +0,0 @@
body {
font-family: 'Roboto', sans-serif;
color: #212121;
background-color: #f5f5f5;
height: 100%;
width: 100%;
padding-top: 3em;
}
* {
box-sizing: border-box;
}
a {
text-decoration: none;
color: #1976D2;
}
code {
border-radius: .2em;
}
img {
max-width: 100%;
}
h2 {
margin: .83em 0;
}
.container {
margin: 0 auto;
width: 95%;
max-width: 1000px;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
#content > header {
background-color: #00BCD4;
padding: 1px 0;
}
/* NAVIGATION */
body > nav {
position: fixed;
top: 0;
left: 0;
height: 3em;
width: 100%;
background-color: #0097A7;
padding: 0 1em;
box-sizing: border-box;
z-index: 999;
color: #eee;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
body > nav ul {
margin: 0;
padding: 0;
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
body > nav ul li {
list-style-type: none;
display: inline-block;
vertical-align: middle;
}
body > nav ul li:first-child a {
margin-left: -0.5em;
}
body > nav ul li:last-child a {
margin-right: -0.5em;
}
body > nav ul li:last-child {
margin-left: auto;
}
body > nav img {
height: 2em;
}
body > nav ul li a {
padding: .5em;
line-height: 2em;
display: block;
text-decoration: none;
color: inherit;
-webkit-transition: .5s ease background-color;
transition: .5s ease background-color;
}
body > nav ul li a:hover {
background-color: rgba(0, 0, 0, 0.1);
}
/* FOOTER */
body > footer {
background-color: #ddd;
text-align: center;
padding: 1em 0;
margin-top: 1em;
}
body > footer p {
width: 95%;
max-width: 1000px;
margin: 0 auto;
color: #78909C;
font-size: .9em
}
body > footer a {
color: #aaa;
}
/* NOFICATIONS */
#noty_topRight_layout_container {
font-family: sans-serif;
top: 4em !important;
right: 1em !important;
position: fixed !important;
width: 310px;
height: auto;
margin: 0;
padding: 0;
list-style-type: none;
z-index: 10000000;
}
#noty_topRight_layout_container li {
overflow: hidden;
margin: 0 0 .25em;
}
.noty_bar {
color: #fff;
background-color: #cfd8dc;
border-radius: .3em;
}
.noty_message {
font-size: .75em;
font-weight: bold;
line-height: 1.2em;
text-align: left;
padding: 1em;
width: auto;
position: relative;
}
.noty_text {
display: block;
box-sizing: border-box;
margin-left: 3em;
top: 1em;
}
.noty_icon {
position: absolute;
left: 0;
top: 0;
box-sizing: border-box;
height: 100%;
padding: 1em;
background-color: rgba(0, 0, 0, .1);
border-top-left-radius: .3em;
border-bottom-left-radius: .3em;
text-align: center;
}
.noty_icon .fa {
width: 1em !important;
}
.noty_type_success {
background-color: #00c853;
}
.noty_type_error {
background-color: #ff5252;
}
.noty_type_warning {
background-color: #ffd600;
}
.noty_type_information {
background-color: #448aff;
}
/* EDITOR : BUTTONS */
button,
input[type="submit"] {
border-radius: 0.2em;
border: 0;
padding: .5em 1em;
color: #000;
font-weight: normal;
background-color: #FFEB3B;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.12);
-webkit-transition: .5s ease background-color;
transition: .5s ease background-color;
}
button.darker {
background-color: #F9A825;
}
button.darker:hover {
background-color: #F57F17;
}
button:hover,
input[type="submit"]:hover,
button:active,
input[type="submit"]:active,
button:focus,
input[type="submit"]:focus {
outline: 0;
background-color: #FDD835;
}
button.add,
button.delete,
button.rename {
color: #fff;
padding: 0.063em 0.375em;
}
button.add {
background-color: #8BC34A;
}
button.add:hover {
background-color: #689F38;
}
button.delete {
background-color: #F44336;
}
button.delete:hover {
background-color: #D32F2F;
}
button.rename {
background-color: #1565C0;
}
button.rename:hover {
background-color: #0D47A1;
}
.frontmatter > .actions {
margin-top: 0;
text-align: right;
}
.frontmatter > .actions button.add {
padding: .5em 1em;
}
.toolbar .right {
float: right;
}
.toolbar input[type="submit"] {
background-color: #00BCD4;
color: #fff;
}
.toolbar input.default {
background-color: #8BC34A;
}
.editor h1 textarea {
width: 100%;
border: 0;
font-size: 2em;
font-weight: 400;
resize: none;
overflow: hidden;
line-height: 1em;
height: 1em;
background-color: transparent;
}
.block > .actions,
fieldset > .actions {
position: absolute;
top: 0.5em;
right: 0.5em;
}
.blocks {
-webkit-column-count: 4;
-moz-column-count: 4;
column-count: 4;
-webkit-column-gap: 1em;
-moz-column-gap: 1em;
column-gap: 1em;
}
.block,
fieldset {
display: inline-block;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
background-color: #fff;
padding: 0.6em;
box-sizing: border-box;
margin: 0 0 1em;
position: relative;
width: 100%;
border: 0;
}
.block label,
fieldset label,
fieldset h3 {
font-weight: bold;
display: block;
margin-top: 0;
font-size: 1em;
}
.block textarea {
width: 100%;
background-color: transparent;
resize: vertical;
background-color: inherit;
border: 0;
overflow: hidden;
}
input {
border: 0;
outline: 0;
background-color: transparent;
width: 100%;
}
input[type="submit"] {
width: auto;
}
fieldset input {
width: calc(100% - 1.57em);
margin: 0.5em 0;
}
.complete .block[data-content="title"] {
display: none;
}
/* TOGGLER, SOURCE AND PREVIEW */
.editor .content {
border-radius: 0.5em;
border: 1px solid #d8d8d8;
background-color: #f7f7f7;
}
.editor .content nav a {
padding: 1em 1em;
line-height: 3em;
cursor: pointer;
font-size: 1em;
color: inherit;
}
.editor .content nav a.active {
font-weight: bold;
}
#editor-preview {
padding: 4% 13%;
display: block;
background-color: rgb(255, 255, 255);
display: none;
}
.ace_editor {
margin: 0;
border-bottom-left-radius: .5em;
border-bottom-right-radius: 0.5em;
}
.ace_gutter {
background-color: #f7f7f7 !important;
}
/* BROWSE */
.browse a {
color: inherit;
text-decoration: none;
}
.browse .actions {
background-color: #00BCD4;
color: #fff;
padding: 1.5em 0;
}
.browse .actions .container {
margin: 0 auto;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.browse .actions .container > a,
.browse .actions .container > span {
line-height: 2em;
vertical-align: middle;
}
.browse .actions .container > a {
margin-right: 0.5em;
}
.browse .actions .container > span {
font-weight: bold;
font-size: 1.1em;
}
.browse .actions .fa {
vertical-align: middle;
}
.browse .actions .go-right {
margin-left: auto;
position: relative;
}
.browse .go-right input[type="file"] {
display: none;
}
.browse table {
margin: 1em 0;
width: 100%;
}
.browse tr {
line-height: 2em;
border-bottom: 1px solid rgba(0, 0, 0, 0.03);
transition: .2s ease background-color;
}
.browse tr:hover {
background-color: rgba(0,0,0,0.04);
}
.browse th.buttons {
width: 4em;
}
.browse tr button {
line-height: 1.5em;
border-radius: 50%;
width: 1.5em;
height: 1.5em;
padding: 0;
}
.browse #new-file {
display: none;
position: absolute;
right: 0;
top: 2.5em;
background-color: #263238;
color: rgba(255, 255, 255, .5);
border-radius: .5em;
padding: 1em;
width: 182%;
}
/* POPUS */
#foreground {
z-index: 99999;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(0, 0, 0, 0.1);
}
.popup {
z-index: 999999;
position: fixed;
margin: 0 auto;
max-width: 25em;
width: 95%;
top: 10%;
left:50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
background-color: #006064;
color: #fff;
padding: 1em 2em;
border-radius: .5em;
box-shadow: 0 1px 3px rgba(0,0,0,.12),0 1px 2px rgba(0,0,0,.24);
}
.popup input[type="text"] {
border-bottom: .15em solid white;
}
@media screen and (max-width: 900px) {
.blocks {
-webkit-column-count: 3;
-moz-column-count: 3;
column-count: 3;
}
}
@media screen and (max-width: 600px) {
.blocks {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
body > nav span {
display: none;
}
body>nav ul li:last-child {
margin-left: 0;
}
body > nav .container {
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
text-align: center;
}
.hideable {
display: none;
}
}
@media screen and (max-width: 350px) {
.blocks {
-webkit-column-count: 1;
-moz-column-count: 1;
column-count: 1;
}
.browse .actions {
text-align: center;
}
.browse .actions .container {
display: block;
}
.browse .container .go-right {
display: block;
}
}

View File

@@ -1,53 +0,0 @@
$(document).ready(function() {
// Log out the user sending bad credentials to the server
$("#logout").click(function(event) {
event.preventDefault();
$.ajax({
type: "GET",
url: "/admin",
async: false,
username: "username",
password: "password",
headers: {
"Authorization": "Basic xxx"
}
}).fail(function() {
window.location = "/";
});
return false;
});
$(document).pjax('a[data-pjax]', '#content');
});
$(document).on('ready pjax:end', function() {
$('#content').off();
// Update the title
document.title = document.getElementById('site-title').innerHTML;
//TODO: navbar titles changing effect when changing page
// Auto Grow Textarea
function autoGrow() {
this.style.height = '5px';
this.style.height = this.scrollHeight + 'px';
}
$("textarea").each(autoGrow);
$('textarea').keyup(autoGrow);
$(window).resize(function() {
$("textarea").each(autoGrow);
});
if ($('main').hasClass('browse')) {
$(document).trigger("page:browse");
}
if ($(".editor")[0]) {
$(document).trigger("page:editor");
}
return false;
});

View File

@@ -1,358 +0,0 @@
$(document).on('page:browse', function() {
var foreground = '#foreground';
/* DELETE FILE */
var remove = new Object();
remove.selector = 'form#delete';
remove.form = $(remove.selector);
remove.row = '';
remove.button = '';
remove.url = '';
$('#content').on('click', '.delete', function(event) {
event.preventDefault();
remove.button = $(this);
remove.row = $(this).parent().parent();
$(foreground).fadeIn(200);
remove.url = remove.row.find('.filename').text();
remove.form.find('span').text(remove.url);
remove.form.fadeIn(200);
return false;
});
$('#content').on('submit', remove.selector, function(event) {
event.preventDefault();
var request = new XMLHttpRequest();
request.open("DELETE", remove.button.data("file"));
request.send();
request.onreadystatechange = function() {
if (request.readyState == 4) {
var response = JSON.parse(request.responseText),
type = "success",
timeout = 5000;
$(foreground).fadeOut(200);
remove.form.fadeOut(200);
remove.row.fadeOut(200);
if (request.status != 200) {
type = "error";
timeout = false;
}
notification({
text: response.message,
type: type,
timeout: timeout
});
}
}
return false;
});
/* FILE UPLOAD */
$('#content').on('change', 'input[type="file"]', function(event) {
event.preventDefault();
files = event.target.files;
// Create a formdata object and add the files
var data = new FormData();
$.each(files, function(key, value) {
data.append(key, value);
});
$.ajax({
url: window.location.pathname,
type: 'POST',
data: data,
cache: false,
dataType: 'json',
headers: {
'X-Upload': 'true',
},
processData: false,
contentType: false,
}).done(function(data) {
notification({
text: "File(s) uploaded successfully.",
type: 'success',
timeout: 5000
});
$.pjax({
url: window.location.pathname,
container: '#content'
})
}).fail(function(data) {
notification({
text: 'Something went wrong.',
type: 'error'
});
console.log(data);
});
return false;
});
$('#content').on('click', '#upload', function(event) {
event.preventDefault();
$('.actions input[type="file"]').click();
return false;
});
/* NEW FILE */
var create = new Object();
create.selector = 'form#new';
create.form = $(create.selector);
create.input = create.selector + ' input[type="text"]';
create.button = '';
create.url = '';
$('#content').on('click', '.new', function(event) {
event.preventDefault();
create.button = $(this);
$(foreground).fadeIn(200);
create.form.fadeIn(200);
return false;
});
$('#content').on('keypress', create.input, function(event) {
if (event.keyCode == 13) {
event.preventDefault();
$(create.form).submit();
return false;
}
});
$('#content').on('submit', create.selector, function(event) {
event.preventDefault();
var value = create.form.find('input[type="text"]').val(),
splited = value.split(":"),
filename = "",
archetype = "";
if (value == "") {
notification({
text: "You have to write something. If you want to close the box, click the button again.",
type: 'warning',
timeout: 5000
});
return false;
} else if (splited.length == 1) {
filename = value;
} else if (splited.length == 2) {
filename = splited[0];
archetype = splited[1];
} else {
notification({
text: "Hmm... I don't understand you. Try writing something like 'name[:archetype]'.",
type: 'error'
});
return false;
}
var content = {
filename: filename,
archetype: archetype
}
var request = new XMLHttpRequest();
request.open("POST", window.location.pathname);
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
request.send(JSON.stringify(content));
request.onreadystatechange = function() {
if (request.readyState == 4) {
var response = JSON.parse(request.responseText);
var type = "success";
var timeout = 5000;
if (request.status != 200) {
type = "error";
timeout = false;
}
notification({
text: response.message,
type: type,
timeout: timeout
});
if (request.status == 200) {
$.pjax({
url: data.Location,
container: '#content'
})
}
}
}
return false;
});
/* RENAME FILE */
var rename = new Object();
rename.selector = 'form#rename';
rename.form = $(rename.selector);
rename.input = rename.selector + ' input[type="text"]';
rename.button = '';
rename.url = '';
$('#content').on('click', '.rename', function(event) {
event.preventDefault();
rename.button = $(this);
$(foreground).fadeIn(200);
rename.url = $(this).parent().parent().find('.filename').text();
rename.form.fadeIn(200);
rename.form.find('span').text(rename.url);
rename.form.find('input[type="text"]').val(rename.url);
return false;
});
$('#content').on('keypress', rename.input, function(event) {
if (event.keyCode == 13) {
event.preventDefault();
$(rename.form).submit();
return false;
}
});
$('#content').on('submit', rename.selector, function(event) {
event.preventDefault();
var filename = rename.form.find('input[type="text"]').val();
if (filename === "") {
return false;
}
if (filename.substring(0, 1) != "/") {
filename = window.location.pathname.replace("/admin/browse/", "") + '/' + filename;
}
var content = {
filename: filename
};
var request = new XMLHttpRequest();
request.open("PUT", rename.url);
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
request.send(JSON.stringify(content));
request.onreadystatechange = function() {
if (request.readyState == 4) {
var response = JSON.parse(request.responseText),
type = "success",
timeout = 5000;
if (request.status != 200) {
type = "error";
timeout = false;
}
$.pjax({
url: window.location.pathname,
container: '#content'
});
notification({
text: response.message,
type: type,
timeout: timeout
});
}
}
return false;
});
/* GIT ACTIONS */
var git = new Object();
git.selector = 'form#git';
git.form = $(git.selector);
git.input = git.selector + ' input[type="text"]';
$('#content').on('click', 'button.git', function(event) {
event.preventDefault();
$(foreground).fadeIn(200);
git.form.fadeIn(200);
return false;
});
$('#content').on('keypress', git.input, function(event) {
if (event.keyCode == 13) {
event.preventDefault();
$(git.form).submit();
return false;
}
});
$('#content').on('submit', git.selector, function(event) {
event.preventDefault();
var value = git.form.find('input[type="text"]').val();
if (value == "") {
notification({
text: "You have to write something. If you want to close the box, click outside of the box.",
type: 'warning',
timeout: 5000
});
return false;
}
var request = new XMLHttpRequest();
request.open("POST", "/admin/git");
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
request.send(JSON.stringify({
command: value
}));
request.onreadystatechange = function() {
if (request.readyState == 4) {
var data = JSON.parse(request.responseText);
if (request.status == 200) {
notification({
text: data.message,
type: "success"
});
} else {
notification({
text: data.message,
type: "error"
});
}
}
}
return false;
});
/* $(foreground) AND STUFF */
$('#content').on('click', '.close', function(event) {
event.preventDefault();
$(this).parent().parent().fadeOut(200);
$(foreground).click();
return false;
});
$('#content').on('click', foreground, function(event) {
event.preventDefault();
$(foreground).fadeOut(200);
create.form.fadeOut(200);
rename.form.fadeOut(200);
remove.form.fadeOut(200);
git.form.fadeOut(200);
return false;
});
});

View File

@@ -1,257 +0,0 @@
$(document).on('page:editor', function() {
var container = $('.editor');
var preview = $('#editor-preview');
var editor = $('#editor-source');
if (container.hasClass('complete')) {
// Change title field when editing the header
$('#content').on('keyup', '#site-title', function() {
$('.frontmatter #title').val($(this).val());
});
}
if (!container.hasClass('frontmatter-only')) {
// Setup ace editor
var mode = $("#editor-source").data('mode');
var textarea = $('textarea[name="content"]').hide();
var aceEditor = ace.edit('editor-source');
aceEditor.getSession().setMode("ace/mode/" + mode);
aceEditor.getSession().setValue(textarea.val());
aceEditor.getSession().on('change', function() {
textarea.val(aceEditor.getSession().getValue());
});
aceEditor.setOptions({
wrap: true,
maxLines: Infinity,
theme: "ace/theme/github",
showPrintMargin: false,
fontSize: "1em",
minLines: 20
});
$('#content').on('click', '#see-source', function(event) {
event.preventDefault();
preview.hide();
editor.fadeIn();
$(this).addClass('active');
$("#see-preview").removeClass('active');
$("#see-preview").data("previewing", "false");
})
// Toggles between preview and editing mode
$('#content').on('click', '#see-preview', function(event) {
event.preventDefault();
// If it currently in the preview mode, hide the preview
// and show the editor
if ($(this).data("previewing") == "true") {
preview.hide();
editor.fadeIn();
$(this).removeClass('active');
$("#see-source").addClass('active');
$(this).data("previewing", "false");
} else {
// If it's in editing mode, convert the markdown to html
// and show it
var converter = new showdown.Converter(),
text = aceEditor.getValue(),
html = converter.makeHtml(text);
// Hide the editor and show the preview
editor.hide();
preview.html(html).fadeIn();
$(this).addClass('active');
$("#see-source").removeClass('active');
$(this).data("previewing", "true");
}
return false;
});
}
$('#content').on('keypress', 'input', function(event) {
if (event.keyCode == 13) {
event.preventDefault();
$('input[value="Save"]').focus().click();
return false;
}
});
// Submites any form in the page in JSON format
$('#content').on('submit', 'form', function(event) {
event.preventDefault();
if (!container.hasClass('frontmatter-only')) {
// Reset preview area and button to make sure it will
// not serialize any form inside the preview
preview.html('').fadeOut();
$("#see-preview").data("previewing", "false");
editor.fadeIn();
}
var data = JSON.stringify($(this).serializeJSON()),
button = $(this).find("input[type=submit]:focus");
var request = new XMLHttpRequest();
request.open("POST", window.location);
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
request.setRequestHeader("X-Regenerate", button.data("regenerate"));
request.setRequestHeader("X-Schedule", button.data("schedule"));
request.setRequestHeader("X-Content-Type", button.data("type"));
request.send(data);
request.onreadystatechange = function() {
if (request.readyState == 4) {
if (request.status == 200) {
notification({
text: button.data("message"),
type: 'success',
timeout: 5000
});
} else {
notification({
text: 'Something went wrong.',
type: 'error'
});
console.log(request.responseText);
}
}
}
return false;
});
// Adds one more field to the current group
$("#content").on('click', '.add', function(event) {
event.preventDefault();
defaultID = "lorem-ipsum-sin-dolor-amet";
// Remove if there is an incomplete new item
newItem = $("#" + defaultID);
if (newItem.length) {
newItem.remove();
}
block = $(this).parent().parent();
blockType = block.data("type");
blockID = block.attr("id");
// If the Block Type is an array
if (blockType == "array") {
newID = blockID + "[]";
input = blockID;
input = input.replace(/\[/, '\\[');
input = input.replace(/\]/, '\\]');
block.append('<div id="' + newID + '-' + $('#' + input + ' > div').length + '" data-type="array-item"><input name="' + newID + ':auto" id="' + newID + '"></input><span class="actions"> <button class="delete">&#8722;</button></span></div></div>');
console.log('New array item added.');
}
// Main add button, after all blocks
if (block.is('div') && block.hasClass("frontmatter")) {
block = $('.blocks');
blockType = "object";
}
// If the Block is an object
if (blockType == "object") {
block.append('<div class="block" id="' + defaultID + '"></div>');
newItem = $("#" + defaultID);
newItem.html('<input id="name-' + defaultID + '" placeholder="Write the field name and press enter..."></input>');
field = $("#name-" + defaultID);
// Show a notification with some information for newbies
if (!document.cookie.replace(/(?:(?:^|.*;\s*)placeholdertip\s*\=\s*([^;]*).*$)|^.*$/, "$1")) {
var date = new Date();
date.setDate(date.getDate() + 365);
document.cookie = 'placeholdertip=true; expires=' + date.toUTCString + '; path=/';
notification({
text: 'Write the field name and then press enter. If you want to create an array or an object, end the name with ":array" or ":object".',
type: 'information'
});
}
$(field).keypress(function(event) {
// When you press enter within the new name field:
if (event.which == 13) {
event.preventDefault();
// This var should have a value of the type "name[:array, :object]"
value = field.val();
if (value == "") {
newItem.remove();
return false;
}
elements = value.split(":")
if (elements.length > 2) {
notification({
text: "Invalid syntax. It must be 'name[:type]'.",
type: 'error'
});
return false;
}
if (elements.length == 2 && elements[1] != "array" && elements[1] != "object") {
notification({
text: "Only arrays and objects are allowed.",
type: 'error'
});
return false;
}
field.remove();
if (typeof blockID === "undefined") {
blockID = elements[0];
} else {
blockID = blockID + '[' + elements[0] + ']';
}
if (elements.length == 1) {
newItem.attr('id', 'block-' + blockID);
newItem.append('<input name="' + blockID + ':auto" id="' + blockID + '"></input><br>');
newItem.prepend('<label for="' + blockID + '">' + value + '</label> <span class="actions"><button class="delete">&#8722;</button></span>');
} else {
type = "";
if (elements[1] == "array") {
type = "array";
} else {
type = "object"
}
template = "<fieldset id=\"${blockID}\" data-type=\"${type}\"> <h3>${elements[0]}</h3> <span class=\"actions\"> <button class=\"add\">&#43;</button> <button class=\"delete\">&#8722;</button> </span> </fieldset>"
template = template.replace("${blockID}", blockID);
template = template.replace("${elements[0]}", elements[0]);
template = template.replace("${type}", type);
newItem.after(template);
newItem.remove();
console.log('"' + blockID + '" block of type "' + type + '" added.');
}
return false;
}
});
}
return false;
});
$("#content").on('click', '.delete', function(event) {
event.preventDefault();
button = $(this);
name = button.parent().parent().attr("for") || button.parent().parent().attr("id") || button.parent().parent().parent().attr("id");
name = name.replace(/\[/, '\\[');
name = name.replace(/\]/, '\\]');
console.log(name)
$('label[for="' + name + '"]').fadeOut().remove();
$('#' + name).fadeOut().remove();
return false;
});
});

View File

@@ -1,82 +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);
if (!document.cookie.replace(/(?:(?:^|.*;\s*)stickynoties\s*\=\s*([^;]*).*$)|^.*$/, "$1") && !options.timeout) {
var date = new Date();
date.setDate(date.getDate() + 365);
document.cookie = 'stickynoties=true; expires=' + date.toUTCString + '; path=/';
notification({
text: "Some notifications are sticky. If it doesn't go away, click to dismiss it.",
type: 'information'
});
}
}