Przeglądaj źródła

[enh][oscar_template] split js-files and compile them together

Thomas Pointhuber 10 lat temu
rodzic
commit
e687f5c290

+ 1
- 0
.gitignore Wyświetl plik

@@ -9,6 +9,7 @@ setup.cfg
9 9
 
10 10
 *.pyc
11 11
 */*.pyc
12
+*~
12 13
 
13 14
 bin/
14 15
 build/

+ 2
- 0
.travis.yml Wyświetl plik

@@ -5,6 +5,7 @@ before_install:
5 5
   - "export DISPLAY=:99.0"
6 6
   - "sh -e /etc/init.d/xvfb start"
7 7
   - npm install -g less
8
+  - cd searx/static/oscar;npm install
8 9
 install:
9 10
   - "make"
10 11
   - pip install coveralls
@@ -12,6 +13,7 @@ script:
12 13
   - "make tests"
13 14
   - "make robot"
14 15
   - "make styles"
16
+  - "make grunt"
15 17
   - make coverage
16 18
 after_success:
17 19
   coveralls

+ 4
- 0
Makefile Wyświetl plik

@@ -20,6 +20,7 @@ $(python):
20 20
 
21 21
 tests: .installed.cfg
22 22
 	@bin/test
23
+	@grunt test --gruntfile searx/static/oscar/gruntfile.js
23 24
 
24 25
 robot: .installed.cfg
25 26
 	@bin/robot
@@ -48,6 +49,9 @@ styles:
48 49
 	@lessc -x searx/static/oscar/less/bootstrap/bootstrap.less > searx/static/oscar/css/bootstrap.min.css
49 50
 	@lessc -x searx/static/oscar/less/oscar/oscar.less > searx/static/oscar/css/oscar.min.css
50 51
 
52
+grunt:
53
+	@grunt --gruntfile searx/static/oscar/gruntfile.js
54
+
51 55
 locales:
52 56
 	@pybabel compile -d searx/translations
53 57
 

+ 1
- 0
searx/static/oscar/.gitignore Wyświetl plik

@@ -0,0 +1 @@
1
+node_modules/

+ 17
- 0
searx/static/oscar/README.rst Wyświetl plik

@@ -0,0 +1,17 @@
1
+install dependencies
2
+~~~~~~~~~~~~~~~~~~~~
3
+
4
+run this command in the directory ``searx/static/oscar``
5
+
6
+``npm install``
7
+
8
+compile sources
9
+~~~~~~~~~~~~~~~
10
+
11
+run this command in the directory ``searx/static/oscar``
12
+
13
+``grunt``
14
+
15
+or in the root directory:
16
+
17
+``make grunt``

+ 51
- 0
searx/static/oscar/gruntfile.js Wyświetl plik

@@ -0,0 +1,51 @@
1
+module.exports = function(grunt) {
2
+
3
+  grunt.initConfig({
4
+    pkg: grunt.file.readJSON('package.json'),
5
+    concat: {
6
+      options: {
7
+        separator: ';'
8
+      },
9
+      dist: {
10
+        src: ['js/searx_src/*.js'],
11
+        dest: 'js/searx.js'
12
+      }
13
+    },
14
+    uglify: {
15
+      options: {
16
+        banner: '/*! oscar/searx.min.js | <%= grunt.template.today("dd-mm-yyyy") %> | https://github.com/asciimoo/searx */\n'
17
+      },
18
+      dist: {
19
+        files: {
20
+          'js/searx.min.js': ['<%= concat.dist.dest %>']
21
+        }
22
+      }
23
+    },
24
+    jshint: {
25
+      files: ['gruntfile.js', 'js/searx_src/*.js'],
26
+      options: {
27
+        // options here to override JSHint defaults
28
+        globals: {
29
+          jQuery: true,
30
+          console: true,
31
+          module: true,
32
+          document: true
33
+        }
34
+      }
35
+    },
36
+    watch: {
37
+      files: ['<%= jshint.files %>'],
38
+      tasks: ['jshint']
39
+    }
40
+  });
41
+
42
+  grunt.loadNpmTasks('grunt-contrib-uglify');
43
+  grunt.loadNpmTasks('grunt-contrib-jshint');
44
+  grunt.loadNpmTasks('grunt-contrib-watch');
45
+  grunt.loadNpmTasks('grunt-contrib-concat');
46
+
47
+  grunt.registerTask('test', ['jshint']);
48
+
49
+  grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
50
+
51
+};

