This repository has been archived by the owner on Dec 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
JSON Object recieving #92
Open
bhavul
wants to merge
12
commits into
privly:master
Choose a base branch
from
bhavul:InjectableFailPassive
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f91f23c
Merge pull request #1 from privly/master
bhavul 0dcbd15
Syncing fork - Merge remote-tracking branch 'upstream/master'
bhavul 27141df
Syncing new commits. Merge remote-tracking branch 'upstream/master'
bhavul 5fbf466
Merge remote-tracking branch 'upstream/master'
bhavul 63c4b92
Merge remote-tracking branch 'upstream/master'
bhavul f1280b3
Merge remote-tracking branch 'upstream/master'
bhavul e821923
JSON recievin and parsing works.
bhavul 226d1a9
added functions for hiding, showing and removing iframe
bhavul 753ace0
added message sending recieving API doc
bhavul bff6486
inconsistency removed and nit
bhavul 6b151c6
generic listener added
bhavul aa4a053
remove listener leftover fixed
bhavul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Sending and Recieving Messages API | ||
======================================= | ||
|
||
Any injected application can send messages to the content script (privly.js) to trigger it to resize, show or hide the iframe content. JSON is used for this communication. Injected application can use the following blueprint for sending messages :- | ||
|
||
An example of a message could be: | ||
``` | ||
{command:"resize", | ||
frameID:"name of iframe" | ||
heightNEW:No. of pixels, | ||
} | ||
``` | ||
|
||
**A possible syntax for sending this message over the host would be:** | ||
```javascript | ||
var message = {command:"resize", | ||
frameID:"name of iframe" | ||
heightNEW:No. of pixels | ||
}; | ||
msgJSON = JSON.stringify(message); | ||
parent.postMessage(JSON.stringify(resizeData),"*"); | ||
``` | ||
|
||
##Possible set of options | ||
|
||
* command : "resize" | "hide" | "show" | ||
* frameID : "<name of iframe>" | ||
* heightNEW : no. of pixels | ||
|
||
|
||
While using `hide` or `show` as the command, `heightNEW` doesn't matter and you may or may not include it in your message. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't this set elsewhere? Why are you setting it now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smcgregor In which field is it set? I checked the whole iframe element by going through it, the original link wasn't there. So, I added this and have used it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/privly/privly-chrome/blob/master/javascripts/content_scripts/privly.js#L327
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smcgregor Yes. It is set for the element 'a'. And, 'a' is local to that method. I just have access to iframe element here, so had to put the original link as a new attribute into iframe.
Is there a way I could get 'a' corresponding to the iframe directly?