mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-23 20:10:52 +00:00
Compare commits
7 Commits
3bf111a868
...
8d5e55e74e
Author | SHA1 | Date | |
---|---|---|---|
8d5e55e74e | |||
df08525010 | |||
cf4e70c7ac | |||
6bc94d0ec8 | |||
a067904b81 | |||
d083d45013 | |||
3d5e484364 |
465
composer.lock
generated
465
composer.lock
generated
File diff suppressed because it is too large
Load Diff
1151
package-lock.json
generated
1151
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,5 +19,8 @@
|
||||
"sass": "^1.56.1",
|
||||
"sass-loader": "^8.0.2",
|
||||
"vite": "^3.2.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"moment": "^2.29.4"
|
||||
}
|
||||
}
|
||||
|
35
public/build/assets/app.0299f74e.js
vendored
35
public/build/assets/app.0299f74e.js
vendored
File diff suppressed because one or more lines are too long
44
public/build/assets/app.f51a693a.js
vendored
Normal file
44
public/build/assets/app.f51a693a.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"resources/js/app.js": {
|
||||
"file": "assets/app.0299f74e.js",
|
||||
"file": "assets/app.f51a693a.js",
|
||||
"src": "resources/js/app.js",
|
||||
"isEntry": true
|
||||
},
|
||||
|
BIN
public/favicon.png
Normal file
BIN
public/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
52
resources/js/app.js
vendored
52
resources/js/app.js
vendored
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import './bootstrap';
|
||||
import moment from "moment";
|
||||
|
||||
// window.Vue = require('vue');
|
||||
|
||||
@ -20,3 +21,54 @@ import './bootstrap';
|
||||
// const app = new Vue({
|
||||
// el: '#app'
|
||||
// });
|
||||
|
||||
function updateTime() {
|
||||
var dates = document.getElementsByClassName("takenItemDate");
|
||||
for (let i = 0; i < dates.length; i++) {
|
||||
let time = dates.item(i).innerText;
|
||||
let fromNow = moment(time).fromNow();
|
||||
let id = "itemPassedTime_" + dates.item(i).id;
|
||||
document.getElementById(id).innerText = fromNow;
|
||||
}
|
||||
}
|
||||
updateTime();
|
||||
setInterval(updateTime, 1 * 60 * 1000);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* Source:
|
||||
* https://www.designcise.com/web/tutorial/how-to-detect-if-the-browser-tab-is-active-or-not-using-javascript
|
||||
*/
|
||||
document.addEventListener('visibilitychange', function (event) {
|
||||
if (document.hidden) {
|
||||
console.log('not visible');
|
||||
} else {
|
||||
updateTime();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
@if ($item->used_by == \Auth::id())
|
||||
<form action="/take" method="POST" class="form-inline">
|
||||
<em class="pr-sm-2 ml-auto">{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em>
|
||||
<em id="itemPassedTime_{{$item->id}}" class="pr-sm-2 ml-auto">{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em>
|
||||
<div hidden class="takenItemDate" id="{{$item->id}}">{{\Carbon\Carbon::parse($item->updated_at)->format('Y-m-d\TH:i:s.uP')}}</div>
|
||||
<div class="w-100 d-xm-block d-sm-none"></div>
|
||||
{{ csrf_field() }}
|
||||
@method('DELETE')
|
||||
@ -16,8 +17,9 @@
|
||||
@if ($item->waiting_user_id && $item->waiting_user_id != \Auth::id())
|
||||
<strong>> {{str_limit($users[$item->waiting_user_id], 15, '...')}}</strong>
|
||||
@endif
|
||||
<small>({{$item->updated_at->diffForHumans()}})</small>
|
||||
<small id="itemPassedTime_{{$item->id}}">({{$item->updated_at->diffForHumans()}})</small>
|
||||
</em>
|
||||
<div hidden class="takenItemDate" id="{{$item->id}}">{{$item->updated_at->format('Y-m-d\TH:i:s.uP')}}</div>
|
||||
<div class="w-100 d-xm-block d-sm-none"></div>
|
||||
{{ csrf_field() }}
|
||||
<input type="hidden" name="item" value="{{$item->id}}">
|
||||
|
@ -19,9 +19,12 @@
|
||||
|
||||
<!-- Styles -->
|
||||
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
|
||||
|
||||
<link id="favicon" rel="icon" type="image/png" href="favicon.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div hidden id="usedItems">{{ isset($usedItems) && $usedItems > 0 ? $usedItems : '' }}</div>
|
||||
<div id="app">
|
||||
<nav class="navbar navbar-expand-md navbar-light navbar-laravel">
|
||||
<div class="container">
|
||||
|
@ -5,6 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Share It</title>
|
||||
<link id="favicon" rel="icon" type="image/png" href="favicon.png" />
|
||||
|
||||
<!-- Fonts -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet" type="text/css">
|
||||
|
Loading…
Reference in New Issue
Block a user