Skip to content

Conversation

@yiminzme
Copy link

添加”Enter键后才搜索“模式
添加相应的checkbox
(Note:

  1. 有些人比较习惯这个模式,有时想要看着已有的搜索结果查新的单词
  2. javascript部分我改的主要在public/js/popup.min.js 48-66行:
    $button.addEventListener("click", function() {
    queryInPopup()
    }), $input.select();
    $input.addEventListener("input", function() {
    if(realTimeQuery.checked){
    var a = $input.value;
    setTimeout(function() {
    $input.value === a && "" !== $input.value && queryInPopup()
    }, 500)
    }
    });
    $input.addEventListener("keyup", function(e) {
    if(!realTimeQuery.checked){
    if(e.which==13){
    console.log(realTimeQuery.checked);
    queryInPopup(this.value);
    }
    }
    });
    我把if-else写到了addEventListener里了,可能写法不好。你能帮我改下吗,我想知道正确写法,我是业余的。
    感谢 👍

vinc96_PC and others added 2 commits December 9, 2016 20:12
add realTimeQuery checkbox to determine if Query When Enter KeyDown or
Query In RealTime
fix unintentionally changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants