简体   繁体   English

如何创建书签以隐藏特定页面元素?

[英]How do I create a bookmarklet to hide a specific page element?

I'm a total noob with bookmarklets.我是一个小书签的菜鸟。 Can anyone help me with the code I need to put in my bookmark URL to hide this specific page element?任何人都可以帮助我使用我需要放入书签 URL 以隐藏此特定页面元素的代码吗?

<div id="snigel-cmp-framework" class="snigel-cmp-framework" style="height: 722px;">

我想隐藏的元素

It's for a website I access a lot with a super annoying/aggressive cookie policy.这是一个我经常使用超级烦人/激进的 cookie 政策访问的网站。 You have to click a million checkboxes to opt out, and your preferences are erased when you close your browser.您必须单击一百万个复选框才能选择退出,当您关闭浏览器时,您的偏好将被删除。

Thanks!谢谢!

It's a simple javascript, you just need to make it a one liner, and add javascript: as href of the link you shall drag to your bookmark bar to become bookmarklet.这是一个简单的 javascript,您只需将其设为一个衬里,然后添加javascript:作为链接的 href,您应将其拖动到书签栏以成为书签。 As for the code itself, it's pretty simple.至于代码本身,它非常简单。

 <a href='javascript:var elem = document.querySelector("#snigel-cmp-framework"); elem && elem.remove()'>Drag me to bookmark bar</a>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何创建要点书签? - How do I create a gist bookmarklet? 如何创建可更新AngularJS输入元素并更新范围的小书签? - How do I create a bookmarklet that updates an AngularJS input element and updates the scope? 如何创建在URL上添加前缀的小书签? - How do I create a bookmarklet that adds an infix to a URL? 如何使用 Javascript 创建工具栏/书签? - How do I create a Toolbar/ Bookmarklet using Javascript? 如何创建一个带有延迟/超时的 javascript 书签? - How do I create a javascript bookmarklet with a delay/timeout inside? 如何改善此书签? - How do i improve this bookmarklet? 如何在已经具有样式的特定页面上隐藏 html 元素(可见性:可见)并且仅当孩子具有某个 class - How do I hide an html element on a specific page that already has the style (visibility: visible) and only if the child has a certain class 将页面加载到书签页面以加载特定的框架内容,是否可以使用FF书签或FF插件? - Bookmarking page to load specific Frame content, is there a FF add-on or somethign I can do with a bookmarklet? 如何隐藏和显示页面中特定部分的元素? - How to Hide and show the element on specific section in the page? 如何创建书签来操作此 URL? - How can I create a bookmarklet to manipulate this URL?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM