This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Avenger { | |
// Initialization and constructor | |
isMale: function() { | |
return this.sex == “M”; | |
} | |
canFly: function() { | |
return this.canFly; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width, user-scalable=no"> | |
<meta name="theme-color" content="#ffffff"> | |
<title>My ugly form</title> | |
<style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="application/javascript"> | |
window.onload = function() { | |
materializeControls(); | |
} | |
function materializeControls() { | |
materializeTextInputs(); | |
} | |
function materializeTextInputs() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function materializeSelects() { | |
var label, parentEl; | |
document.querySelectorAll('select').forEach(function(control) { | |
parentEl = control.parentElement; | |
control.classList.add('mdl-selectfield__select'); | |
if (parentEl.tagName !== 'DIV') { | |
return; | |
} | |
parentEl.classList.add('mdl-selectfield', 'mdl-js-selectfield'); | |
label = parentEl.querySelector('label'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function materializeRadioButtons() { | |
var parentEl; | |
document.querySelectorAll('input[type="radio"]').forEach(function(control) { | |
parentEl = control.parentElement; | |
control.classList.add('mdl-radio__button'); | |
if (parentEl.tagName == "LABEL") { | |
parentEl.setAttribute('for', control.id || control.name) | |
parentEl.classList.add('mdl-radio', 'mdl-js-radio', 'mdl-js-ripple-effect'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function materializeCheckboxes() { | |
var parentEl; | |
document.querySelectorAll('input[type="checkbox"]').forEach(function(control) { | |
parentEl = control.parentElement; | |
control.classList.add('mdl-checkbox__input'); | |
if (parentEl.tagName == "LABEL") { | |
parentEl.setAttribute('for', control.id || control.name) | |
parentEl.classList.add('mdl-checkbox', 'mdl-js-checkbox', 'mdl-js-ripple-effect'); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function materializeTables() { | |
document.querySelectorAll('table').forEach(function(table) { | |
table.classList.add('mdl-data-table', 'mdl-js-data-table'); | |
table.querySelectorAll('th,td').forEach(function(cell) { | |
cell.classList.add('mdl-data-table__cell--non-numeric'); | |
}); | |
}); | |
} | |
function materializeControls() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function materializeLists() { | |
document.querySelectorAll('ul').forEach(function(ulEl) { | |
ulEl.classList.add('mdl-list'); | |
ulEl.querySelectorAll('li').forEach(function(liEl) { | |
liEl.classList.add('mdl-list__item'); | |
liEl.innerHTML = "<span class='mdl-list__item-primary-content'>" + | |
"<i class='material-icons mdl-list__item-icon'>home</i>" + | |
liEl.innerText + "</span>"; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<meta name="viewport" content="width=device-width, user-scalable=no"> | |
<meta name="theme-color" content="#ffffff"> | |
<title>My beautiful form</title> | |
<!-- MDL references --> |
OlderNewer