Commit Graph

5496 Commits

Author SHA1 Message Date
David Wick
9752b4dc47 Comment embeds: fix early closing body tag 2015-02-23 18:09:57 -08:00
David Wick
a400524cb5 Comment embeds: Add event pixel tracking 2015-02-23 18:09:57 -08:00
David Wick
ef1d38f4f7 Comment embeds: change footer bg color 2015-02-23 18:09:57 -08:00
David Wick
82090d9ce9 Comment embeds: fix reflow flicker in firefox
Firefox was returning a height of 0 when an iframe was hidden.
This was causing unnecessary reflows when toggling between the
options for comment embeds. There doesn't seem to be a good
reason to broadcast a 0 height up to the parent window, so
i've added a guard for that.
2015-02-23 18:09:57 -08:00
David Wick
400abd9435 Comment embeds: improve frame styles
This moves the margin, border-radius, and box-shadow to the iframe
itself so things don't have to be awkwardly inset.
2015-02-23 18:09:57 -08:00
umbrae
56774c2ea4 Split embed preparation into two stages to allow framing on 304s
Safari respects `X-Frame-Options` on 304s, causing embeds to break
if `c.allow_framing` is not set before we return a 304. This splits
embed prepping into two stages so that we can set `c.allow_framing`
before we check modified headers.
2015-02-23 18:09:57 -08:00
David Wick
3859ce58b6 Comment embeds: increased vertical padding of footer 2015-02-23 18:09:57 -08:00
David Wick
a78d6238d5 Comment embeds: remove dead/erroneous code 2015-02-23 18:09:57 -08:00
David Wick
d70b844093 Fix media_domain being treated as a 3rd party cname
When constucting urls to 3rd party cnames, for example,
"thecutelist.com" -> /r/aww, this forces the removal of the
`sr_path`.  This was unintentionally affecting pages served by
the `media_domain`, eg. comment & live embeds.
2015-02-23 18:09:57 -08:00
David Wick
491fa288a3 Comment embeds: fix deleted comment rendering
Comments with no replies should still show the message: "This
comment was deleted."
2015-02-23 18:09:56 -08:00
David Wick
9e0e078687 Comment embeds: Fix relative links
Relative links to reddit (username autolinks for example) should
go to reddit.com not the static domain.
2015-02-23 18:09:56 -08:00
David Wick
2bac44bd56 Comment embeds: remove tracking 2015-02-23 18:09:56 -08:00
David Wick
5eac2ba9ed Comment embeds: fix display when a user account has been deleted 2015-02-23 18:09:56 -08:00
David Wick
4898d11c77 Comment embeds: add missing translations 2015-02-23 18:09:56 -08:00
David Wick
773b4a1d19 Comment embeds: add/improve link instrumentation 2015-02-23 18:09:56 -08:00
David Wick
01b4d727e5 Comment embeds: comment links should include sr path 2015-02-23 18:09:56 -08:00
umbrae
c88c818b26 Add underline to links in embeds 2015-02-23 18:09:56 -08:00
David Wick
ef9609c9c1 Comment embeds: fix user link being in a sr context
This was causing custom style sheets to be applied to user pages
which has a tendency to break things.
2015-02-23 18:09:56 -08:00
David Wick
1a1fac7517 Comment embeds: visual improvements 2015-02-23 18:09:56 -08:00
David Wick
844c9154ff Add can_embed to wrapped Comment for rendercache
Similar to `can_save`, `can_embed` controls the visibility of the
embed button.  This needs to be apart of the `Comment` or else
the rendercache will use the wrong version on heavily cached
comments.
2015-02-23 18:09:56 -08:00
David Wick
de43277cec Add a link to reddit in the footer 2015-02-23 18:09:56 -08:00
David Wick
eace788771 Fix edit control
When a data attribute is missing it should be `false` not `null`.
2015-02-23 18:09:56 -08:00
David Wick
112c26dcdd Comment embeds: instrument w/hivemind 2015-02-23 18:09:56 -08:00
David Wick
df5b1e5e47 post-message.js: fix method overload 2015-02-23 18:09:55 -08:00
David Wick
26524c5e51 post-message.js: fix origin checking file: protocol 2015-02-23 18:09:55 -08:00
David Wick
dad6caa30c Comment embeds: add togglable help for edit control 2015-02-23 18:09:55 -08:00
David Wick
d667ffef24 Comment embeds: reduce reflow 2015-02-23 18:09:55 -08:00
xiongchiamiov
e29e727791 Comment embeds: add per-comment token
While in the process of rolling out comment embeds, we'd like to have restrict
our beta a bit - because by their nature, once embeds are out, we lose control
over them, making it extremely difficult to make changes.  So we're restricting
the embed generation modal to a certain subset of users (for now), but a savvy
user could simply modify an existing public embed to plug in another comment
id, which would defeat the point of restricting it.  Enter hmac.

We know generate a unique token for each comment, and only by using the
appropriate token will your embed work.  This will be transparent to users, as
its just another piece of the html that they copy and paste onto their website.

