b0o / surfingkeys-conf

🏄 A SurfingKeys config which adds 180+ key mappings & 50+ search engines
MIT License
395 stars 67 forks source link

alias: "oy", openOmnibar: "oy", opensearchkey: "yt" #4

Closed ghost closed 6 years ago

ghost commented 6 years ago
const sl = '';

// Search engines

var completions = [
    { alias:  'yt' 
    , name:   'youtube'
    , search: 'https://www.youtube.com/results?search_query='
    , compl:  'https://suggestqueries.google.com/complete/search?client=youtube&ds=yt&client=chrome-ext&q='
    , callback: function(response) {
         var res = JSON.parse(response.text);
         return res[1];
      }
    }, 
    { alias:  'am'
    , name:   'amazon'
    , search: 'https://amazon.com/s/?field-keywords='
    , compl:  'https://completion.amazon.com/search/complete?method=completion&mkt=44551&p=Search&l=es_ES&b2b=0&fresh=0&client=amazon-search-ui&x=String&search-alias=aps&ks=69&q='
    , callback: function(response) {
        var regex = /[^[\]]+(?=])/;
        var matched = regex.exec(response.text);
        return matched[0]
            .split(',')
            .map(item => item.substring(1, item.length-1));
      }
    }
    ]

Object.keys(completions).forEach((k) => {
  const s = completions[k] // Search Engine object
  const la = sl + s.alias // Search leader + alias

  addSearchAliasX(s.alias, s.name, s.search, sl, s.compl, s.callback);
  mapkey(la, `#8Search ${s.name}`, () => Front.openOmnibar({ type: "SearchEngine", extra: s.alias }));
});
b0o commented 6 years ago

I'm going to close this because I can't quite understand the question. If you're still having trouble, please open a new issue. Thanks 😃

ghost commented 6 years ago

@b0o Increase open search key${s.alias}

const searchleader = "" alias: "oy", openOmnibar: "oy", searchkey: "yt" a s

b0o commented 6 years ago

I still don't understand your question...

ghost commented 6 years ago

@b0o

search_leader_key

s

addSearchAliasX('d', 'duckduckgo', 'https://duckduckgo.com/?q=', 'c', 'https://duckduckgo.com/ac/?q=', function(response) {
    var res = JSON.parse(response.text);
    return res.map(function(r){
        return r.phrase;
    });
});