Redacted.CH :: Artist Focus & HTML5 Upload Form Validation

Type directly the artist you are looking for without clicking on "artist" field in the header

当前为 2019-07-26 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Redacted.CH :: Artist Focus & HTML5 Upload Form Validation
// @description	Type directly the artist you are looking for without clicking on "artist" field in the header
// @include	    http*://*redacted.ch/*
// @version	    1.6
// @icon        https://redacted.ch/favicon.ico
// @require     https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js
// @grant       GM_getValue
// @namespace https://greasyfork.org/users/2290
// ==/UserScript==


// Get Document URL
var url = document.URL;
    
// Get the PHP page
var elem = url.split('/');
var page = elem[3];

var page_detect = false;

var pageid = page.split("?")[0];
var page = pageid;

// Upload Page
if(page == "upload.php"){
    page_detect = true;
    $("#artist").focus();
    
    // Add HTML5 Form validation
    $('#file').prop('required',true);
    $('#artist').prop('required',true);
    $('#title').prop('required',true);
    $('#year').prop('required',true);
    $('#releasetype').prop('required',true);
    $("#releasetype").val('0');
    $('#format').prop('required',true);
    $('#bitrate').prop('required',true);
    $('#media').prop('required',true);
    $('#tags').prop('required',true);
    $('#album_desc').prop('required',true);
}

// Top 10 Page
if(page == "top10.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#tags").focus();
}
}

// Torrents Page
if(page == "torrents.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#torrentssearch").focus();
}
}

// Requests Page
if(page == "requests.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#requestssearch").focus();
}
}

// Forums Page
if(page == "forums.php" || page == "userhistory.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#forumssearch").focus();
}
}

if(page == "log.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#logsearch").focus();
}
}

// Friends Page
if(page == "friends.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#userssearch").focus();
}
}

// Logchecker Page
if(page == "logchecker.php"){
    page_detect = true;
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#log_contents").focus();
}
}

// Focus to the artist search field (by default)
if(page_detect == false){
    if(url.indexOf("#") != -1){
    
    }
    // No achor, we focus the artist field
else {
    $("#artistsearch").focus();
    
}
    
}