Performance-wise, we're generating tokens for every comment that can be
embedded.  However, for now that's a limited set, and the operation is pretty
fast (roughly 5ms for 1000 tokens on my dev VM); if that becomes a problem, we
can easily take this code out after we no longer need the restriction.
2015-02-23 18:09:55 -08:00
xiongchiamiov
e454857b31 add_sr: allow alternate domains for https pages
`add_sr()` has had, since reddit/reddit@b57dff70, a special-case when the
requested page was on https, where it would ignore whatever domain it would
normally set and use the current one instead.  As best as we can tell, this was
to prevent issues with a lack of https support on all reddit domains, eg links
on `https://pay.reddit.com` pointing to `https://www.reddit.com`.  This should
no longer be an issue.

Additionally, it has caused problems with the comment embeds, which are served
from `redditmedia.com` but need to have links pointing to `www.reddit.com`.

Now that this special-case doesn't exist, the function should act more
intuitively.  And hopefully that doesn't break anything too badly. :p

The request from the comment embed javascript to get the actual embed has been
going through `g.media_domain`.  This in turn meant that sometimes (namely,
when the embed was placed on an https page) the link to the comment was also
heading through the media domain.  While this works, we'd rather have users go
through the standard `www.reddit.com` domain for brand, caching, and probably
other infrastructure reasons.
2015-02-23 18:09:55 -08:00
xiongchiamiov
bf300d1ecc Comment embeds: fix subreddit link
At the bottom of the comment embeds is a link to the subreddit from which the
comment was extracted.  This link has had an extra domain appended, so we'd end
up with URLs like `http://www.redditmedia.com/www.reddit.com/r/worldnews`.

The problem stemmed from the fact that `get_domain()` returns a protocol-less
URL (`www.reddit.com/r/worldnews`).  Thus, `add_sr()` (which it ends up being
passed into) assumes it has been handed a relative URL and appends a domain.

Instead of getting the entire domain, we now just get the subreddit path and
let `add_sr()` handle the domain (and protocol) later.
2015-02-23 18:09:55 -08:00
David Wick
a5728036a2 Comment embeds: prevent embeds from being converted multiple times
With multiple embed snippets comes the inclusion of the embed
script multiple times (and therefore multiple execusions of it).
This fixes the race condition that occurs when `init` is run
multiple times before the `<div>` is removed and as a result
multiple iframes for the same embed are included in the page.
2015-02-23 18:09:55 -08:00
David Wick
c54d035c5e Fix embed footer being cutoff
Tables treat `height` as `min-height` and disregard `min-height`
in firefox.
2015-02-23 18:09:55 -08:00
David Wick
99e3b00039 post-message.js: Allow events to be scoped to a source.
Embeds were listening to `postMessage`s from other embeds and
causing weird behaviors.
2015-02-23 18:09:55 -08:00
David Wick
08f61238a6 Fix 1x snoo crop 2015-02-23 18:09:55 -08:00
David Wick
fe0fb1723c Comment embeds: fix missing "load more comments" regression. 2015-02-23 18:09:55 -08:00
David Wick
099c1ecba1 Do not mangle names of embed scripts 2015-02-23 18:09:55 -08:00
David Wick
59cddc30bc Comment embeds: only show button on permalink page 2015-02-23 18:09:55 -08:00
David Wick
8ef0d66922 Comment embeds: add feature flag 2015-02-23 18:09:54 -08:00
David Wick
9584157319 Remove new login flow feature flag 2015-02-23 18:09:54 -08:00
David Wick
77ff39a511 Remove dead compact login code 2015-02-23 18:09:54 -08:00
David Wick
cc585b9345 Refactor modals to use a common component 2015-02-23 18:09:54 -08:00
David Wick
e5d579e020 Comment embeds: add UI for creating embed code 2015-02-23 18:09:54 -08:00
David Wick
6493c95ea2 Remove unused css 2015-02-23 18:09:54 -08:00
David Wick
3349dda147 Comment embeds: add support for data attributes in menus 2015-02-23 17:38:52 -08:00
David Wick
7acbd4d6b0 Comment embeds: support including scripts using absolute paths
This is useful for generating the script tags needed by the embed
snippet in such a way that it works for both dev and production
environments.
2015-02-23 17:38:43 -08:00
David Wick
cb70bc65d9 Comment embeds: add bootstrap modal 2015-02-23 17:38:37 -08:00
David Wick
47edd7e3d2 Comment embeds: add new framable template 2015-02-23 17:37:58 -08:00
David Wick
01e124c52b underscore.js: Remove "/" as an escape character 2015-02-23 17:36:20 -08:00
David Wick
88e7eaab9d Ensure namespace is defined
Previously this timings snippet assumed that window.r was an
defined and an object.  This ensures we don't throw errors as a
result for admin bar timings.
2015-02-23 17:36:13 -08:00
David Wick
caeab56e17 Gold: remove unused/broken tracking
This was causing issues with people who have adblock/ghostery and
is no longer being used so I removed it.
2015-02-23 11:46:12 -08:00