Commit Graph

162 Commits

Author SHA1 Message Date
whyisjake
3dd9628aae Build/Test Tools: Enable JSDocs to be linted with ESLint.
As part of the [Javascript Inline Docs Initiative](https://make.wordpress.org/core/handbook/docs/inline/js/) this add some tooling to lint Javascript docblocks. Two new commands:

* `npm run lint:jsdoc`
* `npm run lint:jsdoc:fix`

The latter will run the linter and try to fix an possible issues automatically.

Fixes #43828.
Props netweb, atimmer, kamataryo, whyisjake.


Built from https://develop.svn.wordpress.org/trunk@48650


git-svn-id: http://core.svn.wordpress.org/trunk@48412 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 23:35:02 +00:00
Dominik Schilling
93662e1d32 I18N: Fix typo in [48348].
Props swizzzpidy.
See #50578.
Built from https://develop.svn.wordpress.org/trunk@48351


git-svn-id: http://core.svn.wordpress.org/trunk@48120 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 21:34:04 +00:00
Dominik Schilling
1145607a85 I18N: Use wp.i18n for translatable strings in wp-admin/js/edit-comments.js.
This removes the usage of `wp_localize_script()` for passing translations to the script and instead adds the translatable strings in the script directly through the use of `wp.i18n` and its utilities.

Props swissspidy, ocean90.
See #20491.
Fixes #50578.
Built from https://develop.svn.wordpress.org/trunk@48348


git-svn-id: http://core.svn.wordpress.org/trunk@48117 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 20:17:02 +00:00
Sergey Biryukov
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
Sergey Biryukov
a6949956d1 Administration: Capitalize Trash consistently in various messages and comments.
When used as a noun referring to the "virtual" place, `Trash` should be capitalized.

Props garrett-eclipse, aandrewdixon, Presskopp.
Fixes #45317.
Built from https://develop.svn.wordpress.org/trunk@47233


git-svn-id: http://core.svn.wordpress.org/trunk@47033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 04:12:07 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
ffcb1d0d99 Comments: In AJAX response when deleting a comment, account for   as a thousands separator in total_items_i18n and total_pages_i18n numbers.
Props denisco, SergeyBiryukov.
Fixes #47953.
Built from https://develop.svn.wordpress.org/trunk@45918


git-svn-id: http://core.svn.wordpress.org/trunk@45729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-30 18:34:06 +00:00
Sergey Biryukov
9d7bd11631 Docs: Correct @since for admin/edit-comments.js, introduced in [3736].
See #47581.
Built from https://develop.svn.wordpress.org/trunk@45567


git-svn-id: http://core.svn.wordpress.org/trunk@45378 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-26 18:19:52 +00:00
atimmer
225de4e6eb Docs: Improve JSDoc for admin/edit-comments.js.
Props manuelaugustin, diedeexterkate, thulshof, Xyfi, ireneyoast.
Fixes #47581.

Built from https://develop.svn.wordpress.org/trunk@45558


git-svn-id: http://core.svn.wordpress.org/trunk@45369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-20 14:45:51 +00:00
atimmer
8756207ef2 Comments: Open comment quick edit on double click.
In [42767] the quick edit button changed from a link to a button. This caused the jQuery code that selects on a link to no longer work. This commit restores the previous behavior.

Fixes #47572.
See #43382, #38677.

Built from https://develop.svn.wordpress.org/trunk@45553


git-svn-id: http://core.svn.wordpress.org/trunk@45364 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-20 10:06:51 +00:00
Andrea Fercia
e901bc4c2b Accessibility: Improve the Comments and Privacy count text.
- standardizes the Comment count string to `%s Comment in moderation', '%s Comments in moderation` so it can be bulk-updated
- adds the string as visually hidden text in the admin menu 
- introduces an `updateInModerationText` JS simple function, responsible to correctly update all the related text using the data from the AJAX response
- adds a visually hidden text "1 Privacy Policy update" to the Privacy menu items count
- adds/improves translators comments

Changes that apply to all the count bubbles (Updates, plugins, etc.)
- makes the bubbles and their text slightly bigger
- improves the active menu item bubble contrast by changing the background color to red (option 2 in the screenshot attached in a previous comment)

Props adamsoucie, afercia.
Fixes #33030.

Built from https://develop.svn.wordpress.org/trunk@44924


git-svn-id: http://core.svn.wordpress.org/trunk@44755 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-18 15:22:53 +00:00
Andrea Fercia
6fe48278ea Accessibility: Comments: Improve links and buttons semantics and interaction.
With the exception of the "Edit" link, the "row actions" controls in the Comments table behave differently depending if JavaScript support is on or off.
When JavaScript support is off, they behave like links. When JavaScript support is on, they behave like buttons and they need to be buttons or have an ARIA `role="button"` added via JavaScript.

Lastly, the buttons in the Reply/Quick Edit form and the "Add Comment" in the edit post page meta box need to be buttons.

Fixes #43412.

Built from https://develop.svn.wordpress.org/trunk@44759


git-svn-id: http://core.svn.wordpress.org/trunk@44591 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-02-20 23:37:50 +00:00
omarreiss
bdbaccce37 General: Explicitly assigns all JS globals to the window.
Many variables in the JavaScript were defined in the global scope without being explicitly assigned to the window. When built with Webpack, the code gets encapsulated in anonymous functions and those implicit globals get assigned to the wrong scope. This patch prevents that from happening.

Fixes #44371. See #43731.

Built from https://develop.svn.wordpress.org/trunk@43577


git-svn-id: http://core.svn.wordpress.org/trunk@43406 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-19 13:33:24 +00:00
atimmer
bde558be2f Docs: Add file doc @output annotations.
These annotations make it clear to the reader of a JavaScript source
where the build process outputs to. These annotations can later be
integrated in a webpack configuration. This way there is one source of
truth.

The `build` folder is omitted from the paths, because a single JS file
shouldn't not be responsible of knowing where outputs in general will
end up at. A file only knows its output location relative to the
project.

Props adamsilverstein, herregroen, omarreiss, pento.
Fixes #44361.

Built from https://develop.svn.wordpress.org/trunk@43347


git-svn-id: http://core.svn.wordpress.org/trunk@43175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-06-28 02:30:15 +00:00
Andrea Fercia
d2d64f13c7 Accessibility: Change the comments "Quick Edit" and "Reply" links to buttons.
For better accessibility and semantics, user interface controls that perform an
action should be buttons. Links should exclusively be used for navigation.

Props Cheffeid, audrasjb, afercia.
See #43382, #38677.
Fixes #43376.

Built from https://develop.svn.wordpress.org/trunk@42767


git-svn-id: http://core.svn.wordpress.org/trunk@42597 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-28 22:36:34 +00:00
Andrea Fercia
a42b9cebde Quick/Bulk Edit: Improve the inline error messages styling.
- uses the core `notice` styles for the Quick Edit form inline error messages
- adds missing periods at the end of a few error messages

Props ocean90, karmatosed, melchoyce, afercia.
Fixes #35496.

Built from https://develop.svn.wordpress.org/trunk@41684


git-svn-id: http://core.svn.wordpress.org/trunk@41518 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-02 21:52:52 +00:00
Pascal Birchler
3e189479a7 List Tables: Hide 'Empty Trash' and 'Empty Spam' buttons when view is already empty.
Props ivantedja, Presskopp, printsachen1, Jaydeep Rami, mathieuhays, cazm.
Fixes #38341.
Built from https://develop.svn.wordpress.org/trunk@40297


git-svn-id: http://core.svn.wordpress.org/trunk@40204 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-03-17 16:54:42 +00:00
Rachel Baker
8b0e1859bc Comments: Keep comments safe in the Edit Post screen.
Warns users that have added a new Comment or began editing an existing without saving their changes, before they press the “update” button which would wipe out their comment changes.

Fixes #32818.

Props polevaultweb.
Built from https://develop.svn.wordpress.org/trunk@37303


git-svn-id: http://core.svn.wordpress.org/trunk@37269 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-22 21:43:28 +00:00
Scott Taylor
be59d289b7 Dashboard: toggle the "View" link for comments when Approving / Unapproving from the Dashboard widget.
Fixes #35518.

Built from https://develop.svn.wordpress.org/trunk@37302


git-svn-id: http://core.svn.wordpress.org/trunk@37268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-04-22 21:30:28 +00:00
Sergey Biryukov
2099e388bb Comments: Avoid extra AJAX requests when undoing Spam or Trash actions.
Props afercia.
Fixes #35904.
Built from https://develop.svn.wordpress.org/trunk@36774


git-svn-id: http://core.svn.wordpress.org/trunk@36741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-02-29 03:20:26 +00:00
Dominik Schilling
b3d8732c17 jQuery: Replace the use of the .size() method with the .length property.
The `.size()` method is deprecated since jQuery 1.8. The `.length` property is preferred because it doesn't have the overhead of a function call.

See https://api.jquery.com/size/.
See #35380.
Built from https://develop.svn.wordpress.org/trunk@36286


git-svn-id: http://core.svn.wordpress.org/trunk@36253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-01-13 16:17:27 +00:00
Dominik Schilling
27e4384e89 Comments: Dynamically update the document title text for all languages, not only English.
See [33821].
Fixes #33414.
Built from https://develop.svn.wordpress.org/trunk@35615


git-svn-id: http://core.svn.wordpress.org/trunk@35579 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-11 21:00:27 +00:00
Andrew Ozz
a6cf0b41a6 JS: in event callbacks replace the very outdated return false with preventDefault().
Props adamsilverstein.
Fixes #18590.
Built from https://develop.svn.wordpress.org/trunk@34977


git-svn-id: http://core.svn.wordpress.org/trunk@34942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-09 01:27:27 +00:00
Andrea Fercia
0acededa82 In wp_comment_reply() change the H5 headings in fieldset legends for better accessibility.
Also, add a "Edit Comment" legend before the Quick Edit form to pair it with "Reply to Comment" and "Add new Comment" and move the Name, Email, and URL fields after the Comment textarea.

Props joedolson, afercia.

Fixes #33757.
Built from https://develop.svn.wordpress.org/trunk@34743


git-svn-id: http://core.svn.wordpress.org/trunk@34708 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-01 14:52:25 +00:00
Scott Taylor
e87150fc06 Comments List Table: after [34179], scope the <th>s and <td>s as direct descendants of their parent row.
Fixes #33943.

Built from https://develop.svn.wordpress.org/trunk@34527


git-svn-id: http://core.svn.wordpress.org/trunk@34491 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-25 02:21:26 +00:00
Scott Taylor
44822831fe Comments List Table JS: move the dynamic count functions into closure scope so that setCommentsList AND commentReply can access them. Update counts when replying inline.
Fixes #33403.

Built from https://develop.svn.wordpress.org/trunk@34517


git-svn-id: http://core.svn.wordpress.org/trunk@34481 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 20:16:49 +00:00
Scott Taylor
4671e03766 Comments List Table: include count for "All". Dynamically update.
Fixes #17275.

Built from https://develop.svn.wordpress.org/trunk@34506


git-svn-id: http://core.svn.wordpress.org/trunk@34470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 17:57:25 +00:00
Scott Taylor
5b9af35c4c Comments: update Comment counts dynamically in the Right Now widget based on moderation actions in the Activity widget.
Fixes #10422.

Built from https://develop.svn.wordpress.org/trunk@34500


git-svn-id: http://core.svn.wordpress.org/trunk@34464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-24 15:53:25 +00:00
Sergey Biryukov
80165bfc4a Comments: When setting the colspan value for inline edit/reply, make sure it's actually a table and the value is not empty.
Props afercia.
Fixes #33596.
Built from https://develop.svn.wordpress.org/trunk@34179


git-svn-id: http://core.svn.wordpress.org/trunk@34147 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 13:44:34 +00:00
Scott Taylor
387f271ea5 After [34070], account for the new ID in Quick Edit JS.
Props afercia.
Fixes #33770.

Built from https://develop.svn.wordpress.org/trunk@34159


git-svn-id: http://core.svn.wordpress.org/trunk@34127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-15 01:31:26 +00:00
Helen Hou-Sandí
7f772bdaff Comments: Fix inline edit/reply on small screens.
props ocean90, SergeyBiryukov.
fixes #33596.

Built from https://develop.svn.wordpress.org/trunk@34094


git-svn-id: http://core.svn.wordpress.org/trunk@34062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-13 12:47:27 +00:00
Scott Taylor
bbbbf11961 After [33821], when dynamically updating the document title text of the Comments List Table page, operate only on the fragment that contains the comment count. This prevents us from including other numbers that may be present in the other title parts (site title, etc).
See #33414.

Built from https://develop.svn.wordpress.org/trunk@33982


git-svn-id: http://core.svn.wordpress.org/trunk@33951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-10 01:03:25 +00:00
Scott Taylor
7808d5d1fa Comments: dynamically update the document title text of the Comments List Table page when dynamically updating the number of comments awaiting moderation.
Fixes #33414. 

Built from https://develop.svn.wordpress.org/trunk@33821


git-svn-id: http://core.svn.wordpress.org/trunk@33789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-31 17:58:22 +00:00
Scott Taylor
fa2d0a2d55 Comment List Tables:
* Toggle visibility of pending bubble when a comment is dynamically moderated
* Add a CSS class to the pending bubble to hide it / remove to show it

See #11200.

Built from https://develop.svn.wordpress.org/trunk@33692


git-svn-id: http://core.svn.wordpress.org/trunk@33659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-21 17:26:26 +00:00
Scott Taylor
d65112d382 After [33662], remove unused var.
See #11200.

Built from https://develop.svn.wordpress.org/trunk@33663


git-svn-id: http://core.svn.wordpress.org/trunk@33630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 17:19:25 +00:00
Scott Taylor
20f6db2b18 Comment List Tables:
* Ensure that dynamic bubble counts are in sync by `comment_post_ID`
* Scope `:animated` to `#the-comment-list`

See #11200.


Built from https://develop.svn.wordpress.org/trunk@33662


git-svn-id: http://core.svn.wordpress.org/trunk@33629 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 16:36:25 +00:00
Scott Taylor
0e4606c13e JSHint after [33655].
Built from https://develop.svn.wordpress.org/trunk@33660


git-svn-id: http://core.svn.wordpress.org/trunk@33627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 06:31:25 +00:00
Scott Taylor
2e2223ae74 Comments List Table:
* In a view that initially has comments, but they get removed due to user actions: show the `No Items` row instead of bombing out and showing nothing (which looks broken)
* To accomplish this, in `WP_Comments_List_Table::display()`: call `->display_rows_or_placeholder()` instead of `->display()`
* Listen for the end of row `.fadeOut()`s if necessary using jQuery Promises

Fixes #11200.

Built from https://develop.svn.wordpress.org/trunk@33657


git-svn-id: http://core.svn.wordpress.org/trunk@33624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 05:54:25 +00:00
Scott Taylor
657d0f6918 Comments List Table:
* Properly increment/decrement approved/pending bubbles in `response` column

See #11200.

Built from https://develop.svn.wordpress.org/trunk@33656


git-svn-id: http://core.svn.wordpress.org/trunk@33623 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 04:02:24 +00:00
Scott Taylor
df618f3461 Comments List Table:
* Show count next to "Approved"
* Properly increment/decrement counts when row actions are clicked
* In `_wp_ajax_delete_comment_response()`, return the comment's `status` with the `supplemental` data
* Handle counts properly on each scenario of `undo`

See #11200.

Built from https://develop.svn.wordpress.org/trunk@33655


git-svn-id: http://core.svn.wordpress.org/trunk@33622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-08-20 02:51:25 +00:00
Konstantin Obenland
4e7c057a5a Check that current changes can be lost before editing another comment.
When replying to or editing a comment, double-clicking another comment will
open it in quick edit and changes to the current comment are lost.

Props pareshradadiya, chriscct7.
Fixes #21845.


Built from https://develop.svn.wordpress.org/trunk@32857


git-svn-id: http://core.svn.wordpress.org/trunk@32828 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-19 13:48:25 +00:00
Andrew Ozz
fe427017a5 Fix comments postbox:
- Add comment button text.
- Positioning of the Author, Email, URL fields.
Fixes #32349.
Built from https://develop.svn.wordpress.org/trunk@32495


git-svn-id: http://core.svn.wordpress.org/trunk@32465 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-12 01:22:25 +00:00
Helen Hou-Sandí
3ac1a19529 Spinners: Toggle a class instead of show/hide.
Toggling spinners also now uses visibility instead of display, so that the space is always reserved and nothing moves around unexpectedly.

props cdog, MikeHansenMe, valendesigns.
fixes #22839. see #31875, #30725.

Built from https://develop.svn.wordpress.org/trunk@31996


git-svn-id: http://core.svn.wordpress.org/trunk@31975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-03 04:52:27 +00:00
Sergey Biryukov
cd2e63700e Use a more specific selector for comment moderation hotkeys after [31513].
props afercia.
fixes #31545.
Built from https://develop.svn.wordpress.org/trunk@31929


git-svn-id: http://core.svn.wordpress.org/trunk@31908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-30 13:54:26 +00:00
Scott Taylor
6ffa051689 Replace flagrant instances of .html('') with .empty().
Props OriginalEXE, SergeyBiryukov.
Fixes #27034.

Built from https://develop.svn.wordpress.org/trunk@31690


git-svn-id: http://core.svn.wordpress.org/trunk@31671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-09 19:44:26 +00:00
Helen Hou-Sandí
b80c5d3e51 Comments: Simplify JS for inline edit and reply.
fixes #27533.

Built from https://develop.svn.wordpress.org/trunk@29662


git-svn-id: http://core.svn.wordpress.org/trunk@29436 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-02 03:57:18 +00:00
Scott Taylor
396e77b643 Use unobtrusive JS for Comment list table row actions.
Props aubreypwd.
Fixes #27533.

Built from https://develop.svn.wordpress.org/trunk@28810


git-svn-id: http://core.svn.wordpress.org/trunk@28618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 23:55:16 +00:00
Scott Taylor
d4e46e3f8d Fix double avatars and JS errors when spamming/trashing comments.
Props avryl, SergeyBiryukov.
Fixes #27329.
 

Built from https://develop.svn.wordpress.org/trunk@27759


git-svn-id: http://core.svn.wordpress.org/trunk@27596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-26 23:14:15 +00:00
Andrew Nacin
6adabc6e4d Various JSHint fixes. see #26446.
Built from https://develop.svn.wordpress.org/trunk@27131


git-svn-id: http://core.svn.wordpress.org/trunk@26998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-02-08 00:52:12 +00:00
Andrew Ozz
2a68f85fa1 Comment moderation shortcuts:
- Fix "toggle checkboxes" (shift+x).
- Add noDisable selector and use it to stop disabling the shortcuts when a select-comment checkbox is focused.
See #26755.
Built from https://develop.svn.wordpress.org/trunk@26889


git-svn-id: http://core.svn.wordpress.org/trunk@26772 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-01-02 00:11:14 +00:00