Greatly annoyed with my own ignorance. HELP

Discussion in 'Scripts' started by awfiedler84, Nov 4, 2012.

  1. awfiedler84

    Joined:
    May 13, 2012
    Messages:
    58
    Likes Received:
    0
    So I'm trying to write a userstyle for Stylish on Firefox to set the iframe height on hits to 1200 no matter what. After what seems like hours of trying this and that my style does not do anything. What am I doing wrong?

    @-moz-document domain("mturk.com"), url-prefix("https://www.mturk"), url-prefix("http://www.mturk") {
    iframe {
    height: 1200 !important;
    }
    }

    Is what I've currently landed on, but I've tried numerous other ways. The iframe has a name of ExternalQuestionIFrameand is a child of only a form tag with no id, the body and the html tags. The base height (which is what I typically want changed) is 400.
     
  2. ThirdClassIntMasterTurker

    Joined:
    Sep 8, 2012
    Messages:
    86
    Likes Received:
    0
    I can't help with Stylish, but this greasemonkey script should work:
    Code:
    // ==UserScript==
    // @name        Fix iframe
    // @namespace   localhost
    // @include     https://www.mturk.com/mturk/*
    // @version     1
    // ==/UserScript==
    
    var iframes = document.getElementsByName('ExternalQuestionIFrame');
    if (iframes[0] != null)
      iframes[0].style.height = '1200';
    
    // If no 'ExternalQuestionIFrame' try 'HTMLQuestionIFrame'
    if (iframes[0] == null)
    {
      iframes = document.getElementsByName('HTMLQuestionIFrame');
      if (iframes[0] != null)
        iframes[0].style.height = '1200';
    }
    
    Remove that 'HTMLQuestionIFrame' part if you only want to change external questions.
     
  3. sasquatch

    sasquatch User

    Joined:
    Oct 19, 2012
    Messages:
    4,446
    Likes Received:
    0
    when you're logged into mturk, the protocol is actually https, not http... also, you might want to add a unit value to height, i'm assuming you're going for pixels so px
     

Share This Page