Greasy Fork is available in English.

議論 » 作成依頼

Automatically Modify Post Data/Parameter(s)

§
投稿日: 2015/07/26

Automatically Modify Post Data/Parameter(s)

Im wondering if someone can write a script that would allow me or other users to edit the script in order to automatically change post data like you can do in Tamper Data. Tamper Data is manual though I would really like to see an automatic one which is why I am here :)

Qon
§
投稿日: 2015/07/26

What is "the script"?
What site are you requesting this script for? All of them?

§
投稿日: 2015/07/26
What is "the script"?
What site are you requesting this script for? All of them?

I want it for just any site really (i can edit it) if you are considering taking up the challenge you could just try making a script for live.com and just make it so it can replace one of the post values.

Qon
§
投稿日: 2015/07/26
編集日: 2015/07/26

// ==UserScript== // @name Thingy // @description Makes stuff happen. // @namespace https://greasyfork.org/en/users/11891-qon // @include * // @grant none // ==/UserScript==

window.addEventListener('click', catchEvent) // it catches all the clicks which isn't necessary but it works...

function catchEvent(ev) {
  // check that its an input submit box
  if(ev.target.tagName == 'INPUT' && ev.target.type == 'submit') {
    var sub = ev.target
    //find the form tag that contains the submit button you clicked
    var form = sub.parentNode
    while(form != null && form.tagName != 'FORM') {
      form = form.parentNode
    }
    if(form.tagName == 'FORM'){
      var inputs = form.getElementsByTagName('input')
      var s = ''
      // check all input boxes
      for(input of inputs) {
        s += 'type: ' + input.type + '  id: ' + input.id + '  value: ' + input.value + '\n'
        // change the values of it's the email or password field
        if(input.type=='email') {
          input.value='hello@hotmail.com'
        }
        if(input.type=='password') {
          input.value='p455w0rd'
        }
      }
      alert(s) // display all input fields in the form
    }
  }
}

This changes the email field to 'hello@hotmail.com' and password field to 'p455w0rd'. Was it something like this you wanted? Should work on most sites but tested on login.live.com. Anything that has a submit button in a form and where the email and password fields have the correct type set should work.

woxxomMod
§
投稿日: 2015/07/26

It might be better to use document.addEventListener('submit', catchEvent) to also process submits triggered by pressing the Enter key.

Qon
§
投稿日: 2015/07/26
編集日: 2015/07/26

@wOxxOm But click does catch submits with enter. At least in firefox.

And yes the qode could be prettier. That can be an exercise for Rav_n q:

返信を投稿

返信を投稿するにはログインしてください。