Commit Graph

26 Commits

Author SHA1 Message Date
derv82
1c188f1f8d Only fetch style JSON during installation.
JSON is 'cached' within the userstyleSearchResult object,
so the JSON is only fetched once during the life of the popup window.
2017-12-09 00:25:47 -08:00
derv82
4732184670 10 results @ a time, floating Install button, fixed height while loading styles. 2017-12-08 01:44:55 -08:00
derv82
308973cb13 Clicking thumbnail (above overlay) installs/uninstalls.
Same behavior as clicking overlay
2017-12-07 20:54:17 -08:00
derv82
1f95fd3571 Search results show "uninstall" after installation.
* Not removed from search results
* Still shows "customize" button.
2017-12-07 02:06:44 -08:00
derv82
34ab1abd11 Search result only shows title & thumbnail, more info on hover.
Clicking search result thumbnail (overlay) installs it. So does clicking "install" button.
Fixed author link installing the sytle.
Removed bg-color change on hover.
2017-12-07 00:06:12 -08:00
derv82
8ec06d9830 Title above screenshot. Removed 'Results for...' header
Brought back 'Author' (was hidden before).
2017-12-06 23:33:42 -08:00
derv82
0e63896f4f Switch camelCase to dash-case in DOM classes and IDs 2017-12-06 22:38:35 -08:00
derv82
826605242b Disable next/prev search result buttons when loading 2017-12-06 02:20:17 -08:00
derv82
da6ea2b69b 'Customize' button stops propagation & opens tab. 2017-12-06 01:40:39 -08:00
derv82
0161df5af0 Addressed PR feedback: i18n, result.onlick, description-expander, loader fix
* i18n text and titles for all labels.
* Clicking a search result opens the page for that style.
* Descriptions are truncated with (i) info button; expands description when clicked
* Simplified/fixed setLoader() + lds-spinner functionality.
2017-12-06 01:22:33 -08:00
derv82
ca2050d549 Spinner while loading results. Description expando. 2017-12-05 00:41:16 -08:00
derv82
f4f5c47320 Single-line enable or disable of next/prev buttons 2017-12-04 20:01:34 -08:00
derv82
4919cf0817 Fixing over-styling in search-results.css
* Right-padding to account for scrollbar when showing search results.
* No 'max-width' anymore -- width adjusts to popup width.
* Description uses ellilpsis on overflow.
  * Still needs info/expando (and need to remove title-text)
* Screenshots have 'object-fit:cover' to fill the space.

Unrelated: Hack for search category 'userstyles' (should be userstyles.org)
2017-12-04 00:30:06 -08:00
derv82
58f003392a Scroll up when search results options are clicked (find/next/prev) 2017-12-03 23:27:55 -08:00
derv82
b3cd06bedd "inline" checkbox opens search results within popup.
Unchecked => opens new tab for search page.

Checkbox hidden if inline results are shown (still shows link to "find styles" which opens a new tab by-default).
2017-12-03 20:24:39 -08:00
derv82
8d75042f02 Address part of PR feedback.
Main diff: Wrapped onDOMready() & SearchResults() function in IIFE closure.

* [X] const SearchResults = ... // should be inside a closure (IIFE @ Top)
* [X] SearchUserstyles should be firstLetterLowercase
* [X] Don't fetch category on load; use regexp to derive category. (left 'HEAD' code commented-out).
* [X] Don't use XMLHttpRequest() anymore (used in 3 places?): Use download() which accepts custom request params.
* [X] Remove unused getters ('getCurrentPage' & others?)
* [X] const BASE_USO_URL = 'https://userstyles.org'; @ top of searchResults closure. Refer elsewhere.
* [X] const searchUrl = new URL... should be a single multiline statement (new URL('...' +\ '...'
* [X] .innerHTML = ... // use .textContent = ... instead
* [X] Don't use `setAttribute` on 'disabled':   $('..-prev').disabled = currentDisplayedPage <= 1 || loading
* [X] Don't use .indexOf() on strings, use .includes()
* [X] Move onDOMReady() code to top of file.
2017-12-03 15:34:44 -08:00
derv82
6cdc442986 Resolve eslint warning (reason not used) 2017-12-02 23:19:23 -08:00
derv82
8ae669bd12 Detects Customization. Prefetches "category" when popup is loaded.
* Fetches 'category' for the current URL when popup is first loaded.
* Customizable styles have "Customize" button next to "Install"
* "Customize" button opens a new tab to the style page.
* Removed all console.log() statements (except when `catch()`ing errors).
2017-12-02 23:12:27 -08:00
derv82
02260ff65d Show rating & install counts in results. Remove artifical delays. 2017-12-02 17:25:01 -08:00
derv82
b16ee42deb Only one "find styles" link. Hides result after installing.
* "Find more styles for this site" renamed to "Search on userstyles.org".
  * Only appears below search results after "Find more styles" is clicked.
* When style is installed from serach results, it no longer appears in the results.
* "Install" uses already-fetched .JSON data. Avoiding useless call to download().
2017-12-02 04:34:37 -08:00
derv82
1daa12b59f Search userstyles by-category. Fetch only when needed.
* Discovers category via userstyles request.
* Disables navigation while loading results.
* Navigation above search results
* Handles styles without screenshots (blank img).
2017-12-02 03:29:12 -08:00
derv82
e8f793b16a Refactor search-results: Only show applicable styles.
Fetches .json for each search result and asserts style applies to the page.

Still needs:
* Smarter search ("metacritic.com" = 0 results)
* Faster (or parallel) fetching of search result .json files
* Better feedback ("loading" messages)
* Detection of styles that can be Customized
* Install styles using searchResult.json (not downloading)
2017-12-01 00:42:56 -08:00
derv82
696b6f97c3 Hides installed styles from search results.
Also:
1. Dims search result during installation.
2. Removes the search result after installation.
2017-11-24 01:57:42 -08:00
derv82
98c9024eb9 It works! "Install" installs the style.
Added an 'error' container for search-related errors.
2017-11-20 01:11:32 -08:00
derv82
16d32c40f5 Resolve eslint errs/warnings in search-results.js 2017-11-19 22:55:07 -08:00
derv82
c9e894f670 Rename searchResults -> search-results, replaced double quotes with single-quotes 2017-11-19 22:28:54 -08:00