Skip to content

Commit

Permalink
style:初步优化
Browse files Browse the repository at this point in the history
  • Loading branch information
pengfeng05 committed May 19, 2021
1 parent aac1f63 commit 7a705fb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 46 deletions.
20 changes: 9 additions & 11 deletions assets/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,22 @@ function initDisplay() {
}

function judgeGo(){
var word = $("#keyword").val().trim();
if(word == "" && $("#keyword").hasClass("wait")){
var word = $("#keyword").val().trim();
if(word == "" && $("#keyword").hasClass("wait")){
alert("Please enter keywords first.");
return;
}
initDisplay();
if(word == "") {
return;
}
goSearching(word.toUpperCase());
}

// no btn needed
function goSearching(word) {
let changeColor = document.getElementById("seach-tabs");

// 一旦变绿直接变绿 8D /xs
changeColor.style.backgroundColor = "lightgreen";

queryTabs(word);
}
document.getElementById("seach-tabs").addEventListener("click", judgeGo);

document.onkeydown=keyListener;

Expand All @@ -64,13 +62,13 @@ function goSearching(word) {
function queryTabs(keywords) {
let tabs = [];
traverseTabsOfCurWindow(function (tab) {
if (tab.title.toUpperCase().indexOf(keywords) != -1
|| tab.url.toUpperCase().indexOf(keywords) != -1
if ((tab.title && tab.title.toUpperCase().indexOf(keywords) != -1)
|| (tab.url && tab.url.toUpperCase().indexOf(keywords) != -1)
|| (tab.pendingUrl && tab.pendingUrl.toUpperCase().indexOf(keywords) != -1)) {
tabs.push(tab);
}
}, function () {
$(".container").append('<div class="tab-result">Results in tabs:</div>');
$(".container").append('<div class="tab-result"></div>');
for (let j in tabs) {
let tab = tabs[j];
$('.tab-result').append('<p id = "' + tab.id + '"' + '>' + tab.title + '</p>');
Expand Down
25 changes: 17 additions & 8 deletions assets/srch-res.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
button {
height: 30px;
width: 30px;
outline: none;
margin: 10px;
border: ridge;
border-radius: 4px;
}
input{
outline-style: none ;
border: 1px solid #ccc;
border-radius: 3px;
padding: 13px 14px;
width: 180px;
font-size: 10px;
font-weight: 666;
font-family: "Microsoft soft";
}

input:focus{
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)
}
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Where is my tab ?",
"description": "Search for tabs in the opened window, may can also search for bookmarks and history in future versions.",
"version": "1.2",
"description": "Search for tabs in the opened window, can also increase your speed of switching tabs.",
"version": "1.3",
"manifest_version": 3,
"permissions": [
"tabs","commands","windows"
Expand Down
3 changes: 2 additions & 1 deletion srch-res.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
<body>
<h1 align="center">Where is my tab ?</h1>
<div align="center">
<input type="text" id = "keyword"/><input type="button" id="seach-tabs" value="GO!"/>
<input type="text" id = "keyword"/>
<!-- <input type="button" id="seach-tabs" value="GO!"/> -->
</div>
<div class="container">
<!-- <div class="tab-result">Results in tabs:</div>
Expand Down
24 changes: 0 additions & 24 deletions 银翼杀手2049.md

This file was deleted.

0 comments on commit 7a705fb

Please sign in to comment.