Creating CSS rules with Dragonfly?

Forums » Dev.Opera » Opera Dragonfly Discussions

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

29. April 2012, 22:37:55

beiren

北人

Posts: 120

Creating CSS rules with Dragonfly?

I just discovered the Dragonfly in Opera and noticed I can customize webpages "on the fly". However, I couldn't figure out how to save the result so it loads it every time I visit the page. In my case that would mean omitting few parts of a website by default. How do I do that? It would be super awesome to be able to do that.
Handle so, daß du die Menschheit sowohl in deiner Person, als auch in der Person eines jeden anderen jederzeit zugleich als Zweck, niemals bloß als Mittel brauchest.

1. May 2012, 11:27:25

schemestrom

Posts: 251

I just had the same wish a few days ago. This would be awesome, +1000!

21. July 2012, 20:19:22

FFFUUUFox

lo loroi, loroi jiju, lojiju lojiju

Posts: 830

I think what's good for you is to use userscript

Make a new file.js, and put in your Userscript folder.

Paste this text in your file.js

// ==UserScript==
// @name		Your new userscript
// @description		your description
// @include		http://thewebpage.com/blah/*
// @exclude		http://maybe-optional.com/*

// ==/UserScript==

window.addEventListener('DOMContentLoaded', function blahblah()
{

// For hide the elements:
	css = document.styleSheets[0].insertRule("#XXXXX, .YYYY {display:none !important; blah: yadda !important }",0);

// For delete elements:
	crap_element = document.getElementById("crap_element_id");
	if (crap_element) { crap_element.parentNode.removeChild(crap_element); }

}, false);


Sorry my bad English.
User Opera's # 4510210
Userscript: Quick Quote Fix

27. July 2012, 12:06:33 (edited)

a3ano

Posts: 287

Originally posted by beiren:

...
However, I couldn't figure out how to save the result so it loads it every time I visit the page. In my case that would mean omitting few parts of a website by default. How do I do that? It would be super awesome to be able to do that.


What you want/need is 'usercss'.
It allows you to overrule the page css with some of your own.
See http://www.opera.com/docs/usercss/

Example:
To make the (Dutch) site http://teletekst.nos.nl/tekst/101-01.html more readable I made a file 'TeletekstNos.css' with
pre {
	font-size: 18px !important;  }
font[color="blue"] {
	color: #0AF;  }
pre {
	margin-right: 0.5em !important;  }


Edit the site preferences for the site (Display | My stylesheet) and link 'teletekst.nos.nl' to 'TeletekstNos.css'.

Regards, a3ano
Test page to show browser differences caused by bugs, 'features', interpretation differences or lack of support.
http://www.vonreeken.demon.nl/test/index.htm
Reference Pages for Website Creation (Colors, Chars, Fonts, Local Information and CSS3 support).
http://www.vonreeken.demon.nl/webreference/index.html

28. July 2012, 17:43:00

beiren

北人

Posts: 120

Originally posted by FFFUUUFox:

I think what's good for you is to use userscript

Make a new file.js, and put in your Userscript folder.

Paste this text in your file.js

// ==UserScript==
// @name		Your new userscript
// @description		your description
// @include		http://thewebpage.com/blah/*
// @exclude		http://maybe-optional.com/*

// ==/UserScript==

window.addEventListener('DOMContentLoaded', function blahblah()
{

// For hide the elements:
	css = document.styleSheets[0].insertRule("#XXXXX, .YYYY {display:none !important; blah: yadda !important }",0);

// For delete elements:
	crap_element = document.getElementById("crap_element_id");
	if (crap_element) { crap_element.parentNode.removeChild(crap_element); }

}, false);


Sorry my bad English.


Wow! This is awesome! Thanks!
Handle so, daß du die Menschheit sowohl in deiner Person, als auch in der Person eines jeden anderen jederzeit zugleich als Zweck, niemals bloß als Mittel brauchest.

Forums » Dev.Opera » Opera Dragonfly Discussions