init
This commit is contained in:
3
html/tasks/chapter_1/hello_world/Images/html5.svg
Executable file
3
html/tasks/chapter_1/hello_world/Images/html5.svg
Executable file
@@ -0,0 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
aria-label="HTML5" role="img"
|
||||
viewBox="0 0 512 512"><path fill="#e34f26" d="M71 460L30 0h451l-41 460-185 52"/><path fill="#ef652a" d="M256 472l149-41 35-394H256"/><path fill="#ebebeb" d="M256 208h-75l-5-58h80V94H114l15 171h127zm-1 147l-63-17-4-45h-56l7 89 116 32z"/><path fill="#fff" d="M255 208v57h70l-7 73-63 17v59l116-32 16-174zm0-114v56h137l5-56z"/></svg>
|
After Width: | Height: | Size: 399 B |
16
html/tasks/chapter_1/hello_world/Images/visualStudioCode.svg
Executable file
16
html/tasks/chapter_1/hello_world/Images/visualStudioCode.svg
Executable file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" viewBox="0 0 261 260" fill-rule="evenodd" clip-rule="evenodd" stroke-linejoin="round" stroke-miterlimit="1.414" version="1.1" id="svg4" sodipodi:docname="vscode.svg" inkscape:version="0.92.2 (unknown)">
|
||||
<metadata id="metadata10">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
<dc:title/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs id="defs8"/>
|
||||
<sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1360" inkscape:window-height="722" id="namedview6" showgrid="false" inkscape:zoom="0.64183539" inkscape:cx="112.48701" inkscape:cy="128.72041" inkscape:window-x="0" inkscape:window-y="24" inkscape:window-maximized="1" inkscape:current-layer="svg4"/>
|
||||
<path d="M 195.47461 -0.005859375 L 195.47461 223.29688 L 0.49609375 194.33789 L 195.47461 259.99219 L 260.47461 232.95312 L 260.47461 31.064453 L 260.49609 31.054688 L 260.47461 31.011719 L 260.47461 27.035156 L 195.47461 -0.005859375 z " id="path951" style="fill:#007acc;fill-opacity:1"/>
|
||||
<path d="M 127.24219 38.037109 L 67.521484 97.070312 L 31.566406 69.992188 L 16.748047 74.941406 L 53.328125 111.10156 L 16.748047 147.25977 L 31.566406 152.21094 L 67.521484 125.13086 L 67.523438 125.13086 L 127.24023 184.16016 L 163.00781 168.96289 L 163.00781 53.234375 L 127.24219 38.037109 z M 127.24023 80.158203 L 127.24023 142.03711 L 86.154297 111.09766 L 127.24023 80.158203 z " id="path887" style="fill:#007acc;fill-opacity:1"/>
|
||||
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
BIN
html/tasks/chapter_1/hello_world/Karate.ttf
Executable file
BIN
html/tasks/chapter_1/hello_world/Karate.ttf
Executable file
Binary file not shown.
50
html/tasks/chapter_1/hello_world/Main.css
Executable file
50
html/tasks/chapter_1/hello_world/Main.css
Executable file
@@ -0,0 +1,50 @@
|
||||
html {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Karate';
|
||||
src: url('Karate.ttf') format('truetype');
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0%;
|
||||
padding: 0%;
|
||||
border: 0%;
|
||||
background-color: rgb(32, 32, 32);
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: rgb(0, 255, 13);
|
||||
text-align: center;
|
||||
font-size: 5em;
|
||||
font-family: Karate;
|
||||
}
|
||||
|
||||
|
||||
p, h2, h3, h4, h5 {
|
||||
color: white;
|
||||
}
|
||||
|
||||
a { color: rgb(49, 188, 216); }
|
||||
a:hover { color: rgb(42, 255, 5); }
|
||||
|
||||
.header{ /* This is an example of a class */
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#video{ /* This is an example of an ID */
|
||||
|
||||
|
||||
}
|
||||
|
||||
#linkimage{
|
||||
position: fixed;
|
||||
right: 1em;
|
||||
bottom: 1em;
|
||||
width: 10em;
|
||||
height: 10em;
|
||||
}
|
227
html/tasks/chapter_1/hello_world/js/lorem-ipsum.js
Executable file
227
html/tasks/chapter_1/hello_world/js/lorem-ipsum.js
Executable file
@@ -0,0 +1,227 @@
|
||||
/**
|
||||
* @fileOverview Generates "Lorem ipsum" style text.
|
||||
* @author rviscomi@gmail.com Rick Viscomi,
|
||||
* tinsley@tinsology.net Mathew Tinsley
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Copyright (c) 2009, Mathew Tinsley (tinsley@tinsology.net)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of the organization nor the
|
||||
* names of its contributors may be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATHEW TINSLEY ''AS IS'' AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @class Jibborish generator.
|
||||
*/
|
||||
var LoremIpsum = function () {
|
||||
};
|
||||
|
||||
/**
|
||||
* Average number of words per sentence.
|
||||
* @constant {number}
|
||||
*/
|
||||
LoremIpsum.WORDS_PER_SENTENCE_AVG = 24.460;
|
||||
|
||||
/**
|
||||
* Standard deviation of the number of words per sentence.
|
||||
* @constant {number}
|
||||
*/
|
||||
LoremIpsum.WORDS_PER_SENTENCE_STD = 5.080;
|
||||
|
||||
/**
|
||||
* List of possible words.
|
||||
* @constant {Array.string}
|
||||
*/
|
||||
LoremIpsum.WORDS = [
|
||||
'lorem', 'ipsum', 'dolor', 'sit', 'amet', 'consectetur',
|
||||
'adipiscing', 'elit', 'curabitur', 'vel', 'hendrerit', 'libero',
|
||||
'eleifend', 'blandit', 'nunc', 'ornare', 'odio', 'ut',
|
||||
'orci', 'gravida', 'imperdiet', 'nullam', 'purus', 'lacinia',
|
||||
'a', 'pretium', 'quis', 'congue', 'praesent', 'sagittis',
|
||||
'laoreet', 'auctor', 'mauris', 'non', 'velit', 'eros',
|
||||
'dictum', 'proin', 'accumsan', 'sapien', 'nec', 'massa',
|
||||
'volutpat', 'venenatis', 'sed', 'eu', 'molestie', 'lacus',
|
||||
'quisque', 'porttitor', 'ligula', 'dui', 'mollis', 'tempus',
|
||||
'at', 'magna', 'vestibulum', 'turpis', 'ac', 'diam',
|
||||
'tincidunt', 'id', 'condimentum', 'enim', 'sodales', 'in',
|
||||
'hac', 'habitasse', 'platea', 'dictumst', 'aenean', 'neque',
|
||||
'fusce', 'augue', 'leo', 'eget', 'semper', 'mattis',
|
||||
'tortor', 'scelerisque', 'nulla', 'interdum', 'tellus', 'malesuada',
|
||||
'rhoncus', 'porta', 'sem', 'aliquet', 'et', 'nam',
|
||||
'suspendisse', 'potenti', 'vivamus', 'luctus', 'fringilla', 'erat',
|
||||
'donec', 'justo', 'vehicula', 'ultricies', 'varius', 'ante',
|
||||
'primis', 'faucibus', 'ultrices', 'posuere', 'cubilia', 'curae',
|
||||
'etiam', 'cursus', 'aliquam', 'quam', 'dapibus', 'nisl',
|
||||
'feugiat', 'egestas', 'class', 'aptent', 'taciti', 'sociosqu',
|
||||
'ad', 'litora', 'torquent', 'per', 'conubia', 'nostra',
|
||||
'inceptos', 'himenaeos', 'phasellus', 'nibh', 'pulvinar', 'vitae',
|
||||
'urna', 'iaculis', 'lobortis', 'nisi', 'viverra', 'arcu',
|
||||
'morbi', 'pellentesque', 'metus', 'commodo', 'ut', 'facilisis',
|
||||
'felis', 'tristique', 'ullamcorper', 'placerat', 'aenean', 'convallis',
|
||||
'sollicitudin', 'integer', 'rutrum', 'duis', 'est', 'etiam',
|
||||
'bibendum', 'donec', 'pharetra', 'vulputate', 'maecenas', 'mi',
|
||||
'fermentum', 'consequat', 'suscipit', 'aliquam', 'habitant', 'senectus',
|
||||
'netus', 'fames', 'quisque', 'euismod', 'curabitur', 'lectus',
|
||||
'elementum', 'tempor', 'risus', 'cras'
|
||||
];
|
||||
|
||||
/**
|
||||
* Generate "Lorem ipsum" style words.
|
||||
* @param num_words {number} Number of words to generate.
|
||||
* @return {string} "Lorem ipsum..."
|
||||
*/
|
||||
LoremIpsum.prototype.generate = function (num_words) {
|
||||
var words, ii, position, word, current, sentences, sentence_length, sentence;
|
||||
|
||||
/**
|
||||
* @default 100
|
||||
*/
|
||||
num_words = num_words || 100;
|
||||
|
||||
words = [LoremIpsum.WORDS[0], LoremIpsum.WORDS[1]];
|
||||
num_words -= 2;
|
||||
|
||||
for (ii = 0; ii < num_words; ii++) {
|
||||
position = Math.floor(Math.random() * LoremIpsum.WORDS.length);
|
||||
word = LoremIpsum.WORDS[position];
|
||||
|
||||
if (ii > 0 && words[ii - 1] === word) {
|
||||
ii -= 1;
|
||||
|
||||
} else {
|
||||
words[ii] = word;
|
||||
}
|
||||
}
|
||||
|
||||
sentences = [];
|
||||
current = 0;
|
||||
|
||||
while (num_words > 0) {
|
||||
sentence_length = this.getRandomSentenceLength();
|
||||
|
||||
if (num_words - sentence_length < 4) {
|
||||
sentence_length = num_words;
|
||||
}
|
||||
|
||||
num_words -= sentence_length;
|
||||
|
||||
sentence = [];
|
||||
|
||||
for (ii = current; ii < (current + sentence_length); ii++) {
|
||||
sentence.push(words[ii]);
|
||||
}
|
||||
|
||||
sentence = this.punctuate(sentence);
|
||||
current += sentence_length;
|
||||
sentences.push(sentence.join(' '));
|
||||
}
|
||||
|
||||
return sentences.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Insert commas and periods in the given sentence.
|
||||
* @param {Array.string} sentence List of words in the sentence.
|
||||
* @return {Array.string} Sentence with punctuation added.
|
||||
*/
|
||||
LoremIpsum.prototype.punctuate = function (sentence) {
|
||||
var word_length, num_commas, ii, position;
|
||||
|
||||
word_length = sentence.length;
|
||||
|
||||
/* End the sentence with a period. */
|
||||
sentence[word_length - 1] += '.';
|
||||
|
||||
if (word_length < 4) {
|
||||
return sentence;
|
||||
}
|
||||
|
||||
num_commas = this.getRandomCommaCount(word_length);
|
||||
|
||||
for (ii = 0; ii <= num_commas; ii++) {
|
||||
position = Math.round(ii * word_length / (num_commas + 1));
|
||||
|
||||
if (position < (word_length - 1) && position > 0) {
|
||||
/* Add the comma. */
|
||||
sentence[position] += ',';
|
||||
}
|
||||
}
|
||||
|
||||
/* Capitalize the first word in the sentence. */
|
||||
sentence[0] = sentence[0].charAt(0).toUpperCase() + sentence[0].slice(1);
|
||||
|
||||
return sentence;
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces a random number of commas.
|
||||
* @param {number} word_length Number of words in the sentence.
|
||||
* @return {number} Random number of commas
|
||||
*/
|
||||
LoremIpsum.prototype.getRandomCommaCount = function (word_length) {
|
||||
var base, average, standard_deviation;
|
||||
|
||||
/* Arbitrary. */
|
||||
base = 6;
|
||||
|
||||
average = Math.log(word_length) / Math.log(base);
|
||||
standard_deviation = average / base;
|
||||
|
||||
return Math.round(this.gaussMS(average, standard_deviation));
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces a random sentence length based on the average word length
|
||||
* of an English sentence.
|
||||
* @return {number} Random sentence length
|
||||
*/
|
||||
LoremIpsum.prototype.getRandomSentenceLength = function () {
|
||||
return Math.round(
|
||||
this.gaussMS(
|
||||
LoremIpsum.WORDS_PER_SENTENCE_AVG,
|
||||
LoremIpsum.WORDS_PER_SENTENCE_STD
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces a random number.
|
||||
* @return {number} Random number
|
||||
*/
|
||||
LoremIpsum.prototype.gauss = function () {
|
||||
return (Math.random() * 2 - 1) +
|
||||
(Math.random() * 2 - 1) +
|
||||
(Math.random() * 2 - 1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Produces a random number with Gaussian distribution.
|
||||
* @param {number} mean
|
||||
* @param {number} standard_deviation
|
||||
* @return {number} Random number
|
||||
*/
|
||||
LoremIpsum.prototype.gaussMS = function (mean, standard_deviation) {
|
||||
return Math.round(this.gauss() * standard_deviation + mean);
|
||||
};
|
49
html/tasks/chapter_1/hello_world/oppgave.html
Executable file
49
html/tasks/chapter_1/hello_world/oppgave.html
Executable file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="nb">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="Main.css">
|
||||
<style>
|
||||
body{
|
||||
margin-bottom: 13em;
|
||||
margin-left: 4em;
|
||||
margin-right: 17em;
|
||||
}
|
||||
</style>
|
||||
<script src="./js/lorem-ipsum.js"></script>
|
||||
|
||||
<title>Hello World!</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!--Comment-->
|
||||
<h1>Header</h1>
|
||||
<p>This is an example of a website. Please turn down the volume in order to play the soundcloud track. (Which doesn't exist anymore because I removed it some time ago ¯\_(ツ)_/¯</p>
|
||||
<br>
|
||||
|
||||
|
||||
<h2 class=header>Class Header</h2>
|
||||
<p>
|
||||
<a href="">Click me!</a>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
|
||||
<h2>Lorem Ipsum</h2>
|
||||
<p>
|
||||
<script>
|
||||
lorem = new LoremIpsum();
|
||||
loremtext = lorem.generate(1000);
|
||||
document.write(loremtext);
|
||||
</script>
|
||||
</p>
|
||||
|
||||
|
||||
<img src="./Images/html5.svg" id="linkimage">
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
15
html/tasks/chapter_1/oppgave 2/oppgave.html
Executable file
15
html/tasks/chapter_1/oppgave 2/oppgave.html
Executable file
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Oppgave X</title>
|
||||
<link rel="stylesheet" href="../../../../resources/css/main.css">
|
||||
<script async src="./script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Oppgave X</h1>
|
||||
</body>
|
||||
</html>
|
0
html/tasks/chapter_1/oppgave 2/script.js
Executable file
0
html/tasks/chapter_1/oppgave 2/script.js
Executable file
Reference in New Issue
Block a user