shareit/resources/js/app.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

2018-09-07 23:12:34 +00:00
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
import './bootstrap';
2018-09-07 23:12:34 +00:00
2022-11-12 22:00:35 +00:00
// window.Vue = require('vue');
2018-09-07 23:12:34 +00:00
/**
* Next, we will create a fresh Vue application instance and attach it to
* the page. Then, you may begin adding components to this application
* or customize the JavaScript scaffolding to fit your unique needs.
*/
2022-11-12 22:00:35 +00:00
// Vue.component('example-component', require('./components/ExampleComponent.vue'));
2018-09-07 23:12:34 +00:00
2022-11-12 22:00:35 +00:00
// const app = new Vue({
// el: '#app'
// });
function setFaviconNumber(number) {
var canvas = document.createElement('canvas'),
ctx,
img = document.createElement('img'),
link = document.getElementById('favicon').cloneNode(true);
if (canvas.getContext) {
canvas.height = canvas.width = 48; // set the size
ctx = canvas.getContext('2d');
img.onload = function () { // once the image has loaded
ctx.drawImage(this, 0, 0);
ctx.font = 'bold 35px "helvetica", sans-serif';
ctx.fillStyle = '#ffff66';
ctx.fillText(number, 3, 25);
link.href = canvas.toDataURL('image/png');
document.body.appendChild(link);
};
img.src = 'favicon.png';
}
};
usedItems = document.getElementById("usedItems").innerText;
setFaviconNumber(usedItems);