Compare commits

..

No commits in common. "8d5e55e74e91de18304ee9f34292beafd09db6c6" and "3bf111a868237f78a8a88f3df34aeddcfea5a316" have entirely different histories.

12 changed files with 876 additions and 898 deletions

465
composer.lock generated

File diff suppressed because it is too large Load Diff

1161
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -19,8 +19,5 @@
"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 Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"resources/js/app.js": {
"file": "assets/app.f51a693a.js",
"file": "assets/app.0299f74e.js",
"src": "resources/js/app.js",
"isEntry": true
},

0
public/favicon.ico Normal file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

52
resources/js/app.js vendored
View File

@ -6,7 +6,6 @@
*/
import './bootstrap';
import moment from "moment";
// window.Vue = require('vue');
@ -21,54 +20,3 @@ import moment from "moment";
// 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();
}
});

View File

@ -1,7 +1,6 @@
@if ($item->used_by == \Auth::id())
<form action="/take" method="POST" class="form-inline">
<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>
<em class="pr-sm-2 ml-auto">{{\Carbon\Carbon::parse($item->updated_at)->diffForHumans()}}</em>
<div class="w-100 d-xm-block d-sm-none"></div>
{{ csrf_field() }}
@method('DELETE')
@ -17,9 +16,8 @@
@if ($item->waiting_user_id && $item->waiting_user_id != \Auth::id())
<strong>> {{str_limit($users[$item->waiting_user_id], 15, '...')}}</strong>
@endif
<small id="itemPassedTime_{{$item->id}}">({{$item->updated_at->diffForHumans()}})</small>
<small>({{$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}}">
@ -30,4 +28,4 @@
<button type="submit" class="btn btn-sm btn-outline-secondary ml-auto">@lang('home.alert_me')</button>
@endif
</form>
@endif
@endif

View File

@ -19,12 +19,9 @@
<!-- 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">

View File

@ -5,7 +5,6 @@
<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">