beautify assets
Cette révision appartient à :
Parent
3c34b0a728
révision
a931b47bff
|
@ -1,85 +1,162 @@
|
||||||
/* This is a placeholder so the classic theme can be used */
|
/* This is a placeholder so the classic theme can be used */
|
||||||
|
|
||||||
|
|
||||||
/* Ideally, the decorative parts of main.css would be here instead of there. This will have to do for now though */
|
/* Ideally, the decorative parts of main.css would be here instead of there. This will have to do for now though */
|
||||||
body { color: #333; background: #ededed; }
|
|
||||||
|
|
||||||
.header, .box, .pagination li, .user-menu { box-shadow: 1px 3px 4px rgba(0,0,0,0.1) }
|
body {
|
||||||
|
color: #333;
|
||||||
|
background: #ededed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header, .box, .pagination li, .user-menu {
|
||||||
|
box-shadow: 1px 3px 4px rgba(0, 0, 0, 0.1)
|
||||||
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: #196759;
|
color: #196759;
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #238BC7;
|
||||||
}
|
}
|
||||||
a:hover { color: #238BC7; }
|
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
background: #111; /* Old browsers */
|
background: #111;
|
||||||
background: -moz-linear-gradient(bottom, #222 0%, #111 100%);
|
/* Old browsers */
|
||||||
background: -webkit-linear-gradient(bottom, #222 0%, #111 100%);
|
background: -moz-linear-gradient(bottom, #222 0%, #111 100%);
|
||||||
background: linear-gradient(to top, #222 0%, #111 100%);
|
background: -webkit-linear-gradient(bottom, #222 0%, #111 100%);
|
||||||
border-color: #444;
|
background: linear-gradient(to top, #222 0%, #111 100%);
|
||||||
|
border-color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header .nav-btn {
|
||||||
|
color: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header .nav-btn:hover {
|
||||||
|
color: #d5d5d5;
|
||||||
}
|
}
|
||||||
.header .nav-btn { color: #ccc; }
|
|
||||||
.header .nav-btn:hover { color: #d5d5d5; }
|
|
||||||
|
|
||||||
.box, .pagination li {
|
.box, .pagination li {
|
||||||
background: rgba(255,255,255, 0.8);
|
background: rgba(255, 255, 255, 0.8);
|
||||||
border-color: #BBC9CF !important;
|
border-color: #BBC9CF !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
border-color: #BBC9CF !important;
|
||||||
|
background: #fafafa;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
.form-input { border-color: #BBC9CF !important; background: #fafafa; color: #666; }
|
.btn:hover, .up-btn:hover {
|
||||||
|
background: rgba(192, 192, 192, 0.2);
|
||||||
.btn:hover, .up-btn:hover { background: rgba(192,192,192,0.2); }
|
}
|
||||||
|
|
||||||
.form-input:focus { box-shadow: 0 0 5px #fff; }
|
|
||||||
|
|
||||||
|
.form-input:focus {
|
||||||
|
box-shadow: 0 0 5px #fff;
|
||||||
|
}
|
||||||
|
|
||||||
select:after {
|
select:after {
|
||||||
content: "AAAAA";
|
content: "AAAAA";
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .h-user .user-avatar {
|
.header .h-user .user-avatar {
|
||||||
background: #111;
|
background: #111;
|
||||||
border-color: #444;
|
border-color: #444;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead { background: #fff; }
|
table thead {
|
||||||
|
background: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
th a {
|
||||||
|
color: #6E96AA;
|
||||||
|
}
|
||||||
|
|
||||||
th a { color: #6E96AA; }
|
th {
|
||||||
th { border-color: #ddd !important; }
|
border-color: #ddd !important;
|
||||||
td { border-color: #ccc !important; }
|
}
|
||||||
|
|
||||||
td.tr-se, .success-text { color: #22A243; }
|
td {
|
||||||
td.tr-le, .error-text { color: #E84C4C; }
|
border-color: #ccc !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-se, .success-text {
|
||||||
|
color: #22A243;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-le, .error-text {
|
||||||
|
color: #E84C4C;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-red {
|
.btn-red {
|
||||||
background-color: #E84C4C;
|
background-color: #E84C4C;
|
||||||
color: #E8E8E8!important;
|
color: #E8E8E8!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-red:hover {
|
.btn-red:hover {
|
||||||
color: #E8E8E8;
|
color: #E8E8E8;
|
||||||
}
|
}
|
||||||
|
|
||||||
.torrent-info-box > p > a, .torrent-info-box > div > a, #description-box a {
|
.torrent-info-box>p>a, .torrent-info-box>div>a, #description-box a {
|
||||||
color: #1fa4d0;
|
color: #1fa4d0;
|
||||||
}
|
}
|
||||||
.torrent-info-box > p > a:hover, .torrent-info-box > div > a:hover, #description-box a:hover { color: #1fa4d0; }
|
|
||||||
|
.torrent-info-box>p>a:hover, .torrent-info-box>div>a:hover, #description-box a:hover {
|
||||||
|
color: #1fa4d0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Original Nyaa colors, do NOT change! */
|
/* Original Nyaa colors, do NOT change! */
|
||||||
.aplus, .btn-blue { background: #60B0F0; }
|
|
||||||
.trusted, .btn-green { background: #98D9A8; }
|
|
||||||
.remake, .btn-orange { background: #F0B080; }
|
|
||||||
|
|
||||||
.pagination .active { background: #d5d5d5; color: #222; }
|
.aplus, .btn-blue {
|
||||||
.pagination .disabled { color: #d5d5d5; cursor: unset; }
|
background: #60B0F0;
|
||||||
|
}
|
||||||
|
|
||||||
.sukebei { color: #9C7575; }
|
.trusted, .btn-green {
|
||||||
.sukebei a { color: #893636; }
|
background: #98D9A8;
|
||||||
.sukebei a:hover { color: #C7235D; }
|
}
|
||||||
.sukebei th { color: #9C7575; }
|
|
||||||
.sukebei th a { color: #893636; }
|
|
||||||
.sukebei #mascot { background-image: url('/img/mafuyu.svg'); background-size: 100%; }
|
|
||||||
|
|
||||||
.form-input.language { background-color: #f5f5f5; }
|
.remake, .btn-orange {
|
||||||
|
background: #F0B080;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination .active {
|
||||||
|
background: #d5d5d5;
|
||||||
|
color: #222;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination .disabled {
|
||||||
|
color: #d5d5d5;
|
||||||
|
cursor: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei {
|
||||||
|
color: #9C7575;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a {
|
||||||
|
color: #893636;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a:hover {
|
||||||
|
color: #C7235D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei th {
|
||||||
|
color: #9C7575;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei th a {
|
||||||
|
color: #893636;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei #mascot {
|
||||||
|
background-image: url('/img/mafuyu.svg');
|
||||||
|
background-size: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input.language {
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
background: url('flags.png') no-repeat;
|
background: url('flags.png') no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.flag.flag-zh {
|
.flag.flag-zh {
|
||||||
background-position: -16px 0;
|
background-position: -16px 0;
|
||||||
}
|
}
|
||||||
|
|
212
public/css/g.css
212
public/css/g.css
|
@ -1,92 +1,190 @@
|
||||||
body { color: #373737; background: url('theme_g_anon/bg-body.png'); }
|
body {
|
||||||
|
color: #373737;
|
||||||
|
background: url('theme_g_anon/bg-body.png');
|
||||||
|
}
|
||||||
|
|
||||||
.header, .user-menu { box-shadow: 1px 3px 4px hsla(200,20%,20%,0.15) }
|
.header, .user-menu {
|
||||||
.box, .pagination li { box-shadow: 1px 3px 4px hsla(270,20%,20%,0.15) }
|
box-shadow: 1px 3px 4px hsla(200, 20%, 20%, 0.15)
|
||||||
|
}
|
||||||
|
|
||||||
#mascot { background-image: url('/img/renchon.svg'); }
|
.box, .pagination li {
|
||||||
a { color: #676767; }
|
box-shadow: 1px 3px 4px hsla(270, 20%, 20%, 0.15)
|
||||||
a:hover { color: #444; }
|
}
|
||||||
|
|
||||||
|
#mascot {
|
||||||
|
background-image: url('/img/renchon.svg');
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #676767;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
background: #bfe3f3 url('theme_g_anon/bg-header-tile.png') repeat-x;
|
background: #bfe3f3 url('theme_g_anon/bg-header-tile.png') repeat-x;
|
||||||
border-color: #1d6d90;
|
border-color: #1d6d90;
|
||||||
}
|
}
|
||||||
.header .nav-btn { color: #1d6d90; }
|
|
||||||
.header .nav-btn:hover { color: #2586B0; }
|
|
||||||
|
|
||||||
.box, .pagination li { background: hsla(198, 63%, 97%, 0.85); border-color: #cbbdd7 !important; }
|
.header .nav-btn {
|
||||||
|
color: #1d6d90;
|
||||||
|
}
|
||||||
|
|
||||||
.form-input { border-color: #c4c4c4 !important; background: #fff; color: #676767; }
|
.header .nav-btn:hover {
|
||||||
|
color: #2586B0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box, .pagination li {
|
||||||
|
background: hsla(198, 63%, 97%, 0.85);
|
||||||
|
border-color: #cbbdd7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
border-color: #c4c4c4 !important;
|
||||||
|
background: #fff;
|
||||||
|
color: #676767;
|
||||||
|
}
|
||||||
|
|
||||||
.header .h-user .user-avatar {
|
.header .h-user .user-avatar {
|
||||||
background: #99BFD0;
|
background: #99BFD0;
|
||||||
border-color: #a3c7d3;
|
border-color: #a3c7d3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sukebei .header .h-user .user-avatar {
|
.sukebei .header .h-user .user-avatar {
|
||||||
background: #bf99d0;
|
background: #bf99d0;
|
||||||
border-color: #d3a3d1;
|
border-color: #d3a3d1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .h-user .user-menu {
|
.header .h-user .user-menu {
|
||||||
background: #BDE0EF;
|
background: #BDE0EF;
|
||||||
background: -moz-linear-gradient(top, #BDE0EF 0%, #ABCFDF 100%);
|
background: -moz-linear-gradient(top, #BDE0EF 0%, #ABCFDF 100%);
|
||||||
background: -webkit-linear-gradient(top, #BDE0EF 0%, #ABCFDF 100%);
|
background: -webkit-linear-gradient(top, #BDE0EF 0%, #ABCFDF 100%);
|
||||||
background: linear-gradient(to bottom, #BDE0EF 0%, #ABCFDF 100%);
|
background: linear-gradient(to bottom, #BDE0EF 0%, #ABCFDF 100%);
|
||||||
border-color: #1d6d90;
|
border-color: #1d6d90;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header .h-user button:focus {
|
||||||
|
background-color: rgba(0, 100, 200, 0.15);
|
||||||
}
|
}
|
||||||
.header .h-user button:focus {background-color: rgba(0,100,200, 0.15);}
|
|
||||||
|
|
||||||
table thead {
|
table thead {
|
||||||
background: #dcccea !important; /* Old browsers */
|
background: #dcccea !important;
|
||||||
background: -moz-linear-gradient(top, #dcccea 0%, #d7c6e7 100%) !important;
|
/* Old browsers */
|
||||||
background: -webkit-linear-gradient(top, #dcccea 0%,#d7c6e7 100%) !important;
|
background: -moz-linear-gradient(top, #dcccea 0%, #d7c6e7 100%) !important;
|
||||||
background: linear-gradient(to bottom, #dcccea 0%,#d7c6e7 100%) !important;
|
background: -webkit-linear-gradient(top, #dcccea 0%, #d7c6e7 100%) !important;
|
||||||
|
background: linear-gradient(to bottom, #dcccea 0%, #d7c6e7 100%) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
th { color: #9b85ae; }
|
th {
|
||||||
th a { color: #7A5C94; }
|
color: #9b85ae;
|
||||||
|
}
|
||||||
|
|
||||||
th { border-color: #cbbdd7 !important; }
|
th a {
|
||||||
td { border-color: #e6eff4 !important; }
|
color: #7A5C94;
|
||||||
|
}
|
||||||
|
|
||||||
td.tr-se, .success-text { color: #22A243; }
|
th {
|
||||||
td.tr-le, .error-text { color: #E84C4C; }
|
border-color: #cbbdd7 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-color: #e6eff4 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-se, .success-text {
|
||||||
|
color: #22A243;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-le, .error-text {
|
||||||
|
color: #E84C4C;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-red {
|
.btn-red {
|
||||||
background-color: #E84C4C;
|
background-color: #E84C4C;
|
||||||
color: #E8E8E8!important;
|
color: #E8E8E8!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-red:hover { color: #E8E8E8; }
|
.btn-red:hover {
|
||||||
|
color: #E8E8E8;
|
||||||
|
}
|
||||||
|
|
||||||
.aplus, .btn-blue { background: hsla(200, 100%, 50%, 0.2) !important; }
|
.aplus, .btn-blue {
|
||||||
.trusted, .btn-green { background: hsla(100, 100%, 50%, 0.2) !important; }
|
background: hsla(200, 100%, 50%, 0.2) !important;
|
||||||
.remake, .btn-orange { background: hsla(30, 100%, 50%, 0.2) !important; }
|
}
|
||||||
|
|
||||||
.pagination .active { background: #cbbdd7; color: #444; }
|
.trusted, .btn-green {
|
||||||
|
background: hsla(100, 100%, 50%, 0.2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.pagination .disabled { color: #cbbdd7; cursor: unset; }
|
.remake, .btn-orange {
|
||||||
|
background: hsla(30, 100%, 50%, 0.2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.torrent-info-box > p > a, .torrent-info-box > div > a, #description-box a {
|
.pagination .active {
|
||||||
|
background: #cbbdd7;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination .disabled {
|
||||||
|
color: #cbbdd7;
|
||||||
|
cursor: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.torrent-info-box>p>a, .torrent-info-box>div>a, #description-box a {
|
||||||
color: #1fa4d0;
|
color: #1fa4d0;
|
||||||
}
|
}
|
||||||
.torrent-info-box > p > a:hover, .torrent-info-box > div > a:hover, #description-box a:hover { color: #1fa4d0; }
|
|
||||||
|
|
||||||
.sukebei { color: #373737; }
|
.torrent-info-box>p>a:hover, .torrent-info-box>div>a:hover, #description-box a:hover {
|
||||||
.sukebei .header { background-image: url('theme_g_anon/s_bg-header-tile.png'); border-color: #C48CBE; }
|
color: #1fa4d0;
|
||||||
.sukebei .header .nav-btn { color: #C48CBE; }
|
}
|
||||||
.sukebei .header .nav-btn:hover { color: #AD6CA6; }
|
|
||||||
.sukebei a { color: #676767; }
|
.sukebei {
|
||||||
.sukebei a:hover { color: #444; }
|
color: #373737;
|
||||||
.sukebei th { color: #9b85ae; }
|
}
|
||||||
.sukebei th a { color: #7A5C94; }
|
|
||||||
.sukebei tr:nth-child(2n+1) { background: hsla(330, 100%, 91%, 0.2); }
|
.sukebei .header {
|
||||||
.sukebei .header .h-user button:focus {background-color: rgba(150,100,255, 0.16);}
|
background-image: url('theme_g_anon/s_bg-header-tile.png');
|
||||||
|
border-color: #C48CBE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei .header .nav-btn {
|
||||||
|
color: #C48CBE;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei .header .nav-btn:hover {
|
||||||
|
color: #AD6CA6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a {
|
||||||
|
color: #676767;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a:hover {
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei th {
|
||||||
|
color: #9b85ae;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei th a {
|
||||||
|
color: #7A5C94;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei tr:nth-child(2n+1) {
|
||||||
|
background: hsla(330, 100%, 91%, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei .header .h-user button:focus {
|
||||||
|
background-color: rgba(150, 100, 255, 0.16);
|
||||||
|
}
|
||||||
|
|
||||||
.sukebei .header .h-user .user-menu {
|
.sukebei .header .h-user .user-menu {
|
||||||
background: #EFDCF0;
|
background: #EFDCF0;
|
||||||
background: -moz-linear-gradient(top, #EFDCF0 0%, #EBCFEC 100%);
|
background: -moz-linear-gradient(top, #EFDCF0 0%, #EBCFEC 100%);
|
||||||
background: -webkit-linear-gradient(top, #EFDCF0 0%, #EBCFEC 100%);
|
background: -webkit-linear-gradient(top, #EFDCF0 0%, #EBCFEC 100%);
|
||||||
background: linear-gradient(to bottom, #EFDCF0 0%, #EBCFEC 100%);
|
background: linear-gradient(to bottom, #EFDCF0 0%, #EBCFEC 100%);
|
||||||
border-color: #C48CBE;
|
border-color: #C48CBE;
|
||||||
}
|
}
|
||||||
|
|
1765
public/css/main.css
1765
public/css/main.css
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
|
@ -1,16 +1,18 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'nyacon';
|
font-family: 'nyacon';
|
||||||
src: url('./font/nyacon.eot?1588873');
|
src: url('./font/nyacon.eot?1588873');
|
||||||
src: url('./font/nyacon.eot?1588873#iefix') format('embedded-opentype'),
|
src: url('./font/nyacon.eot?1588873#iefix') format('embedded-opentype'), url('./font/nyacon.woff2?1588873') format('woff2'), url('./font/nyacon.woff?1588873') format('woff'), url('./font/nyacon.ttf?1588873') format('truetype'), url('./font/nyacon.svg?1588873#nyacon') format('svg');
|
||||||
url('./font/nyacon.woff2?1588873') format('woff2'),
|
font-weight: normal;
|
||||||
url('./font/nyacon.woff?1588873') format('woff'),
|
font-style: normal;
|
||||||
url('./font/nyacon.ttf?1588873') format('truetype'),
|
|
||||||
url('./font/nyacon.svg?1588873#nyacon') format('svg');
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
|
||||||
|
|
||||||
|
|
||||||
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||||
@font-face {
|
@font-face {
|
||||||
|
@ -20,50 +22,114 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[class^="icon-"]:before, [class*=" icon-"]:before {
|
[class^="icon-"]:before, [class*=" icon-"]:before {
|
||||||
font-family: "nyacon";
|
font-family: "nyacon";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
speak: none;
|
speak: none;
|
||||||
|
display: inline-block;
|
||||||
display: inline-block;
|
text-decoration: inherit;
|
||||||
text-decoration: inherit;
|
width: 1em;
|
||||||
width: 1em;
|
margin-right: .2em;
|
||||||
margin-right: .2em;
|
text-align: center;
|
||||||
text-align: center;
|
/* opacity: .8; */
|
||||||
/* opacity: .8; */
|
/* For safety - reset parent styles, that can break glyph codes*/
|
||||||
|
font-variant: normal;
|
||||||
/* For safety - reset parent styles, that can break glyph codes*/
|
text-transform: none;
|
||||||
font-variant: normal;
|
/* fix buttons height, for twitter bootstrap */
|
||||||
text-transform: none;
|
line-height: 1em;
|
||||||
|
/* Animation center compensation - margins should be symmetric */
|
||||||
/* fix buttons height, for twitter bootstrap */
|
/* remove if not needed */
|
||||||
line-height: 1em;
|
margin-left: .2em;
|
||||||
|
/* you can be more comfortable with increased icons size */
|
||||||
/* Animation center compensation - margins should be symmetric */
|
/* font-size: 120%; */
|
||||||
/* remove if not needed */
|
/* Font smoothing. That was taken from TWBS */
|
||||||
margin-left: .2em;
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
/* you can be more comfortable with increased icons size */
|
/* Uncomment for 3D effect */
|
||||||
/* font-size: 120%; */
|
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
||||||
|
|
||||||
/* Font smoothing. That was taken from TWBS */
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
|
|
||||||
/* Uncomment for 3D effect */
|
|
||||||
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.icon-heart:before { content: '\e800'; } /* '' */
|
.icon-heart:before {
|
||||||
.icon-help-circled:before { content: '\e801'; } /* '' */
|
content: '\e800';
|
||||||
.icon-magnet:before { content: '\e802'; } /* '' */
|
}
|
||||||
.icon-upload:before { content: '\e803'; } /* '' */
|
|
||||||
.icon-search:before { content: '\e804'; } /* '' */
|
|
||||||
.icon-floppy:before { content: '\e805'; } /* '' */
|
/* '' */
|
||||||
.icon-users:before { content: '\e806'; } /* '' */
|
|
||||||
.icon-chat:before { content: '\e807'; } /* '' */
|
.icon-help-circled:before {
|
||||||
.icon-attention:before { content: '\e808'; } /* '' */
|
content: '\e801';
|
||||||
.icon-rss-squared:before { content: '\f143'; } /* '' */
|
}
|
||||||
.icon-trash:before { content: '\f1f8'; } /* '' */
|
|
||||||
.icon-user-plus:before { content: '\f234'; } /* '' */
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-magnet:before {
|
||||||
|
content: '\e802';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-upload:before {
|
||||||
|
content: '\e803';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-search:before {
|
||||||
|
content: '\e804';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-floppy:before {
|
||||||
|
content: '\e805';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-users:before {
|
||||||
|
content: '\e806';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-chat:before {
|
||||||
|
content: '\e807';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-attention:before {
|
||||||
|
content: '\e808';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-rss-squared:before {
|
||||||
|
content: '\f143';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-trash:before {
|
||||||
|
content: '\f1f8';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
||||||
|
.icon-user-plus:before {
|
||||||
|
content: '\f234';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* '' */
|
||||||
|
|
|
@ -1,103 +1,187 @@
|
||||||
body { color: #c5c8c6; background: #1d1f21 ; }
|
body {
|
||||||
|
color: #c5c8c6;
|
||||||
|
background: #1d1f21;
|
||||||
|
}
|
||||||
|
|
||||||
.header, .box, .pagination li, .user-menu { box-shadow: 1px 3px 4px rgba(0,0,0,0.2) }
|
.header, .box, .pagination li, .user-menu {
|
||||||
|
box-shadow: 1px 3px 4px rgba(0, 0, 0, 0.2)
|
||||||
|
}
|
||||||
|
|
||||||
#mascot { background-image: url('/img/megumin.svg'); }
|
#mascot {
|
||||||
|
background-image: url('/img/megumin.svg');
|
||||||
|
}
|
||||||
|
|
||||||
a { color: #81a2be; }
|
a {
|
||||||
a:hover { color: #5F89AC; }
|
color: #81a2be;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #5F89AC;
|
||||||
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
background: #282A2E;
|
background: #282A2E;
|
||||||
border-color: #000;
|
border-color: #000;
|
||||||
}
|
}
|
||||||
.header .nav-btn { color: #c5c8c6; }
|
|
||||||
.header .nav-btn:hover { color: #eee; }
|
|
||||||
|
|
||||||
.box, .pagination li { background: hsla(222, 8%, 20%, 0.85); border-color: #141517 !important; }
|
.header .nav-btn {
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
.form-input { border-color: #0C0D0E !important; background: #141517; color: #c5c8c6; }
|
.header .nav-btn:hover {
|
||||||
|
color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box, .pagination li {
|
||||||
|
background: hsla(222, 8%, 20%, 0.85);
|
||||||
|
border-color: #141517 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-input {
|
||||||
|
border-color: #0C0D0E !important;
|
||||||
|
background: #141517;
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
.header .h-user .user-avatar {
|
.header .h-user .user-avatar {
|
||||||
background: #99BFD0;
|
background: #99BFD0;
|
||||||
border-color: #282A2E;
|
border-color: #282A2E;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header .h-user .user-menu {
|
.header .h-user .user-menu {
|
||||||
background: #282A2E;
|
background: #282A2E;
|
||||||
background: -moz-linear-gradient(top, #282A2E 0%, #34373C 100%);
|
background: -moz-linear-gradient(top, #282A2E 0%, #34373C 100%);
|
||||||
background: -webkit-linear-gradient(top, #282A2E 0%, #34373C 100%);
|
background: -webkit-linear-gradient(top, #282A2E 0%, #34373C 100%);
|
||||||
background: linear-gradient(to bottom, #282A2E 0%, #34373C 100%);
|
background: linear-gradient(to bottom, #282A2E 0%, #34373C 100%);
|
||||||
border-color: #282A2E;
|
border-color: #282A2E;
|
||||||
}
|
}
|
||||||
|
|
||||||
table thead { background: #141517 !important; }
|
table thead {
|
||||||
|
background: #141517 !important;
|
||||||
|
}
|
||||||
|
|
||||||
th { color: #838B98; }
|
th {
|
||||||
th a { color: #c5c8c6; }
|
color: #838B98;
|
||||||
|
}
|
||||||
|
|
||||||
th, td { border-color: #141517 !important; }
|
th a {
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
td.tr-se, .success-text { color: #b5bd68; }
|
th, td {
|
||||||
td.tr-le, .error-text { color: #cc6666; }
|
border-color: #141517 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-se, .success-text {
|
||||||
|
color: #b5bd68;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.tr-le, .error-text {
|
||||||
|
color: #cc6666;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-red {
|
.btn-red {
|
||||||
background-color: #cc6666;
|
background-color: #cc6666;
|
||||||
}
|
}
|
||||||
|
|
||||||
.aplus, .btn-blue { background: hsla(180, 50%, 50%, 0.2) !important; }
|
.aplus, .btn-blue {
|
||||||
.trusted, .btn-green { background: hsla(90, 50%, 50%, 0.2) !important; }
|
background: hsla(180, 50%, 50%, 0.2) !important;
|
||||||
.remake, .btn-orange { background: hsla(40, 50%, 50%, 0.2) !important; }
|
}
|
||||||
|
|
||||||
.pagination .active { background: #141517; color: #c5c8c6; }
|
.trusted, .btn-green {
|
||||||
.pagination .disabled { color: #141517; cursor: unset; }
|
background: hsla(90, 50%, 50%, 0.2) !important;
|
||||||
|
}
|
||||||
|
|
||||||
.sukebei { color: #c5c8c6; }
|
.remake, .btn-orange {
|
||||||
.sukebei a { color: #cc6666; }
|
background: hsla(40, 50%, 50%, 0.2) !important;
|
||||||
.sukebei a:hover { color: #c82829; }
|
}
|
||||||
.sukebei th, .sukebei th a { color: #c5c8c6; }
|
|
||||||
|
.pagination .active {
|
||||||
|
background: #141517;
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination .disabled {
|
||||||
|
color: #141517;
|
||||||
|
cursor: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei {
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a {
|
||||||
|
color: #cc6666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei a:hover {
|
||||||
|
color: #c82829;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sukebei th, .sukebei th a {
|
||||||
|
color: #c5c8c6;
|
||||||
|
}
|
||||||
|
|
||||||
.captcha-container img {
|
.captcha-container img {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
border-radius: .4em .4em 0 0;
|
border-radius: .4em .4em 0 0;
|
||||||
border-bottom: .5em solid #fff;
|
border-bottom: .5em solid #fff;
|
||||||
margin-bottom: -.5em;
|
margin-bottom: -.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Markdown editor */
|
/* Markdown editor */
|
||||||
|
|
||||||
.editor-toolbar a {
|
.editor-toolbar a {
|
||||||
color: #fff !important;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-toolbar a.active, .editor-toolbar a:hover {
|
.editor-toolbar a.active, .editor-toolbar a:hover {
|
||||||
background: #666;
|
background: #666;
|
||||||
border-color: #828282;
|
border-color: #828282;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-toolbar {
|
.editor-toolbar {
|
||||||
background: #000 !important;
|
background: #000 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-toolbar.fullscreen::before, .editor-toolbar.fullscreen::after {
|
.editor-toolbar.fullscreen::before, .editor-toolbar.fullscreen::after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.editor-preview, .editor-preview-side, .editor-toolbar.disabled-for-preview a:not(.no-disable) {
|
.editor-preview, .editor-preview-side, .editor-toolbar.disabled-for-preview a:not(.no-disable) {
|
||||||
background: #141517;
|
background: #141517;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror {
|
.CodeMirror {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
background: #141517;
|
background: #141517;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror-cursor {
|
.CodeMirror-cursor {
|
||||||
border-color: #fff;
|
border-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror .CodeMirror-selected {
|
.CodeMirror .CodeMirror-selected {
|
||||||
background: #585858;
|
background: #585858;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror-focused .CodeMirror-selected, .CodeMirror-line::selection, .CodeMirror-line>span::selection, .CodeMirror-line>span>span::selection {
|
.CodeMirror-focused .CodeMirror-selected, .CodeMirror-line::selection, .CodeMirror-line>span::selection, .CodeMirror-line>span>span::selection {
|
||||||
background: #454545;
|
background: #454545;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror-line::-moz-selection, .CodeMirror-line>span::-moz-selection, .CodeMirror-line>span>span::-moz-selection {
|
.CodeMirror-line::-moz-selection, .CodeMirror-line>span::-moz-selection, .CodeMirror-line>span>span::-moz-selection {
|
||||||
background: #454545;
|
background: #454545;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-input.language { background-color: #35363c; }
|
.form-input.language {
|
||||||
|
background-color: #35363c;
|
||||||
|
}
|
||||||
|
|
||||||
.torrent-info-box > p > a, .torrent-info-box > div > a, #description-box a { text-decoration: none; }
|
.torrent-info-box>p>a, .torrent-info-box>div>a, #description-box a {
|
||||||
.torrent-info-box { border-color: #53565e; }
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.torrent-info-box {
|
||||||
|
border-color: #53565e;
|
||||||
|
}
|
||||||
|
|
|
@ -30,17 +30,23 @@ var Kilo = function (params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private variables
|
// Private variables
|
||||||
var Keywords_flags= [
|
var Keywords_flags = [
|
||||||
["vostfr","vosfr", "[ita]", "[eng]", " eng ","[english]","[english sub]", "engsub", "[jp]","[jpn]","[japanese]", "[jav]"],
|
["vostfr", "vosfr", "[ita]", "[eng]", " eng ", "[english]", "[english sub]", "engsub", "[jp]", "[jpn]", "[japanese]", "[jav]"],
|
||||||
["fr","fr", "it", "en","en","en","en","en", "ja","ja","ja","ja"]
|
["fr", "fr", "it", "en", "en", "en", "en", "en", "ja", "ja", "ja", "ja"]
|
||||||
]
|
]
|
||||||
var Keywords_categories = [
|
var Keywords_categories = [
|
||||||
[["[jav]","[h-games]"], [7,3]],
|
[
|
||||||
[[""], [0]]
|
["[jav]", "[h-games]"],
|
||||||
|
[7, 3]
|
||||||
|
],
|
||||||
|
[
|
||||||
|
[""],
|
||||||
|
[0]
|
||||||
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
// Parsing categories
|
// Parsing categories
|
||||||
document.querySelectorAll(".form-torrent-category option").forEach(function(el) {
|
document.querySelectorAll(".form-torrent-category option").forEach(function (el) {
|
||||||
var subcat
|
var subcat
|
||||||
if (self.sukebei) {
|
if (self.sukebei) {
|
||||||
subcat = el.value.replace("_", "")
|
subcat = el.value.replace("_", "")
|
||||||
|
@ -56,7 +62,7 @@ var Kilo = function (params) {
|
||||||
// Displaying the block and set the locale timestamp
|
// Displaying the block and set the locale timestamp
|
||||||
document.getElementsByClassName('torrent-preview-table')[0].style.display = 'block'
|
document.getElementsByClassName('torrent-preview-table')[0].style.display = 'block'
|
||||||
document.getElementsByClassName('table-torrent-date')[0].innerText = new Date(Date.now()).toISOString()
|
document.getElementsByClassName('table-torrent-date')[0].innerText = new Date(Date.now()).toISOString()
|
||||||
|
|
||||||
// Adding listener events
|
// Adding listener events
|
||||||
for (var langIndex = 0; langIndex < document.getElementsByName(this.langSelect).length; langIndex++) {
|
for (var langIndex = 0; langIndex < document.getElementsByName(this.langSelect).length; langIndex++) {
|
||||||
document.getElementsByName(this.langSelect)[langIndex].addEventListener('change', updateTorrentLang)
|
document.getElementsByName(this.langSelect)[langIndex].addEventListener('change', updateTorrentLang)
|
||||||
|
@ -81,7 +87,7 @@ var Kilo = function (params) {
|
||||||
this.setCategory(formCategory.selectedIndex)
|
this.setCategory(formCategory.selectedIndex)
|
||||||
updateTorrentLang()
|
updateTorrentLang()
|
||||||
|
|
||||||
//Adding the torrent under and above the previewed one.
|
//Adding the torrent under and above the previewed one.
|
||||||
if (this.listContext) {
|
if (this.listContext) {
|
||||||
Query.Get('/api/search?limit=2', function (data) {
|
Query.Get('/api/search?limit=2', function (data) {
|
||||||
torrents = data.torrents
|
torrents = data.torrents
|
||||||
|
@ -122,40 +128,41 @@ var Kilo = function (params) {
|
||||||
tableCategory.className = 'nyaa-cat table-torrent-category ' + (this.sukebei ? 'sukebei' : 'nyaa') + '-cat-' + this.categories[index]
|
tableCategory.className = 'nyaa-cat table-torrent-category ' + (this.sukebei ? 'sukebei' : 'nyaa') + '-cat-' + this.categories[index]
|
||||||
tableCategory.title = document.getElementsByClassName('form-torrent-category')[0].querySelectorAll("option")[index].textContent
|
tableCategory.title = document.getElementsByClassName('form-torrent-category')[0].querySelectorAll("option")[index].textContent
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this.addKeywordFlags = function(value) {
|
this.addKeywordFlags = function (value) {
|
||||||
var torrentLowerCaseName = value.toLowerCase()
|
var torrentLowerCaseName = value.toLowerCase()
|
||||||
var updateLang = false
|
var updateLang = false
|
||||||
|
|
||||||
for(var KeywordIndex = 0; KeywordIndex < Keywords_flags[0].length; KeywordIndex++)
|
for (var KeywordIndex = 0; KeywordIndex < Keywords_flags[0].length; KeywordIndex++)
|
||||||
if(torrentLowerCaseName.includes(Keywords_flags[0][KeywordIndex])) {
|
if (torrentLowerCaseName.includes(Keywords_flags[0][KeywordIndex])) {
|
||||||
document.getElementById("upload-lang-" + Keywords_flags[1][KeywordIndex]).checked = true
|
document.getElementById("upload-lang-" + Keywords_flags[1][KeywordIndex]).checked = true
|
||||||
updateLang = true
|
updateLang = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if(updateLang) updateTorrentLang()
|
if (updateLang) updateTorrentLang()
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this.addKeywordCategories = function(value) {
|
this.addKeywordCategories = function (value) {
|
||||||
if(document.getElementsByClassName('form-torrent-category')[0].selectedIndex != 0)
|
if (document.getElementsByClassName('form-torrent-category')[0].selectedIndex != 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
var torrentLowerCaseName = value.toLowerCase(),
|
var torrentLowerCaseName = value.toLowerCase(),
|
||||||
IsOnSukebei = params.sukebei ? 0 : 1;
|
IsOnSukebei = params.sukebei ? 0 : 1;
|
||||||
|
|
||||||
for(var KeywordIndex = 0; KeywordIndex < Keywords_categories[IsOnSukebei][0].length; KeywordIndex++)
|
for (var KeywordIndex = 0; KeywordIndex < Keywords_categories[IsOnSukebei][0].length; KeywordIndex++)
|
||||||
if(torrentLowerCaseName.includes(Keywords_categories[IsOnSukebei][0][KeywordIndex])) {
|
if (torrentLowerCaseName.includes(Keywords_categories[IsOnSukebei][0][KeywordIndex])) {
|
||||||
document.getElementsByClassName('form-torrent-category')[0].selectedIndex = Keywords_categories[IsOnSukebei][1][KeywordIndex];
|
document.getElementsByClassName('form-torrent-category')[0].selectedIndex = Keywords_categories[IsOnSukebei][1][KeywordIndex];
|
||||||
this.setCategory(document.getElementsByClassName('form-torrent-category')[0].selectedIndex)
|
this.setCategory(document.getElementsByClassName('form-torrent-category')[0].selectedIndex)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Helper to prevent the functions on keyup/keydown to slow the user typing
|
// Helper to prevent the functions on keyup/keydown to slow the user typing
|
||||||
this.debounce = function (func, wait, immediate) {
|
this.debounce = function (func, wait, immediate) {
|
||||||
var timeout
|
var timeout
|
||||||
return function() {
|
return function () {
|
||||||
var context = this, args = arguments
|
var context = this,
|
||||||
var later = function() {
|
args = arguments
|
||||||
|
var later = function () {
|
||||||
timeout = null
|
timeout = null
|
||||||
if (!immediate) func.apply(context, args)
|
if (!immediate) func.apply(context, args)
|
||||||
}
|
}
|
||||||
|
@ -176,7 +183,7 @@ var Kilo = function (params) {
|
||||||
var updatePreviewTorrentName = function (e) {
|
var updatePreviewTorrentName = function (e) {
|
||||||
var el = e.target
|
var el = e.target
|
||||||
self.setName(el.value)
|
self.setName(el.value)
|
||||||
self.debounce(function(value) {
|
self.debounce(function (value) {
|
||||||
self.addKeywordFlags(value)
|
self.addKeywordFlags(value)
|
||||||
self.addKeywordCategories(value)
|
self.addKeywordCategories(value)
|
||||||
}, 300)(el.value)
|
}, 300)(el.value)
|
||||||
|
|
|
@ -2,15 +2,15 @@
|
||||||
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
function loadLanguages() {
|
function loadLanguages() {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function () {
|
||||||
if (xhr.readyState == 4 && xhr.status == 199) {
|
if (xhr.readyState == 4 && xhr.status == 199) {
|
||||||
var selector = document.getElementById("bottom_language_selector");
|
var selector = document.getElementById("bottom_language_selector");
|
||||||
selector.hidden = false
|
selector.hidden = false
|
||||||
/* Response format is
|
/* Response format is
|
||||||
* { "current": "(user current language)",
|
* { "current": "(user current language)",
|
||||||
* "languages": {
|
* "languages": {
|
||||||
* "(language_code)": "(language_name"),
|
* "(language_code)": "(language_name"),
|
||||||
* }} */
|
* }} */
|
||||||
var response = JSON.parse(xhr.responseText);
|
var response = JSON.parse(xhr.responseText);
|
||||||
for (var language in response.languages) {
|
for (var language in response.languages) {
|
||||||
if (!response.languages.hasOwnProperty(language)) continue;
|
if (!response.languages.hasOwnProperty(language)) continue;
|
||||||
|
|
|
@ -59,33 +59,33 @@ parseAllDates()
|
||||||
{
|
{
|
||||||
//Get current lang, mascot & theme cookies
|
//Get current lang, mascot & theme cookies
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//Remove all cookies:
|
//Remove all cookies:
|
||||||
var cookies = document.cookie.split(";");
|
var cookies = document.cookie.split(";");
|
||||||
var excludedCookies = ["mascot", "theme", "mascot_url", "lang"];
|
var excludedCookies = ["mascot", "theme", "mascot_url", "lang"];
|
||||||
|
|
||||||
for (var i = 0; i < cookies.length; i++) {
|
for (var i = 0; i < cookies.length; i++) {
|
||||||
var cookieName = (cookies[i].split("=")[0]).trim();
|
var cookieName = (cookies[i].split("=")[0]).trim();
|
||||||
//Remove spaces because some cookie names have it
|
//Remove spaces because some cookie names have it
|
||||||
if(excludedCookies.includes(cookieName)) continue;
|
if(excludedCookies.includes(cookieName)) continue;
|
||||||
document.cookie = cookieName + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
|
document.cookie = cookieName + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set new version in cookie
|
//Set new version in cookie
|
||||||
document.cookie = "version=" + Version;
|
document.cookie = "version=" + Version;
|
||||||
|
|
||||||
//Apply back lang, mascot & theme cookie
|
//Apply back lang, mascot & theme cookie
|
||||||
//TODO
|
//TODO
|
||||||
|
|
||||||
//Add fancy "new" text at bottom of page
|
//Add fancy "new" text at bottom of page
|
||||||
document.getElementById("commit").className = "new";
|
document.getElementById("commit").className = "new";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*Fixed-Navbar offset fix*/
|
/*Fixed-Navbar offset fix*/
|
||||||
if(document.getElementsByClassName("search-box")[0] !== undefined)
|
if(document.getElementsByClassName("search-box")[0] !== undefined)
|
||||||
startupCode()
|
startupCode()
|
||||||
else
|
else
|
||||||
document.addEventListener("DOMContentLoaded", function(event) { startupCode() })
|
document.addEventListener("DOMContentLoaded", function(event) { startupCode() })
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,17 +10,17 @@ var Modal = {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var nbEl = elements.length
|
var nbEl = elements.length
|
||||||
for (var i=0; i < nbEl; i++) {
|
for (var i = 0; i < nbEl; i++) {
|
||||||
var modal = elements[i];
|
var modal = elements[i];
|
||||||
this.addModal(modal, button, i, params.before, params.after, params.close)
|
this.addModal(modal, button, i, params.before, params.after, params.close)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addModal: function(modal, btn, i, before_callback, after_callback, close_callback) {
|
addModal: function (modal, btn, i, before_callback, after_callback, close_callback) {
|
||||||
var isBtnArray = false;
|
var isBtnArray = false;
|
||||||
// Get the button that opens the modal
|
// Get the button that opens the modal
|
||||||
if (!btn) {
|
if (!btn) {
|
||||||
btn = document.getElementById("modal_btn_"+modal.id)
|
btn = document.getElementById("modal_btn_" + modal.id)
|
||||||
} else if (btn.match(/^#/)) {
|
} else if (btn.match(/^#/)) {
|
||||||
btn = document.getElementById(btn.substr(1));
|
btn = document.getElementById(btn.substr(1));
|
||||||
} else if (btn.match(/^\./)) {
|
} else if (btn.match(/^\./)) {
|
||||||
|
@ -31,7 +31,7 @@ var Modal = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if ((isBtnArray) && (i > 0) && (btn.length > 0) && (btn.length > i)) {
|
if ((isBtnArray) && (i > 0) && (btn.length > 0) && (btn.length > i)) {
|
||||||
btn[i].addEventListener("click", function(e) {
|
btn[i].addEventListener("click", function (e) {
|
||||||
if (before_callback != undefined) before_callback()
|
if (before_callback != undefined) before_callback()
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
Modal.active = modal;
|
Modal.active = modal;
|
||||||
|
@ -41,7 +41,7 @@ var Modal = {
|
||||||
} else {
|
} else {
|
||||||
btn = (isBtnArray) ? btn[0] : btn;
|
btn = (isBtnArray) ? btn[0] : btn;
|
||||||
// When the user clicks on the button, open the modal
|
// When the user clicks on the button, open the modal
|
||||||
btn.addEventListener("click", function(e) {
|
btn.addEventListener("click", function (e) {
|
||||||
if (before_callback != undefined) before_callback()
|
if (before_callback != undefined) before_callback()
|
||||||
modal.style.display = "block";
|
modal.style.display = "block";
|
||||||
Modal.active = modal;
|
Modal.active = modal;
|
||||||
|
@ -50,16 +50,16 @@ var Modal = {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Get the <span> element that closes the modal
|
// Get the <span> element that closes the modal
|
||||||
var span = document.querySelectorAll("#"+modal.id+" .close")[0]
|
var span = document.querySelectorAll("#" + modal.id + " .close")[0]
|
||||||
// When the user clicks on <span> (x), close the modal
|
// When the user clicks on <span> (x), close the modal
|
||||||
span.addEventListener("click", function(e) {
|
span.addEventListener("click", function (e) {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
Modal.active = 0;
|
Modal.active = 0;
|
||||||
if (close_callback != undefined) close_callback()
|
if (close_callback != undefined) close_callback()
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
// When the user clicks anywhere outside of the modal, close it
|
// When the user clicks anywhere outside of the modal, close it
|
||||||
window.addEventListener("click", function(event) {
|
window.addEventListener("click", function (event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
Modal.active = 0;
|
Modal.active = 0;
|
||||||
|
@ -67,19 +67,19 @@ var Modal = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
CloseActive: function() {
|
CloseActive: function () {
|
||||||
if (this.active != 0) {
|
if (this.active != 0) {
|
||||||
this.active.style.display= "none";
|
this.active.style.display = "none";
|
||||||
this.active = 0;
|
this.active = 0;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GetActive: function() {
|
GetActive: function () {
|
||||||
return this.active;
|
return this.active;
|
||||||
},
|
},
|
||||||
Open: function(q) {
|
Open: function (q) {
|
||||||
var modal = document.querySelector(q);
|
var modal = document.querySelector(q);
|
||||||
if (modal != undefined) {
|
if (modal != undefined) {
|
||||||
modal.style.display= "none";
|
modal.style.display = "none";
|
||||||
this.active = modal;
|
this.active = modal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
|
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
|
||||||
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
var Query = {
|
var Query = {
|
||||||
Failed:0,
|
Failed: 0,
|
||||||
MaxFail: 10,
|
MaxFail: 10,
|
||||||
Get: function(url, renderer, callback) {
|
Get: function (url, renderer, callback) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('GET', url, true);
|
xhr.open('GET', url, true);
|
||||||
xhr.responseType = 'json';
|
xhr.responseType = 'json';
|
||||||
xhr.onload = function(e) {
|
xhr.onload = function (e) {
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
Query.Failed = 0;
|
Query.Failed = 0;
|
||||||
renderer(this.response);
|
renderer(this.response);
|
||||||
|
@ -15,26 +15,26 @@ var Query = {
|
||||||
} else {
|
} else {
|
||||||
console.log("Error when refresh")
|
console.log("Error when refresh")
|
||||||
Query.Failed++;
|
Query.Failed++;
|
||||||
console.log("Attempt to refresh "+Query.Failed+"...");
|
console.log("Attempt to refresh " + Query.Failed + "...");
|
||||||
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Get(url, renderer, callback);
|
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Get(url, renderer, callback);
|
||||||
else console.error("Too many attempts, stopping...")
|
else console.error("Too many attempts, stopping...")
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
xhr.send();
|
xhr.send();
|
||||||
},
|
},
|
||||||
Post: function(url, postArgs, callback) {
|
Post: function (url, postArgs, callback) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open('POST', url, true);
|
xhr.open('POST', url, true);
|
||||||
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||||
xhr.responseType = 'json';
|
xhr.responseType = 'json';
|
||||||
xhr.onload = function(e) {
|
xhr.onload = function (e) {
|
||||||
if (this.status == 200) {
|
if (this.status == 200) {
|
||||||
Query.Failed = 0;
|
Query.Failed = 0;
|
||||||
if (callback != undefined) callback(this.response);
|
if (callback != undefined) callback(this.response);
|
||||||
} else {
|
} else {
|
||||||
console.log("Error when refresh")
|
console.log("Error when refresh")
|
||||||
Query.Failed++;
|
Query.Failed++;
|
||||||
console.log("Attempt to refresh "+Query.Failed+"...");
|
console.log("Attempt to refresh " + Query.Failed + "...");
|
||||||
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Post(url, postArgs, callback);
|
if ((Query.MaxFail == -1) || (Query.Failed < Query.MaxFail)) Query.Post(url, postArgs, callback);
|
||||||
else console.error("Too many attempts, stopping...")
|
else console.error("Too many attempts, stopping...")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
|
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
|
||||||
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
document.querySelector("[data-selectall='checkbox']").addEventListener("change", function(e) {
|
document.querySelector("[data-selectall='checkbox']").addEventListener("change", function (e) {
|
||||||
var cbs = document.querySelectorAll("input[type='checkbox'].selectable");
|
var cbs = document.querySelectorAll("input[type='checkbox'].selectable");
|
||||||
var l = cbs.length;
|
var l = cbs.length;
|
||||||
for (var i=0; i<l; i++) cbs[i].checked = e.target.checked;
|
for (var i = 0; i < l; i++) cbs[i].checked = e.target.checked;
|
||||||
});
|
});
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
// Templates variable
|
// Templates variable
|
||||||
var Templates = {
|
var Templates = {
|
||||||
tmpl: [],
|
tmpl: [],
|
||||||
Add: function(templateName, template) {
|
Add: function (templateName, template) {
|
||||||
this.tmpl[templateName] = template
|
this.tmpl[templateName] = template
|
||||||
},
|
},
|
||||||
Render: function(templateName, model) {
|
Render: function (templateName, model) {
|
||||||
if (this.tmpl[templateName] === undefined) {
|
if (this.tmpl[templateName] === undefined) {
|
||||||
console.log("The template with name '%s' doesn't exist", templateName)
|
console.log("The template with name '%s' doesn't exist", templateName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return this.tmpl[templateName](model)
|
return this.tmpl[templateName](model)
|
||||||
},
|
},
|
||||||
ApplyItemListRenderer: function(params) {
|
ApplyItemListRenderer: function (params) {
|
||||||
return function(models) {
|
return function (models) {
|
||||||
for (var i=models.length-1; i >= 0; i--) {
|
for (var i = models.length - 1; i >= 0; i--) {
|
||||||
var object = Templates.Render(params.templateName, models[i]);
|
var object = Templates.Render(params.templateName, models[i]);
|
||||||
if (params.method == "append") {
|
if (params.method == "append") {
|
||||||
params.element.innerHTML = params.element.innerHTML + object
|
params.element.innerHTML = params.element.innerHTML + object
|
||||||
|
@ -25,21 +25,21 @@ var Templates = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
EncodeEntities: function(value) {
|
EncodeEntities: function (value) {
|
||||||
return value.
|
return value.
|
||||||
replace(/&/g, '&').
|
replace(/&/g, '&').
|
||||||
replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, function(value) {
|
replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, function (value) {
|
||||||
var hi = value.charCodeAt(0);
|
var hi = value.charCodeAt(0);
|
||||||
var low = value.charCodeAt(1);
|
var low = value.charCodeAt(1);
|
||||||
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
|
||||||
}).
|
}).
|
||||||
replace(/([^\#-~| |!])/g, function(value) {
|
replace(/([^\#-~| |!])/g, function (value) {
|
||||||
return '&#' + value.charCodeAt(0) + ';';
|
return '&#' + value.charCodeAt(0) + ';';
|
||||||
}).
|
}).
|
||||||
replace(/</g, '<').
|
replace(/</g, '<').
|
||||||
replace(/>/g, '>');
|
replace(/>/g, '>');
|
||||||
},
|
},
|
||||||
FlagCode: function(language) {
|
FlagCode: function (language) {
|
||||||
var split = language.split("-")
|
var split = language.split("-")
|
||||||
if (split.length > 1) {
|
if (split.length > 1) {
|
||||||
return split[1]
|
return split[1]
|
||||||
|
|
|
@ -7,38 +7,42 @@ var Torrents = {
|
||||||
SearchURL: "/api/search",
|
SearchURL: "/api/search",
|
||||||
Method: "prepend",
|
Method: "prepend",
|
||||||
LastID: 0,
|
LastID: 0,
|
||||||
StopRefresh: function() {
|
StopRefresh: function () {
|
||||||
clearTimeout(this.timeout)
|
clearTimeout(this.timeout)
|
||||||
this.timeout = undefined
|
this.timeout = undefined
|
||||||
this.CanRefresh = false
|
this.CanRefresh = false
|
||||||
},
|
},
|
||||||
Refresh: function() {
|
Refresh: function () {
|
||||||
if (this.CanRefresh) {
|
if (this.CanRefresh) {
|
||||||
this.timeout = setTimeout(function() {
|
this.timeout = setTimeout(function () {
|
||||||
var searchArgs = (window.location.search != "") ? window.location.search.substr(1) : ""
|
var searchArgs = (window.location.search != "") ? window.location.search.substr(1) : ""
|
||||||
searchArgs = (Torrents.LastID > 0) ? "?fromID="+Torrents.LastID+"&"+searchArgs : "?"+searchArgs
|
searchArgs = (Torrents.LastID > 0) ? "?fromID=" + Torrents.LastID + "&" + searchArgs : "?" + searchArgs
|
||||||
Query.Get(Torrents.SearchURL+searchArgs,
|
Query.Get(Torrents.SearchURL + searchArgs,
|
||||||
function(data) {
|
function (data) {
|
||||||
var torrents = data.torrents
|
var torrents = data.torrents
|
||||||
Templates.ApplyItemListRenderer({
|
Templates.ApplyItemListRenderer({
|
||||||
templateName: "torrents.item", method: "prepend", element: document.getElementById("torrentListResults")
|
templateName: "torrents.item",
|
||||||
|
method: "prepend",
|
||||||
|
element: document.getElementById("torrentListResults")
|
||||||
})(torrents)
|
})(torrents)
|
||||||
for (var i =0; i < torrents.length; i++) { if (Torrents.LastID < torrents[i].id) Torrents.LastID = torrents[i].id; }
|
for (var i = 0; i < torrents.length; i++) {
|
||||||
|
if (Torrents.LastID < torrents[i].id) Torrents.LastID = torrents[i].id;
|
||||||
|
}
|
||||||
parseAllDates()
|
parseAllDates()
|
||||||
Torrents.Refresh()
|
Torrents.Refresh()
|
||||||
});
|
});
|
||||||
}, this.Seconds*1000);
|
}, this.Seconds * 1000);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
StartRefresh: function() {
|
StartRefresh: function () {
|
||||||
this.CanRefresh = true
|
this.CanRefresh = true
|
||||||
this.Refresh()
|
this.Refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() { // if Torrents.CanRefresh is enabled, refresh is automatically done (no need to start it anually)
|
document.addEventListener("DOMContentLoaded", function () { // if Torrents.CanRefresh is enabled, refresh is automatically done (no need to start it anually)
|
||||||
if (Torrents.CanRefresh) {
|
if (Torrents.CanRefresh) {
|
||||||
Torrents.StartRefresh()
|
Torrents.StartRefresh()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
|
@ -16,20 +16,20 @@ var TorrentsMod = {
|
||||||
// Internal variables used for processing the request
|
// Internal variables used for processing the request
|
||||||
selected: [],
|
selected: [],
|
||||||
queued: [],
|
queued: [],
|
||||||
unique_id:1,
|
unique_id: 1,
|
||||||
error_count:0,
|
error_count: 0,
|
||||||
progress_count: 0,
|
progress_count: 0,
|
||||||
progress_max: 0,
|
progress_max: 0,
|
||||||
pause: false,
|
pause: false,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|
||||||
// Init method
|
// Init method
|
||||||
Create: function() {
|
Create: function () {
|
||||||
var sh_btn = document.getElementById(TorrentsMod.show_hide_button);
|
var sh_btn = document.getElementById(TorrentsMod.show_hide_button);
|
||||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||||
btn_submit[0].disabled = true;
|
btn_submit[0].disabled = true;
|
||||||
for (var i=0; i < btn_actions.length; i++) {
|
for (var i = 0; i < btn_actions.length; i++) {
|
||||||
btn_actions[i].disabled = true;
|
btn_actions[i].disabled = true;
|
||||||
switch (btn_actions[i].id) {
|
switch (btn_actions[i].id) {
|
||||||
case this.delete_btn:
|
case this.delete_btn:
|
||||||
|
@ -45,22 +45,22 @@ var TorrentsMod = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (var i=0; i < this.checkboxes.length; i++) {
|
for (var i = 0; i < this.checkboxes.length; i++) {
|
||||||
var checkbox = this.checkboxes[i];
|
var checkbox = this.checkboxes[i];
|
||||||
checkbox.addEventListener("change", this.checkboxEventHandler)
|
checkbox.addEventListener("change", this.checkboxEventHandler)
|
||||||
}
|
}
|
||||||
sh_btn.addEventListener("click", function(e) {
|
sh_btn.addEventListener("click", function (e) {
|
||||||
var divActions = this.nextElementSibling;
|
var divActions = this.nextElementSibling;
|
||||||
if (divActions.style.display == "inline") {
|
if (divActions.style.display == "inline") {
|
||||||
TorrentsMod.enabled = false;
|
TorrentsMod.enabled = false;
|
||||||
document.getElementsByClassName("results box mod-open")[0].className = "results box";
|
document.getElementsByClassName("results box mod-open")[0].className = "results box";
|
||||||
} else {
|
} else {
|
||||||
TorrentsMod.enabled = true;
|
TorrentsMod.enabled = true;
|
||||||
document.getElementsByClassName("results box")[0].className = "results box mod-open";
|
document.getElementsByClassName("results box")[0].className = "results box mod-open";
|
||||||
}
|
}
|
||||||
divActions.style.display = (TorrentsMod.enabled) ? "inline" : "none";
|
divActions.style.display = (TorrentsMod.enabled) ? "inline" : "none";
|
||||||
var td_cbs = document.getElementsByClassName("tr-cb")
|
var td_cbs = document.getElementsByClassName("tr-cb")
|
||||||
for (var i=0; i < td_cbs.length; i++) {
|
for (var i = 0; i < td_cbs.length; i++) {
|
||||||
td_cb = td_cbs[i];
|
td_cb = td_cbs[i];
|
||||||
td_cb.style.display = (TorrentsMod.enabled) ? "table-cell" : "none";
|
td_cb.style.display = (TorrentsMod.enabled) ? "table-cell" : "none";
|
||||||
}
|
}
|
||||||
|
@ -70,99 +70,102 @@ var TorrentsMod = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// generate a unique id for a query
|
// generate a unique id for a query
|
||||||
getId: function(){
|
getId: function () {
|
||||||
return this.unique_id++;
|
return this.unique_id++;
|
||||||
},
|
},
|
||||||
|
|
||||||
// UI Methods
|
// UI Methods
|
||||||
selectAll: function(bool) {
|
selectAll: function (bool) {
|
||||||
var l = TorrentsMod.checkboxes.length;
|
var l = TorrentsMod.checkboxes.length;
|
||||||
for (var i = 0; i < l; i++) {
|
for (var i = 0; i < l; i++) {
|
||||||
TorrentsMod.checkboxes[i].checked = bool;
|
TorrentsMod.checkboxes[i].checked = bool;
|
||||||
TorrentsMod.checkboxEventHandlerFunc(TorrentsMod.checkboxes[i]);
|
TorrentsMod.checkboxEventHandlerFunc(TorrentsMod.checkboxes[i]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
disableBtnActions: function() {
|
disableBtnActions: function () {
|
||||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||||
for (var i=0; i < btn_actions.length; i++) {
|
for (var i = 0; i < btn_actions.length; i++) {
|
||||||
btn_actions[i].disabled = true;
|
btn_actions[i].disabled = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableBtnActions: function() {
|
enableBtnActions: function () {
|
||||||
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
var btn_actions = document.getElementsByClassName(this.btn_class_action)
|
||||||
for (var i=0; i < btn_actions.length; i++) {
|
for (var i = 0; i < btn_actions.length; i++) {
|
||||||
btn_actions[i].disabled = false;
|
btn_actions[i].disabled = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enableBtnSubmit: function() {
|
enableBtnSubmit: function () {
|
||||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||||
btn_submit[0].disabled = false;
|
btn_submit[0].disabled = false;
|
||||||
},
|
},
|
||||||
enableApplyChangesBtn: function() {
|
enableApplyChangesBtn: function () {
|
||||||
var btn_apply_changes = document.getElementById("confirm_changes");
|
var btn_apply_changes = document.getElementById("confirm_changes");
|
||||||
btn_apply_changes.disabled=false;
|
btn_apply_changes.disabled = false;
|
||||||
},
|
},
|
||||||
disableBtnSubmit: function() {
|
disableBtnSubmit: function () {
|
||||||
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
|
||||||
btn_submit[0].disabled = true;
|
btn_submit[0].disabled = true;
|
||||||
},
|
},
|
||||||
disableApplyChangesBtn: function() {
|
disableApplyChangesBtn: function () {
|
||||||
var btn_apply_changes = document.getElementById("confirm_changes");
|
var btn_apply_changes = document.getElementById("confirm_changes");
|
||||||
btn_apply_changes.disabled=true;
|
btn_apply_changes.disabled = true;
|
||||||
},
|
},
|
||||||
removeDivFromList: function(i) {
|
removeDivFromList: function (i) {
|
||||||
var queueAction = this.queued[i];
|
var queueAction = this.queued[i];
|
||||||
var parentDiv = document.getElementById(queueAction.unique_id).parentNode;
|
var parentDiv = document.getElementById(queueAction.unique_id).parentNode;
|
||||||
parentDiv.removeChild(document.getElementById(queueAction.unique_id));
|
parentDiv.removeChild(document.getElementById(queueAction.unique_id));
|
||||||
},
|
},
|
||||||
removeFromParent: function(el) {
|
removeFromParent: function (el) {
|
||||||
var parentDiv = el.parentNode;
|
var parentDiv = el.parentNode;
|
||||||
parentDiv.removeChild(el);
|
parentDiv.removeChild(el);
|
||||||
},
|
},
|
||||||
generatingModal: function() {
|
generatingModal: function () {
|
||||||
var listLength = this.queued.length;
|
var listLength = this.queued.length;
|
||||||
var div = {"edit": "", "delete": ""};
|
var div = {
|
||||||
for (var i=0; i < listLength; i++) {
|
"edit": "",
|
||||||
|
"delete": ""
|
||||||
|
};
|
||||||
|
for (var i = 0; i < listLength; i++) {
|
||||||
var listHTML = "";
|
var listHTML = "";
|
||||||
for(key in this.queued[i].selection) {
|
for (key in this.queued[i].selection) {
|
||||||
var selection = this.queued[i].selection[key];
|
var selection = this.queued[i].selection[key];
|
||||||
selection.key = i;
|
selection.key = i;
|
||||||
listHTML += Templates.Render("torrents."+this.queued[i].action+".item", selection);
|
listHTML += Templates.Render("torrents." + this.queued[i].action + ".item", selection);
|
||||||
}
|
}
|
||||||
this.queued[i].list = listHTML;
|
this.queued[i].list = listHTML;
|
||||||
this.queued[i].key = i;
|
this.queued[i].key = i;
|
||||||
div[this.queued[i].action] += Templates.Render("torrents."+this.queued[i].action+".block", this.queued[i]);
|
div[this.queued[i].action] += Templates.Render("torrents." + this.queued[i].action + ".block", this.queued[i]);
|
||||||
}
|
}
|
||||||
this.progress_count = 0;
|
this.progress_count = 0;
|
||||||
this.progress_max = listLength;
|
this.progress_max = listLength;
|
||||||
document.querySelector(".modal .edit_changes").innerHTML = div["edit"];
|
document.querySelector(".modal .edit_changes").innerHTML = div["edit"];
|
||||||
document.querySelector(".modal .delete_changes").innerHTML = div["delete"];
|
document.querySelector(".modal .delete_changes").innerHTML = div["delete"];
|
||||||
},
|
},
|
||||||
toggleList: function(el) {
|
toggleList: function (el) {
|
||||||
el.parentNode.nextSibling.style.display = (el.parentNode.nextSibling.style.display != "block") ? "block" : "none"
|
el.parentNode.nextSibling.style.display = (el.parentNode.nextSibling.style.display != "block") ? "block" : "none"
|
||||||
},
|
},
|
||||||
addToLog: function(type, msg) {
|
addToLog: function (type, msg) {
|
||||||
var logDiv = document.querySelector(".modal .logs_mess");
|
var logDiv = document.querySelector(".modal .logs_mess");
|
||||||
if (logDiv.style.display == "none") logDiv.style.display = "block"
|
if (logDiv.style.display == "none") logDiv.style.display = "block"
|
||||||
logDiv.innerHTML += Templates.Render("torrents.logs."+type, msg);
|
logDiv.innerHTML += Templates.Render("torrents.logs." + type, msg);
|
||||||
},
|
},
|
||||||
updateProgressBar: function() {
|
updateProgressBar: function () {
|
||||||
document.querySelector("#"+this.progress_bar_id).style.display = "block";
|
document.querySelector("#" + this.progress_bar_id).style.display = "block";
|
||||||
var progress_green = document.querySelector("#"+this.progress_bar_id+" .progress-green");
|
var progress_green = document.querySelector("#" + this.progress_bar_id + " .progress-green");
|
||||||
var perc = this.progress_count/this.progress_max*100;
|
var perc = this.progress_count / this.progress_max * 100;
|
||||||
progress_green.style.width=perc+"%";
|
progress_green.style.width = perc + "%";
|
||||||
progress_green.innerText = this.progress_count+"/"+this.progress_max;
|
progress_green.innerText = this.progress_count + "/" + this.progress_max;
|
||||||
},
|
},
|
||||||
resetModal: function() {
|
resetModal: function () {
|
||||||
var logDiv = document.querySelector(".modal .logs_mess");
|
var logDiv = document.querySelector(".modal .logs_mess");
|
||||||
logDiv.style.display = "none";
|
logDiv.style.display = "none";
|
||||||
document.querySelector("#"+this.progress_bar_id).style.display = "none";
|
document.querySelector("#" + this.progress_bar_id).style.display = "none";
|
||||||
logDiv.innerHTML = "";
|
logDiv.innerHTML = "";
|
||||||
document.querySelector(".modal .edit_changes").innerHTML = "";
|
document.querySelector(".modal .edit_changes").innerHTML = "";
|
||||||
document.querySelector(".modal .delete_changes").innerHTML = "";
|
document.querySelector(".modal .delete_changes").innerHTML = "";
|
||||||
this.enableApplyChangesBtn();
|
this.enableApplyChangesBtn();
|
||||||
},
|
},
|
||||||
statusToClassName: function(status) {
|
statusToClassName: function (status) {
|
||||||
var className = ["", "normal", "remake", "trusted", "aplus", ""]
|
var className = ["", "normal", "remake", "trusted", "aplus", ""]
|
||||||
return className[status];
|
return className[status];
|
||||||
},
|
},
|
||||||
|
@ -171,7 +174,7 @@ var TorrentsMod = {
|
||||||
addToSelection: function (torrent) {
|
addToSelection: function (torrent) {
|
||||||
this.selected[torrent.id] = torrent;
|
this.selected[torrent.id] = torrent;
|
||||||
},
|
},
|
||||||
removeFromSelection: function(torrent) {
|
removeFromSelection: function (torrent) {
|
||||||
delete this.selected[torrent.id];
|
delete this.selected[torrent.id];
|
||||||
for (var t in this.selected) {
|
for (var t in this.selected) {
|
||||||
return
|
return
|
||||||
|
@ -180,45 +183,45 @@ var TorrentsMod = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Query Queue Management Methods
|
// Query Queue Management Methods
|
||||||
AddToQueue: function(QueueAction) {
|
AddToQueue: function (QueueAction) {
|
||||||
QueueAction.unique_id = this.getId(); // used for DOM interaction
|
QueueAction.unique_id = this.getId(); // used for DOM interaction
|
||||||
this.queued.push(QueueAction);
|
this.queued.push(QueueAction);
|
||||||
this.enableBtnSubmit()
|
this.enableBtnSubmit()
|
||||||
},
|
},
|
||||||
RemoveFromQueueAfterItems: function(i) {
|
RemoveFromQueueAfterItems: function (i) {
|
||||||
for (t in this.queued[i].selection) {
|
for (t in this.queued[i].selection) {
|
||||||
this.RemoveItemFromQueue(i, t);
|
this.RemoveItemFromQueue(i, t);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
RemoveFromQueue: function(i) {
|
RemoveFromQueue: function (i) {
|
||||||
this.progress_max = (this.progress_max - 1 >= 0) ? this.progress_max-1 : 0;
|
this.progress_max = (this.progress_max - 1 >= 0) ? this.progress_max - 1 : 0;
|
||||||
this.RemoveFromQueueAction(i)
|
this.RemoveFromQueueAction(i)
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
RemoveFromQueueAction: function(i) {
|
RemoveFromQueueAction: function (i) {
|
||||||
this.removeFromParent(document.getElementById("list_"+this.queued[i].unique_id));
|
this.removeFromParent(document.getElementById("list_" + this.queued[i].unique_id));
|
||||||
this.queued.splice(i, 1);
|
this.queued.splice(i, 1);
|
||||||
if (this.queued.length == 0) {
|
if (this.queued.length == 0) {
|
||||||
this.disableBtnSubmit();
|
this.disableBtnSubmit();
|
||||||
if (this.progress_max>0) {
|
if (this.progress_max > 0) {
|
||||||
this.disableApplyChangesBtn();
|
this.disableApplyChangesBtn();
|
||||||
} else {
|
} else {
|
||||||
Modal.CloseActive();
|
Modal.CloseActive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
formatSelectionToQuery: function(selection) {
|
formatSelectionToQuery: function (selection) {
|
||||||
var format = "";
|
var format = "";
|
||||||
for (var s in selection) {
|
for (var s in selection) {
|
||||||
format += "&torrent_id="+selection[s].id
|
format += "&torrent_id=" + selection[s].id
|
||||||
}
|
}
|
||||||
return (format != "") ? format.substr(1) : ""
|
return (format != "") ? format.substr(1) : ""
|
||||||
},
|
},
|
||||||
RemoveItemFromQueue: function(i, id) {
|
RemoveItemFromQueue: function (i, id) {
|
||||||
this.removeFromParent(document.getElementById("list_item_"+id));
|
this.removeFromParent(document.getElementById("list_item_" + id));
|
||||||
delete this.queued[i].selection[id];
|
delete this.queued[i].selection[id];
|
||||||
document.getElementById("torrent_cb_"+id).checked=false;
|
document.getElementById("torrent_cb_" + id).checked = false;
|
||||||
document.getElementById("torrent_"+id).style.display="";
|
document.getElementById("torrent_" + id).style.display = "";
|
||||||
var test = 0;
|
var test = 0;
|
||||||
for (t in this.queued[i].selection) {
|
for (t in this.queued[i].selection) {
|
||||||
test++
|
test++
|
||||||
|
@ -227,9 +230,9 @@ var TorrentsMod = {
|
||||||
if (test == 0) this.RemoveFromQueue(i);
|
if (test == 0) this.RemoveFromQueue(i);
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
newQueryAttempt: function(queryUrl, queryPost, callback) {
|
newQueryAttempt: function (queryUrl, queryPost, callback) {
|
||||||
Query.Post(queryUrl, queryPost, function (response) {
|
Query.Post(queryUrl, queryPost, function (response) {
|
||||||
if ((response.length == 0)||(!response.ok)) { // Query has failed
|
if ((response.length == 0) || (!response.ok)) { // Query has failed
|
||||||
var errorMsg = response.errors.join("<br>");
|
var errorMsg = response.errors.join("<br>");
|
||||||
TorrentsMod.addToLog("error", errorMsg);
|
TorrentsMod.addToLog("error", errorMsg);
|
||||||
TorrentsMod.error_count++;
|
TorrentsMod.error_count++;
|
||||||
|
@ -250,7 +253,7 @@ var TorrentsMod = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
QueryQueue: function(i, callback) {
|
QueryQueue: function (i, callback) {
|
||||||
if (this.queued.length > 0) {
|
if (this.queued.length > 0) {
|
||||||
var QueueAction = this.queued[i]; // we clone it so we can delete it safely
|
var QueueAction = this.queued[i]; // we clone it so we can delete it safely
|
||||||
this.RemoveFromQueueAction(i);
|
this.RemoveFromQueueAction(i);
|
||||||
|
@ -258,29 +261,29 @@ var TorrentsMod = {
|
||||||
var queryUrl = "/mod/api/torrents";
|
var queryUrl = "/mod/api/torrents";
|
||||||
QueueAction.queryPost = TorrentsMod.formatSelectionToQuery(QueueAction.selection)
|
QueueAction.queryPost = TorrentsMod.formatSelectionToQuery(QueueAction.selection)
|
||||||
if (QueueAction.action == "delete") {
|
if (QueueAction.action == "delete") {
|
||||||
queryPost="action="+QueueAction.action;
|
queryPost = "action=" + QueueAction.action;
|
||||||
queryPost+="&withreport="+QueueAction.withReport;
|
queryPost += "&withreport=" + QueueAction.withReport;
|
||||||
queryPost += "&status="+((QueueAction.status != undefined) ? QueueAction.status : "");
|
queryPost += "&status=" + ((QueueAction.status != undefined) ? QueueAction.status : "");
|
||||||
queryPost += "&"+QueueAction.queryPost; // we add torrent id
|
queryPost += "&" + QueueAction.queryPost; // we add torrent id
|
||||||
} else if (QueueAction.action == "edit") {
|
} else if (QueueAction.action == "edit") {
|
||||||
queryPost="action=multiple";
|
queryPost = "action=multiple";
|
||||||
queryPost += "&status="+QueueAction.status;
|
queryPost += "&status=" + QueueAction.status;
|
||||||
queryPost += "&owner="+QueueAction.owner;
|
queryPost += "&owner=" + QueueAction.owner;
|
||||||
queryPost += "&category="+QueueAction.category;
|
queryPost += "&category=" + QueueAction.category;
|
||||||
queryPost += "&"+QueueAction.queryPost; // we add torrent id
|
queryPost += "&" + QueueAction.queryPost; // we add torrent id
|
||||||
}
|
}
|
||||||
TorrentsMod.newQueryAttempt(queryUrl, queryPost, callback)
|
TorrentsMod.newQueryAttempt(queryUrl, queryPost, callback)
|
||||||
} else {
|
} else {
|
||||||
TorrentsMod.addToLog("success", T.r("all_operations_done"))
|
TorrentsMod.addToLog("success", T.r("all_operations_done"))
|
||||||
if (TorrentsMod.refreshTimeout > 0) {
|
if (TorrentsMod.refreshTimeout > 0) {
|
||||||
TorrentsMod.addToLog("success", T.r("refreshing_in", TorrentsMod.refreshTimeout/1000))
|
TorrentsMod.addToLog("success", T.r("refreshing_in", TorrentsMod.refreshTimeout / 1000))
|
||||||
setTimeout(function(){
|
setTimeout(function () {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}, TorrentsMod.refreshTimeout);
|
}, TorrentsMod.refreshTimeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
QueryLoop: function() {
|
QueryLoop: function () {
|
||||||
if (TorrentsMod.progress_count <= TorrentsMod.progress_max) {
|
if (TorrentsMod.progress_count <= TorrentsMod.progress_max) {
|
||||||
TorrentsMod.updateProgressBar()
|
TorrentsMod.updateProgressBar()
|
||||||
TorrentsMod.progress_count++;
|
TorrentsMod.progress_count++;
|
||||||
|
@ -290,53 +293,62 @@ var TorrentsMod = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Event Handlers
|
// Event Handlers
|
||||||
checkboxEventHandler: function(e) {
|
checkboxEventHandler: function (e) {
|
||||||
var el = e.target;
|
var el = e.target;
|
||||||
TorrentsMod.checkboxEventHandlerFunc(el);
|
TorrentsMod.checkboxEventHandlerFunc(el);
|
||||||
},
|
},
|
||||||
checkboxEventHandlerFunc: function(el) {
|
checkboxEventHandlerFunc: function (el) {
|
||||||
var name = el.dataset.name;
|
var name = el.dataset.name;
|
||||||
var id = el.value;
|
var id = el.value;
|
||||||
if (el.checked) TorrentsMod.addToSelection({name:name, id:id});
|
if (el.checked) TorrentsMod.addToSelection({
|
||||||
else TorrentsMod.removeFromSelection({name:name, id:id});
|
name: name,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
|
else TorrentsMod.removeFromSelection({
|
||||||
|
name: name,
|
||||||
|
id: id
|
||||||
|
});
|
||||||
if (TorrentsMod.selected.length > 0) TorrentsMod.enableBtnActions();
|
if (TorrentsMod.selected.length > 0) TorrentsMod.enableBtnActions();
|
||||||
else TorrentsMod.disableBtnActions();
|
else TorrentsMod.disableBtnActions();
|
||||||
},
|
},
|
||||||
|
|
||||||
// Action Methods
|
// Action Methods
|
||||||
DeleteHandler: function(locked) {
|
DeleteHandler: function (locked) {
|
||||||
var withReport = confirm(T.r("delete_reports_with_torrents"))
|
var withReport = confirm(T.r("delete_reports_with_torrents"))
|
||||||
var selection = TorrentsMod.selected;
|
var selection = TorrentsMod.selected;
|
||||||
if (locked)
|
if (locked)
|
||||||
TorrentsMod.AddToQueue({ action: "delete",
|
TorrentsMod.AddToQueue({
|
||||||
|
action: "delete",
|
||||||
withReport: withReport,
|
withReport: withReport,
|
||||||
selection: selection,
|
selection: selection,
|
||||||
queryPost: "",
|
queryPost: "",
|
||||||
infos: T.r("with_st", T.r("lock")) + ((withReport) ? T.r("and_reports") : ""),
|
infos: T.r("with_st", T.r("lock")) + ((withReport) ? T.r("and_reports") : ""),
|
||||||
status: "5" });
|
status: "5"
|
||||||
|
});
|
||||||
else TorrentsMod.AddToQueue({
|
else TorrentsMod.AddToQueue({
|
||||||
action: "delete",
|
action: "delete",
|
||||||
withReport: withReport,
|
withReport: withReport,
|
||||||
selection: selection,
|
selection: selection,
|
||||||
infos: (withReport) ? T.r("with_st", T.r("reports")) : "",
|
infos: (withReport) ? T.r("with_st", T.r("reports")) : "",
|
||||||
queryPost: ""});
|
queryPost: ""
|
||||||
for (i in selection) document.getElementById("torrent_"+i).style.display="none";
|
});
|
||||||
|
for (i in selection) document.getElementById("torrent_" + i).style.display = "none";
|
||||||
TorrentsMod.selected = []
|
TorrentsMod.selected = []
|
||||||
TorrentsMod.disableBtnActions();
|
TorrentsMod.disableBtnActions();
|
||||||
},
|
},
|
||||||
Delete: function(e) {
|
Delete: function (e) {
|
||||||
TorrentsMod.DeleteHandler(false);
|
TorrentsMod.DeleteHandler(false);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
LockDelete: function(e) {
|
LockDelete: function (e) {
|
||||||
TorrentsMod.DeleteHandler(true);
|
TorrentsMod.DeleteHandler(true);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
Edit: function(e) {
|
Edit: function (e) {
|
||||||
var selection = TorrentsMod.selected;
|
var selection = TorrentsMod.selected;
|
||||||
var status = document.querySelector(".modtools *[name='"+TorrentsMod.status_input_name+"']").value;
|
var status = document.querySelector(".modtools *[name='" + TorrentsMod.status_input_name + "']").value;
|
||||||
var owner_id = document.querySelector(".modtools *[name='"+TorrentsMod.owner_input_name+"']").value;
|
var owner_id = document.querySelector(".modtools *[name='" + TorrentsMod.owner_input_name + "']").value;
|
||||||
var category = document.querySelector(".modtools *[name='"+TorrentsMod.category_input_name+"']").value;
|
var category = document.querySelector(".modtools *[name='" + TorrentsMod.category_input_name + "']").value;
|
||||||
var infos = "";
|
var infos = "";
|
||||||
infos += (status != "") ? T.r("status_js", status) : "";
|
infos += (status != "") ? T.r("status_js", status) : "";
|
||||||
infos += (owner_id != "") ? T.r("owner_id_js", owner_id) : "";
|
infos += (owner_id != "") ? T.r("owner_id_js", owner_id) : "";
|
||||||
|
@ -345,26 +357,27 @@ var TorrentsMod = {
|
||||||
action: "edit",
|
action: "edit",
|
||||||
selection: selection,
|
selection: selection,
|
||||||
queryPost: "", // We don't format now, we wait until the query is sent
|
queryPost: "", // We don't format now, we wait until the query is sent
|
||||||
infos: (infos != "" ) ? T.r("with_st", infos) : T.r("no_changes"),
|
infos: (infos != "") ? T.r("with_st", infos) : T.r("no_changes"),
|
||||||
status: status,
|
status: status,
|
||||||
category: category,
|
category: category,
|
||||||
owner: owner_id });
|
owner: owner_id
|
||||||
|
});
|
||||||
if (status != "") {
|
if (status != "") {
|
||||||
for (i in selection) document.getElementById("torrent_"+i).className="torrent-info "+TorrentsMod.statusToClassName(status);
|
for (i in selection) document.getElementById("torrent_" + i).className = "torrent-info " + TorrentsMod.statusToClassName(status);
|
||||||
}
|
}
|
||||||
TorrentsMod.selected = []
|
TorrentsMod.selected = []
|
||||||
TorrentsMod.disableBtnActions();
|
TorrentsMod.disableBtnActions();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
},
|
},
|
||||||
ApplyChanges: function() {
|
ApplyChanges: function () {
|
||||||
this.pause = false;
|
this.pause = false;
|
||||||
this.QueryLoop();
|
this.QueryLoop();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Load torrentMods when DOM is ready
|
// Load torrentMods when DOM is ready
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
|
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
|
||||||
TorrentsMod.Create();
|
TorrentsMod.Create();
|
||||||
});
|
});
|
||||||
// @license-end
|
// @license-end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
|
||||||
function Translations() {
|
function Translations() {
|
||||||
var translations = {};
|
var translations = {};
|
||||||
this.Add = function(tr, val) {
|
this.Add = function (tr, val) {
|
||||||
trans = {}
|
trans = {}
|
||||||
if (val != undefined) {
|
if (val != undefined) {
|
||||||
trans[tr] = val;
|
trans[tr] = val;
|
||||||
|
@ -11,7 +11,7 @@ function Translations() {
|
||||||
}
|
}
|
||||||
Object.assign(translations, trans);
|
Object.assign(translations, trans);
|
||||||
};
|
};
|
||||||
this.r = function(string, ...args) {
|
this.r = function (string, ...args) {
|
||||||
if ((string != undefined) && (translations[string] != undefined)) {
|
if ((string != undefined) && (translations[string] != undefined)) {
|
||||||
if (args != undefined) {
|
if (args != undefined) {
|
||||||
return this.format(translations[string], ...args);
|
return this.format(translations[string], ...args);
|
||||||
|
@ -21,12 +21,11 @@ function Translations() {
|
||||||
console.error("No translation string for %s! Please check!", string);
|
console.error("No translation string for %s! Please check!", string);
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
this.format = function(format, ...args) {
|
this.format = function (format, ...args) {
|
||||||
return format.replace(/{(\d+)}/g, function(match, number) {
|
return format.replace(/{(\d+)}/g, function (match, number) {
|
||||||
return typeof args[number] != 'undefined'
|
return typeof args[number] != 'undefined' ?
|
||||||
? args[number]
|
args[number] :
|
||||||
: match
|
match;
|
||||||
;
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,44 @@
|
||||||
{{ import "layouts/partials/helpers/search" }}
|
{{ import "layouts/partials/helpers/search" }} {{ block rss_link()}}{{end}}
|
||||||
{{ block rss_link()}}{{end}}
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="h-left">
|
<div class="h-left">
|
||||||
<div class="h-logo">
|
<div class="h-logo">
|
||||||
<a href="{{URL.Parse("/")}}"><img class="hide-md" src="/img/{{if Sukebei()}}sukebei_logo.png{{else}}logo.png{{end}}" alt="Nyaa Pantsu"><img class="visible-md" src="/img/logo_s.png"/></a>
|
<a href="{{URL.Parse(" / ")}}">
|
||||||
</div>
|
<img class="hide-md" src="/img/{{if Sukebei()}}sukebei_logo.png{{else}}logo.png{{end}}" alt="Nyaa Pantsu"/>
|
||||||
<div class="h-nav">
|
<img class="visible-md" src="/img/logo_s.png" alt="Nyaa Pantsu"/>
|
||||||
<a href="{{URL.Parse("/upload")}}" class="nav-btn"><div class="icon-upload visible-md"></div><span class="hide-md">{{ T("upload") }}</span></a>
|
</a>
|
||||||
<a href="/feed{{ yield rss_link() }}" class="nav-btn"><div class="icon-rss-squared visible-md"></div><span class="hide-md">RSS</span></a>
|
|
||||||
<a href="{{URL.Parse("/faq")}}" class="nav-btn"><div class="icon-help-circled visible-md"></div><span class="hide-md">{{ T("faq") }}</span></a>
|
|
||||||
{{if Sukebei()}}
|
|
||||||
<a href="{{Config.WebAddress.Nyaa}}" class="nav-btn"><div class="icon-heart visible-md"></div><span class="hide-md">{{ T("fun") }}</span></a>
|
|
||||||
{{else}}
|
|
||||||
<a href="{{Config.WebAddress.Sukebei}}" class="nav-btn"><div class="icon-heart visible-md"></div><span class="hide-md">{{ T("fap") }}</span></a>
|
|
||||||
{{end}}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="h-right">
|
<div class="h-nav">
|
||||||
{{ include "layouts/partials/helpers/badgemenu" }}
|
<a href="{{URL.Parse(" /upload ")}}" class="nav-btn">
|
||||||
<div class="h-search">
|
<div class="icon-upload visible-md"></div>
|
||||||
<form role="search" action="{{URL.Parse("/search")}}" id="header-form" method="get">
|
<span class="hide-md">{{ T("upload") }}</span>
|
||||||
{{ yield search_common() }}
|
</a>
|
||||||
{{ yield search_button() }}
|
<a href="/feed{{ yield rss_link() }}" class="nav-btn">
|
||||||
</form>
|
<div class="icon-rss-squared visible-md"></div>
|
||||||
</div>
|
<span class="hide-md">RSS</span>
|
||||||
|
</a>
|
||||||
|
<a href="{{URL.Parse(" /faq ")}}" class="nav-btn">
|
||||||
|
<div class="icon-help-circled visible-md"></div>
|
||||||
|
<span class="hide-md">{{ T("faq") }}</span>
|
||||||
|
</a>
|
||||||
|
{{if Sukebei()}}
|
||||||
|
<a href="{{Config.WebAddress.Nyaa}}" class="nav-btn">
|
||||||
|
<div class="icon-heart visible-md"></div>
|
||||||
|
<span class="hide-md">{{ T("fun") }}</span>
|
||||||
|
</a>
|
||||||
|
{{else}}
|
||||||
|
<a href="{{Config.WebAddress.Sukebei}}" class="nav-btn">
|
||||||
|
<div class="icon-heart visible-md"></div>
|
||||||
|
<span class="hide-md">{{ T("fap") }}</span>
|
||||||
|
</a>
|
||||||
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="h-right">
|
||||||
|
{{ include "layouts/partials/helpers/badgemenu" }}
|
||||||
|
<div class="h-search">
|
||||||
|
<form role="search" action="{{URL.Parse(" /search ")}}" id="header-form" method="get">
|
||||||
|
{{ yield search_common() }} {{ yield search_button() }}
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Référencer dans un nouveau ticket