web-api-manager/add-on/config/js/components/web-api-standards.vue.js

88 lines
3.6 KiB
JavaScript
Raw Normal View History

2017-10-12 19:00:04 +00:00
(function () {
2017-10-14 20:24:18 +00:00
"use strict";
2017-10-12 19:00:04 +00:00
const standardsDefaults = window.WEB_API_MANAGER.defaults;
const Vue = window.Vue;
2017-10-12 19:00:04 +00:00
Vue.component("web-api-standards", {
2017-10-14 18:52:56 +00:00
props: ["standards", "selectedStandards", "selectedDomain"],
2017-10-12 19:00:04 +00:00
template: `
<div class="web-api-standards-container">
2017-10-14 18:52:56 +00:00
<h3>Pattern: <code>{{ selectedDomain }}</code></h3>
<div class="panel panel-default form-horizontal">
<div class="panel-heading">
Default configurations
</div>
<div class="panel-body">
<button @click="onLiteClicked">
Use Lite Settings
</button>
<button @click="onConservativeClicked">
Use Conservative Settings
</button>
<button @click="onAggressiveClicked">
Use Aggressive Settings
</button>
<button @click="onClearClicked">
Clear Settings
</button>
<button @click="onAllClicked">
Block All
</button>
</div>
<div class="panel-footer">
<strong>Lite</strong> is designed to have a minimal
impact on typical browsing while still providing
security and privacy improvements.
<strong>Conservative</strong> and <strong>Aggressive</strong>
provide extra protections, though will impact the
functionaltiy more sites.
</div>
</div>
2017-10-14 18:52:56 +00:00
<div class="panel panel-default">
<div class="panel-heading">Blocked standards</div>
<ul class="list-group">
<li class="list-group-item" v-for="standard in standards">
<span v-if="standard.info.url" class="badge">
<a href="{{ standard.info.url }}">info</a>
</span>
<input type="checkbox"
:value="standard.info.identifier"
2017-10-14 18:52:56 +00:00
v-model="selectedStandards"
@change="onStandardChecked">
{{ standard.info.identifier }}
2017-10-14 18:52:56 +00:00
</li>
</ul>
2017-10-12 19:00:04 +00:00
</div>
</div>
`,
methods: {
onStandardChecked: function () {
this.$root.$data.setSelectedStandards(this.selectedStandards);
},
onLiteClicked: function () {
this.$root.$data.setSelectedStandards(standardsDefaults.lite);
},
onConservativeClicked: function () {
this.$root.$data.setSelectedStandards(standardsDefaults.conservative);
},
onAggressiveClicked: function () {
this.$root.$data.setSelectedStandards(standardsDefaults.aggressive);
},
onClearClicked: function () {
this.$root.$data.setSelectedStandards([]);
},
onAllClicked: function () {
const allStandards = Object.keys(this.standards)
.map(aStdName => this.standards[aStdName].info.identifier);
this.$root.$data.setSelectedStandards(allStandards);
2017-10-12 19:00:04 +00:00
}
}
});
}());