From 9e7cb89560c4d223a382a7a24b84be4017906962 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 1 Sep 2020 16:41:34 -0500 Subject: [PATCH] CSS: clean up some classes There were some values hard-coded in the html attributes, but we already were setting them in our css. Also, search__backdrop was basically the same as search__outer__wrapper --- sphinx_search/static/css/rtd_sphinx_search.css | 14 +------------- sphinx_search/static/css/rtd_sphinx_search.min.css | 2 +- sphinx_search/static/js/rtd_sphinx_search.js | 6 +++--- sphinx_search/static/js/rtd_sphinx_search.min.js | 2 +- tests/test_ui.py | 6 +++--- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/sphinx_search/static/css/rtd_sphinx_search.css b/sphinx_search/static/css/rtd_sphinx_search.css index 33f0260..a642cb9 100644 --- a/sphinx_search/static/css/rtd_sphinx_search.css +++ b/sphinx_search/static/css/rtd_sphinx_search.css @@ -2,19 +2,6 @@ position: fixed; top: 0; left: 0; - width: 100%; - height: 100%; - z-index: 700; -} - -/* Backdrop */ - -.search__backdrop { - /* Positioning */ - position: fixed; - top: 0; - left: 0; - z-index: 500; /* Display and box model */ width: 100%; @@ -22,6 +9,7 @@ display: none; /* Other */ + z-index: 700; background-color: rgba(0, 0, 0, 0.502); } diff --git a/sphinx_search/static/css/rtd_sphinx_search.min.css b/sphinx_search/static/css/rtd_sphinx_search.min.css index 8b8252e..864c34c 100644 --- a/sphinx_search/static/css/rtd_sphinx_search.min.css +++ b/sphinx_search/static/css/rtd_sphinx_search.min.css @@ -1 +1 @@ -@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.search__backdrop,.search__outer__wrapper{position:fixed;top:0;left:0;width:100%;height:100%;z-index:700}.search__backdrop{z-index:500;display:none;background-color:rgba(0,0,0,.502)}.search__outer{margin:auto;position:absolute;top:0;left:0;right:0;bottom:0;z-index:100000;height:80%;width:80%;max-height:1000px;max-width:1500px;padding:10px;overflow-y:scroll;border:1px solid #e0e0e0;line-height:1.875;background-color:#fcfcfc;-webkit-box-shadow:1px 3px 4px rgba(0,0,0,.09);box-shadow:1px 3px 4px rgba(0,0,0,.09);text-align:left}.search__outer::-webkit-scrollbar-track{border-radius:10px;background-color:#fcfcfc}.search__outer::-webkit-scrollbar{width:7px;height:7px;background-color:#fcfcfc}.search__outer::-webkit-scrollbar-thumb{border-radius:10px;background-color:#8f8f8f}.search__cross__img{width:15px;height:15px;margin:12px}.search__cross{position:absolute;top:0;right:0}.search__cross:hover{cursor:pointer}.search__outer__input{width:90%;height:30px;font-size:19px;outline:0;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#fcfcfc;border:0;border-bottom:1px solid #757575;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgNDUxIDQ1MSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDUxIDQ1MTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTQ0Ny4wNSw0MjhsLTEwOS42LTEwOS42YzI5LjQtMzMuOCw0Ny4yLTc3LjksNDcuMi0xMjYuMUMzODQuNjUsODYuMiwyOTguMzUsMCwxOTIuMzUsMEM4Ni4yNSwwLDAuMDUsODYuMywwLjA1LDE5Mi4zDQoJCXM4Ni4zLDE5Mi4zLDE5Mi4zLDE5Mi4zYzQ4LjIsMCw5Mi4zLTE3LjgsMTI2LjEtNDcuMkw0MjguMDUsNDQ3YzIuNiwyLjYsNi4xLDQsOS41LDRzNi45LTEuMyw5LjUtNA0KCQlDNDUyLjI1LDQ0MS44LDQ1Mi4yNSw0MzMuMiw0NDcuMDUsNDI4eiBNMjYuOTUsMTkyLjNjMC05MS4yLDc0LjItMTY1LjMsMTY1LjMtMTY1LjNjOTEuMiwwLDE2NS4zLDc0LjIsMTY1LjMsMTY1LjMNCgkJcy03NC4xLDE2NS40LTE2NS4zLDE2NS40QzEwMS4xNSwzNTcuNywyNi45NSwyODMuNSwyNi45NSwxOTIuM3oiLz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjwvc3ZnPg0K);background-repeat:no-repeat;background-position:left;background-size:15px 15px;padding-left:25px}.search__outer__input:focus{outline:0}.search__outer .bar{position:relative;display:block;width:90%;margin-bottom:15px}.search__outer .bar:after,.search__outer .bar:before{content:"";height:2px;width:0;bottom:1px;position:absolute;background:#5264ae;-webkit-transition:.2s ease all;-o-transition:.2s ease all;transition:.2s ease all}.search__outer .bar:before{left:50%}.search__outer .bar:after{right:50%}.search__outer__input:focus~.bar:after,.search__outer__input:focus~.bar:before{width:50%}.search__result__single{margin-top:10px;padding:0 10px;border-bottom:1px solid #e6e6e6}.outer_div_page_results:hover,.search__result__box .active{background-color:#f5f5f5}.search__error__box{color:#000;min-width:300px;font-weight:700}.outer_div_page_results{margin:5px 0;overflow:auto;padding:3px 5px}.search__result__single a{text-decoration:none;cursor:pointer}.search__result__title{display:inline-block;font-weight:500;margin-bottom:15px;margin-top:0;font-size:15px;color:#6ea0ec;border-bottom:1px solid #6ea0ec}.search__result__subheading{color:#000;font-weight:700;float:left;width:20%;font-size:15px;margin-right:10px;word-break:break-all;overflow-x:hidden}.search__result__content{text-decoration:none;color:#000;font-size:15px;display:block;margin:0;line-height:inherit;float:right;width:calc(80% - 15px);text-align:left}.search__outer span{font-style:normal}.search__outer .search__result__title span{background-color:#e5f6ff;padding-bottom:3px;border-bottom-color:#000}.search__outer .search__result__content span{background-color:#e5f6ff;border-bottom:1px solid #000}.search__result__subheading span{border-bottom:1px solid #000}.br-for-hits{display:block;content:"";margin-top:10px}.rtd_ui_search_subtitle{all:unset;color:inherit;font-size:85%}.rtd__search__credits{margin:auto;position:absolute;top:0;left:0;right:0;bottom:calc(-80% - 20px);width:80%;max-width:1500px;height:30px;overflow:hidden;background:#eee;z-index:100000;border:1px solid #eee;padding:5px 10px;text-align:center;color:#000}.rtd__search__credits a{color:#000;text-decoration:underline}.search__domain_role_name{font-size:80%;letter-spacing:1px}@media (max-width:670px){.rtd__search__credits{height:50px;bottom:calc(-80% - 40px);overflow:hidden}}@media (min-height:1250px){.rtd__search__credits{bottom:calc(-1000px - 30px)}}@media (max-width:630px){.search__result__content,.search__result__subheading{float:none;width:90%}} \ No newline at end of file +@-webkit-keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.search__outer__wrapper{position:fixed;top:0;left:0;width:100%;height:100%;display:none;z-index:700;background-color:rgba(0,0,0,.502)}.search__outer{margin:auto;position:absolute;top:0;left:0;right:0;bottom:0;z-index:100000;height:80%;width:80%;max-height:1000px;max-width:1500px;padding:10px;overflow-y:scroll;border:1px solid #e0e0e0;line-height:1.875;background-color:#fcfcfc;-webkit-box-shadow:1px 3px 4px rgba(0,0,0,.09);box-shadow:1px 3px 4px rgba(0,0,0,.09);text-align:left}.search__outer::-webkit-scrollbar-track{border-radius:10px;background-color:#fcfcfc}.search__outer::-webkit-scrollbar{width:7px;height:7px;background-color:#fcfcfc}.search__outer::-webkit-scrollbar-thumb{border-radius:10px;background-color:#8f8f8f}.search__cross__img{width:15px;height:15px;margin:12px}.search__cross{position:absolute;top:0;right:0}.search__cross:hover{cursor:pointer}.search__outer__input{width:90%;height:30px;font-size:19px;outline:0;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#fcfcfc;border:0;border-bottom:1px solid #757575;background-image:url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjEuMCwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPg0KPHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgNDUxIDQ1MSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDUxIDQ1MTsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KPGc+DQoJPHBhdGggZD0iTTQ0Ny4wNSw0MjhsLTEwOS42LTEwOS42YzI5LjQtMzMuOCw0Ny4yLTc3LjksNDcuMi0xMjYuMUMzODQuNjUsODYuMiwyOTguMzUsMCwxOTIuMzUsMEM4Ni4yNSwwLDAuMDUsODYuMywwLjA1LDE5Mi4zDQoJCXM4Ni4zLDE5Mi4zLDE5Mi4zLDE5Mi4zYzQ4LjIsMCw5Mi4zLTE3LjgsMTI2LjEtNDcuMkw0MjguMDUsNDQ3YzIuNiwyLjYsNi4xLDQsOS41LDRzNi45LTEuMyw5LjUtNA0KCQlDNDUyLjI1LDQ0MS44LDQ1Mi4yNSw0MzMuMiw0NDcuMDUsNDI4eiBNMjYuOTUsMTkyLjNjMC05MS4yLDc0LjItMTY1LjMsMTY1LjMtMTY1LjNjOTEuMiwwLDE2NS4zLDc0LjIsMTY1LjMsMTY1LjMNCgkJcy03NC4xLDE2NS40LTE2NS4zLDE2NS40QzEwMS4xNSwzNTcuNywyNi45NSwyODMuNSwyNi45NSwxOTIuM3oiLz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjxnPg0KPC9nPg0KPGc+DQo8L2c+DQo8Zz4NCjwvZz4NCjwvc3ZnPg0K);background-repeat:no-repeat;background-position:left;background-size:15px 15px;padding-left:25px}.search__outer__input:focus{outline:0}.search__outer .bar{position:relative;display:block;width:90%;margin-bottom:15px}.search__outer .bar:after,.search__outer .bar:before{content:"";height:2px;width:0;bottom:1px;position:absolute;background:#5264ae;-webkit-transition:.2s ease all;-o-transition:.2s ease all;transition:.2s ease all}.search__outer .bar:before{left:50%}.search__outer .bar:after{right:50%}.search__outer__input:focus~.bar:after,.search__outer__input:focus~.bar:before{width:50%}.search__result__single{margin-top:10px;padding:0 10px;border-bottom:1px solid #e6e6e6}.outer_div_page_results:hover,.search__result__box .active{background-color:#f5f5f5}.search__error__box{color:#000;min-width:300px;font-weight:700}.outer_div_page_results{margin:5px 0;overflow:auto;padding:3px 5px}.search__result__single a{text-decoration:none;cursor:pointer}.search__result__title{display:inline-block;font-weight:500;margin-bottom:15px;margin-top:0;font-size:15px;color:#6ea0ec;border-bottom:1px solid #6ea0ec}.search__result__subheading{color:#000;font-weight:700;float:left;width:20%;font-size:15px;margin-right:10px;word-break:break-all;overflow-x:hidden}.search__result__content{text-decoration:none;color:#000;font-size:15px;display:block;margin:0;line-height:inherit;float:right;width:calc(80% - 15px);text-align:left}.search__outer span{font-style:normal}.search__outer .search__result__title span{background-color:#e5f6ff;padding-bottom:3px;border-bottom-color:#000}.search__outer .search__result__content span{background-color:#e5f6ff;border-bottom:1px solid #000}.search__result__subheading span{border-bottom:1px solid #000}.br-for-hits{display:block;content:"";margin-top:10px}.rtd_ui_search_subtitle{all:unset;color:inherit;font-size:85%}.rtd__search__credits{margin:auto;position:absolute;top:0;left:0;right:0;bottom:calc(-80% - 20px);width:80%;max-width:1500px;height:30px;overflow:hidden;background:#eee;z-index:100000;border:1px solid #eee;padding:5px 10px;text-align:center;color:#000}.rtd__search__credits a{color:#000;text-decoration:underline}.search__domain_role_name{font-size:80%;letter-spacing:1px}@media (max-width:670px){.rtd__search__credits{height:50px;bottom:calc(-80% - 40px);overflow:hidden}}@media (min-height:1250px){.rtd__search__credits{bottom:calc(-1000px - 30px)}}@media (max-width:630px){.search__result__content,.search__result__subheading{float:none;width:90%}} \ No newline at end of file diff --git a/sphinx_search/static/js/rtd_sphinx_search.js b/sphinx_search/static/js/rtd_sphinx_search.js index 46a5fb9..e16c4d9 100644 --- a/sphinx_search/static/js/rtd_sphinx_search.js +++ b/sphinx_search/static/js/rtd_sphinx_search.js @@ -546,15 +546,15 @@ const fetchAndGenerateResults = (search_url, projectName) => { */ const generateAndReturnInitialHtml = () => { let initialHtml = - '
\ + '
\
\
\ \ - \ + \ \ \
\ - \ + \ \
\
\ diff --git a/sphinx_search/static/js/rtd_sphinx_search.min.js b/sphinx_search/static/js/rtd_sphinx_search.min.js index c0e6f00..5928140 100644 --- a/sphinx_search/static/js/rtd_sphinx_search.min.js +++ b/sphinx_search/static/js/rtd_sphinx_search.min.js @@ -1 +1 @@ -"use strict";var MAX_SUGGESTIONS=50,MAX_SECTION_RESULTS=3,MAX_SUBSTRING_LIMIT=100,ANIMATION_TIME=200,FETCH_RESULTS_DELAY=250,CLEAR_RESULTS_DELAY=300,COUNT=0,debounce=function(r,n){function e(){var e=this,t=arguments;clearTimeout(a),a=setTimeout(function(){return r.apply(e,t)},n)}var a;return e.cancel=function(){clearTimeout(a),a=null},e},convertObjToUrlParams=function(t){for(var e=Object.keys(t).map(function(e){if(_is_string(e))return e+"="+encodeURI(t[e])}),r=[],n=0;n
<%= section_subheading %> <% for (var i = 0; i < section_content.length; ++i) { %>

<%= section_content[i] %>

<% } %>

',{section_link:i,section_id:c,section_subheading:r,section_content:a})},get_domain_html=function(e,t){var r="".concat(t,"#").concat(e.id),n=e.role,a=e.name,o=e.content.substr(0,MAX_SUBSTRING_LIMIT)+" ...",s=e.highlights;s.name.length&&(a=s.name[0]),s.content.length&&(o=s.content[0]);var i="hit__"+COUNT,n="["+n+"]";return $u.template('
<%= domain_subheading %>
<%= domain_role_name %>

<%= domain_content %>


',{domain_link:r,domain_id:i,domain_content:o,domain_subheading:a,domain_role_name:n})},generateSingleResult=function(e,t){var r=createDomNode("div"),n=e.path,a=e.title,o=e.highlights;o.title.length&&(a=o.title[0]),t!==e.project&&(a+=" "+$u.template(' (from project <%= project %>) ',{project:e.project})),a+="
",r.innerHTML+=$u.template('

<%= page_title %>

',{page_link:n,page_title:a});for(var s=0;s
\x3c!--?xml version="1.0" encoding="UTF-8"?--\x3e
Search by Read the Docs & readthedocs-sphinx-search
'},showSearchModal=function(t){removeResults();var r=getInputField();r.blur(),$(".search__outer__wrapper").fadeIn(ANIMATION_TIME,function(){var e=document.querySelector(".search__outer__input");null!==e&&(void 0!==t&&_is_string(t)?(e.value=t,r.value=t):e.value=r.value,e.focus())})},removeSearchModal=function(){removeResults(),updateSearchBar();var e=document.querySelector(".search__outer__input");null!==e&&(e.value="",e.blur()),updateUrl(),$(".search__outer__wrapper").fadeOut(ANIMATION_TIME)};window.addEventListener("DOMContentLoaded",function(e){var n,a,o,t,r,s,i,c,l,u,d,_,h;window.hasOwnProperty("READTHEDOCS_DATA")?(n=READTHEDOCS_DATA.project,a=READTHEDOCS_DATA.version,o=READTHEDOCS_DATA.language||"en",t=generateAndReturnInitialHtml(),document.body.innerHTML+=t,r=document.querySelector(".search__outer__wrapper"),s=document.querySelector(".search__outer__input"),i=document.querySelector(".search__cross"),c=0,l=null,(u=getInputField()).addEventListener("focus",function(e){showSearchModal()}),s.addEventListener("input",function(e){var t=getSearchTerm();COUNT=0;var r="/_/api/v2/search/?"+convertObjToUrlParams({q:t,project:n,version:a,language:o});0
<%= section_subheading %> <% for (var i = 0; i < section_content.length; ++i) { %>

<%= section_content[i] %>

<% } %>

',{section_link:i,section_id:c,section_subheading:r,section_content:a})},get_domain_html=function(e,t){var r="".concat(t,"#").concat(e.id),n=e.role,a=e.name,o=e.content.substr(0,MAX_SUBSTRING_LIMIT)+" ...",s=e.highlights;s.name.length&&(a=s.name[0]),s.content.length&&(o=s.content[0]);var i="hit__"+COUNT,n="["+n+"]";return $u.template('
<%= domain_subheading %>
<%= domain_role_name %>

<%= domain_content %>


',{domain_link:r,domain_id:i,domain_content:o,domain_subheading:a,domain_role_name:n})},generateSingleResult=function(e,t){var r=createDomNode("div"),n=e.path,a=e.title,o=e.highlights;o.title.length&&(a=o.title[0]),t!==e.project&&(a+=" "+$u.template(' (from project <%= project %>) ',{project:e.project})),a+="
",r.innerHTML+=$u.template('

<%= page_title %>

',{page_link:n,page_title:a});for(var s=0;s
\x3c!--?xml version="1.0" encoding="UTF-8"?--\x3e
Search by Read the Docs & readthedocs-sphinx-search
'},showSearchModal=function(t){removeResults();var r=getInputField();r.blur(),$(".search__outer__wrapper").fadeIn(ANIMATION_TIME,function(){var e=document.querySelector(".search__outer__input");null!==e&&(void 0!==t&&_is_string(t)?(e.value=t,r.value=t):e.value=r.value,e.focus())})},removeSearchModal=function(){removeResults(),updateSearchBar();var e=document.querySelector(".search__outer__input");null!==e&&(e.value="",e.blur()),updateUrl(),$(".search__outer__wrapper").fadeOut(ANIMATION_TIME)};window.addEventListener("DOMContentLoaded",function(e){var n,a,o,t,r,s,i,c,l,u,d,_,h;window.hasOwnProperty("READTHEDOCS_DATA")?(n=READTHEDOCS_DATA.project,a=READTHEDOCS_DATA.version,o=READTHEDOCS_DATA.language||"en",t=generateAndReturnInitialHtml(),document.body.innerHTML+=t,r=document.querySelector(".search__outer__wrapper"),s=document.querySelector(".search__outer__input"),i=document.querySelector(".search__cross"),c=0,l=null,(u=getInputField()).addEventListener("focus",function(e){showSearchModal()}),s.addEventListener("input",function(e){var t=getSearchTerm();COUNT=0;var r="/_/api/v2/search/?"+convertObjToUrlParams({q:t,project:n,version:a,language:o});0 +
- +
- +