npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

console-ban

v5.0.0

Published

Detect F12 open browser console. protect web site static resources, support redirect, rewrite, custom callback strategies

Downloads

1,068

Readme

console-ban

F12 ブラウザのコンソールを見破る、Web サイトのスタティックなリソースを保護し、リダイレクト、リライト、コールバック三つのストラテジーを通用が可能。

Language: English|中文|日本語

使い方

HTML に直接に挿入:

<head>
  <!-- ... -->
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/console-ban.min.js"></script>
  <script>
    // デフォルトオプション
    ConsoleBan.init()
    // カスタムオプション
    ConsoleBan.init({
      redirect: '/404'
    })
  </script>
</head>

現代なウェブのプロジェクトにインストール:

  yarn add console-ban
import { init } from 'console-ban'

init(options)

ストラテジー

リダイレクト

ConsoleBan.init({
  // 相対的な /404 目的にリダイレクト
  redirect: '/404',
  // 絶対的な目的地にリダイレクト
  redirect: 'http://domain.com/path'
})

リダイレクトを使ってユーザーをサイトの紹介ページまたは純粋にスタティックな 404 ページに誘導

注意:SPA プロジェクトにルートが変化の場合、再び効果を取らない

リライト

var div = document.createElement('div')
div.innerHTML = '見るな'

ConsoleBan.init({
  // 単純なストリングをページの body にリライト
  write: '<h1> 見るな </h1>',
  // あるいは、実在なエレメントを使うのが可能
  write: div
})

リライトは完全にウェブサイトの検査をブロックするのが可能、一方でユーザーに不気分な意味を混じる、推薦するの方がいいと言うことが言わない

コールバック

ConsoleBan.init({
  callback: () => {
    // ...
  }
})

コールバックのオプションは自分でコンソールを開けて起きることを決めることができる

オプション

| name | required | type | default | description | | :---------: | :------: | :---------------: | :-----: | :-------------------------------------------------- | | clear | no | boolean | true | console.clear を禁止 | | debug | no | boolean | true | debugger を無限に実行するかどうか | | debugTime | no | number | 3000 | 定時に debugger を循環の間隔 | | redirect | no | string | - | コンソールを開けてリダイレクトの目的地 | | write | no | string | Element | - | コンソールを開けて document.body をリライトの内容 | | callback | no | Function | - | コンソールを開けて自分で定義出来るコールバック | | bfcache | no | boolean | true | bfcache の能力を禁止 |

注意:redirectwritecallback 三つのストラテジーは唯一つが使うことが出来る,コールバックの優先位が一番高い

ブラウザの支持

| browser core | support | | :----------: | :-----: | | chrome | ✓ | | firefox | ✓ | | safari | ✓ |