privly / privly-firefox

Official Privly Browser Extension for Firefox - Allows for Viewing and Posting Content on Any Website Without the Host Site Having Access
https://priv.ly
MIT License
21 stars 15 forks source link

Active form elements don't update when posting to Privly #17

Closed smcgregor closed 12 years ago

smcgregor commented 12 years ago

Problem: Facebook (and likely others) submit the form element without the URL as updated by the extension. Currently, this will post the clear text to Facebook, and when we have the secure posting form, it will try to post empty contents. We need to simulate a user typing or pasting into a form element when we create new Privly posts. This will cause host pages to look for updated content in the form element.

We should trigger key press events (keydown, keypress, keyup, change) on the form element receiving the Privly link. Currently, this functionality belongs in the success callbacks defined within extension-host-interface.js.

  jQ.ajax({
    data: { auth_token: privlyAuthentication.authToken,
      "post[content]": value,
      "post[public]": postPrivacySetting,
      endpoint: "extension", browser: "firefox", version: "0.1.1.1"
    },
    type: "POST",
    url: contentServerUrl + "/posts.json",
    contentType: "application/x-www-form-urlencoded; charset=UTF-8",
    dataType: "json",
    accepts: "json",
    success: function (data, textStatus, jqXHR) {
      target.value = jqXHR.getResponseHeader("privlyurl");

      //
      //
      //trigger element change events here
      //
      //
    }
  });
smcgregor commented 12 years ago

I bumped this one to critical. Another integration point having difficulty is the message history window on Facebook. When you use the encrypted message endpoint, the element receives the URL, but this locks the posting form for some reason.

It works if: You type some text into the form element before posting.

It doesn't work if: You right click on the form element before typing into it.

Note: this problem only appears on Facebook's message history window. It is sometimes difficult to get to this window since it is shown dependent on whether the other user has signed on, and some other mysterious factors.

@balajiathreya or @born2c0de Do either of you have time to work on this?

born2c0de commented 12 years ago

Not this week. I can probably work on it next week. I might have a fix though. All you need to do is trigger the keydown event for the textarea before posting the link.

balajiathreya commented 12 years ago

Yes. I'll take a look into this today.

On Tue, Jul 31, 2012 at 8:16 PM, Sanchit Karve < reply@reply.github.com

wrote:

Not this week. I can probably work on it next week. I might have a fix though. All you need to do is trigger the keydown event for the textarea before posting the link.


Reply to this email directly or view it on GitHub: https://github.com/privly/privly-firefox/issues/17#issuecomment-7417408

Balaji.

smcgregor commented 12 years ago

Thanks Balaji.

Sanchit: I think there may be more shenanigans behind this particular form element, but simulating the normal series of click and keyboard events is a great place to start.

-Sean

On Tue, Jul 31, 2012 at 8:41 PM, Balaji Athreya reply@reply.github.com wrote:

Yes. I'll take a look into this today.

On Tue, Jul 31, 2012 at 8:16 PM, Sanchit Karve < reply@reply.github.com

wrote:

Not this week. I can probably work on it next week. I might have a fix though. All you need to do is trigger the keydown event for the textarea before posting the link.


Reply to this email directly or view it on GitHub: https://github.com/privly/privly-firefox/issues/17#issuecomment-7417408

Balaji.


Reply to this email directly or view it on GitHub: https://github.com/privly/privly-firefox/issues/17#issuecomment-7417677

smcgregor commented 12 years ago

@balajiathreya How is this going?