mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-06-17 03:45:25 +02:00
Add custom css slots to prepare for donators feature
This commit is contained in:
@ -18,11 +18,12 @@ function deleteForm(user_id) {
|
||||
return funct.promise();
|
||||
}
|
||||
|
||||
function patchForm(user_id, css) {
|
||||
function patchForm(user_id, param) {
|
||||
var data = Object.assign({"user_id": user_id}, param);
|
||||
var funct = $.ajax({
|
||||
dataType: "json",
|
||||
method: "PATCH",
|
||||
data: {"user_id": user_id, "css": css}
|
||||
data: data,
|
||||
});
|
||||
return funct.promise();
|
||||
}
|
||||
@ -68,7 +69,7 @@ function delete_user(user_id) {
|
||||
|
||||
function update_css_switch(user_id, element) {
|
||||
var css_checked = $(element).is(':checked');
|
||||
var formPatch = patchForm(user_id, css_checked);
|
||||
var formPatch = patchForm(user_id, {"css": css_checked});
|
||||
formPatch.done(function (data) {
|
||||
Materialize.toast('CSS updated!', 10000);
|
||||
});
|
||||
@ -79,4 +80,18 @@ function update_css_switch(user_id, element) {
|
||||
Materialize.toast('Oh no! Something has failed changing the css toggle!', 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function update_css_limit(user_id, value) {
|
||||
var formPatch = patchForm(user_id, {"css_limit": value});
|
||||
formPatch.done(function (data) {
|
||||
Materialize.toast('CSS value updated!', 10000);
|
||||
});
|
||||
formPatch.fail(function (data) {
|
||||
if (data.status == 409) {
|
||||
Materialize.toast('This user id does not exists!', 10000);
|
||||
} else {
|
||||
Materialize.toast('Oh no! Something has failed changing the css limit field!', 10000);
|
||||
}
|
||||
});
|
||||
}
|
@ -1,12 +1,20 @@
|
||||
/*global $, ace, Materialize, newCSS*/
|
||||
(function () {
|
||||
var editor = ace.edit("css_editor");
|
||||
if($("#css_editor").length != 0) {
|
||||
var editor = ace.edit("css_editor");
|
||||
}
|
||||
|
||||
function postForm() {
|
||||
var name = $('#css_name').val();
|
||||
var var_enabled = $("#toggleCSSVar").is(':checked');
|
||||
var variables = JSON.stringify(formatCSSVars());
|
||||
var css = editor.getValue();
|
||||
var css = null;
|
||||
if($("#css_editor").length != 0) {
|
||||
css = editor.getValue();
|
||||
if (css.length == 0) {
|
||||
css = null;
|
||||
}
|
||||
}
|
||||
var funct = $.ajax({
|
||||
dataType: "json",
|
||||
method: "POST",
|
||||
@ -16,8 +24,10 @@
|
||||
}
|
||||
|
||||
$(function(){
|
||||
editor.getSession().setMode("ace/mode/css");
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
if($("#css_editor").length != 0) {
|
||||
editor.getSession().setMode("ace/mode/css");
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
}
|
||||
$("#submit-btn").click(submitForm);
|
||||
|
||||
if (!newCSS) {
|
||||
|
Reference in New Issue
Block a user