Skip to content

Instantly share code, notes, and snippets.

View ovlb's full-sized avatar
🦉
Owlish

Oscar ovlb

🦉
Owlish
View GitHub Profile
// vue.config.js
const path = require('path')
module.exports = {
outputDir: path.resolve(__dirname, 'dist-demo'),
chainWebpack: config => {
config
.entry('app')
.clear()
@ovlb
ovlb / ks-video-image-styles.scss
Created January 14, 2019 19:46
KS – Styles for the custom preview image
.video-container__image {
pointer-events: none;
transition: opacity 0.3s cubic-bezier(0, 0.1, 0.3, 1);
// Add play icon
&::after {
background-image: url('/images/icon_play_big.svg');
background-position: center;
// Play icon in large containers should be larger than in small ones
background-size: calc(45px + 5%);
if (hlsSupported || this.parsed) {
this.playVideo()
} else {
// hls.js attaches itself to the window, we use this to detect if it has already been downloaded
const { Hls } = window
if (Hls) {
this.parseHlsManifest()
} else {
@ovlb
ovlb / ks-video-detection-retrieval.js
Created January 14, 2019 19:20
KS – Retrieve value of localStorage entry
static hlsSupported() {
return localStorage.getItem('hlsSupport') === 'true'
}
optOutController() {
if (this.usingStorage) { // A
FacebookPixelController.setStorage('opt-out') // B
}
FacebookPixelController.setCookie('opt-out') // C
if (window.hasOwnProperty('fbq')) {
FacebookPixelController.disableTrackingFunction() // D
}
}
this.$optOutButton = document.querySelector('.js-fb-opt-out')
<!-- www.domain.tld/datenschutz/ -->
<h3>Facebook-Pixel</h3>
<p>Diese Seite verwendet einen Facebook-Pixel […]</p>
<section class="opt-out-control">
<a href="#" class="js-fb-opt-out">Tracking deaktivieren</a>
</section>
<p>mehr Datenschutz […]</p>
<!-- rest der seite -->
<script data-pixel="fb">
var optOutWish = function() {
var doNotTrack = navigator.doNotTrack === '1';
var hasOptedOut = localStorage.getItem('fb-pixel-status') === 'opt-out';
return doNotTrack || hasOptedOut;
}
if (optOutWish()) {
console.info('User prohibits tracking. Not embedding Facebook’s script.')
} else {
// Check current status
const optOutWish = () => {
const doNotTrack = navigator.doNotTrack === '1'
const hasOptedOut = localStorage.getItem('fb-pixel-status') === 'opt-out'
return doNotTrack || hasOptedOut
}
// Output to an element in the document
const setDebugStatus = () => {