+ 2
- 0
searx/static/oscar/js/searx.min.js Wyświetl plik

@@ -0,0 +1,2 @@
1
+/*! oscar/searx.min.js | 30-11-2014 | https://github.com/asciimoo/searx */
2
+requirejs.config({baseUrl:"/static/oscar/js",paths:{app:"../app"}}),searx.autocompleter&&(searx.searchResults=new Bloodhound({datumTokenizer:Bloodhound.tokenizers.obj.whitespace("value"),queryTokenizer:Bloodhound.tokenizers.whitespace,remote:"/autocompleter?q=%QUERY"}),searx.searchResults.initialize()),$(document).ready(function(){searx.autocompleter&&$("#q").typeahead(null,{name:"search-results",displayKey:function(a){return a},source:searx.searchResults.ttAdapter()})}),$(document).ready(function(){$("#q.autofocus").focus(),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var a=$(this).data("btn-text-collapsed"),b=$(this).data("btn-text-not-collapsed");""!==a&&""!==b&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(a,b):$(this).html().replace(b,a),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var a="btn-"+$(this).data("btn-class"),b=$(this).data("btn-label-default"),c=$(this).data("btn-label-toggled");""!==c&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(b,c):$(this).html().replace(c,b),$(this).html(new_html)),$(this).toggleClass(a),$(this).toggleClass("btn-default")})}),$(document).ready(function(){$(".searx_overpass_request").on("click",function(a){var b="https://overpass-api.de/api/interpreter?data=",c=b+"[out:json][timeout:25];(",d=");out meta;",e=$(this).data("osm-id"),f=$(this).data("osm-type"),g=$(this).data("result-table"),h="#"+$(this).data("result-table-loadicon"),i=["addr:city","addr:country","addr:housenumber","addr:postcode","addr:street"];if(e&&f&&g){g="#"+g;var j=null;switch(f){case"node":j=c+"node("+e+");"+d;break;case"way":j=c+"way("+e+");"+d;break;case"relation":j=c+"relation("+e+");"+d}if(j){$.ajax(j).done(function(a){if(a&&a.elements&&a.elements[0]){var b=a.elements[0],c=$(g).html();for(var d in b.tags)if(null===b.tags.name||-1==i.indexOf(d)){switch(c+="<tr><td>"+d+"</td><td>",d){case"phone":case"fax":c+='<a href="tel:'+b.tags[d].replace(/ /g,"")+'">'+b.tags[d]+"</a>";break;case"email":c+='<a href="mailto:'+b.tags[d]+'">'+b.tags[d]+"</a>";break;case"website":case"url":c+='<a href="'+b.tags[d]+'">'+b.tags[d]+"</a>";break;case"wikidata":c+='<a href="https://www.wikidata.org/wiki/'+b.tags[d]+'">'+b.tags[d]+"</a>";break;case"wikipedia":if(-1!=b.tags[d].indexOf(":")){c+='<a href="https://'+b.tags[d].substring(0,b.tags[d].indexOf(":"))+".wikipedia.org/wiki/"+b.tags[d].substring(b.tags[d].indexOf(":")+1)+'">'+b.tags[d]+"</a>";break}default:c+=b.tags[d]}c+="</td></tr>"}$(g).html(c),$(g).removeClass("hidden"),$(h).addClass("hidden")}}).fail(function(){$(h).html($(h).html()+'<p class="text-muted">could not load data!</p>')})}}$(this).off(a)}),$(".searx_init_map").on("click",function(a){var b=$(this).data("leaflet-target"),c=$(this).data("map-lon"),d=$(this).data("map-lat"),e=$(this).data("map-zoom"),f=$(this).data("map-boundingbox"),g=$(this).data("map-geojson");require(["leaflet-0.7.3.min"],function(){f&&(southWest=L.latLng(f[0],f[2]),northEast=L.latLng(f[1],f[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="/static/oscar/img/map";{var a=L.map(b),h="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",i='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors',j=new L.TileLayer(h,{minZoom:1,maxZoom:19,attribution:i}),k="http://otile{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.jpg",l='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png">',m=new L.TileLayer(k,{minZoom:1,maxZoom:18,subdomains:"1234",attribution:l}),n="http://otile{s}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg",o='Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="https://developer.mapquest.com/content/osm/mq_logo.png"> | Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency';new L.TileLayer(n,{minZoom:1,maxZoom:11,subdomains:"1234",attribution:o})}map_bounds?setTimeout(function(){a.fitBounds(map_bounds,{maxZoom:17})},0):c&&d&&(e?a.setView(new L.LatLng(d,c),e):a.setView(new L.LatLng(d,c),8)),a.addLayer(m);var p={"OSM Mapnik":j,MapQuest:m};L.control.layers(p).addTo(a),g&&L.geoJson(g).addTo(a)}),$(this).off(a)})});

+ 23
- 0
searx/static/oscar/js/searx_src/00_requirejs_config.js Wyświetl plik

@@ -0,0 +1,23 @@
1
+/**
2
+ * searx is free software: you can redistribute it and/or modify
3
+ * it under the terms of the GNU Affero General Public License as published by
4
+ * the Free Software Foundation, either version 3 of the License, or
5
+ * (at your option) any later version.
6
+ *
7
+ * searx is distributed in the hope that it will be useful,
8
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
+ * GNU Affero General Public License for more details.
11
+ *
12
+ * You should have received a copy of the GNU Affero General Public License
13
+ * along with searx. If not, see < http://www.gnu.org/licenses/ >.
14
+ *
15
+ * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
16
+ */
17
+
18
+requirejs.config({
19
+    baseUrl: '/static/oscar/js',
20
+    paths: {
21
+        app: '../app'
22
+    }
23
+});

+ 37
- 0
searx/static/oscar/js/searx_src/autocompleter.js Wyświetl plik

@@ -0,0 +1,37 @@
1
+/**
2
+ * searx is free software: you can redistribute it and/or modify
3
+ * it under the terms of the GNU Affero General Public License as published by
4
+ * the Free Software Foundation, either version 3 of the License, or
5
+ * (at your option) any later version.
6
+ *
7
+ * searx is distributed in the hope that it will be useful,
8
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
+ * GNU Affero General Public License for more details.
11
+ *
12
+ * You should have received a copy of the GNU Affero General Public License
13
+ * along with searx. If not, see < http://www.gnu.org/licenses/ >.
14
+ *
15
+ * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
16
+ */
17
+
18
+if(searx.autocompleter) {
19
+    searx.searchResults = new Bloodhound({
20
+        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
21
+        queryTokenizer: Bloodhound.tokenizers.whitespace,
22
+        remote: '/autocompleter?q=%QUERY'
23
+    });
24
+    searx.searchResults.initialize();
25
+}
26
+
27
+$(document).ready(function(){ 
28
+    if(searx.autocompleter) {
29
+        $('#q').typeahead(null, {
30
+            name: 'search-results',
31
+            displayKey: function(result) {
32
+                return result;
33
+            },
34
+            source: searx.searchResults.ttAdapter()
35
+        });
36
+    }
37
+});

+ 66
- 0
searx/static/oscar/js/searx_src/element_modifiers.js Wyświetl plik

@@ -0,0 +1,66 @@
1
+/**
2
+ * searx is free software: you can redistribute it and/or modify
3
+ * it under the terms of the GNU Affero General Public License as published by
4
+ * the Free Software Foundation, either version 3 of the License, or
5
+ * (at your option) any later version.
6
+ *
7
+ * searx is distributed in the hope that it will be useful,
8
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
+ * GNU Affero General Public License for more details.
11
+ *
12
+ * You should have received a copy of the GNU Affero General Public License
13
+ * along with searx. If not, see < http://www.gnu.org/licenses/ >.
14
+ *
15
+ * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
16
+ */
17
+
18
+$(document).ready(function(){
19
+    /**
20
+     * focus element if class="autofocus" and id="q"
21
+     */
22
+    $('#q.autofocus').focus();
23
+
24
+    /**
25
+     * select full content on click if class="select-all-on-click"
26
+     */
27
+    $(".select-all-on-click").click(function () {
28
+        $(this).select();
29
+    });    
30
+
31
+    /**
32
+     * change text during btn-collapse click if possible
33
+     */
34
+    $('.btn-collapse').click(function() {
35
+        var btnTextCollapsed = $(this).data('btn-text-collapsed');
36
+        var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed');
37
+        
38
+        if(btnTextCollapsed !== '' && btnTextNotCollapsed !== '') {
39
+            if($(this).hasClass('collapsed')) {
40
+                new_html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed);
41
+            } else {
42
+                new_html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed);
43
+            }
44
+            $(this).html(new_html);
45
+        }
46
+    });
47
+
48
+    /**
49
+     * change text during btn-toggle click if possible
50
+     */
51
+    $('.btn-toggle .btn').click(function() {
52
+        var btnClass = 'btn-' + $(this).data('btn-class');
53
+        var btnLabelDefault = $(this).data('btn-label-default');
54
+        var btnLabelToggled = $(this).data('btn-label-toggled');
55
+        if(btnLabelToggled !== '') {
56
+            if($(this).hasClass('btn-default')) {
57
+                new_html = $(this).html().replace(btnLabelDefault, btnLabelToggled);
58
+            } else {
59
+                new_html = $(this).html().replace(btnLabelToggled, btnLabelDefault);
60
+            }
61
+            $(this).html(new_html);
62
+        }
63
+        $(this).toggleClass(btnClass);
64
+        $(this).toggleClass('btn-default');
65
+    });
66
+});

searx/static/oscar/js/scripts.js → searx/static/oscar/js/searx_src/leaflet_map.js Wyświetl plik

@@ -1,74 +1,21 @@
1 1
 /**
2
- _                 _       _                  
3
-| |__   ___   ___ | |_ ___| |_ _ __ __ ___  __
4
-| '_ \ / _ \ / _ \| __/ __| __| '__/ _` \ \/ /
5
-| |_) | (_) | (_) | |_\__ | |_| | | (_| |>  < 
6
-|_.__/ \___/ \___/ \__|___/\__|_|  \__,_/_/\_\.js
7
-
8
-*/
9
-
10
-requirejs.config({
11
-baseUrl: '/static/oscar/js',
12
-paths: {
13
-app: '../app'
14
-}
15
-});
16
-
17
-if(searx.autocompleter) {
18
-    searx.searchResults = new Bloodhound({
19
-        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),
20
-        queryTokenizer: Bloodhound.tokenizers.whitespace,
21
-        remote: '/autocompleter?q=%QUERY'
22
-    });
23
-    searx.searchResults.initialize();
24
-}
2
+ * searx is free software: you can redistribute it and/or modify
3
+ * it under the terms of the GNU Affero General Public License as published by
4
+ * the Free Software Foundation, either version 3 of the License, or
5
+ * (at your option) any later version.
6
+ *
7
+ * searx is distributed in the hope that it will be useful,
8
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
+ * GNU Affero General Public License for more details.
11
+ *
12
+ * You should have received a copy of the GNU Affero General Public License
13
+ * along with searx. If not, see < http://www.gnu.org/licenses/ >.
14
+ *
15
+ * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
16
+ */
25 17
 
