[.12 Project Endor (Zoltar)] Car Website Evaluation

Open window, hotkeys

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            [.12 Project Endor (Zoltar)] Car Website Evaluation 
// @author          Original by robert ~ mod by Loveable_Cactus ~
// @namespace       https://greasyfork.org/en/users/13168-robert
// @include         *
// @version         1.1
// @grant           none
// @require         http://code.jquery.com/jquery-2.1.4.min.js
// @description:en  Open window, hotkeys
// @description Open window, hotkeys
// ==/UserScript==
/*
to add:
- instruction hide
- auto submit
- instant copypaste
- compact layout
- close new window upon submit
*/
if ($("h2:contains('In this HIT, please answer the following')").length)
  runScript();

function runScript()
{
  window.open($("a:contains('http')").text(), "", "_blank");
  var companyNameTextField = window.document.getElementById("name");
  window.addEventListener("message", companyNameListener, false);
  window.onkeydown = function(e)
  {
    // Radio button group 1 - Website Loads Correctly?
    if (e.keyCode === 49) //1 key 
      $('input:radio[name=siteavailable]')[0].checked = true;    
    if (e.keyCode === 50) //2 key
      $('input:radio[name=siteavailable]')[1].checked = true;
  
    // Radio button group 2 - Is new car dealer?
    if (e.keyCode === 81) //Q key 
      $('input:radio[name=isnewcardealer]')[0].checked = true;    
    if (e.keyCode === 87) //W key 
      $('input:radio[name=isnewcardealer]')[1].checked = true; 





    if (e.keyCode === 192 ) // ` = submit
      $("input[type='submit']" ).click();
    if (e.keyCode === 220 ) // \ = submit
      $("input[id='site_availability']" ).click();    
  };
} // end function runScript()

function companyNameListener(l) {companyNameTextField.value = l.data.A;}
$(window).mouseup
(
  function(e) 
  {       
    window.opener.postMessage({A: getSelection().toString()},'*');
  }
);