Commit graph

18 commits

Author SHA1 Message Date
rhymes
f9506affb5
Use faster JS selection methods (#11409)
* Add JS tips section to frontend documentation

* Replace document.getElementsByTagName('body') with document.body

* Replace querySelectorAll with faster selecting methods where appropriate

* Replace querySelector with faster selecting methods where appropriate

* Fix typo

* Fix forEach and getElementsByClassName

* Change querySelector* to faster methods in erb files

* Change querySelector* to faster methods in ruby files

* Fix runkit tag

* Various fixes

* Update app/assets/javascripts/initializers/initializeEllipsisMenu.js

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Update app/assets/javascripts/utilities/slideSidebar.js

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>

* Commenting out flaky spec

Co-authored-by: Ridhwana <Ridhwana.Khan16@gmail.com>
2020-11-16 17:35:50 +01:00
Nizar
7058d628af
Added Copy Permalink Functionality to Comment Dropdown (#8311)
* Added Copy Permalink Functionality to Comment Dropdown

Copy functionality is similar to the way 'copy article link' is implemented. It checks for the android bridge first, then the navigator, then fallsback to the default document copy command

Since the codes were really similar, I moved the copy functionality to a function of its own with callbacks and fallbacks as lambdas, and triggered it with the copyArticleLink and the copyPermalink

* Replaced Copy Permalink Callbacks with Promises

* Keep anchor tags instead of buttons (#1)

* copy permalink using anchor tag

* Missing closing button tag

* Adds 'Copied to Clipboard' Snackbar Message

* Patches bug introduced in #10323

Patch suggested in following comment: https://github.com/forem/forem/pull/8311\#pullrequestreview-492011202

* Removes import statement for addSnackbarItem and Suppresses ESLint Error

Initializer runs in global scope

* Unhandles exception when copying permalink so Honeybadger can handle it

* Replaces ButtonListener suffix for copyPermalink method with Listener

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2020-11-11 08:32:10 -05:00
Elliot
6a1f560f65
[deploy] Fix dropdowns breaking after adding comment (#10976)
What was wrong?
`initializeCommentDropdown` is called when a new comment is added.
`initializeCommentDropdown` calls `addDropdownListener(dropdown)` on all
`.dropbtn` elements. Elements with the `.dropbtn` class already exist on
the page so an extra listener is added to it whenever a comment is
added.

How was it fixed?
Whenever a dropdown listener is added to an element with the
`.dropbtn` class, an attribute is set on that element so we know it
already has a dropdown listener. When we add listeners to elements with
the `.dropbtn` class in the future, we don't add them to elements with
the attribute.
2020-10-21 08:15:10 -04:00
Fernando Valverde
1aa8233d9e
Adds runtime copy to clipboard (#10323) 2020-09-14 14:45:54 -04:00
Fernando Valverde
9da71a47c7
[deploy] Introduces Runtime class for standardized & other native cleanup + replace podcast GA with ahoy (#10026) 2020-08-28 05:52:04 -06:00
Ben Halpern
4a8936a18e
[deploy] Slight fix in dropdown menu code (#9095) 2020-07-03 00:08:22 -04:00
Nick Taylor
dcc882c0c5
[deploy] Fixed the three dot menu on the article page. (#9088) 2020-07-02 21:13:26 -04:00
Ben Halpern
2a31f7b9de
[deploy] Remove report-abuse link from base HTML document into JavaScript (#9059) 2020-07-01 16:29:22 -04:00
ludwiczakpawel
16f4d7d46a
[deploy] Article Design update (#8234)
* flare tag line height

* .

* init

* widgets

* widgets lists

* new tabs on home

* instantclick

* .

* rethinking css

* .

* .

* empty space

* init

* campaign widget

* .

* merge

* .

* update layout

* fix sidebars on home page

* .

* fix onboarding x

* test

* spec

* test

* toolbar fix

* more

* test

* better handling ads

* .

* spec

* card border

* .

* .

* actions bar

* cleanup

* animation

* test

* button width

* .

* better responsiveness and author boxes

* meta info

* padding

* better animation

* optimize videos

* fixes

* spec

* .

* codeblocks in comments

* whoops

* Use .present? correctly as it preloads items

* sticky nav

* Update app/views/articles/_sticky_nav.html.erb

I don't know what I'm doing but @benhalpern says so! e8c0f337a5 (r440248874)

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* Update app/views/articles/show.html.erb

I don't know what I'm doing but @benhalpern says so! e8c0f337a5 (r440247802)

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* little fixes

* Update app/assets/stylesheets/article-show.scss

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>

* pawel updating ruby code......

* actually better merge

* semantic updates

* .

Co-authored-by: rhymes <rhymesete@gmail.com>
Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-06-17 09:57:57 -04:00
Fernando Valverde
5dc0ebbb04
Copy to clipboard fixes including support for Android Native Bridge (#7382)
* Adds Clipboard Async API & makes use of Android Native Bridge interface for write post image copy to clipboard

* Checks for clipboard api support before trying to use it

* Adds support for comment dropdown copy link

* Adds AndroidBridge to globals definition
2020-04-21 10:36:49 -04:00
Mac Siri
d2373b5678
Add Clipboard polyfill (#4824) [deploy] 2019-11-20 11:32:30 -05:00
Yash Dave
d307ce7469 Fix JavaScript Console errors in /Comments sub-page of any article (#4446)
* Fix JavaScript Console errors in /Comments sub-page of any article

- Make use of `document.body.contains()` to check if the element is present before trying to Add or Remove Event listeners or assign attribute values to the same.

* Implement recommendations for changes

- Switch String.match() to Regex.test() in order to have consistent Boolean return.
- Switch if(document.body.contains(element)) to if(element) as no need to check if the element is in visible context, only whether present or not.

* Implement recommendations for changes

- Switch String.match() to Regex.test() in order to have consistent Boolean return for isIOSDevice().
- Switch if(document.body.contains(element)) to if(element) as no need to check if the element is in visible context, only whether present or not.
2019-10-16 09:06:28 -04:00
Yash Dave
fd1b003334 Refactor/fix initializeCommentDropdown.js (#4318)
* Fix eslint issues in initializeCommentDropdown.js
- file was already compliant, just needed to add
  'use strict'.

* remove unnecessary eslint rule
2019-10-09 08:19:08 -04:00
Mac Siri
f62bc7faa8 Fix js-breaking webcomponent (#3087)
* Remove webcomponents-loader

* Add unpkg webcomponent-loader

* Update clipboard-copy-element to include @githubscope

* Make WebComponent loading async

* Simplify clipboardCopy
2019-06-10 11:23:42 -04:00
Ben Halpern
2f69ca91ed
Folllow on for show page adjustments and fix uglifier issue (#2841)
* Simplify article show page reactions

* Clean up styling and adjust zen mode logic

* Remove unused variables

* Update app/views/articles/_actions.html.erb

Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>

* Small style mods

* Slight padding change

* Finalize new show page button design

* Remove uncompileable JS and small css changes
2019-05-15 11:29:46 -04:00
Ben Halpern
dd20e70f12
Simplify article show page reactions (#2827)
* Simplify article show page reactions

* Clean up styling and adjust zen mode logic

* Remove unused variables

* Update app/views/articles/_actions.html.erb

Co-Authored-By: Nick Taylor <nick@iamdeveloper.com>

* Small style mods

* Slight padding change

* Finalize new show page button design
2019-05-15 10:32:36 -04:00
Benny Powers
5f9a8a7501 Add click-to-copy to article share dropdown (#1579) 2019-05-14 17:45:40 -04:00
Mac Siri
301c6080e3 Initial commit 2018-02-28 16:11:08 -05:00