logo

searx

Unnamed repository; edit this file 'description' to name the repository.
commit: f8a5f7d6751ad72c877d6008f1a7d9792ba911f6
parent: c711212662996e232a1d3bc692f6f765e1467125
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Tue, 10 Feb 2015 15:28:14 +0100

Merge branch 'Cqoicebordel-rtl'

Diffstat:

Makefile | 2++
searx/static/themes/courgette/css/style-rtl.css | 2++
searx/static/themes/courgette/css/style.css | 4++--
searx/static/themes/courgette/less/style-rtl.less | 39+++++++++++++++++++++++++++++++++++++++
searx/static/themes/courgette/less/style.less | 2+-
searx/static/themes/default/css/style-rtl.css | 2++
searx/static/themes/default/less/style-rtl.less | 11+++++++++++
searx/templates/courgette/base.html | 5++++-
searx/templates/courgette/index.html | 5+++++
searx/templates/courgette/preferences.html | 2+-
searx/templates/courgette/results.html | 1-
searx/templates/default/base.html | 5++++-
searx/templates/default/index.html | 5+++++
searx/templates/default/preferences.html | 4++--
searx/templates/default/results.html | 4++--
searx/templates/oscar/base.html | 2+-
searx/templates/oscar/categories.html | 22+++++++++++++++++++++-
searx/templates/oscar/macros.html | 31+++++++++++++++++++++++++++++++
searx/templates/oscar/navbar.html | 19+++++++++++++++++++
searx/templates/oscar/preferences.html | 163++++++++++++++++++++++++++++++++++++++++---------------------------------------
searx/templates/oscar/result_templates/code.html | 6+++++-
searx/templates/oscar/result_templates/default.html | 6+++++-
searx/templates/oscar/result_templates/map.html | 6+++++-
searx/templates/oscar/result_templates/torrent.html | 6+++++-
searx/templates/oscar/result_templates/videos.html | 4++++
searx/templates/oscar/results.html | 22++++++++++++++++++++++
searx/templates/oscar/search_full.html | 4++++
searx/webapp.py | 13++++++++++---
28 files changed, 297 insertions(+), 100 deletions(-)

