Skip to content

Commit

Permalink
Remove unused/useless code & Optimization Page
Browse files Browse the repository at this point in the history
v3.1 (2022)
  • Loading branch information
Klubuntu authored Oct 6, 2022
1 parent de31a28 commit 69987fb
Show file tree
Hide file tree
Showing 6 changed files with 239 additions and 318 deletions.
93 changes: 93 additions & 0 deletions beta/cookieSupport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// Author: KB
// Version: 1.0
// All Rights Copyrights 2022

class cookieSupport{
static list(){
var cookies = document.cookie.split(";");
console.warn("[Cookie] List Availables Cookies")
for (var cookie in cookies){
console.log(cookies[cookie])
}
console.warn("=================================")
}
static check(cookie_name){
/*var res = document.cookie.indexOf(cookie_name + "=");
if (res == 0){
return "[Cookie] " + cookie_name + " exist";
}
else{
return "[Cookie] " + cookie_name + " no exist";
}*/
var res = this.get(cookie_name);
if (res.length > 0){
return "[Cookie] " + cookie_name + " exist";
}
else{
return "[Cookie] " + cookie_name + " no exist";
}
}
static check_val(cookie_name){
/*var res = document.cookie.indexOf(cookie_name + "=");
if (res == 0){
return true;
}
else{
return false;
}*/
var res = this.get(cookie_name);
try{
if (res.length > 0){
return true;
}
else{
return false;
}
}
catch{
return false;
}
}
static get(cookie_name){
const value = `; ${document.cookie}`;
const parts = value.split(`; ${cookie_name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
static add(cookie_name, value){
try{
document.cookie = cookie_name + "=" + value + "; expires=Thu, 31 Dec 2023 23:59:00 UTC";
return "[Cookie] " + cookie_name + " created";
}
catch{
return "[Cookie] invalid cookie name or value";
}
}
static edit(cookie_name, value){
this.add(cookie_name, value)
}
static remove(cookie_name){
try{
document.cookie = cookie_name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
document.cookie = cookie_name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
return "[Cookie] " + cookie_name + " deleted"
}
catch{
return "[Cookie] Problem with delete Cookie " + cookie_name
}
}

/* Setup Aliases */

static delete(cookie_name){
this.remove(cookie_name);
}
static del(cookie_name){
this.delete(cookie_name);
}
static find(cookie_name, value){
this.check(cookie_name);
}
}

// Init
const cst = cookieSupport
173 changes: 37 additions & 136 deletions beta/easycookie.js
Original file line number Diff line number Diff line change
@@ -1,148 +1,49 @@
/* EasyCookie v2.1 [Rewrited] */
/* EasyCookie v3 [Rewrited Class Edition] */
/* Created by Klubuntu */
/* Source Code: https://github.com/Klubuntu/EasyCookieJS */

const $prefix = '[EasyCookie] ';

//easyCookieInterpreter
function eCI(cmd, arg1 = "", arg2 = "") {
msg = "[EasyCookie] ";
function addCookie() {
name = arg1
val = arg2
if (!name == "" || !name == null) {
if (!val == "" || !val == null) {
let usrcookie = getCookie(get = 1);
if (usrcookie != "") {
console.log(msg + "Cookie " + name + " has been already created")
} else {
if (name != "" && [name] != null) {
document.cookie = name + "=" + val
console.log(msg + "Cookie " + name + " has been created")
}
};
}
else {
console.warn(msg + "Cookie value no set")
}
}
else {
console.warn(msg + "Cookie name no set")
}
}
function getCookie(get = 0) {
name = arg1
if (!name == "" || !name == null) {
//cname = cookiename
cname = name;
let tmpName = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(tmpName) == 0) {
xcookie = c.substring(tmpName.length, c.length);
return c.substring(tmpName.length, c.length);
}
}
if (get == 0) {
return msg + "Cookie " + name + " no exists";
}
else if (get == 1) {
return "";
}

}
else {
console.warn(msg + "Cookie name no set")
class EasyCookie {
static add(cookieName, cookieValue){
try{
document.cookie = cookieName + "=" + cookieValue + "; expires=Thu, 31 Dec 2023 23:59:00 UTC";
return $prefix + cookieName + " created";
}
catch{
return $prefix + "invalid cookie name or value";
}
}
function editCookie() {
name = arg1
val = arg2
if (!name == "" || !name == null) {
if (!val == "" || !val == null) {
let usrcookie = getCookie(get = 1);
if (usrcookie != "") {
document.cookie = document.cookie = name + "=" + val;
} else {
if (name != "" && [name] != null) {
console.log(msg + "Cookie ", name, " not found.")
}
}
}
else {
console.warn(msg + "Cookie value no set")
}
}
else {
console.warn(msg + "Cookie name no set")
}
}
function delCookie() {
name = arg1
if (!name == "" || !name == null) {
let usrcookie = getCookie(get = 1);
if (usrcookie != "") {
document.cookie = name + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
} else {
if (name != "" && [name] != null) {
console.log(msg + "Cookie ", name, " not found.")
}
}
}
else {
console.warn(msg + "Cookie name no set")
}
static get(cookieName){
const value = `; ${document.cookie}`;
const parts = value.split(`; ${cookieName}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}

function version(){
return(
msg + "Version 2.1 [Rewrited]" + "\n" + "Check new release on https://github.com/Klubuntu/EasyCookieJS"
)
static edit(cookieName, cookieValue){
return this.add(cookieName, cookieValue);
}


if (cmd == "add") {
addCookie();
}
else if (cmd == "get") {
getCookie();
}
else if (cmd == "edit") {
editCookie();
}
else if (cmd == "del") {
delCookie();
}
else if(cmd == "ver"){
console.log(version());
static remove(cookieName){
try{
document.cookie = cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
document.cookie = cookieName + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";
return $prefix + cookieName + " deleted"
}
catch{
return $prefix + "Problem with delete cookie " + cookieName
}
}
else {
return msg + "Unknown Command";
}
}



//define main function
var easycookie = (function () {
return {
add: function (name, val) { return eCI("add", name, val) },
edit: function (name, val) { return eCI("edit", name, val) },
del: function (name) { return eCI("del", name) },
get: function (name) { return eCI("get", name) },
ver: function () { eCI("ver") },
// popular aliases
set: function (name, val) { return eCI("add", name, val) },
change: function (name, val) { return eCI("edit", name, val) },
rem: function (name) { return eCI("del", name) },
remove: function (name) { return eCI("del", name) },
rm: function (name) { return eCI("del", name) },
check: function (name) { return eCI("get", name) },
version: function () { eCI("ver") },
about: function () { eCI("ver") },
};
})();
/* Setup Aliases */

static delete(cookieName){
return this.remove(cookieName);
}
static del(cookieName){
return this.delete(cookieName);
}
static find(cookieName){
return this.check(cookieName);
}
}
61 changes: 35 additions & 26 deletions beta/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<link id="default-style" rel="stylesheet" href="style.css" />
<!-- <link id="dark-style" rel="stylesheet" href="dark-style.css" /> -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="jquery-3.4.1.min.js"></script>
<link rel="stylesheet" href="w3-modal.css">
<script type="text/javascript" src="awesome/js/all.min.js"></script>
<script type="text/javascript" src="easycookie.js"></script>
<script type="text/javascript" src="script.js"></script>
Expand All @@ -19,51 +17,62 @@
<div class="container">
<h1 id="logo" onclick="refresh()">Klubuntu</h1>
<div class="span-elements loading">
<span id="span" onclick="opengt()" class="bg-test"><i class="fab fa-github test"></i
></span>
<span id="span2" onclick="openyt()" class="bg-test"><i class="fab fa-youtube test"></i
></span>
<span id="span3" onclick="openfb()" class="bg-test"><i class="fab fa-facebook test"></i
></span>
<span id="span4" onclick="openpt()" class="bg-test"><i class="fas fa-dollar-sign test"></i
></span>
<span id="span" onclick="opengt()" class="bg-test"><i class="fab fa-github test"></i></span>
<span id="span2" onclick="openyt()" class="bg-test"><i class="fab fa-youtube test"></i></span>
<span id="span3" onclick="openfb()" class="bg-test"><i class="fab fa-facebook test"></i></span>
<span id="span4" onclick="openpt()" class="bg-test"><i class="fas fa-dollar-sign test"></i></span>
<span id="span5" onclick="opendc()" class="bg-test" style="display: block;width: 281px;height: 46px;margin-left: 65px;margin-top: 7px;">
<i class="fab fa-discord test" style="margin-top: 3%;"></i>
<span style="
color: rgb(163, 15, 15) !important;
font-size: 21px;
margin-left: 11px;
position: relative;
top: -5px;
">Join to Discord</span>
</span>
</div>
</div>
<div class="footer loading">

<span id="about" onclick="about()"><i class="fas fa-info-circle white icon"></i></span>
</div>
<div class="mm" style="transition: all .5s linear;">
<div id="demo-modal" class="modal" role="dialog" tabindex="-1" style="transition: all .5s linear;" onresize="console.log('e')">
<div id="page-modal" class="modal" role="dialog" tabindex="-1" style="transition: all .5s linear;"
onresize="console.log('e')">
<div class="model-inner" style="transition: all .5s linear;">
<div class="modal-header">
<h3>
<span id="back-action">&lsaquo;&nbsp;</span><span id="modal-header-title">About Page</span>
<span id="back-action" onclick="Menu()">&lsaquo;</span><span>&nbsp;</span><span
id="modal-header-title">About Page</span>
</h3>
<button class="modal-close" data-id="demo-modal" aria-label="Close" onclick="closeModal()">
&times;
</button>
<button class="modal-close" data-id="page-modal" aria-label="Close" onclick="closeModal()">
&times;
</button>
</div>
<p id="start-loading">
<h4>
<center>Update in progress
<progressv></progressv>
</center>
</h4>
<h4>
<center>Update in progress
<progressv></progressv>
</center>
</h4>
</p>
<p id="end-loading">
<center id="other-info">
<h3 onclick="Privacy()">Privacy Policy</h3>
<h3 onclick="Frameworks()">Frameworks</h3>
<h3 onclick="Links()">Links</h3>
<center id="content">
<div id="menu">
<h3 onclick="Privacy()">Privacy Policy</h3>
<h3 onclick="Frameworks()">Frameworks</h3>
<h3 onclick="Links()">Links</h3>
</div>
<div id="other"></div>
</center>
</p>
<div class="modal-header"></div>
<p id="page-info">
<center id="page-other">
<h5>© Klubuntu (2020-2021)</h5>
<h5>© Klubuntu (2020-2022)</h5>
<h5>
Page Version 3.0
Page Version 3.1
</h5>
</center>
</p>
Expand Down
1 change: 1 addition & 0 deletions beta/other/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
animation: fadeIn;
animation-duration: 750ms;
transition: 1s ease-in-out;
overflow: auto;
}

.model-inner {
Expand Down
Loading

1 comment on commit 69987fb

@vercel
Copy link

@vercel vercel bot commented on 69987fb Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.