On the way to Release #3…

Posted: February 17, 2014 in Programming
Tags: , , , , ,

Good day!
Open Source Development is becoming more and more familiar to me. Thanks CDOT for that. 🙂
Lets get closer to my bugs for this release and what should be done by Friday, Feb 21st. During the last week I was assigned to some new bugs which are related to CSP implementation into Webmaker components(thimble, goggles, webmaker):

  • Moving inline script to separate file -> bug 973120
  • Remove inline script for quick-linking to a tag -> bug 973116 Fixed
  • Move google analytics snippet into a separate JS file -> bug 973119
  • Move JS error tracking snippet -> bug 973112

All these bugs should be resolved first, before I can start final CSP implementation into the webmaker components. That is why, once they will be resolved, I will start to work on this bugs:

Content Security Policy is a great feature that would be really beneficial to webmaker and maybe after could be implemented to other Open Source Projects. It is a standard and could be written in different languages. One more thing that I learned during my bug fixes is a data-* attribute that helps transporting variables from html file into separate .js file.
This is how it works:

In data-atr.html file

<!DOCTYPE html>
    <title>Testing Data-* attributes</title>
    <!--passing data here-->
    <!--you can pass any kind of data through the data-* attributes, really useful-->
    <script id="your-id" src="pathToFile.js" 
      data-anyVariable="I like to code"
      data-anyOtherVariable="That is how it works">

In pathToFile.js file

var first = document.getElementById("your-id").getAttribute("data-anyVariable");
var second = document.getElementById("your-id").getAttribute("data-anyOtherVariable");

//Now you can use variables from html
alert(first + "\n" + second);

I found a really good explanation and example here -> hacks.mozilla.org
See you later:)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s