6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>新しいタブ | MyBrowser</title>
9 <link href="my://style.css" rel="stylesheet">
10 <link href="https://stackpath.bootstrapcdn.com/bootswatch/3.4.1/paper/bootstrap.min.css" rel="stylesheet"
11 integrity="sha384-czdUt3c5InCk6AjJWW7zMMS5xcvRAyC6tWoWfXuRYfX6Vvv4Es8m8eRjzMChD493" crossorigin="anonymous">
12 <link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css" rel="stylesheet">
13 <link href="https://fonts.googleapis.com/css?family=Noto+Sans|Noto+Sans+JP|Roboto" rel="stylesheet">
14 <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
15 <link rel="icon" sizes="any" href="my://public.svg" type="image/svg+xml">
16 <link rel="mask-icon" href="my://public.svg" color="black">
20 <header class="topbar">
21 <div class="nav-toggle">
22 <i class="material-icons">
26 <h5 class="title">新しいタブ</h5>
27 <input class="topbar-search" id="search" placeholder="Google で検索または URL を入力" onkeydown="handleKeydown();">
28 <div class="btn btn-primary topbar-search-btn">
29 <i class="material-icons">
36 <div class="container"></div>
37 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
38 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
39 <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
40 <script type="text/javascript">
41 $(document).ready(function () {
42 $('.nav a[href="' + window.location.pathname + '"]').parent().addClass('active');
44 $('#search').prop('placeholder', `${getSearchEngine().name} で検索または URL を入力`);
46 $('#search').autocomplete({
47 source: function (request, response) {
49 url: "http://www.google.com/complete/search",
50 data: { hl: 'ja', client: 'firefox', q: request.term },
53 success: function (data) {
63 $('.topbar').css({ 'background-color': '#323232', 'color': 'white' });
64 $('.topbar > .title').css('color', 'white');
65 $('.topbar-search').css({ 'background-color': '#252525', 'color': 'white' });
66 $('body').css('background-color', '#252525');
68 $('.nav-toggle').hover(function () {
69 $(this).css('background-color', 'rgba(130, 130, 130, 0.3)');
71 $(this).css('background-color', '');
74 $('.topbar').css({ 'background-color': '', 'color': '' });
75 $('.topbar > .title').css('color', '');
76 $('.topbar-search').css({ 'background-color': '', 'color': '' });
77 $('body').css('background-color', '');
79 $('.nav-toggle').hover(function () {
80 $(this).css('background-color', 'rgba(0, 0, 0, 0.06)');
82 $(this).css('background-color', '');
87 function handleKeydown() {
88 let searchBar = $('#search');
89 if (event.keyCode != 13 || searchBar.val().length == 0 || searchBar.val() == '') return;
91 if (isURL(searchBar.val())) {
92 location.href = searchBar.val();
94 location.href = window.getSearchEngine().url.replace('%s', searchBar.val());
98 function isURL(input) {
99 const pattern = /^((?:\w+:)?\/\/([^\s.]+\.\S{2}|localhost[:?\d]*)|my:\/\/\S.*)\S*$/;
101 if (pattern.test(input)) {
104 return pattern.test(`http://${input}`);