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

Open window, hotkeys

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

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

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

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

您需要先安装一款用户脚本管理器扩展,例如 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()},'*');
  }
);