Albirew/nyaa-pantsu
Albirew
/
nyaa-pantsu
Archivé
1
0
Bifurcation 0

beautify assets

Cette révision appartient à :
PantsuDev 2017-07-23 12:50:36 +10:00
Parent 3c34b0a728
révision a931b47bff
17 fichiers modifiés avec 1909 ajouts et 1057 suppressions

Voir le fichier

@ -1,85 +1,162 @@
/* 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 */
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 {
color: #196759;
pointer-events: auto;
color: #196759;
pointer-events: auto;
}
a:hover {
color: #238BC7;
}
a:hover { color: #238BC7; }
.header {
background: #111; /* Old browsers */
background: -moz-linear-gradient(bottom, #222 0%, #111 100%);
background: -webkit-linear-gradient(bottom, #222 0%, #111 100%);
background: linear-gradient(to top, #222 0%, #111 100%);
border-color: #444;
background: #111;
/* Old browsers */
background: -moz-linear-gradient(bottom, #222 0%, #111 100%);
background: -webkit-linear-gradient(bottom, #222 0%, #111 100%);
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 {
background: rgba(255,255,255, 0.8);
border-color: #BBC9CF !important;
background: rgba(255, 255, 255, 0.8);
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); }
.form-input:focus { box-shadow: 0 0 5px #fff; }
.btn:hover, .up-btn:hover {
background: rgba(192, 192, 192, 0.2);
}
.form-input:focus {
box-shadow: 0 0 5px #fff;
}
select:after {
content: "AAAAA";
content: "AAAAA";
}
.header .h-user .user-avatar {
background: #111;
border-color: #444;
background: #111;
border-color: #444;
}
table thead { background: #fff; }
table thead {
background: #fff;
}
th a {
color: #6E96AA;
}
th a { color: #6E96AA; }
th { border-color: #ddd !important; }
td { border-color: #ccc !important; }
th {
border-color: #ddd !important;
}
td.tr-se, .success-text { color: #22A243; }
td.tr-le, .error-text { color: #E84C4C; }
td {
border-color: #ccc !important;
}
td.tr-se, .success-text {
color: #22A243;
}
td.tr-le, .error-text {
color: #E84C4C;
}
.btn-red {
background-color: #E84C4C;
color: #E8E8E8!important;
background-color: #E84C4C;
color: #E8E8E8!important;
}
.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;
}
.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! */
.aplus, .btn-blue { background: #60B0F0; }
.trusted, .btn-green { background: #98D9A8; }
.remake, .btn-orange { background: #F0B080; }
.pagination .active { background: #d5d5d5; color: #222; }
.pagination .disabled { color: #d5d5d5; cursor: unset; }
.aplus, .btn-blue {
background: #60B0F0;
}
.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%; }
.trusted, .btn-green {
background: #98D9A8;
}
.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;
}

Voir le fichier

@ -9,7 +9,6 @@
background: url('flags.png') no-repeat;
}
.flag.flag-zh {
background-position: -16px 0;
}

Voir le fichier

@ -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) }
.box, .pagination li { box-shadow: 1px 3px 4px hsla(270,20%,20%,0.15) }
.header, .user-menu {
box-shadow: 1px 3px 4px hsla(200, 20%, 20%, 0.15)
}
#mascot { background-image: url('/img/renchon.svg'); }
a { color: #676767; }
a:hover { color: #444; }
.box, .pagination li {
box-shadow: 1px 3px 4px hsla(270, 20%, 20%, 0.15)
}
#mascot {
background-image: url('/img/renchon.svg');
}
a {
color: #676767;
}
a:hover {
color: #444;
}
.header {
background: #bfe3f3 url('theme_g_anon/bg-header-tile.png') repeat-x;
border-color: #1d6d90;
background: #bfe3f3 url('theme_g_anon/bg-header-tile.png') repeat-x;
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 {
background: #99BFD0;
border-color: #a3c7d3;
background: #99BFD0;
border-color: #a3c7d3;
}
.sukebei .header .h-user .user-avatar {
background: #bf99d0;
border-color: #d3a3d1;
background: #bf99d0;
border-color: #d3a3d1;
}
.header .h-user .user-menu {
background: #BDE0EF;
background: -moz-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%);
border-color: #1d6d90;
background: #BDE0EF;
background: -moz-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%);
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 {
background: #dcccea !important; /* Old browsers */
background: -moz-linear-gradient(top, #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;
background: #dcccea !important;
/* Old browsers */
background: -moz-linear-gradient(top, #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 a { color: #7A5C94; }
th {
color: #9b85ae;
}
th { border-color: #cbbdd7 !important; }
td { border-color: #e6eff4 !important; }
th a {
color: #7A5C94;
}
td.tr-se, .success-text { color: #22A243; }
td.tr-le, .error-text { color: #E84C4C; }
th {
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 {
background-color: #E84C4C;
color: #E8E8E8!important;
background-color: #E84C4C;
color: #E8E8E8!important;
}
.btn-red:hover { color: #E8E8E8; }
.btn-red:hover {
color: #E8E8E8;
}
.aplus, .btn-blue { background: hsla(200, 100%, 50%, 0.2) !important; }
.trusted, .btn-green { background: hsla(100, 100%, 50%, 0.2) !important; }
.remake, .btn-orange { background: hsla(30, 100%, 50%, 0.2) !important; }
.aplus, .btn-blue {
background: hsla(200, 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;
}
.torrent-info-box > p > a:hover, .torrent-info-box > div > a:hover, #description-box a:hover { color: #1fa4d0; }
.sukebei { color: #373737; }
.sukebei .header { 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);}
.torrent-info-box>p>a:hover, .torrent-info-box>div>a:hover, #description-box a:hover {
color: #1fa4d0;
}
.sukebei {
color: #373737;
}
.sukebei .header {
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 {
background: #EFDCF0;
background: -moz-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%);
border-color: #C48CBE;
background: #EFDCF0;
background: -moz-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%);
border-color: #C48CBE;
}

Fichier diff supprimé car celui-ci est trop grand Voir la Diff

Voir le fichier

@ -1,16 +1,18 @@
@font-face {
font-family: 'nyacon';
src: url('./font/nyacon.eot?1588873');
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');
font-weight: normal;
font-style: normal;
font-family: 'nyacon';
src: url('./font/nyacon.eot?1588873');
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');
font-weight: normal;
font-style: normal;
}
/* 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 */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
@ -20,50 +22,114 @@
}
*/
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "nyacon";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* 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); */
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: "nyacon";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: .2em;
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
margin-left: .2em;
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* 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-help-circled:before { content: '\e801'; } /* '' */
.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'; } /* '' */
.icon-heart:before {
content: '\e800';
}
/* '' */
.icon-help-circled:before {
content: '\e801';
}
/* '' */
.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';
}
/* '' */

Voir le fichier

@ -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:hover { color: #5F89AC; }
a {
color: #81a2be;
}
a:hover {
color: #5F89AC;
}
.header {
background: #282A2E;
border-color: #000;
background: #282A2E;
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 {
background: #99BFD0;
border-color: #282A2E;
background: #99BFD0;
border-color: #282A2E;
}
.header .h-user .user-menu {
background: #282A2E;
background: -moz-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%);
border-color: #282A2E;
background: #282A2E;
background: -moz-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%);
border-color: #282A2E;
}
table thead { background: #141517 !important; }
table thead {
background: #141517 !important;
}
th { color: #838B98; }
th a { color: #c5c8c6; }
th {
color: #838B98;
}
th, td { border-color: #141517 !important; }
th a {
color: #c5c8c6;
}
td.tr-se, .success-text { color: #b5bd68; }
td.tr-le, .error-text { color: #cc6666; }
th, td {
border-color: #141517 !important;
}
td.tr-se, .success-text {
color: #b5bd68;
}
td.tr-le, .error-text {
color: #cc6666;
}
.btn-red {
background-color: #cc6666;
background-color: #cc6666;
}
.aplus, .btn-blue { background: hsla(180, 50%, 50%, 0.2) !important; }
.trusted, .btn-green { background: hsla(90, 50%, 50%, 0.2) !important; }
.remake, .btn-orange { background: hsla(40, 50%, 50%, 0.2) !important; }
.aplus, .btn-blue {
background: hsla(180, 50%, 50%, 0.2) !important;
}
.pagination .active { background: #141517; color: #c5c8c6; }
.pagination .disabled { color: #141517; cursor: unset; }
.trusted, .btn-green {
background: hsla(90, 50%, 50%, 0.2) !important;
}
.sukebei { color: #c5c8c6; }
.sukebei a { color: #cc6666; }
.sukebei a:hover { color: #c82829; }
.sukebei th, .sukebei th a { color: #c5c8c6; }
.remake, .btn-orange {
background: hsla(40, 50%, 50%, 0.2) !important;
}
.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 {
background: #fff;
border-radius: .4em .4em 0 0;
border-bottom: .5em solid #fff;
margin-bottom: -.5em;
background: #fff;
border-radius: .4em .4em 0 0;
border-bottom: .5em solid #fff;
margin-bottom: -.5em;
}
/* Markdown editor */
.editor-toolbar a {
color: #fff !important;
color: #fff !important;
}
.editor-toolbar a.active, .editor-toolbar a:hover {
background: #666;
border-color: #828282;
background: #666;
border-color: #828282;
}
.editor-toolbar {
background: #000 !important;
background: #000 !important;
}
.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) {
background: #141517;
background: #141517;
}
.CodeMirror {
color: #fff;
background: #141517;
color: #fff;
background: #141517;
}
.CodeMirror-cursor {
border-color: #fff;
border-color: #fff;
}
.CodeMirror .CodeMirror-selected {
background: #585858;
background: #585858;
}
.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 {
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 { border-color: #53565e; }
.torrent-info-box>p>a, .torrent-info-box>div>a, #description-box a {
text-decoration: none;
}
.torrent-info-box {
border-color: #53565e;
}

Voir le fichier

@ -30,17 +30,23 @@ var Kilo = function (params) {
}
// Private variables
var Keywords_flags= [
["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"]
var Keywords_flags = [
["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"]
]
var Keywords_categories = [
[["[jav]","[h-games]"], [7,3]],
[[""], [0]]
[
["[jav]", "[h-games]"],
[7, 3]
],
[
[""],
[0]
]
]
// Parsing categories
document.querySelectorAll(".form-torrent-category option").forEach(function(el) {
document.querySelectorAll(".form-torrent-category option").forEach(function (el) {
var subcat
if (self.sukebei) {
subcat = el.value.replace("_", "")
@ -56,7 +62,7 @@ var Kilo = function (params) {
// Displaying the block and set the locale timestamp
document.getElementsByClassName('torrent-preview-table')[0].style.display = 'block'
document.getElementsByClassName('table-torrent-date')[0].innerText = new Date(Date.now()).toISOString()
// Adding listener events
for (var langIndex = 0; langIndex < document.getElementsByName(this.langSelect).length; langIndex++) {
document.getElementsByName(this.langSelect)[langIndex].addEventListener('change', updateTorrentLang)
@ -81,7 +87,7 @@ var Kilo = function (params) {
this.setCategory(formCategory.selectedIndex)
updateTorrentLang()
//Adding the torrent under and above the previewed one.
//Adding the torrent under and above the previewed one.
if (this.listContext) {
Query.Get('/api/search?limit=2', function (data) {
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.title = document.getElementsByClassName('form-torrent-category')[0].querySelectorAll("option")[index].textContent
}
//
this.addKeywordFlags = function(value) {
//
this.addKeywordFlags = function (value) {
var torrentLowerCaseName = value.toLowerCase()
var updateLang = false
for(var KeywordIndex = 0; KeywordIndex < Keywords_flags[0].length; KeywordIndex++)
if(torrentLowerCaseName.includes(Keywords_flags[0][KeywordIndex])) {
document.getElementById("upload-lang-" + Keywords_flags[1][KeywordIndex]).checked = true
updateLang = true
for (var KeywordIndex = 0; KeywordIndex < Keywords_flags[0].length; KeywordIndex++)
if (torrentLowerCaseName.includes(Keywords_flags[0][KeywordIndex])) {
document.getElementById("upload-lang-" + Keywords_flags[1][KeywordIndex]).checked = true
updateLang = true
}
if(updateLang) updateTorrentLang()
if (updateLang) updateTorrentLang()
}
//
this.addKeywordCategories = function(value) {
if(document.getElementsByClassName('form-torrent-category')[0].selectedIndex != 0)
this.addKeywordCategories = function (value) {
if (document.getElementsByClassName('form-torrent-category')[0].selectedIndex != 0)
return
var torrentLowerCaseName = value.toLowerCase(),
IsOnSukebei = params.sukebei ? 0 : 1;
for(var KeywordIndex = 0; KeywordIndex < Keywords_categories[IsOnSukebei][0].length; KeywordIndex++)
if(torrentLowerCaseName.includes(Keywords_categories[IsOnSukebei][0][KeywordIndex])) {
for (var KeywordIndex = 0; KeywordIndex < Keywords_categories[IsOnSukebei][0].length; KeywordIndex++)
if (torrentLowerCaseName.includes(Keywords_categories[IsOnSukebei][0][KeywordIndex])) {
document.getElementsByClassName('form-torrent-category')[0].selectedIndex = Keywords_categories[IsOnSukebei][1][KeywordIndex];
this.setCategory(document.getElementsByClassName('form-torrent-category')[0].selectedIndex)
break
}
}
}
// Helper to prevent the functions on keyup/keydown to slow the user typing
this.debounce = function (func, wait, immediate) {
var timeout
return function() {
var context = this, args = arguments
var later = function() {
return function () {
var context = this,
args = arguments
var later = function () {
timeout = null
if (!immediate) func.apply(context, args)
}
@ -176,7 +183,7 @@ var Kilo = function (params) {
var updatePreviewTorrentName = function (e) {
var el = e.target
self.setName(el.value)
self.debounce(function(value) {
self.debounce(function (value) {
self.addKeywordFlags(value)
self.addKeywordCategories(value)
}, 300)(el.value)

Voir le fichier

@ -2,15 +2,15 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
function loadLanguages() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 199) {
var selector = document.getElementById("bottom_language_selector");
selector.hidden = false
/* Response format is
* { "current": "(user current language)",
* "languages": {
* "(language_code)": "(language_name"),
* }} */
* { "current": "(user current language)",
* "languages": {
* "(language_code)": "(language_name"),
* }} */
var response = JSON.parse(xhr.responseText);
for (var language in response.languages) {
if (!response.languages.hasOwnProperty(language)) continue;

Voir le fichier

@ -59,33 +59,33 @@ parseAllDates()
{
//Get current lang, mascot & theme cookies
//TODO
//Remove all cookies:
var cookies = document.cookie.split(";");
var excludedCookies = ["mascot", "theme", "mascot_url", "lang"];
for (var i = 0; i < cookies.length; i++) {
var cookieName = (cookies[i].split("=")[0]).trim();
//Remove spaces because some cookie names have it
if(excludedCookies.includes(cookieName)) continue;
document.cookie = cookieName + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
}
//Set new version in cookie
document.cookie = "version=" + Version;
//Apply back lang, mascot & theme cookie
//TODO
//Add fancy "new" text at bottom of page
document.getElementById("commit").className = "new";
}
/*Fixed-Navbar offset fix*/
if(document.getElementsByClassName("search-box")[0] !== undefined)
startupCode()
else
if(document.getElementsByClassName("search-box")[0] !== undefined)
startupCode()
else
document.addEventListener("DOMContentLoaded", function(event) { startupCode() })

Voir le fichier

@ -10,17 +10,17 @@ var Modal = {
} else {
var nbEl = elements.length
for (var i=0; i < nbEl; i++) {
for (var i = 0; i < nbEl; i++) {
var modal = elements[i];
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;
// Get the button that opens the modal
if (!btn) {
btn = document.getElementById("modal_btn_"+modal.id)
btn = document.getElementById("modal_btn_" + modal.id)
} else if (btn.match(/^#/)) {
btn = document.getElementById(btn.substr(1));
} else if (btn.match(/^\./)) {
@ -31,7 +31,7 @@ var Modal = {
return
}
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()
modal.style.display = "block";
Modal.active = modal;
@ -41,7 +41,7 @@ var Modal = {
} else {
btn = (isBtnArray) ? btn[0] : btn;
// 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()
modal.style.display = "block";
Modal.active = modal;
@ -50,16 +50,16 @@ var 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
span.addEventListener("click", function(e) {
span.addEventListener("click", function (e) {
modal.style.display = "none";
Modal.active = 0;
if (close_callback != undefined) close_callback()
e.preventDefault();
});
// 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) {
modal.style.display = "none";
Modal.active = 0;
@ -67,19 +67,19 @@ var Modal = {
}
});
},
CloseActive: function() {
CloseActive: function () {
if (this.active != 0) {
this.active.style.display= "none";
this.active.style.display = "none";
this.active = 0;
}
},
GetActive: function() {
GetActive: function () {
return this.active;
},
Open: function(q) {
Open: function (q) {
var modal = document.querySelector(q);
if (modal != undefined) {
modal.style.display= "none";
modal.style.display = "none";
this.active = modal;
}
}

Voir le fichier

@ -1,13 +1,13 @@
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
var Query = {
Failed:0,
Failed: 0,
MaxFail: 10,
Get: function(url, renderer, callback) {
Get: function (url, renderer, callback) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, true);
xhr.responseType = 'json';
xhr.onload = function(e) {
xhr.onload = function (e) {
if (this.status == 200) {
Query.Failed = 0;
renderer(this.response);
@ -15,26 +15,26 @@ var Query = {
} else {
console.log("Error when refresh")
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);
else console.error("Too many attempts, stopping...")
}
};
xhr.send();
},
Post: function(url, postArgs, callback) {
Post: function (url, postArgs, callback) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url, true);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xhr.responseType = 'json';
xhr.onload = function(e) {
xhr.onload = function (e) {
if (this.status == 200) {
Query.Failed = 0;
if (callback != undefined) callback(this.response);
} else {
console.log("Error when refresh")
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);
else console.error("Too many attempts, stopping...")
}

Voir le fichier

@ -1,8 +1,8 @@
// @source https://github.com/NyaaPantsu/nyaa/tree/dev/public/js
// @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 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

Voir le fichier

@ -3,19 +3,19 @@
// Templates variable
var Templates = {
tmpl: [],
Add: function(templateName, template) {
Add: function (templateName, template) {
this.tmpl[templateName] = template
},
Render: function(templateName, model) {
Render: function (templateName, model) {
if (this.tmpl[templateName] === undefined) {
console.log("The template with name '%s' doesn't exist", templateName)
return
}
return this.tmpl[templateName](model)
},
ApplyItemListRenderer: function(params) {
return function(models) {
for (var i=models.length-1; i >= 0; i--) {
ApplyItemListRenderer: function (params) {
return function (models) {
for (var i = models.length - 1; i >= 0; i--) {
var object = Templates.Render(params.templateName, models[i]);
if (params.method == "append") {
params.element.innerHTML = params.element.innerHTML + object
@ -25,21 +25,21 @@ var Templates = {
}
};
},
EncodeEntities: function(value) {
EncodeEntities: function (value) {
return value.
replace(/&/g, '&amp;').
replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, function(value) {
replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, function (value) {
var hi = value.charCodeAt(0);
var low = value.charCodeAt(1);
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
}).
replace(/([^\#-~| |!])/g, function(value) {
replace(/([^\#-~| |!])/g, function (value) {
return '&#' + value.charCodeAt(0) + ';';
}).
replace(/</g, '&lt;').
replace(/>/g, '&gt;');
},
FlagCode: function(language) {
FlagCode: function (language) {
var split = language.split("-")
if (split.length > 1) {
return split[1]

Voir le fichier

@ -7,38 +7,42 @@ var Torrents = {
SearchURL: "/api/search",
Method: "prepend",
LastID: 0,
StopRefresh: function() {
StopRefresh: function () {
clearTimeout(this.timeout)
this.timeout = undefined
this.CanRefresh = false
},
Refresh: function() {
Refresh: function () {
if (this.CanRefresh) {
this.timeout = setTimeout(function() {
this.timeout = setTimeout(function () {
var searchArgs = (window.location.search != "") ? window.location.search.substr(1) : ""
searchArgs = (Torrents.LastID > 0) ? "?fromID="+Torrents.LastID+"&"+searchArgs : "?"+searchArgs
Query.Get(Torrents.SearchURL+searchArgs,
function(data) {
searchArgs = (Torrents.LastID > 0) ? "?fromID=" + Torrents.LastID + "&" + searchArgs : "?" + searchArgs
Query.Get(Torrents.SearchURL + searchArgs,
function (data) {
var torrents = data.torrents
Templates.ApplyItemListRenderer({
templateName: "torrents.item", method: "prepend", element: document.getElementById("torrentListResults")
templateName: "torrents.item",
method: "prepend",
element: document.getElementById("torrentListResults")
})(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()
Torrents.Refresh()
});
}, this.Seconds*1000);
}, this.Seconds * 1000);
}
},
StartRefresh: function() {
StartRefresh: function () {
this.CanRefresh = true
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) {
Torrents.StartRefresh()
}
})
// @license-end
// @license-end

Voir le fichier

@ -16,20 +16,20 @@ var TorrentsMod = {
// Internal variables used for processing the request
selected: [],
queued: [],
unique_id:1,
error_count:0,
unique_id: 1,
error_count: 0,
progress_count: 0,
progress_max: 0,
pause: false,
enabled: false,
// Init method
Create: function() {
Create: function () {
var sh_btn = document.getElementById(TorrentsMod.show_hide_button);
var btn_actions = document.getElementsByClassName(this.btn_class_action)
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
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;
switch (btn_actions[i].id) {
case this.delete_btn:
@ -45,22 +45,22 @@ var TorrentsMod = {
break;
}
}
for (var i=0; i < this.checkboxes.length; i++) {
for (var i = 0; i < this.checkboxes.length; i++) {
var checkbox = this.checkboxes[i];
checkbox.addEventListener("change", this.checkboxEventHandler)
}
sh_btn.addEventListener("click", function(e) {
sh_btn.addEventListener("click", function (e) {
var divActions = this.nextElementSibling;
if (divActions.style.display == "inline") {
TorrentsMod.enabled = false;
document.getElementsByClassName("results box mod-open")[0].className = "results box";
} else {
TorrentsMod.enabled = true;
document.getElementsByClassName("results box")[0].className = "results box mod-open";
} else {
TorrentsMod.enabled = true;
document.getElementsByClassName("results box")[0].className = "results box mod-open";
}
divActions.style.display = (TorrentsMod.enabled) ? "inline" : "none";
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.style.display = (TorrentsMod.enabled) ? "table-cell" : "none";
}
@ -70,99 +70,102 @@ var TorrentsMod = {
});
},
// generate a unique id for a query
getId: function(){
getId: function () {
return this.unique_id++;
},
// UI Methods
selectAll: function(bool) {
selectAll: function (bool) {
var l = TorrentsMod.checkboxes.length;
for (var i = 0; i < l; i++) {
TorrentsMod.checkboxes[i].checked = bool;
TorrentsMod.checkboxEventHandlerFunc(TorrentsMod.checkboxes[i]);
}
},
disableBtnActions: function() {
disableBtnActions: function () {
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;
}
},
enableBtnActions: function() {
enableBtnActions: function () {
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;
}
},
enableBtnSubmit: function() {
enableBtnSubmit: function () {
var btn_submit = document.getElementsByClassName(this.btn_class_submit)
btn_submit[0].disabled = false;
},
enableApplyChangesBtn: function() {
enableApplyChangesBtn: function () {
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)
btn_submit[0].disabled = true;
},
disableApplyChangesBtn: function() {
disableApplyChangesBtn: function () {
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 parentDiv = document.getElementById(queueAction.unique_id).parentNode;
parentDiv.removeChild(document.getElementById(queueAction.unique_id));
},
removeFromParent: function(el) {
removeFromParent: function (el) {
var parentDiv = el.parentNode;
parentDiv.removeChild(el);
},
generatingModal: function() {
generatingModal: function () {
var listLength = this.queued.length;
var div = {"edit": "", "delete": ""};
for (var i=0; i < listLength; i++) {
var div = {
"edit": "",
"delete": ""
};
for (var i = 0; i < listLength; i++) {
var listHTML = "";
for(key in this.queued[i].selection) {
for (key in this.queued[i].selection) {
var selection = this.queued[i].selection[key];
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].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_max = listLength;
document.querySelector(".modal .edit_changes").innerHTML = div["edit"];
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"
},
addToLog: function(type, msg) {
addToLog: function (type, msg) {
var logDiv = document.querySelector(".modal .logs_mess");
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() {
document.querySelector("#"+this.progress_bar_id).style.display = "block";
var progress_green = document.querySelector("#"+this.progress_bar_id+" .progress-green");
var perc = this.progress_count/this.progress_max*100;
progress_green.style.width=perc+"%";
progress_green.innerText = this.progress_count+"/"+this.progress_max;
updateProgressBar: function () {
document.querySelector("#" + this.progress_bar_id).style.display = "block";
var progress_green = document.querySelector("#" + this.progress_bar_id + " .progress-green");
var perc = this.progress_count / this.progress_max * 100;
progress_green.style.width = perc + "%";
progress_green.innerText = this.progress_count + "/" + this.progress_max;
},
resetModal: function() {
resetModal: function () {
var logDiv = document.querySelector(".modal .logs_mess");
logDiv.style.display = "none";
document.querySelector("#"+this.progress_bar_id).style.display = "none";
document.querySelector("#" + this.progress_bar_id).style.display = "none";
logDiv.innerHTML = "";
document.querySelector(".modal .edit_changes").innerHTML = "";
document.querySelector(".modal .delete_changes").innerHTML = "";
this.enableApplyChangesBtn();
},
statusToClassName: function(status) {
statusToClassName: function (status) {
var className = ["", "normal", "remake", "trusted", "aplus", ""]
return className[status];
},
@ -171,7 +174,7 @@ var TorrentsMod = {
addToSelection: function (torrent) {
this.selected[torrent.id] = torrent;
},
removeFromSelection: function(torrent) {
removeFromSelection: function (torrent) {
delete this.selected[torrent.id];
for (var t in this.selected) {
return
@ -180,45 +183,45 @@ var TorrentsMod = {
},
// Query Queue Management Methods
AddToQueue: function(QueueAction) {
AddToQueue: function (QueueAction) {
QueueAction.unique_id = this.getId(); // used for DOM interaction
this.queued.push(QueueAction);
this.enableBtnSubmit()
},
RemoveFromQueueAfterItems: function(i) {
RemoveFromQueueAfterItems: function (i) {
for (t in this.queued[i].selection) {
this.RemoveItemFromQueue(i, t);
}
},
RemoveFromQueue: function(i) {
this.progress_max = (this.progress_max - 1 >= 0) ? this.progress_max-1 : 0;
RemoveFromQueue: function (i) {
this.progress_max = (this.progress_max - 1 >= 0) ? this.progress_max - 1 : 0;
this.RemoveFromQueueAction(i)
return false;
},
RemoveFromQueueAction: function(i) {
this.removeFromParent(document.getElementById("list_"+this.queued[i].unique_id));
RemoveFromQueueAction: function (i) {
this.removeFromParent(document.getElementById("list_" + this.queued[i].unique_id));
this.queued.splice(i, 1);
if (this.queued.length == 0) {
this.disableBtnSubmit();
if (this.progress_max>0) {
if (this.progress_max > 0) {
this.disableApplyChangesBtn();
} else {
Modal.CloseActive();
}
}
},
formatSelectionToQuery: function(selection) {
formatSelectionToQuery: function (selection) {
var format = "";
for (var s in selection) {
format += "&torrent_id="+selection[s].id
format += "&torrent_id=" + selection[s].id
}
return (format != "") ? format.substr(1) : ""
},
RemoveItemFromQueue: function(i, id) {
this.removeFromParent(document.getElementById("list_item_"+id));
RemoveItemFromQueue: function (i, id) {
this.removeFromParent(document.getElementById("list_item_" + id));
delete this.queued[i].selection[id];
document.getElementById("torrent_cb_"+id).checked=false;
document.getElementById("torrent_"+id).style.display="";
document.getElementById("torrent_cb_" + id).checked = false;
document.getElementById("torrent_" + id).style.display = "";
var test = 0;
for (t in this.queued[i].selection) {
test++
@ -227,9 +230,9 @@ var TorrentsMod = {
if (test == 0) this.RemoveFromQueue(i);
return false;
},
newQueryAttempt: function(queryUrl, queryPost, callback) {
newQueryAttempt: function (queryUrl, queryPost, callback) {
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>");
TorrentsMod.addToLog("error", errorMsg);
TorrentsMod.error_count++;
@ -250,7 +253,7 @@ var TorrentsMod = {
}
});
},
QueryQueue: function(i, callback) {
QueryQueue: function (i, callback) {
if (this.queued.length > 0) {
var QueueAction = this.queued[i]; // we clone it so we can delete it safely
this.RemoveFromQueueAction(i);
@ -258,29 +261,29 @@ var TorrentsMod = {
var queryUrl = "/mod/api/torrents";
QueueAction.queryPost = TorrentsMod.formatSelectionToQuery(QueueAction.selection)
if (QueueAction.action == "delete") {
queryPost="action="+QueueAction.action;
queryPost+="&withreport="+QueueAction.withReport;
queryPost += "&status="+((QueueAction.status != undefined) ? QueueAction.status : "");
queryPost += "&"+QueueAction.queryPost; // we add torrent id
queryPost = "action=" + QueueAction.action;
queryPost += "&withreport=" + QueueAction.withReport;
queryPost += "&status=" + ((QueueAction.status != undefined) ? QueueAction.status : "");
queryPost += "&" + QueueAction.queryPost; // we add torrent id
} else if (QueueAction.action == "edit") {
queryPost="action=multiple";
queryPost += "&status="+QueueAction.status;
queryPost += "&owner="+QueueAction.owner;
queryPost += "&category="+QueueAction.category;
queryPost += "&"+QueueAction.queryPost; // we add torrent id
queryPost = "action=multiple";
queryPost += "&status=" + QueueAction.status;
queryPost += "&owner=" + QueueAction.owner;
queryPost += "&category=" + QueueAction.category;
queryPost += "&" + QueueAction.queryPost; // we add torrent id
}
TorrentsMod.newQueryAttempt(queryUrl, queryPost, callback)
} else {
TorrentsMod.addToLog("success", T.r("all_operations_done"))
if (TorrentsMod.refreshTimeout > 0) {
TorrentsMod.addToLog("success", T.r("refreshing_in", TorrentsMod.refreshTimeout/1000))
setTimeout(function(){
TorrentsMod.addToLog("success", T.r("refreshing_in", TorrentsMod.refreshTimeout / 1000))
setTimeout(function () {
window.location.reload()
}, TorrentsMod.refreshTimeout);
}
}
},
QueryLoop: function() {
QueryLoop: function () {
if (TorrentsMod.progress_count <= TorrentsMod.progress_max) {
TorrentsMod.updateProgressBar()
TorrentsMod.progress_count++;
@ -290,53 +293,62 @@ var TorrentsMod = {
},
// Event Handlers
checkboxEventHandler: function(e) {
checkboxEventHandler: function (e) {
var el = e.target;
TorrentsMod.checkboxEventHandlerFunc(el);
},
checkboxEventHandlerFunc: function(el) {
checkboxEventHandlerFunc: function (el) {
var name = el.dataset.name;
var id = el.value;
if (el.checked) TorrentsMod.addToSelection({name:name, id:id});
else TorrentsMod.removeFromSelection({name:name, id:id});
if (el.checked) TorrentsMod.addToSelection({
name: name,
id: id
});
else TorrentsMod.removeFromSelection({
name: name,
id: id
});
if (TorrentsMod.selected.length > 0) TorrentsMod.enableBtnActions();
else TorrentsMod.disableBtnActions();
},
// Action Methods
DeleteHandler: function(locked) {
DeleteHandler: function (locked) {
var withReport = confirm(T.r("delete_reports_with_torrents"))
var selection = TorrentsMod.selected;
if (locked)
TorrentsMod.AddToQueue({ action: "delete",
TorrentsMod.AddToQueue({
action: "delete",
withReport: withReport,
selection: selection,
queryPost: "",
infos: T.r("with_st", T.r("lock")) + ((withReport) ? T.r("and_reports") : ""),
status: "5" });
status: "5"
});
else TorrentsMod.AddToQueue({
action: "delete",
withReport: withReport,
selection: selection,
infos: (withReport) ? T.r("with_st", T.r("reports")) : "",
queryPost: ""});
for (i in selection) document.getElementById("torrent_"+i).style.display="none";
queryPost: ""
});
for (i in selection) document.getElementById("torrent_" + i).style.display = "none";
TorrentsMod.selected = []
TorrentsMod.disableBtnActions();
},
Delete: function(e) {
Delete: function (e) {
TorrentsMod.DeleteHandler(false);
e.preventDefault();
},
LockDelete: function(e) {
LockDelete: function (e) {
TorrentsMod.DeleteHandler(true);
e.preventDefault();
},
Edit: function(e) {
Edit: function (e) {
var selection = TorrentsMod.selected;
var status = document.querySelector(".modtools *[name='"+TorrentsMod.status_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 status = document.querySelector(".modtools *[name='" + TorrentsMod.status_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 infos = "";
infos += (status != "") ? T.r("status_js", status) : "";
infos += (owner_id != "") ? T.r("owner_id_js", owner_id) : "";
@ -345,26 +357,27 @@ var TorrentsMod = {
action: "edit",
selection: selection,
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,
category: category,
owner: owner_id });
owner: owner_id
});
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.disableBtnActions();
e.preventDefault();
},
ApplyChanges: function() {
ApplyChanges: function () {
this.pause = false;
this.QueryLoop();
}
};
// Load torrentMods when DOM is ready
document.addEventListener("DOMContentLoaded", function() {
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
// Load torrentMods when DOM is ready
document.addEventListener("DOMContentLoaded", function () {
TorrentsMod.checkboxes = document.querySelectorAll("input[name='torrent_id']");
TorrentsMod.Create();
});
// @license-end
// @license-end

Voir le fichier

@ -2,7 +2,7 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt Expat
function Translations() {
var translations = {};
this.Add = function(tr, val) {
this.Add = function (tr, val) {
trans = {}
if (val != undefined) {
trans[tr] = val;
@ -11,7 +11,7 @@ function Translations() {
}
Object.assign(translations, trans);
};
this.r = function(string, ...args) {
this.r = function (string, ...args) {
if ((string != undefined) && (translations[string] != undefined)) {
if (args != undefined) {
return this.format(translations[string], ...args);
@ -21,12 +21,11 @@ function Translations() {
console.error("No translation string for %s! Please check!", string);
return "";
};
this.format = function(format, ...args) {
return format.replace(/{(\d+)}/g, function(match, number) {
return typeof args[number] != 'undefined'
? args[number]
: match
;
this.format = function (format, ...args) {
return format.replace(/{(\d+)}/g, function (match, number) {
return typeof args[number] != 'undefined' ?
args[number] :
match;
});
};
}

Voir le fichier

@ -1,28 +1,44 @@
{{ import "layouts/partials/helpers/search" }}
{{ block rss_link()}}{{end}}
{{ import "layouts/partials/helpers/search" }} {{ block rss_link()}}{{end}}
<div class="container">
<div class="h-left">
<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>
</div>
<div class="h-nav">
<a href="{{URL.Parse("/upload")}}" class="nav-btn"><div class="icon-upload visible-md"></div><span class="hide-md">{{ T("upload") }}</span></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 class="h-left">
<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" alt="Nyaa Pantsu"/>
</a>
</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 class="h-nav">
<a href="{{URL.Parse(" /upload ")}}" class="nav-btn">
<div class="icon-upload visible-md"></div>
<span class="hide-md">{{ T("upload") }}</span>
</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 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>