first commit
This commit is contained in:
198
wp-content/plugins/host-webfonts-local/assets/css/omgf-admin.css
Normal file
198
wp-content/plugins/host-webfonts-local/assets/css/omgf-admin.css
Normal file
@@ -0,0 +1,198 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* ██████╗ ███╗ ███╗ ██████╗ ███████╗
|
||||
* ██╔═══██╗████╗ ████║██╔════╝ ██╔════╝
|
||||
* ██║ ██║██╔████╔██║██║ ███╗█████╗
|
||||
* ██║ ██║██║╚██╔╝██║██║ ██║██╔══╝
|
||||
* ╚██████╔╝██║ ╚═╝ ██║╚██████╔╝██║
|
||||
* ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
|
||||
*
|
||||
* @package : OMGF
|
||||
* @author : Daan van den Bergh
|
||||
* @copyright: (c) 2021 Daan van den Bergh
|
||||
* @url : https://daan.dev
|
||||
* * * * * * * * * * * * * * * * * * * */
|
||||
/**
|
||||
* General
|
||||
*/
|
||||
.omgf .button-cancel {
|
||||
color: #a00;
|
||||
text-decoration: none;
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
background: 0 0;
|
||||
border-radius: 3px;
|
||||
white-space: nowrap;
|
||||
padding: 1px 10px !important;
|
||||
}
|
||||
.omgf .button-cancel:hover {
|
||||
cursor: pointer;
|
||||
background: #d54e21;
|
||||
color: #fff;
|
||||
border-color: #d54e21;
|
||||
}
|
||||
/**
|
||||
* Navigation
|
||||
*/
|
||||
.omgf-nav {
|
||||
padding: 1em 0 1.5em;
|
||||
}
|
||||
.omgf-nav a {
|
||||
cursor: pointer;
|
||||
}
|
||||
.omgf-nav .dashicons-before:before {
|
||||
margin-right: 0.25em;
|
||||
line-height: 1.15em;
|
||||
}
|
||||
.omgf-optimize-fonts-container {
|
||||
text-align: center;
|
||||
padding: 25px 50px;
|
||||
max-width: 1024px;
|
||||
margin: 20px auto 0 220px;
|
||||
overflow: visible;
|
||||
position: relative;
|
||||
}
|
||||
.omgf-optimize-fonts-container .option-title {
|
||||
position: absolute;
|
||||
left: -220px;
|
||||
top: 0;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
color: #1d2327;
|
||||
}
|
||||
.omgf-optimize-fonts-container h3 {
|
||||
font-size: 1.3em;
|
||||
margin-top: 0;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage {
|
||||
text-align: left;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table .tooltip {
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table .tooltip .tooltip-text {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 100%;
|
||||
z-index: 10000;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
||||
font-size: 0.8em;
|
||||
color: #fff;
|
||||
line-height: 1.5;
|
||||
width: 250px;
|
||||
padding: 10px;
|
||||
margin-left: -125px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table .tooltip .tooltip-text .illustration {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table .tooltip:hover .tooltip-text {
|
||||
visibility: visible;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table thead th {
|
||||
width: 13%;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody {
|
||||
border: 1px solid #ccd0d4;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody th {
|
||||
padding: 5px 0 0 10px;
|
||||
width: 40%;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td {
|
||||
padding-bottom: 5px;
|
||||
width: 13%;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .family {
|
||||
padding: 0 10px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody tr:last-child td {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros {
|
||||
margin-right: 10px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros,
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-cons {
|
||||
text-align: left;
|
||||
width: 48%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros span:before,
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-cons span:before {
|
||||
vertical-align: -4px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description label {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-description #omgf_manual_optimize_url {
|
||||
font-size: 18px;
|
||||
padding: 0 15px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.omgf-optimize-fonts-container .omgf-optimize-fonts-tooltip {
|
||||
padding: 0 15px 5px;
|
||||
}
|
||||
.omgf-optimize-fonts-container p,
|
||||
.omgf-optimize-fonts-container ul {
|
||||
text-align: justify;
|
||||
}
|
||||
@media only screen and (max-width: 782px) {
|
||||
.omgf-optimize-fonts-container {
|
||||
margin: 20px 0;
|
||||
}
|
||||
.omgf-optimize-fonts-container .option-title {
|
||||
position: relative;
|
||||
left: initial;
|
||||
top: initial;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Loader
|
||||
*/
|
||||
.omgf-loading {
|
||||
position: fixed;
|
||||
background-color: rgba(255, 255, 255, 0.6);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.omgf-loading .spinner {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
-ms-transform: translate(0, -70%);
|
||||
transform: translate(0, -70%);
|
||||
}
|
||||
/**
|
||||
* Welcome Block
|
||||
*/
|
||||
#footer-thankyou a {
|
||||
vertical-align: -0.65em;
|
||||
}
|
||||
#footer-thankyou .dashicons.ffwp-heart {
|
||||
vertical-align: middle;
|
||||
}
|
||||
#footer-thankyou .dashicons.ffwp-heart:before {
|
||||
color: #FF4136;
|
||||
}
|
||||
#footer-thankyou .signature-image {
|
||||
width: 96px;
|
||||
}
|
||||
/*# sourceMappingURL=./omgf-admin.css.map */
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["omgf-admin.less"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkBA,KACE;EACE,WAAA;EACA,qBAAA;EACA,yBAAA;EACA,gBAAA;EACA,eAAA;EACA,kBAAA;EACA,mBAAA;EACA,4BAAA;;AAEA,KAVF,eAUG;EACC,eAAA;EACA,mBAAA;EACA,WAAA;EACA,qBAAA;;;;;AAQN;EACE,oBAAA;;AADF,SAGE;EACE,eAAA;;AAJJ,SAOE,kBAAiB;EACf,oBAAA;EACA,mBAAA;;AAIJ;EACE,kBAAA;EACA,kBAAA;EACA,iBAAA;EACA,yBAAA;EACA,iBAAA;EACA,kBAAA;;AANF,8BAQE;EACE,kBAAA;EACA,YAAA;EACA,MAAA;EACA,gBAAA;EACA,eAAA;EACA,cAAA;;AAdJ,8BAiBE;EACE,gBAAA;EACA,aAAA;;AAnBJ,8BAsBE;EACE,gBAAA;;AAvBJ,8BAsBE,4BAGE;EACE,WAAA;EACA,yBAAA;;AA3BN,8BAsBE,4BAGE,MAIE;EACE,kBAAA;EACA,eAAA;EACA,iBAAA;;AAhCR,8BAsBE,4BAGE,MAIE,SAKE;EACE,kBAAA;EACA,kBAAA;EACA,SAAA;EACA,UAAA;EACA,cAAA;EACA,qCAAA;EACA,gDAA8C,oDAA+C,4BAA7F;EACA,gBAAA;EACA,WAAA;EACA,gBAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,kBAAA;;AAhDV,8BAsBE,4BAGE,MAIE,SAKE,cAgBE;EACE,gBAAA;;AAIJ,8BAjCN,4BAGE,MAIE,SA0BG,MAAO;EACN,mBAAA;;AAxDV,8BAsBE,4BAGE,MAmCE,MACE;EACE,UAAA;;AA9DV,8BAsBE,4BAGE,MAyCE;EACE,yBAAA;;AAnER,8BAsBE,4BAGE,MAyCE,MAGE;EACE,qBAAA;EACA,UAAA;;AAvEV,8BAsBE,4BAGE,MAyCE,MAQE;EACE,mBAAA;EACA,UAAA;;AA5EV,8BAsBE,4BAGE,MAyCE,MAQE,GAIE;EACE,gBAAA;;AA/EZ,8BAsBE,4BAGE,MAyCE,MAQE,GAQE;EACE,iBAAA;EACA,gBAAA;;AAKF,8BAnER,4BAGE,MAyCE,MAsBE,GACG,WACC;EACE,oBAAA;;AA3Fd,8BAmGE,iCACE;EACE,kBAAA;;AArGN,8BAmGE,iCAKE;AAxGJ,8BAmGE,iCAME;EACE,gBAAA;EACA,UAAA;EACA,qBAAA;EACA,mBAAA;;AA7GN,8BAmGE,iCAKE,0BAOE,KAAI;AA/GV,8BAmGE,iCAME,0BAME,KAAI;EACF,oBAAA;;AAhHR,8BAmGE,iCAiBE;EACE,eAAA;EACA,iBAAA;;AAtHN,8BAmGE,iCAsBE;EACE,eAAA;EACA,eAAA;EACA,iBAAA;;AA5HN,8BAgIE;EACE,mBAAA;;AAjIJ,8BAoIE;AApIF,8BAqIE;EACE,mBAAA;;AAIJ,wBAA0C;EACxC;IACE,cAAA;;EADF,8BAGE;IACE,kBAAA;IACA,aAAA;IACA,YAAA;;;;;;AAQN;EACE,eAAA;EACA,0CAAA;EACA,WAAA;EACA,YAAA;EACA,MAAA;EACA,kBAAA;;AANF,aAQE;EACE,QAAA;EACA,SAAA;EACA,kBAAA;EACA,eAAe,kBAAf;EACA,WAAW,kBAAX;;;;;AAOH,gBACC;EACE,uBAAA;;AAIA,gBADF,WACG;EACC,sBAAA;;AAGF,gBALF,WAKG,WAAW;EACV,cAAA;;AAXL,gBAeC;EACE,WAAA"}
|
||||
@@ -0,0 +1,246 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* ██████╗ ███╗ ███╗ ██████╗ ███████╗
|
||||
* ██╔═══██╗████╗ ████║██╔════╝ ██╔════╝
|
||||
* ██║ ██║██╔████╔██║██║ ███╗█████╗
|
||||
* ██║ ██║██║╚██╔╝██║██║ ██║██╔══╝
|
||||
* ╚██████╔╝██║ ╚═╝ ██║╚██████╔╝██║
|
||||
* ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
|
||||
*
|
||||
* @package : OMGF
|
||||
* @author : Daan van den Bergh
|
||||
* @copyright: (c) 2021 Daan van den Bergh
|
||||
* @url : https://daan.dev
|
||||
* * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/**
|
||||
* General
|
||||
*/
|
||||
.omgf {
|
||||
.button-cancel {
|
||||
color: #a00;
|
||||
text-decoration: none;
|
||||
border-color: transparent;
|
||||
box-shadow: none;
|
||||
background: 0 0;
|
||||
border-radius: 3px;
|
||||
white-space: nowrap;
|
||||
padding: 1px 10px !important;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
background: #d54e21;
|
||||
color: #fff;
|
||||
border-color: #d54e21;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigation
|
||||
*/
|
||||
.omgf-nav {
|
||||
padding: 1em 0 1.5em;
|
||||
|
||||
a {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dashicons-before:before {
|
||||
margin-right: .25em;
|
||||
line-height: 1.15em;
|
||||
}
|
||||
}
|
||||
|
||||
.omgf-optimize-fonts-container {
|
||||
text-align: center;
|
||||
padding: 25px 50px;
|
||||
max-width: 1024px;
|
||||
margin: 20px auto 0 220px;
|
||||
overflow: visible;
|
||||
position: relative;
|
||||
|
||||
.option-title {
|
||||
position: absolute;
|
||||
left: -220px;
|
||||
top: 0;
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
color: #1d2327;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.3em;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.omgf-optimize-fonts-manage {
|
||||
text-align: left;
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
|
||||
.tooltip {
|
||||
position: relative;
|
||||
font-size: 16px;
|
||||
line-height: 25px;
|
||||
|
||||
.tooltip-text {
|
||||
visibility: hidden;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 100%;
|
||||
z-index: 10000;
|
||||
background-color: rgba(0, 0, 0, 0.75);
|
||||
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
||||
font-size: .8em;
|
||||
color: #fff;
|
||||
line-height: 1.5;
|
||||
width: 250px;
|
||||
padding: 10px;
|
||||
margin-left: -125px;
|
||||
border-radius: 3px;
|
||||
|
||||
.illustration {
|
||||
margin-top: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover .tooltip-text {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
thead {
|
||||
th {
|
||||
width: 13%;
|
||||
}
|
||||
}
|
||||
|
||||
tbody {
|
||||
border: 1px solid #ccd0d4;
|
||||
|
||||
th {
|
||||
padding: 5px 0 0 10px;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-bottom: 5px;
|
||||
width: 13%;
|
||||
|
||||
.unload-mass-action {
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
.family {
|
||||
padding: 0 10px 0;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
tr {
|
||||
&:last-child {
|
||||
td {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.omgf-optimize-fonts-description {
|
||||
.omgf-optimize-fonts-pros {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.omgf-optimize-fonts-pros,
|
||||
.omgf-optimize-fonts-cons {
|
||||
text-align: left;
|
||||
width: 48%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
|
||||
span:before {
|
||||
vertical-align: -4px;
|
||||
}
|
||||
}
|
||||
|
||||
label {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#omgf_manual_optimize_url {
|
||||
font-size: 18px;
|
||||
padding: 0 15px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.omgf-optimize-fonts-tooltip {
|
||||
padding: 0 15px 5px;
|
||||
}
|
||||
|
||||
p,
|
||||
ul {
|
||||
text-align: justify;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 782px) {
|
||||
.omgf-optimize-fonts-container {
|
||||
margin: 20px 0;
|
||||
|
||||
.option-title {
|
||||
position: relative;
|
||||
left: initial;
|
||||
top: initial;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loader
|
||||
*/
|
||||
.omgf-loading {
|
||||
position: fixed;
|
||||
background-color: rgba(255,255,255,0.6);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
|
||||
.spinner {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
position: absolute;
|
||||
-ms-transform: translate(0, -70%);
|
||||
transform: translate(0, -70%);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Welcome Block
|
||||
*/
|
||||
#footer-thankyou {
|
||||
a {
|
||||
vertical-align: -.65em;
|
||||
}
|
||||
|
||||
.dashicons {
|
||||
&.ffwp-heart {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&.ffwp-heart:before {
|
||||
color: #FF4136;
|
||||
}
|
||||
}
|
||||
|
||||
.signature-image {
|
||||
width: 96px;
|
||||
}
|
||||
}
|
||||
1
wp-content/plugins/host-webfonts-local/assets/css/omgf-admin.min.css
vendored
Normal file
1
wp-content/plugins/host-webfonts-local/assets/css/omgf-admin.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.omgf .button-cancel{color:#a00;text-decoration:none;border-color:transparent;box-shadow:none;background:0 0;border-radius:3px;white-space:nowrap;padding:1px 10px!important}.omgf .button-cancel:hover{cursor:pointer;background:#d54e21;color:#fff;border-color:#d54e21}.omgf-nav{padding:1em 0 1.5em}.omgf-nav a{cursor:pointer}.omgf-nav .dashicons-before:before{margin-right:.25em;line-height:1.15em}.settings-column.left{float:left;width:66%}.settings-column.right{float:right;width:21.75%}#omgf-welcome-panel{padding:20px 10px 5px}#omgf-welcome-panel .welcome-panel-content{margin-left:0;padding:0 15px}#omgf-welcome-panel h3>.dashicons{line-height:1.4}#omgf-welcome-panel .dashicons.ffwp-heart:before{color:#ff4136}#omgf-welcome-panel .welcome-icon:before{padding:0}#omgf-welcome-panel .signature,.omgf-loading{text-align:center}#omgf-welcome-panel .signature-image{max-width:90%}.omgf-loading{position:fixed;background-color:rgba(255,255,255,.6);width:100%;height:100%;top:0}.omgf-loading .spinner{top:50%;left:50%;position:absolute;-ms-transform:translate(0,-70%);transform:translate(0,-70%)}@media only screen and (max-width:1024px){.settings-column{display:block;float:none}.settings-column.left,.settings-column.right{width:100%}}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 69 KiB |
288
wp-content/plugins/host-webfonts-local/assets/js/omgf-admin.js
Normal file
288
wp-content/plugins/host-webfonts-local/assets/js/omgf-admin.js
Normal file
@@ -0,0 +1,288 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * *
|
||||
*
|
||||
* ██████╗ ███╗ ███╗ ██████╗ ███████╗
|
||||
* ██╔═══██╗████╗ ████║██╔════╝ ██╔════╝
|
||||
* ██║ ██║██╔████╔██║██║ ███╗█████╗
|
||||
* ██║ ██║██║╚██╔╝██║██║ ██║██╔══╝
|
||||
* ╚██████╔╝██║ ╚═╝ ██║╚██████╔╝██║
|
||||
* ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
|
||||
*
|
||||
* @package : OMGF
|
||||
* @author : Daan van den Bergh
|
||||
* @copyright: (c) 2021 Daan van den Bergh
|
||||
* @url : https://daan.dev
|
||||
* * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
var omgf_admin = {
|
||||
ticker_items: document.querySelectorAll('.ticker-item'),
|
||||
ticker_index: 0,
|
||||
empty_cache_directory_xhr: false,
|
||||
optimize_xhr: false,
|
||||
cache_prefix: '-mod-',
|
||||
cache_section: $('.omgf-empty').data('cache-section'),
|
||||
nonce: $('.omgf-empty').data('nonce'),
|
||||
|
||||
/**
|
||||
* Initialize all on click events.
|
||||
*/
|
||||
init: function () {
|
||||
// Settings
|
||||
$('input[name="omgf_optimization_mode"]').on('click', this.toggle_optimization_mode_content);
|
||||
$('.omgf-optimize-fonts-manage .unload').on('change', this.unload_stylesheets);
|
||||
$('.omgf-optimize-fonts-manage .unload, .omgf-optimize-fonts-manage .fallback-font-stack select').on('change', this.generate_cache_key);
|
||||
$('.omgf-optimize-fonts-manage .unload').on('change', this.toggle_preload);
|
||||
$('.omgf-optimize-fonts-manage .preload').on('change', this.toggle_unload);
|
||||
$('.omgf-optimize-fonts-manage .unload-italics').on('click', this.unload_italics);
|
||||
$('.omgf-optimize-fonts-manage .unload-all').on('click', this.unload_all);
|
||||
$('.omgf-optimize-fonts-manage .load-all').on('click', this.load_all);
|
||||
|
||||
// Buttons
|
||||
$('.omgf-empty').on('click', this.empty_cache_directory);
|
||||
$('#omgf-optimize-settings-form').submit(this.show_loader_before_submit);
|
||||
|
||||
// Ticker
|
||||
setInterval(this.loop_ticker_items, 4000);
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
loop_ticker_items: function () {
|
||||
omgf_admin.ticker_items.forEach(function (item, index) {
|
||||
if (index == omgf_admin.ticker_index) {
|
||||
$(item).fadeIn(500);
|
||||
} else {
|
||||
$(item).hide(0);
|
||||
}
|
||||
});
|
||||
|
||||
omgf_admin.ticker_index++;
|
||||
|
||||
if (omgf_admin.ticker_index == omgf_admin.ticker_items.length) {
|
||||
omgf_admin.ticker_index = 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
toggle_optimization_mode_content: function () {
|
||||
if (this.value == 'manual') {
|
||||
$('.omgf-optimize-fonts-manual').show();
|
||||
$('.omgf-optimize-fonts-automatic').hide();
|
||||
} else {
|
||||
$('.omgf-optimize-fonts-automatic').show();
|
||||
$('.omgf-optimize-fonts-manual').hide();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Populates the omgf_unload_stylesheets hidden field.
|
||||
*/
|
||||
unload_stylesheets: function () {
|
||||
var handle = $(this).closest('tbody');
|
||||
var id = handle[0].id;
|
||||
var checked = $('tbody' + '#' + id + ' input.unload:checked').length;
|
||||
var total = $('tbody' + '#' + id + ' input.unload').length;
|
||||
var unloaded_stylesheets_option = $('#omgf_unload_stylesheets');
|
||||
var unloaded_stylesheets = unloaded_stylesheets_option.val().split(',');
|
||||
|
||||
if (checked === total) {
|
||||
if (unloaded_stylesheets.indexOf(id) === -1) {
|
||||
unloaded_stylesheets.push(id);
|
||||
}
|
||||
|
||||
unloaded_stylesheets.join();
|
||||
|
||||
unloaded_stylesheets_option.val(unloaded_stylesheets);
|
||||
} else {
|
||||
position = unloaded_stylesheets.indexOf(id);
|
||||
|
||||
if (~position) unloaded_stylesheets.splice(position, 1);
|
||||
|
||||
unloaded_stylesheets_option.val(unloaded_stylesheets);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Generate a new cache key upon each unload change.
|
||||
*/
|
||||
generate_cache_key: function () {
|
||||
var current_handle = $(this).data('handle'),
|
||||
cache_keys_input = $('#omgf_cache_keys'),
|
||||
cache_keys = cache_keys_input.val().split(','),
|
||||
checked = $('#' + current_handle + ' input.unload:checked').length,
|
||||
total = $('#' + current_handle + ' input.unload').length,
|
||||
cache_key_index = cache_keys.findIndex((key, index) => {
|
||||
if (key.indexOf(current_handle) !== -1) {
|
||||
return true;
|
||||
}
|
||||
}),
|
||||
no_cache_key = false;
|
||||
|
||||
/**
|
||||
* If no or all boxes are checked, (re-)set cache key to default (without random string).
|
||||
*/
|
||||
if (this.nodeName !== 'SELECT' && (checked === 0 || checked === total)) {
|
||||
cache_keys[cache_key_index] = current_handle;
|
||||
|
||||
no_cache_key = true;
|
||||
}
|
||||
|
||||
if (no_cache_key === true) {
|
||||
cache_keys_input.val(cache_keys.join());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique cache key if some of this stylesheet's fonts are unloaded.
|
||||
*/
|
||||
if (cache_key_index !== -1) {
|
||||
var current_cache_key = cache_keys[cache_key_index],
|
||||
cache_key = omgf_admin.cache_prefix + Math.random().toString(36).substring(2, 7);
|
||||
|
||||
if (current_cache_key.indexOf(omgf_admin.cache_prefix) !== -1) {
|
||||
var parts = current_cache_key.split(omgf_admin.cache_prefix),
|
||||
last_part = omgf_admin.get_last_element_index(parts);
|
||||
parts[last_part] = Math.random().toString(36).substring(2, 7);
|
||||
current_cache_key = parts[0];
|
||||
cache_key = omgf_admin.cache_prefix + parts[last_part];
|
||||
}
|
||||
|
||||
cache_keys[cache_key_index] = current_cache_key + cache_key;
|
||||
}
|
||||
|
||||
cache_keys_input.val(cache_keys.join());
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggle preload option associated with this unload option.
|
||||
*/
|
||||
toggle_preload: function () {
|
||||
omgf_admin.toggle(this, 'preload');
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggle unload option associated with the current preload option.
|
||||
*/
|
||||
toggle_unload: function () {
|
||||
omgf_admin.toggle(this, 'unload');
|
||||
},
|
||||
|
||||
/**
|
||||
* Unload all italic styles for current font family.
|
||||
*/
|
||||
unload_italics: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var id = $(this).parents('.font-family').data('id');
|
||||
var unloads = $('.unload');
|
||||
|
||||
unloads.each(function (index, item) {
|
||||
if (item.value.includes('italic') && item.dataset.fontId == id && item.checked == false) {
|
||||
item.click();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Unload all fonts for current font family.
|
||||
*/
|
||||
unload_all: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var id = $(this).parents('.font-family').data('id');
|
||||
var unloads = $('.unload');
|
||||
|
||||
unloads.each(function (index, item) {
|
||||
if (item.dataset.fontId == id && item.checked == false) {
|
||||
item.click();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Uncheck all unload checkboxes for the current font family.
|
||||
*/
|
||||
load_all: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
var id = $(this).parents('.font-family').data('id');
|
||||
var unloads = $('.unload');
|
||||
|
||||
unloads.each(function (index, item) {
|
||||
if (item.dataset.fontId == id && item.checked == true) {
|
||||
item.click();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Toggle a checkbox.
|
||||
*
|
||||
* @param elem
|
||||
* @param option
|
||||
*/
|
||||
toggle: function (elem, option) {
|
||||
var this_option = $(elem);
|
||||
var other_option = $('.' + option + '-' + this_option.data('font-id') + '-' + this_option.val() + ' .' + option);
|
||||
|
||||
if (elem.checked) {
|
||||
other_option.attr('disabled', true);
|
||||
} else {
|
||||
other_option.attr('disabled', false);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array
|
||||
* @returns {number}
|
||||
*/
|
||||
get_last_element_index: function (array) {
|
||||
return array.length - 1;
|
||||
},
|
||||
|
||||
/**
|
||||
* Empty queue, db and cache directory.
|
||||
*/
|
||||
empty_cache_directory: function () {
|
||||
if (omgf_admin.empty_cache_directory_xhr) {
|
||||
omgf_admin.empty_cache_directory_xhr.abort();
|
||||
}
|
||||
|
||||
omgf_admin.empty_cache_directory_xhr = $.ajax({
|
||||
type: 'POST',
|
||||
url: ajaxurl,
|
||||
data: {
|
||||
action: 'omgf_ajax_empty_dir',
|
||||
nonce: omgf_admin.nonce,
|
||||
section: omgf_admin.cache_section
|
||||
},
|
||||
beforeSend: function () {
|
||||
omgf_admin.show_loader();
|
||||
},
|
||||
complete: function () {
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
show_loader_before_submit: function (e) {
|
||||
omgf_admin.show_loader();
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
show_loader: function () {
|
||||
$('#wpcontent').append('<div class="omgf-loading"><span class="spinner is-active"></span></div>');
|
||||
}
|
||||
};
|
||||
|
||||
omgf_show_loader = omgf_admin.show_loader;
|
||||
|
||||
omgf_admin.init();
|
||||
});
|
||||
Reference in New Issue
Block a user