diff --git a/Makefile b/Makefile @@ -46,7 +46,9 @@ minimal: bin/buildout minimal.cfg setup.py styles: @lessc -x searx/static/themes/default/less/style.less > searx/static/themes/default/css/style.css + @lessc -x searx/static/themes/default/less/style-rtl.less > searx/static/themes/default/css/style-rtl.css @lessc -x searx/static/themes/courgette/less/style.less > searx/static/themes/courgette/css/style.css + @lessc -x searx/static/themes/courgette/less/style-rtl.less > searx/static/themes/courgette/css/style-rtl.css @lessc -x searx/static/less/bootstrap/bootstrap.less > searx/static/css/bootstrap.min.css @lessc -x searx/static/themes/oscar/less/oscar/oscar.less > searx/static/themes/oscar/css/oscar.min.css diff --git a/searx/static/themes/courgette/css/style-rtl.css b/searx/static/themes/courgette/css/style-rtl.css @@ -0,0 +1 @@ +.q{padding:.5em 1em .5em 3em}#search_submit{left:0;right:auto}.result .favicon{float:right;margin-left:.5em;margin-right:0}#sidebar{right:auto;left:0}#results{padding:0 32px 0 272px}.search.center{padding-right:0;padding-left:17em}.right{right:auto;left:0}#pagination form+form{float:left;margin-top:-2em}+ \ No newline at end of file diff --git a/searx/static/themes/courgette/css/style.css b/searx/static/themes/courgette/css/style.css @@ -1 +1 @@ -*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="search"]{-webkit-appearance:textfield}h2{color:#666;text-transform:uppercase}body{font-family:sans-serif;line-height:1.5;margin:0;background:#eee}html{position:relative;min-height:100%}a{color:#666}.title h1{font-size:7em;color:#3498db;margin:0 auto;line-height:100px;margin-top:-20px;padding-bottom:20px}.center{max-width:70em;text-align:center;background:rgba(255,255,255,0.6);padding:2em;margin:7% auto 0;position:relative}.center.search{position:static;width:auto;background:none;margin:auto;padding-top:1.8em}@media screen and (min-width:1001px){.center:after{content:"";z-index:-1;background:url(../img/bg-body-index.jpg) no-repeat;background-size:cover;width:100%;height:100%;top:0;left:0;position:fixed}.center.search:after{content:none}}.autocompleter-choices{position:absolute;margin:0;padding:0;background:#fff}.autocompleter-choices li{padding:.5em 1em}.autocompleter-choices li:hover{background:#3498db;color:#fff;cursor:pointer}#categories{text-align:center}.top_margin{position:absolute;bottom:-3.5em;width:100%;left:0}.top_margin a{display:inline-block;margin-right:1em;color:#fff;text-decoration:none}.top_margin a:hover,.top_margin a:focus{text-decoration:underline}@media screen and (max-width:1000px){.center{background:none}.top_margin a{color:#333}}.checkbox_container{margin-top:1.5em}.checkbox_container label{padding:.5em 1em;color:#333;cursor:pointer;font-size:.9em}.checkbox_container label:hover{background:#3498db;color:#fff}.checkbox_container input[type="checkbox"]{position:absolute;top:-9999px}.checkbox_container input[type="checkbox"]:checked+label{background:#3498db;color:#fff}#categories_container>div{display:inline-block}#categories .hidden{display:none;position:absolute;bottom:1em;left:0;text-align:center;width:100%;font-size:.9em;font-style:italic;color:#333}#categories:hover .hidden{display:block}@media screen and (max-width:900px){#categories_container{letter-spacing:-5px}#categories_container>div{letter-spacing:normal;margin-top:1em}.checkbox_container{margin:0}.checkbox_container label{display:block;background:#ccc;padding:1em;border:1px solid #fff}.top_margin{position:static}#categories .hidden{position:static;display:block}}@media screen and (max-width:900px) and (min-width:501px){#categories_container>div{width:31%;margin-left:2.333%}#categories_container>div:nth-child(3n+1){margin-left:0}}@media screen and (max-width:500px){#categories_container>div{width:48%;margin-left:2%;font-size:.9em}#categories_container>div:nth-child(2n+1){margin-left:0}.title h1{background:url(../img/searx-mobile.png) no-repeat;width:200px;height:39px}}#search_wrapper{position:relative}.q{padding:.5em 3em .5em 1em;width:100%;font-size:1.5em;border:0;color:#666}#search_submit{position:absolute;top:0;right:0;border:0;background:url("../img/search-icon.png") no-repeat scroll center center / 65% auto #3498db;text-indent:-9999px;width:5em;height:100%;cursor:pointer}#search_submit:hover,#search_submit:focus{background-color:#0665a2}#sidebar{background:#3498db;position:fixed;top:0;right:0;width:15em;height:100%;padding:1.5em;text-align:right}.right{position:fixed;bottom:1.5em;width:15em;right:0;z-index:1;padding:0 1.5em;text-align:right}.right a{color:#fff;display:block;text-decoration:none}.right a:hover,.right a:focus{text-decoration:underline}#preferences{background:url(../img/preference-icon.png) no-repeat right 0 auto;padding-right:1.8em}#search_url input{border:0;padding:.5em}#sidebar>div{margin-bottom:1em;color:#fff}#sidebar form{display:inline-block}#sidebar input[type="submit"]{background:#ccc;border:0;padding:.5em 1em;cursor:pointer;margin-top:.5em}#sidebar input[type="submit"]:hover,#sidebar input[type="submit"]:focus{color:#fff;background-color:#0665a2}#results{padding-right:17em;padding-left:2em;padding:0 17em 0 2em}.result p{font-size:.9em}.result .content{margin:0;color:#666}.result .url{margin-top:0;color:#ff6530}.result .favicon{float:left;position:relative;top:.5em;margin-right:.5em}.definition_result{background:#ccc;padding:1em}.definition_result .result_title,.definition_result p{margin:0}.result_title{margin-bottom:0;font-weight:normal}.highlight{font-weight:bold}.result_title a{color:#3498db;text-decoration:none}.result_title a:hover,.result_title a:focus{text-decoration:underline}.cache_link{color:#666;font-size:.9em;font-style:italic}.search.center{padding-right:17em}#answers{border:2px solid #3498db;padding:20px;color:#666;text-align:center;max-width:70em;margin:0 auto 20px}#suggestions{margin-bottom:1em}#suggestions span{color:#666}#suggestions form{display:inline-block;vertical-align:top;margin-bottom:.5em}#suggestions input[type="submit"]{color:#333;padding:.5em 1em;border:0;background:#ccc;cursor:pointer}#suggestions input[type="submit"]:hover,#suggestions input[type="submit"]:focus{background:#3498db;color:#fff}#pagination{margin:1.5em 0 2em}#pagination form+form{float:right;margin-top:-2em}input[type="submit"]{display:inline-block;background:#3498db;color:#fff;border:0;padding:.6em 1em;cursor:pointer}input[type="submit"]:hover,input[type="submit"]:focus{background:#0665a2}.row{max-width:60em;margin:auto}.row a{color:#3498db}.row form{letter-spacing:-5px}.row form>*{letter-spacing:normal}.row p{margin:0}.row fieldset{display:inline-block;width:48%;vertical-align:top}.row fieldset:last-of-type{display:block;width:auto;background:none;padding:0}.row fieldset:nth-child(odd){margin-right:2%}.row fieldset:nth-child(2){min-height:10.5em}@media screen and (max-width:900px){.row{margin:0 1em}.row fieldset{width:49%}.row fieldset,.row fieldset:nth-child(odd){margin-right:0}.row fieldset:first-child{width:100%;margin-right:0}.row fieldset:nth-child(even){margin-right:2%}}@media screen and (max-width:800px){.row fieldset{width:100%}select{width:100%}table{font-size:.8em}.right{display:none}#sidebar{display:none}#results{padding:0 2em}.search.center{padding-right:2em}}@media screen and (max-width:400px){.row #categories_container>div{width:100%;margin-left:0}}fieldset{border:0;margin:1em 0;background:#ccc;padding:1.5em}table{width:100%;text-align:left;border:1px solid #ccc;border-collapse:collapse}table th{background:#999;color:#fff}table tr:nth-child(odd){background:#ccc}table th,table td{padding:.5em 1em;border:1px solid #fff}.engine_checkbox label{padding:.5em;background:#3498db;color:#fff;cursor:pointer}.engine_checkbox .deny{background:#3498db}.engine_checkbox .allow{display:none;background:#666}.engine_checkbox input{display:none}.engine_checkbox input:checked+.allow{display:inline}.engine_checkbox input:checked+.allow+.deny{display:none}.row input[type="submit"]{font-size:1em;margin:1em 0 2em}.row .right{position:static;display:inline-block}.row .right a{color:#333;width:auto;text-align:left;padding:0}.small_font{font-size:.8em}table th{padding:1em}legend{background:#eee;padding:0 1em;position:relative}select{border:1px solid #ddd;padding:.5em .8em;font-size:1em}.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#408080;font-style:italic}.highlight .err{border:1px solid #f00}.highlight .k{color:#008000;font-weight:bold}.highlight .o{color:#666}.highlight .cm{color:#408080;font-style:italic}.highlight .cp{color:#bc7a00}.highlight .c1{color:#408080;font-style:italic}.highlight .cs{color:#408080;font-style:italic}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .gr{color:#f00}.highlight .gh{color:#000080;font-weight:bold}.highlight .gi{color:#00a000}.highlight .go{color:#888}.highlight .gp{color:#000080;font-weight:bold}.highlight .gs{font-weight:bold}.highlight .gu{color:#800080;font-weight:bold}.highlight .gt{color:#04d}.highlight .kc{color:#008000;font-weight:bold}.highlight .kd{color:#008000;font-weight:bold}.highlight .kn{color:#008000;font-weight:bold}.highlight .kp{color:#008000}.highlight .kr{color:#008000;font-weight:bold}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#7d9029}.highlight .nb{color:#008000}.highlight .nc{color:#00f;font-weight:bold}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#999;font-weight:bold}.highlight .ne{color:#d2413a;font-weight:bold}.highlight .nf{color:#00f}.highlight .nl{color:#a0a000}.highlight .nn{color:#00f;font-weight:bold}.highlight .nt{color:#008000;font-weight:bold}.highlight .nv{color:#19177c}.highlight .ow{color:#a2f;font-weight:bold}.highlight .w{color:#bbb}.highlight .mf{color:#666}.highlight .mh{color:#666}.highlight .mi{color:#666}.highlight .mo{color:#666}.highlight .sb{color:#ba2121}.highlight .sc{color:#ba2121}.highlight .sd{color:#ba2121;font-style:italic}.highlight .s2{color:#ba2121}.highlight .se{color:#b62;font-weight:bold}.highlight .sh{color:#ba2121}.highlight .si{color:#b68;font-weight:bold}.highlight .sx{color:#008000}.highlight .sr{color:#b68}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:#008000}.highlight .vc{color:#19177c}.highlight .vg{color:#19177c}.highlight .vi{color:#19177c}.highlight .il{color:#666}.highlight pre{overflow:auto}.highlight .lineno{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.highlight .lineno::selection{background:transparent}.highlight .lineno::-moz-selection{background:transparent}- \ No newline at end of file +*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="search"]{-webkit-appearance:textfield}h2{color:#666;text-transform:uppercase}body{font-family:sans-serif;line-height:1.5;margin:0;background:#eee}html{position:relative;min-height:100%}a{color:#666}.title h1{font-size:7em;color:#3498db;margin:0 auto;line-height:100px;margin-top:-20px;padding-bottom:20px}.center{max-width:70em;text-align:center;background:rgba(255,255,255,0.6);padding:2em;margin:7% auto 0;position:relative}.center.search{position:static;width:auto;background:none;margin:auto;padding-top:1.8em}@media screen and (min-width:1001px){.center:after{content:"";z-index:-1;background:url(../img/bg-body-index.jpg) no-repeat;background-size:cover;width:100%;height:100%;top:0;left:0;position:fixed}.center.search:after{content:none}}.autocompleter-choices{position:absolute;margin:0;padding:0;background:#fff}.autocompleter-choices li{padding:.5em 1em}.autocompleter-choices li:hover{background:#3498db;color:#fff;cursor:pointer}#categories{text-align:center}.top_margin{position:absolute;bottom:-3.5em;width:100%;left:0}.top_margin a{display:inline-block;margin-right:1em;color:#fff;text-decoration:none}.top_margin a:hover,.top_margin a:focus{text-decoration:underline}@media screen and (max-width:1000px){.center{background:none}.top_margin a{color:#333}}.checkbox_container{margin-top:1.5em}.checkbox_container label{padding:.5em 1em;color:#333;cursor:pointer;font-size:.9em}.checkbox_container label:hover{background:#3498db;color:#fff}.checkbox_container input[type="checkbox"]{position:absolute;top:-9999px}.checkbox_container input[type="checkbox"]:checked+label{background:#3498db;color:#fff}#categories_container>div{display:inline-block}#categories .hidden{display:none;position:absolute;bottom:1em;left:0;text-align:center;width:100%;font-size:.9em;font-style:italic;color:#333}#categories:hover .hidden{display:block}@media screen and (max-width:900px){#categories_container{letter-spacing:-5px}#categories_container>div{letter-spacing:normal;margin-top:1em}.checkbox_container{margin:0}.checkbox_container label{display:block;background:#ccc;padding:1em;border:1px solid #fff}.top_margin{position:static}#categories .hidden{position:static;display:block}}@media screen and (max-width:900px) and (min-width:501px){#categories_container>div{width:31%;margin-left:2.333%}#categories_container>div:nth-child(3n+1){margin-left:0}}@media screen and (max-width:500px){#categories_container>div{width:48%;margin-left:2%;font-size:.9em}#categories_container>div:nth-child(2n+1){margin-left:0}.title h1{background:url(../img/searx-mobile.png) no-repeat;width:200px;height:39px}}#search_wrapper{position:relative}.q{padding:.5em 3em .5em 1em;width:100%;font-size:1.5em;border:0;color:#666}#search_submit{position:absolute;top:0;right:0;border:0;background:url("../img/search-icon.png") no-repeat scroll center center / 65% auto #3498db;text-indent:-9999px;width:5em;height:100%;cursor:pointer}#search_submit:hover,#search_submit:focus{background-color:#0665a2}#sidebar{background:#3498db;position:fixed;top:0;right:0;width:15em;height:100%;padding:1.5em;text-align:right}.right{position:fixed;bottom:1.5em;width:15em;right:0;z-index:1;padding:0 1.5em;text-align:right}.right a{color:#fff;display:block;text-decoration:none}.right a:hover,.right a:focus{text-decoration:underline}#preferences{background:url("../img/preference-icon.png") no-repeat right center / 12% auto;padding-right:1.8em}#search_url input{border:0;padding:.5em}#sidebar>div{margin-bottom:1em;color:#fff}#sidebar form{display:inline-block}#sidebar input[type="submit"]{background:#ccc;border:0;padding:.5em 1em;cursor:pointer;margin-top:.5em}#sidebar input[type="submit"]:hover,#sidebar input[type="submit"]:focus{color:#fff;background-color:#0665a2}#results{padding-right:17em;padding-left:2em;padding:0 17em 0 2em}.result p{font-size:.9em}.result .content{margin:0;color:#666}.result .url{margin-top:0;color:#ff6530}.result .favicon{float:left;position:relative;top:.5em;margin-right:.5em}.definition_result{background:#ccc;padding:1em}.definition_result .result_title,.definition_result p{margin:0}.result_title{margin-bottom:0;font-weight:normal}.highlight{font-weight:bold}.result_title a{color:#3498db;text-decoration:none}.result_title a:hover,.result_title a:focus{text-decoration:underline}.cache_link{color:#666;font-size:.9em;font-style:italic}.search.center{padding-right:17em}#answers{border:2px solid #3498db;padding:20px;color:#666;text-align:center;max-width:70em;margin:0 auto 20px}#suggestions{margin-bottom:1em}#suggestions span{color:#666}#suggestions form{display:inline-block;vertical-align:top;margin-bottom:.5em}#suggestions input[type="submit"]{color:#333;padding:.5em 1em;border:0;background:#ccc;cursor:pointer}#suggestions input[type="submit"]:hover,#suggestions input[type="submit"]:focus{background:#3498db;color:#fff}#pagination{margin:1.5em 0 2em}#pagination form+form{float:right;margin-top:-2em}input[type="submit"]{display:inline-block;background:#3498db;color:#fff;border:0;padding:.6em 1em;cursor:pointer}input[type="submit"]:hover,input[type="submit"]:focus{background:#0665a2}.row{max-width:60em;margin:auto}.row a{color:#3498db}.row form{letter-spacing:-5px}.row form>*{letter-spacing:normal}.row p{margin:0}.row fieldset{display:inline-block;width:48%;vertical-align:top}.row fieldset:last-of-type{display:block;width:auto;background:none;padding:0}.row fieldset:nth-child(odd){margin-right:2%}.row fieldset:nth-child(2){min-height:10.5em}@media screen and (max-width:900px){.row{margin:0 1em}.row fieldset{width:49%}.row fieldset,.row fieldset:nth-child(odd){margin-right:0}.row fieldset:first-child{width:100%;margin-right:0}.row fieldset:nth-child(even){margin-right:2%}}@media screen and (max-width:800px){.row fieldset{width:100%}select{width:100%}table{font-size:.8em}.right{display:none}#sidebar{display:none}#results{padding:0 2em}.search.center{padding-right:2em}}@media screen and (max-width:400px){.row #categories_container>div{width:100%;margin-left:0}}fieldset{border:0;margin:1em 0;background:#ccc;padding:1.5em}table{width:100%;text-align:left;border:1px solid #ccc;border-collapse:collapse}table th{background:#999;color:#fff}table tr:nth-child(odd){background:#ccc}table th,table td{padding:.5em 1em;border:1px solid #fff}.engine_checkbox label{padding:.5em;background:#3498db;color:#fff;cursor:pointer}.engine_checkbox .deny{background:#3498db}.engine_checkbox .allow{display:none;background:#666}.engine_checkbox input{display:none}.engine_checkbox input:checked+.allow{display:inline}.engine_checkbox input:checked+.allow+.deny{display:none}.row input[type="submit"]{font-size:1em;margin:1em 0 2em}.row .right{position:static;display:inline-block}.row .right a{color:#333;width:auto;text-align:left;padding:0}.small_font{font-size:.8em}table th{padding:1em}legend{background:#eee;padding:0 1em;position:relative}select{border:1px solid #ddd;padding:.5em .8em;font-size:1em}.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#408080;font-style:italic}.highlight .err{border:1px solid #f00}.highlight .k{color:#008000;font-weight:bold}.highlight .o{color:#666}.highlight .cm{color:#408080;font-style:italic}.highlight .cp{color:#bc7a00}.highlight .c1{color:#408080;font-style:italic}.highlight .cs{color:#408080;font-style:italic}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .gr{color:#f00}.highlight .gh{color:#000080;font-weight:bold}.highlight .gi{color:#00a000}.highlight .go{color:#888}.highlight .gp{color:#000080;font-weight:bold}.highlight .gs{font-weight:bold}.highlight .gu{color:#800080;font-weight:bold}.highlight .gt{color:#04d}.highlight .kc{color:#008000;font-weight:bold}.highlight .kd{color:#008000;font-weight:bold}.highlight .kn{color:#008000;font-weight:bold}.highlight .kp{color:#008000}.highlight .kr{color:#008000;font-weight:bold}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#7d9029}.highlight .nb{color:#008000}.highlight .nc{color:#00f;font-weight:bold}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#999;font-weight:bold}.highlight .ne{color:#d2413a;font-weight:bold}.highlight .nf{color:#00f}.highlight .nl{color:#a0a000}.highlight .nn{color:#00f;font-weight:bold}.highlight .nt{color:#008000;font-weight:bold}.highlight .nv{color:#19177c}.highlight .ow{color:#a2f;font-weight:bold}.highlight .w{color:#bbb}.highlight .mf{color:#666}.highlight .mh{color:#666}.highlight .mi{color:#666}.highlight .mo{color:#666}.highlight .sb{color:#ba2121}.highlight .sc{color:#ba2121}.highlight .sd{color:#ba2121;font-style:italic}.highlight .s2{color:#ba2121}.highlight .se{color:#b62;font-weight:bold}.highlight .sh{color:#ba2121}.highlight .si{color:#b68;font-weight:bold}.highlight .sx{color:#008000}.highlight .sr{color:#b68}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:#008000}.highlight .vc{color:#19177c}.highlight .vg{color:#19177c}.highlight .vi{color:#19177c}.highlight .il{color:#666}.highlight pre{overflow:auto}.highlight .lineno{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.highlight .lineno::selection{background:transparent}.highlight .lineno::-moz-selection{background:transparent}+ \ No newline at end of file diff --git a/searx/static/themes/courgette/less/style-rtl.less b/searx/static/themes/courgette/less/style-rtl.less @@ -0,0 +1,38 @@ +.q { + padding: 0.5em 1em 0.5em 3em; +} + +#search_submit { + left: 0; + right:auto; +} + +.result .favicon { + float: right; + margin-left: 0.5em; + margin-right: 0; +} + +#sidebar { + right: auto; + left: 0; +} + +#results { + padding: 0px 32px 0px 272px; +} + +.search.center { + padding-right: 0; + padding-left: 17em; +} + +.right { + right: auto; + left: 0; +} + +#pagination form + form { + float: left; + margin-top: -2em; +}+ \ No newline at end of file diff --git a/searx/static/themes/courgette/less/style.less b/searx/static/themes/courgette/less/style.less @@ -278,7 +278,7 @@ a { } #preferences { - background: url(../img/preference-icon.png) no-repeat right 0 / 12% auto; + background: url("../img/preference-icon.png") no-repeat right center / 12% auto; padding-right: 1.8em; } diff --git a/searx/static/themes/default/css/style-rtl.css b/searx/static/themes/default/css/style-rtl.css @@ -0,0 +1 @@ +#search_submit{left:1px;right:auto}.result .favicon{float:right;margin-left:.5em;margin-right:0}+ \ No newline at end of file diff --git a/searx/static/themes/default/less/style-rtl.less b/searx/static/themes/default/less/style-rtl.less @@ -0,0 +1,11 @@ +#search_submit { + left: 1px; + right:auto; +} + +.result .favicon { + float: right; + margin-left: 0.5em; + margin-right: 0; +} + diff --git a/searx/templates/courgette/base.html b/searx/templates/courgette/base.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> <head> <meta charset="UTF-8" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> @@ -8,6 +8,9 @@ <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> <title>{% block title %}{% endblock %}searx</title> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> + {% if rtl %} + <link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" /> + {% endif %} {% if cookies['courgette-color'] %} <style type="text/css"> {% include 'courgette/color.css' %} diff --git a/searx/templates/courgette/index.html b/searx/templates/courgette/index.html @@ -5,8 +5,13 @@ <div class="title"><h1>searx</h1></div> {% include 'courgette/search.html' %} <p class="top_margin"> + {% if rtl %} + <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> + {% endif %} <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> + {% if not rtl %} <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> + {% endif %} </p> </div> {% endblock %} \ No newline at end of file diff --git a/searx/templates/courgette/preferences.html b/searx/templates/courgette/preferences.html @@ -106,7 +106,7 @@ {% if not search_engine.private %} <tr> - <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</td> + <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td> <td>{{ _(categ) }}</td> <td class="engine_checkbox"> <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> diff --git a/searx/templates/courgette/results.html b/searx/templates/courgette/results.html @@ -8,7 +8,6 @@ </div> <div id="results"> <div id="sidebar"> - <div id="search_url"> {{ _('Search URL') }}: <input type="text" value="{{ base_url }}?q={{ q|urlencode }}&amp;pageno={{ pageno }}{% if selected_categories %}&amp;category_{{ selected_categories|join("&category_")|replace(' ','+') }}{% endif %}" readonly /> diff --git a/searx/templates/default/base.html b/searx/templates/default/base.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> <head> <meta charset="UTF-8" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> @@ -8,6 +8,9 @@ <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" /> <title>{% block title %}{% endblock %}searx</title> <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" /> + {% if rtl %} + <link rel="stylesheet" href="{{ url_for('static', filename='css/style-rtl.css') }}" type="text/css" media="screen" /> + {% endif %} <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" /> {% block styles %} {% endblock %} diff --git a/searx/templates/default/index.html b/searx/templates/default/index.html @@ -4,8 +4,13 @@ <div class="title"><h1>searx</h1></div> {% include 'default/search.html' %} <p class="top_margin"> + {% if rtl %} + <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> + {% endif %} <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a> + {% if not rtl %} <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a> + {% endif %} </p> </div> {% include 'default/github_ribbon.html' %} diff --git a/searx/templates/default/preferences.html b/searx/templates/default/preferences.html @@ -94,7 +94,7 @@ {% if not search_engine.private %} <tr> - <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</td> + <td>{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</td> <td>{{ _(categ) }}</td> <td class="engine_checkbox"> <input type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> @@ -113,7 +113,7 @@ </p> <input type="submit" value="{{ _('save') }}" /> - <div class="right preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> + <div class="{% if rtl %}left{% else %}right{% endif %} preferences_back"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div> </form> </div> {% endblock %} diff --git a/searx/templates/default/results.html b/searx/templates/default/results.html @@ -72,7 +72,7 @@ <div id="pagination"> {% if pageno > 1 %} <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="left"> + <div class="{% if rtl %}right{% else %}left{% endif %}"> <input type="hidden" name="q" value="{{ q }}" /> {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1"/> @@ -83,7 +83,7 @@ </form> {% endif %} <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}"> - <div class="right"> + <div class="{% if rtl %}left{% else %}right{% endif %}"> {% for category in selected_categories %} <input type="hidden" name="category_{{ category }}" value="1"/> {% endfor %} diff --git a/searx/templates/oscar/base.html b/searx/templates/oscar/base.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"{% if rtl %} dir="rtl"{% endif %}> <head> <meta charset="UTF-8" /> <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" /> diff --git a/searx/templates/oscar/categories.html b/searx/templates/oscar/categories.html @@ -1,6 +1,16 @@ <!-- used if scripts are disabled --> <noscript> <div id="categories" class="btn-group btn-toggle"> +{% if rtl %} +{% for category in categories | reverse %} + <!--<div class="checkbox">--> + <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> + <label class="btn btn-sm btn-primary active label_hide_if_not_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label> + <label class="btn btn-sm btn-default label_hide_if_checked" for="checkbox_{{ category|replace(' ', '_') }}_nojs">{{ _(category) }}</label> + <!--</div>--> + {% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %} +{% endfor %} +{% else %} {% for category in categories %} <!--<div class="checkbox">--> <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_nojs" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} /> @@ -9,14 +19,24 @@ <!--</div>--> {% if category in selected_categories %}<input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}_dis_activation" name="category_{{ category }}" value="off" checked="checked"/>{% endif %} {% endfor %} +{% endif %} </div> </noscript> <div id="categories" class="btn-group btn-toggle hide_if_nojs" data-toggle="buttons"> +{% if rtl %} +{% for category in categories | reverse %} + <label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary"> + <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }} + </label> +{% endfor %} +{% else %} {% for category in categories %} <label class="btn btn-sm {% if category in selected_categories %}btn-primary active{% else %}btn-default{% endif %}" data-btn-class="primary"> - <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }}</label> + <input class="hidden" type="checkbox" id="checkbox_{{ category|replace(' ', '_') }}" name="category_{{ category }}" {% if category in selected_categories %}checked="checked"{% endif %} />{{ _(category) }} + </label> {% endfor %} +{% endif %} </div> diff --git a/searx/templates/oscar/macros.html b/searx/templates/oscar/macros.html @@ -28,3 +28,34 @@ <span class="label label-default pull-right">{{ result.engine }}</span> <p class="text-muted">{{ result.pretty_url }}</p> {%- endmacro %} + +<!-- Draw result footer --> +{% macro result_footer_rtl(result) -%} + <div class="clearfix"></div> + <span class="label label-default pull-left">{{ result.engine }}</span> + <p class="text-muted">{{ result.pretty_url }}</p> +{%- endmacro %} + +{% macro preferences_item_header(info, label) -%} + {% if not rtl %} + <div class="row form-group"> + <label class="col-sm-3 col-md-2">{{ label }}</label> + <div class="col-sm-4 col-md-4"> + {% else %} + <div class="row form-group"> + <span class="col-sm-5 col-md-6 help-block">{{ info }}</span> + <div class="col-sm-4 col-md-4"> + {% endif %} +{%- endmacro %} + +{% macro preferences_item_footer(info, label) -%} + {% if not rtl %} + </div> + <span class="col-sm-5 col-md-6 help-block">{{ info }}</span> + </div> + {% else %} + </div> + <label class="col-sm-3 col-md-2">{{ label }}</label> + </div> + {% endif %} +{%- endmacro %} diff --git a/searx/templates/oscar/navbar.html b/searx/templates/oscar/navbar.html @@ -1,6 +1,24 @@ <!-- Static navbar --> <div class="navbar navbar-default" role="navigation"> <div class="container-fluid"> + {% if rtl %} + <div class="navbar-collapse collapse navbar-left"> + <ul class="nav navbar-nav navbar-left"> <!-- results.html --> + <li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a></li> + <li{% if template_name == 'about.html' %} class="active"{% endif %}><a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a></li> + <li{% if template_name == 'index.html' %} class="active"{% endif %}><a href="{{ url_for('index') }}" class="hmarg">{{ _('home') }}</a></li> + </ul> + </div> + <div class="navbar-header navbar-right"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">{{ _('Toggle navigation') }}</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="{{ url_for('index') }}">searx</a> + </div> + {% else %} <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">{{ _('Toggle navigation') }}</span> @@ -17,5 +35,6 @@ <li{% if template_name == 'preferences.html' %} class="active"{% endif %}><a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a></li> </ul> </div><!--/.nav-collapse --> + {% endif %} </div><!--/.container-fluid --> </div> diff --git a/searx/templates/oscar/preferences.html b/searx/templates/oscar/preferences.html @@ -1,3 +1,4 @@ +{% from 'oscar/macros.html' import preferences_item_header, preferences_item_header_rtl, preferences_item_footer, preferences_item_footer_rtl %} {% extends "oscar/base.html" %} {% block title %}{{ _('preferences') }} - {% endblock %} {% block site_alert_warning_nojs %} @@ -12,7 +13,7 @@ <form method="post" action="{{ url_for('preferences') }}" id="search_form"> <!-- Nav tabs --> - <ul class="nav nav-tabs hide_if_nojs" role="tablist" style="margin-bottom:20px;"> + <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;"> <li class="active"><a href="#tab_general" role="tab" data-toggle="tab">{{ _('General') }}</a></li> <li><a href="#tab_engine" role="tab" data-toggle="tab">{{ _('Engines') }}</a></li> </ul> @@ -26,96 +27,94 @@ <fieldset> <div class="container-fluid"> <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> + {% if rtl %} <div class="col-sm-11 col-md-10"> {% include 'oscar/categories.html' %} </div> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Search language') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name='language'> - <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option> - {% for lang_id,lang_name,country_name in language_codes %} - <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option> - {% endfor %} - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('What language do you prefer for search?') }}</span> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Interface language') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name='locale'> - {% for locale_id,locale_name in locales.items() %} - <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> - {% endfor %} - </select> + <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> + {% else %} + <label class="col-sm-3 col-md-2">{{ _('Default categories') }}</label> + <div class="col-sm-11 col-md-10"> + {% include 'oscar/categories.html' %} </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Change the language of the layout') }}</span> + {% endif %} </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Autocomplete') }}</label> - <div class="col-sm-4 col-md-4"> + {% set language_label = _('Search language') %} + {% set language_info = _('What language do you prefer for search?') %} + {{ preferences_item_header(language_info, language_label) }} + <select class="form-control" name='language'> + <option value="all" {% if current_language == 'all' %}selected="selected"{% endif %}>{{ _('Automatic') }}</option> + {% for lang_id,lang_name,country_name in language_codes %} + <option value="{{ lang_id }}" {% if lang_id == current_language %}selected="selected"{% endif %}>{{ lang_name }} ({{ country_name }}) - {{ lang_id }}</option> + {% endfor %} + </select> + {{ preferences_item_footer(language_info, language_label) }} - <select class="form-control" name="autocomplete"> - <option value=""> - </option> - {% for backend in autocomplete_backends %} - <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> - {% endfor %} - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Find stuff as you type') }}</span> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Image proxy') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name='image_proxy'> - <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> - <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option> - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Proxying image results through searx') }}</span> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Method') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name='method'> - <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> - <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') }}</span> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('SafeSearch') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name='safesearch'> - <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> - <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> - <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Filter explicite content') }}</span> - </div> - <div class="row form-group"> - <label class="col-sm-3 col-md-2">{{ _('Themes') }}</label> - <div class="col-sm-4 col-md-4"> - <select class="form-control" name="theme"> - {% for name in themes %} - <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> - {% endfor %} - </select> - </div> - <span class="col-sm-5 col-md-6 help-block">{{ _('Change searx layout') }}</span> - </div> + {% set locale_label = _('Interface language') %} + {% set locale_info = _('Change the language of the layout') %} + {{ preferences_item_header(locale_info, locale_label) }} + <select class="form-control" name='locale'> + {% for locale_id,locale_name in locales.items() %} + <option value="{{ locale_id }}" {% if locale_id == current_locale %}selected="selected"{% endif %}>{{ locale_name }}</option> + {% endfor %} + </select> + {{ preferences_item_footer(locale_info, locale_label) }} + + {% set autocomplete_label = _('Autocomplete') %} + {% set autocomplete_info = _('Find stuff as you type') %} + {{ preferences_item_header(autocomplete_info, autocomplete_label) }} + <select class="form-control" name="autocomplete"> + <option value=""> - </option> + {% for backend in autocomplete_backends %} + <option value="{{ backend }}" {% if backend == autocomplete %}selected="selected"{% endif %}>{{ backend }}</option> + {% endfor %} + </select> + {{ preferences_item_footer(autocomplete_info, autocomplete_label) }} + + {% set image_proxy_label = _('Image proxy') %} + {% set image_proxy_info = _('Proxying image results through searx') %} + {{ preferences_item_header(image_proxy_info, image_proxy_label) }} + <select class="form-control" name='image_proxy'> + <option value="1" {% if image_proxy %}selected="selected"{% endif %}>{{ _('Enabled') }}</option> + <option value="" {% if not image_proxy %}selected="selected"{% endif %}>{{ _('Disabled')}}</option> + </select> + {{ preferences_item_footer(image_proxy_info, image_proxy_label) }} + + {% set method_label = _('Method') %} + {% set method_info = _('Change how forms are submited, <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol#Request_methods" rel="external">learn more about request methods</a>') %} + {{ preferences_item_header(method_info, method_label) }} + <select class="form-control" name='method'> + <option value="POST" {% if method == 'POST' %}selected="selected"{% endif %}>POST</option> + <option value="GET" {% if method == 'GET' %}selected="selected"{% endif %}>GET</option> + </select> + {{ preferences_item_footer(method_info, method_label) }} + + {% set safesearch_label = _('SafeSearch') %} + {% set safesearch_info = _('Filter content') %} + {{ preferences_item_header(safesearch_info, safesearch_label) }} + <select class="form-control" name='safesearch'> + <option value="2" {% if safesearch == '2' %}selected="selected"{% endif %}>{{ _('Strict') }}</option> + <option value="1" {% if safesearch == '1' %}selected="selected"{% endif %}>{{ _('Moderate') }}</option> + <option value="0" {% if safesearch == '0' %}selected="selected"{% endif %}>{{ _('None') }}</option> + </select> + {{ preferences_item_footer(safesearch_info, safesearch_label) }} + + {% set theme_label = _('Themes') %} + {% set theme_info = _('Change searx layout') %} + {{ preferences_item_header(theme_info, theme_label) }} + <select class="form-control" name="theme"> + {% for name in themes %} + <option value="{{ name }}" {% if name == theme %}selected="selected"{% endif %}>{{ name }}</option> + {% endfor %} + </select> + {{ preferences_item_footer(theme_info, theme_label) }} </div> </fieldset> </div> <div class="tab-pane active_if_nojs" id="tab_engine"> <!-- Nav tabs --> - <ul class="nav nav-tabs hide_if_nojs" role="tablist" style="margin-bottom:20px;"> + <ul class="nav nav-tabs nav-justified hide_if_nojs" role="tablist" style="margin-bottom:20px;"> {% for (categ,search_engines) in categs %} <li{% if loop.first %} class="active"{% endif %}><a href="#tab_engine_{{ categ|replace(' ', '_') }}" role="tab" data-toggle="tab">{{ _(categ) }}</a></li> {% endfor %} @@ -136,7 +135,9 @@ {% for search_engine in search_engines %} {% if not search_engine.private %} <div class="row"> + {% if not rtl %} <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})</div> + {% endif %} <div class="col-xs-6 col-sm-4 col-md-4"> <div class="checkbox"> <input class="hidden" type="checkbox" id="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}" name="engine_{{ search_engine.name }}__{{ categ }}"{% if (search_engine.name, categ) in blocked_engines %} checked="checked"{% endif %} /> @@ -144,6 +145,9 @@ <label class="btn btn-danger label_hide_if_not_checked" for="engine_{{ categ|replace(' ', '_') }}_{{ search_engine.name|replace(' ', '_') }}">{{ _('Allow') }}</label> </div> </div> + {% if rtl %} + <div class="col-xs-6 col-sm-4 col-md-4">{{ search_engine.name }} ({{ shortcuts[search_engine.name] }})&lrm;</div> + {% endif %} </div> {% endif %} {% endfor %} @@ -154,7 +158,6 @@ </div> </div> </div> - <p class="text-muted" style="margin:20px 0;">{{ _('These settings are stored in your cookies, this allows us not to store this data about you.') }} <br /> {{ _("These cookies serve your sole convenience, we don't use these cookies to track you.") }} diff --git a/searx/templates/oscar/result_templates/code.html b/searx/templates/oscar/result_templates/code.html @@ -1,4 +1,4 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} @@ -9,4 +9,8 @@ {{ result.codelines|code_highlighter(result.code_language)|safe }} +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} {{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/default.html b/searx/templates/oscar/result_templates/default.html @@ -1,4 +1,4 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} @@ -15,4 +15,8 @@ {% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %} +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} {{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/map.html b/searx/templates/oscar/result_templates/map.html @@ -1,4 +1,4 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} @@ -65,4 +65,8 @@ </div> {% endif %} +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} {{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/torrent.html b/searx/templates/oscar/result_templates/torrent.html @@ -1,4 +1,4 @@ -{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %} +{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, result_footer_rtl, icon %} {{ result_header(result, favicons) }} {{ result_sub_header(result) }} @@ -18,4 +18,8 @@ </p> +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} {{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/result_templates/videos.html b/searx/templates/oscar/result_templates/videos.html @@ -20,4 +20,8 @@ </div> </div> +{% if rtl %} +{{ result_footer_rtl(result) }} +{% else %} {{ result_footer(result) }} +{% endif %} diff --git a/searx/templates/oscar/results.html b/searx/templates/oscar/results.html @@ -33,6 +33,27 @@ <div class="clearfix"></div> {% if paging %} + {% if rtl %} + <div id="pagination"> + <div class="pull-left"> + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + <input type="hidden" name="q" value="{{ q }}" /> + {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %} + <input type="hidden" name="q" value="{{ q }}" /> + <input type="hidden" name="pageno" value="{{ pageno+1 }}" /> + <button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-backward"></span> {{ _('next page') }}</button> + </form> + </div> + <div class="pull-right"> + <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> + {% for category in selected_categories %}<input type="hidden" name="category_{{ category }}" value="1"/>{% endfor %} + <input type="hidden" name="pageno" value="{{ pageno-1 }}" /> + <button type="submit" class="btn btn-default" {% if pageno == 1 %}disabled{% endif %}><span class="glyphicon glyphicon-forward"></span> {{ _('previous page') }}</button> + </form> + </div> + </div><!-- /#pagination --> + <div class="clearfix"></div> + {% else %} <div id="pagination"> <div class="pull-left"> <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" class="pull-left"> @@ -53,6 +74,7 @@ </div><!-- /#pagination --> <div class="clearfix"></div> {% endif %} + {% endif %} </div><!-- /#main_results --> <div class="col-sm-4" id="sidebar_results"> diff --git a/searx/templates/oscar/search_full.html b/searx/templates/oscar/search_full.html @@ -1,7 +1,11 @@ {% from 'oscar/macros.html' import icon %} <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search"> + {% if rtl %} + <div class="input-group"> + {% else %} <div class="input-group col-md-8 col-md-offset-2"> + {% endif %} <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}"> <span class="input-group-btn"> <button type="submit" class="btn btn-default input-lg"><span class="hide_if_nojs">{{ icon('search') }}</span><span class="hidden active_if_nojs">{{ _('Start search') }}</span></button> diff --git a/searx/webapp.py b/searx/webapp.py @@ -20,7 +20,7 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >. if __name__ == '__main__': from sys import path from os.path import realpath, dirname - path.append(realpath(dirname(realpath(__file__))+'/../')) + path.append(realpath(dirname(realpath(__file__)) + '/../')) import json import cStringIO @@ -85,10 +85,13 @@ app.secret_key = settings['server']['secret_key'] babel = Babel(app) +rtl_locales = ['ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', + 'ku', 'mzn', 'pnb'', ''ps', 'sd', 'ug', 'ur', 'yi'] + global_favicons = [] for indice, theme in enumerate(themes): global_favicons.append([]) - theme_img_path = searx_dir+"/static/themes/"+theme+"/img/icons/" + theme_img_path = searx_dir + "/static/themes/" + theme + "/img/icons/" for (dirpath, dirnames, filenames) in os.walk(theme_img_path): global_favicons[indice].extend(filenames) @@ -262,6 +265,9 @@ def render(template_name, override_theme=None, **kwargs): if 'autocomplete' not in kwargs: kwargs['autocomplete'] = autocomplete + if get_locale() in rtl_locales and 'rtl' not in kwargs: + kwargs['rtl'] = True + kwargs['searx_version'] = VERSION_STRING kwargs['method'] = request.cookies.get('method', 'POST') @@ -396,6 +402,7 @@ def about(): """Render about page""" return render( 'about.html', + rtl=False, ) @@ -592,7 +599,7 @@ def image_proxy(): img = '' chunk_counter = 0 - for chunk in resp.iter_content(1024*1024): + for chunk in resp.iter_content(1024 * 1024): chunk_counter += 1 if chunk_counter > 5: return '', 502 # Bad gateway - file is too big (>5M)