Difference between revisions of "Web defacing"

From Interaction Station Wiki
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
The browser mediates the online world of the internet in the same way that a window mediates the view of the physical world. Adding a custom extension to this daily equipment provides a valuable opportunity for creative play and disruptions at both the system- and content levels. Releasing these extensions as tools can be a form of critical and contextual creative practice.
 
The browser mediates the online world of the internet in the same way that a window mediates the view of the physical world. Adding a custom extension to this daily equipment provides a valuable opportunity for creative play and disruptions at both the system- and content levels. Releasing these extensions as tools can be a form of critical and contextual creative practice.
 
To reload your browser extension visit this '''about:debugging#/runtime/this-firefox''' page in FireFox.
 
  
 
= Snippets =
 
= Snippets =
Line 9: Line 7:
 
<syntaxhighlight lang="html">
 
<syntaxhighlight lang="html">
 
<p>This is a paragraph</p>
 
<p>This is a paragraph</p>
 +
</syntaxhighlight>
 +
 +
'''With attribute "class"'''
 +
<syntaxhighlight lang="html">
 +
<p class="my-class">This is a paragraph</p>
 +
</syntaxhighlight>
 +
 +
'''With attribute "id"'''
 +
<syntaxhighlight lang="html">
 +
<p id="my-id">This is a paragraph</p>
 +
</syntaxhighlight>
 +
 +
'''With attribute "src" (images)'''
 +
<syntaxhighlight lang="html">
 +
<img src="https://link-to-image.jpg">
 +
</syntaxhighlight>
 +
 +
'''With attribute "href" (links)'''
 +
<syntaxhighlight lang="html">
 +
<a href="https://link-to-image.jpg">This is a link</a>
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== CSS ==
 
== CSS ==
  
=== Structure of a CSS tag ===
+
=== Structure of CSS ===
 +
'''Using HTML tags'''
 
<syntaxhighlight lang="css">
 
<syntaxhighlight lang="css">
 
p {
 
p {
 +
  color: rgb(255, 0, 0);
 +
}
 +
</syntaxhighlight>
 +
 +
'''Using classes'''
 +
<syntaxhighlight lang="css">
 +
.my-class {
 +
  color: rgb(255, 0, 0);
 +
}
 +
</syntaxhighlight>
 +
 +
'''Using id'''
 +
<syntaxhighlight lang="css">
 +
#my-id {
 
   color: rgb(255, 0, 0);
 
   color: rgb(255, 0, 0);
 
}
 
}
Line 23: Line 56:
  
 
=== Grabbing an element ===
 
=== Grabbing an element ===
 +
'''Using the elements id'''
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
const titleElement = document.getElementById("my-title");
+
const paragraph = document.getElementById("my-id");
 +
</syntaxhighlight>
 +
 
 +
'''Using the elements class'''
 +
<syntaxhighlight lang="javascript">
 +
const paragraph = document.getElementsByClassName("my-class");
 +
</syntaxhighlight>
 +
 
 +
'''Using the elements tag name'''
 +
<syntaxhighlight lang="javascript">
 +
const paragraph = document.getElementsByTagName("p");
 +
</syntaxhighlight>
 +
 
 +
'''Using the CSS selectors'''
 +
<syntaxhighlight lang="javascript">
 +
const paragraph = document.getElementsByTagName("p"); // html tag
 +
const paragraph = document.getElementsByTagName(".my-class"); // class
 +
const paragraph = document.getElementsByTagName("#my-id"); // id
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Editing the content ===
 
=== Editing the content ===
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
titleElement.innerHTML = "🙃";
+
paragraph.innerHTML = "🙃";
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
=== Editing the style ===
 
=== Editing the style ===
 
<syntaxhighlight lang="javascript">
 
<syntaxhighlight lang="javascript">
titleElement.style.color = "rgb(255, 0, 255)";
+
paragraph.style.color = "rgb(255, 0, 255)";
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 53: Line 104:
  
 
= Resources =
 
= Resources =
 +
To reload your browser extension visit this '''about:debugging#/runtime/this-firefox''' page in FireFox.
 
[https://github.com/mywdka/browser-extension Browser extension template]
 
[https://github.com/mywdka/browser-extension Browser extension template]
  
  
 
[[Category:2023]]
 
[[Category:2023]]

Latest revision as of 12:56, 24 April 2024

The browser mediates the online world of the internet in the same way that a window mediates the view of the physical world. Adding a custom extension to this daily equipment provides a valuable opportunity for creative play and disruptions at both the system- and content levels. Releasing these extensions as tools can be a form of critical and contextual creative practice.

Snippets

HTML

Structure of a HTML element

<p>This is a paragraph</p>

With attribute "class"

<p class="my-class">This is a paragraph</p>

With attribute "id"

<p id="my-id">This is a paragraph</p>

With attribute "src" (images)

<img src="https://link-to-image.jpg">

With attribute "href" (links)

<a href="https://link-to-image.jpg">This is a link</a>

CSS

Structure of CSS

Using HTML tags

p {
  color: rgb(255, 0, 0);
}

Using classes

.my-class {
  color: rgb(255, 0, 0);
}

Using id

#my-id {
  color: rgb(255, 0, 0);
}

JavaScript

Grabbing an element

Using the elements id

const paragraph = document.getElementById("my-id");

Using the elements class

const paragraph = document.getElementsByClassName("my-class");

Using the elements tag name

const paragraph = document.getElementsByTagName("p");

Using the CSS selectors

const paragraph = document.getElementsByTagName("p"); // html tag
const paragraph = document.getElementsByTagName(".my-class"); // class
const paragraph = document.getElementsByTagName("#my-id"); // id

Editing the content

paragraph.innerHTML = "🙃";

Editing the style

paragraph.style.color = "rgb(255, 0, 255)";

Creating an element

const newListItem = document.createElement("li");
// Set the content
newListItem.innerHTML = "Add an element using JavaScript";

Insert an element

// Grab the element that we want to insert the new element into.
const list = document.getElementById("my-list");
// Append the new element
list.appendChild(newListItem);

Resources

To reload your browser extension visit this about:debugging#/runtime/this-firefox page in FireFox. Browser extension template