26 18
 $(document).ready(function(){
27
-    $('.btn-toggle .btn').click(function() {
28
-        var btnClass = 'btn-' + $(this).data('btn-class');
29
-        var btnLabelDefault = $(this).data('btn-label-default');
30
-        var btnLabelToggled = $(this).data('btn-label-toggled');
31
-        if(btnLabelToggled != '') {
32
-            if($(this).hasClass('btn-default')) {
33
-                
34
-                var html = $(this).html().replace(btnLabelDefault, btnLabelToggled);
35
-            } else {
36
-                var html = $(this).html().replace(btnLabelToggled, btnLabelDefault);
37
-            }
38
-            $(this).html(html);
39
-        }
40
-        $(this).toggleClass(btnClass);
41
-        $(this).toggleClass('btn-default');
42
-    });
43
-
44
-    $('.btn-collapse').click(function() {
45
-        var btnTextCollapsed = $(this).data('btn-text-collapsed');
46
-        var btnTextNotCollapsed = $(this).data('btn-text-not-collapsed');
47
-        
48
-        if(btnTextCollapsed != '' && btnTextNotCollapsed != '') {
49
-            if($(this).hasClass('collapsed')) {
50
-                var html = $(this).html().replace(btnTextCollapsed, btnTextNotCollapsed);
51
-            } else {
52
-                var html = $(this).html().replace(btnTextNotCollapsed, btnTextCollapsed);
53
-            }
54
-            $(this).html(html);
55
-        }
56
-    });
57
-    
58
-    $(".select-all-on-click").click(function () {
59
-        $(this).select();
60
-    });
61
-    
62
-    if(searx.autocompleter) {
63
-        $('#q').typeahead(null, {
64
-            name: 'search-results',
65
-            displayKey: function(result) {
66
-                return result;
67
-            },
68
-            source: searx.searchResults.ttAdapter()
69
-        });
70
-    }
71
-    
72 19
     $(".searx_overpass_request").on( "click", function( event ) {
73 20
         var overpass_url = "https://overpass-api.de/api/interpreter?data=";
74 21
         var query_start = overpass_url + "[out:json][timeout:25];(";
@@ -80,7 +27,7 @@ $(document).ready(function(){
80 27
         var result_table_loadicon = "#" + $(this).data('result-table-loadicon');
81 28
         
82 29
         // tags which can be ignored
83
-        var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ]
30
+        var osm_ignore_tags = [ "addr:city", "addr:country", "addr:housenumber", "addr:postcode", "addr:street" ];
84 31
         
85 32
         if(osm_id && osm_type && result_table) {
86 33
             result_table = "#" + result_table;
@@ -102,11 +49,11 @@ $(document).ready(function(){
102 49
                 //alert(query);
103 50
                 var ajaxRequest = $.ajax( query )
104 51
                 .done(function( html) {
105
-                    if(html && html['elements'] && html['elements'][0]) {
106
-                        var element = html['elements'][0];
52
+                    if(html && html.elements && html.elements[0]) {
53
+                        var element = html.elements[0];
107 54
                         var newHtml = $(result_table).html();
108 55
                         for (var row in element.tags) {
109
-                            if(element.tags["name"] == null || osm_ignore_tags.indexOf(row) == -1) {
56
+                            if(element.tags.name === null || osm_ignore_tags.indexOf(row) == -1) {
110 57
                                 newHtml += "<tr><td>" + row + "</td><td>";
111 58
                                 switch(row) {
112 59
                                     case "phone":
@@ -125,11 +72,12 @@ $(document).ready(function(){
125 72
                                         break;
126 73
                                     case "wikipedia":
127 74
                                         if(element.tags[row].indexOf(":") != -1) {
128
-                                            newHtml += "<a href=\"https://" + element.tags[row].substring(0,element.tags[row].indexOf(":")) + ".wikipedia.org/wiki/" 
129
-                                                + element.tags[row].substring(element.tags[row].indexOf(":")+1) + "\">" + element.tags[row] + "</a>";
75
+                                            newHtml += "<a href=\"https://" + element.tags[row].substring(0,element.tags[row].indexOf(":")) + ".wikipedia.org/wiki/" + element.tags[row].substring(element.tags[row].indexOf(":")+1) + "\">" + element.tags[row] + "</a>";
130 76
                                             break;
131 77
                                         }
78
+                                    /* jshint ignore:start */
132 79
                                     default:
80
+                                    /* jshint ignore:end */
133 81
                                         newHtml += element.tags[row];
134 82
                                         break;
135 83
                                 }
@@ -143,7 +91,7 @@ $(document).ready(function(){
143 91
                 })
144 92
                 .fail(function() {
145 93
                     $(result_table_loadicon).html($(result_table_loadicon).html() + "<p class=\"text-muted\">could not load data!</p>");
146
-                })
94
+                });
147 95
             }
148 96
         }
149 97
 
@@ -158,12 +106,12 @@ $(document).ready(function(){
158 106
         var map_zoom = $(this).data('map-zoom');
159 107
         var map_boundingbox = $(this).data('map-boundingbox');
160 108
         var map_geojson = $(this).data('map-geojson');
161
-  
109
+
162 110
         require(['leaflet-0.7.3.min'], function(leaflet) {
163 111
             if(map_boundingbox) {
164
-                var southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]),
165
-                    northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]),
166
-                    map_bounds = L.latLngBounds(southWest, northEast);
112
+                southWest = L.latLng(map_boundingbox[0], map_boundingbox[2]);
113
+                northEast = L.latLng(map_boundingbox[1], map_boundingbox[3]);
114
+                map_bounds = L.latLngBounds(southWest, northEast);
167 115
             }
168 116
 
169 117
             // TODO hack

+ 15
- 0
searx/static/oscar/package.json Wyświetl plik

@@ -0,0 +1,15 @@
1
+{
2
+    "devDependencies": {
3
+        "grunt": "~0.4.5",
4
+        "grunt-contrib-uglify": "~0.6.0",
5
+        "grunt-contrib-watch" : "~0.6.1",
6
+        "grunt-contrib-concat" : "~0.5.0",
7
+        "grunt-contrib-jshint" : "~0.10.0"
8
+    },
9
+    
10
+    "scripts": {
11
+        "build": "npm install && grunt",
12
+        "start": "grunt watch",
13
+        "test": "grunt"
14
+    }
15
+}

+ 1
- 1
searx/templates/oscar/base.html Wyświetl plik

@@ -73,6 +73,6 @@
73 73
     <script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
74 74
     {% if autocomplete %}<script src="{{ url_for('static', filename='js/typeahead.bundle.min.js') }}"></script>{% endif %}
75 75
     <script src="{{ url_for('static', filename='js/require-2.1.15.min.js') }}"></script>
76
-    <script src="{{ url_for('static', filename='js/scripts.js') }}"></script>
76
+    <script src="{{ url_for('static', filename='js/searx.min.js') }}"></script>
77 77
 </body>
78 78
 </html>

+ 1
- 1
searx/templates/oscar/search_full.html Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 
3 3
 <form method="{{ method or 'POST' }}" action="{{ url_for('index') }}" id="search_form" role="search">
4 4
     <div class="input-group col-md-8 col-md-offset-2">
5
-        <input type="search" name="q" class="form-control input-lg" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
5
+        <input type="search" name="q" class="form-control input-lg autofocus" id="q" placeholder="{{ _('Search for...') }}" autocomplete="off" value="{{ q }}">
6 6
         <span class="input-group-btn">
7 7
             <button type="submit" class="btn btn-default input-lg">{{ icon('search') }}<span class="sr-only">{{ _('Start search') }}</span></button>
8 8
         </span>