Apollo.RIP :: Artist Focus & HTML5 Upload Form Validation

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

当前为 2016-12-15 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        Apollo.RIP :: 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*://*apollo.rip/*
// @version	    1.5
// @icon        https://apollo.rip/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();
    
}
    
}