diff --git a/app/Helper.php b/app/Helper.php index 513c4287..cb973e21 100644 --- a/app/Helper.php +++ b/app/Helper.php @@ -10,3 +10,27 @@ function format_bytes($bytes, $is_drive_size = true, $beforeunit = '', $afteruni elseif($labels[$x] == "MB") return(round($bytes, 2).$beforeunit.$labels[$x].$afterunit); else return(round($bytes, 0).$beforeunit.$labels[$x].$afterunit); } + +function get_brightness($hex) { + // returns brightness value from 0 to 255 + // strip off any leading # + $hex = str_replace('#', '', $hex); + if(strlen($hex) == 3) { + $hex = $hex[0].$hex[0].$hex[1].$hex[1].$hex[2].$hex[2]; + } + + $c_r = hexdec(substr($hex, 0, 2)); + $c_g = hexdec(substr($hex, 2, 2)); + $c_b = hexdec(substr($hex, 4, 2)); + + return (($c_r * 299) + ($c_g * 587) + ($c_b * 114)) / 1000; +} + +function title_color($hex) +{ + if(get_brightness($hex) > 130) { + return ' black'; + } else { + return ' white'; + } +} \ No newline at end of file diff --git a/public/css/app.css b/public/css/app.css index 02518f0a..4a528c96 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -569,6 +569,14 @@ body { font-size: 16px; } +.item .title.black { + color: #000; +} + +.item .title.white { + color: #fff; +} + .item .details { width: 100%; } diff --git a/public/js/app.js b/public/js/app.js index c5b88db9..e7ac9ebd 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -1,3 +1,215 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ +/******/ // Flag the module as loaded +/******/ module.l = true; +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/******/ +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; +/******/ +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; +/******/ +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ } +/******/ }; +/******/ +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; +/******/ +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; +/******/ +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 0); +/******/ }) +/************************************************************************/ +/******/ ({ + +/***/ "./resources/assets/js/app.js": +/***/ (function(module, exports) { + +$.when($.ready).then(function () { + + if ($('.message-container').length) { + setTimeout(function () { + $('.message-container').fadeOut(); + }, 3500); + } + + if ($('.livestats-container').length) { + $('.livestats-container').each(function (index) { + var id = $(this).data('id'); + var dataonly = $(this).data('dataonly'); + var increaseby = dataonly == 1 ? 20000 : 1000; + var container = $(this); + var max_timer = 30000; + var timer = 5000; + (function worker() { + $.ajax({ + url: '/get_stats/' + id, + dataType: 'json', + success: function success(data) { + container.html(data.html); + if (data.status == 'active') timer = increaseby;else { + if (timer < max_timer) timer += 2000; + } + }, + complete: function complete() { + // Schedule the next request when the current one's complete + setTimeout(worker, timer); + } + }); + })(); + }); + } + + function readURL(input) { + + if (input.files && input.files[0]) { + var reader = new FileReader(); + + reader.onload = function (e) { + $('#appimage img').attr('src', e.target.result); + }; + + reader.readAsDataURL(input.files[0]); + } + } + + $("#upload").change(function () { + readURL(this); + }); + /*$(".droppable").droppable({ + tolerance: "intersect", + drop: function( event, ui ) { + var tag = $( this ).data('id'); + var item = $( ui.draggable ).data('id'); + $.get('tag/add/'+tag+'/'+item, function(data) { + if(data == 1) { + $( ui.draggable ).remove(); + } else { + alert('not added'); + } + }); + + } + });*/ + + $("#sortable").sortable({ + stop: function stop(event, ui) { + var idsInOrder = $("#sortable").sortable('toArray', { + attribute: 'data-id' + }); + $.post('/order', { order: idsInOrder }); + } + + }); + $("#sortable").sortable("disable"); + + $('#app').on('click', '#config-button', function (e) { + e.preventDefault(); + var app = $('#app'); + var active = app.hasClass('header'); + app.toggleClass('header'); + if (active) { + $('.add-item').hide(); + $('.item-edit').hide(); + $('#app').removeClass('sidebar'); + $("#sortable").sortable("disable"); + } else { + $("#sortable").sortable("enable"); + setTimeout(function () { + $('.add-item').fadeIn(); + $('.item-edit').fadeIn(); + }, 350); + } + }).on('click', '#add-item, #pin-item', function (e) { + e.preventDefault(); + var app = $('#app'); + var active = app.hasClass('sidebar'); + app.toggleClass('sidebar'); + }).on('click', '.close-sidenav', function (e) { + e.preventDefault(); + var app = $('#app'); + app.removeClass('sidebar'); + }).on('click', '#test_config', function (e) { + e.preventDefault(); + var apiurl = $('#create input[name=url]').val(); + + var override_url = $('#override_url'); + if (override_url.length && override_url.val() != '') { + apiurl = override_url; + } + var data = {}; + data['url'] = apiurl; + $('input.config-item').each(function (index) { + var config = $(this).data('config'); + data[config] = $(this).val(); + }); + + $.post('/test_config', { data: data }, function (data) { + alert(data); + }); + }); + $('#pinlist').on('click', 'a', function (e) { + e.preventDefault(); + var current = $(this); + var id = current.data('id'); + $.get('items/pintoggle/' + id + '/true', function (data) { + var inner = $(data).filter('#sortable').html(); + $('#sortable').html(inner); + current.toggleClass('active'); + }); + }); +}); + +/***/ }), + +/***/ "./resources/assets/js/huebee.js": +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_LOCAL_MODULE_0__, __WEBPACK_LOCAL_MODULE_0__factory, __WEBPACK_LOCAL_MODULE_0__module;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_LOCAL_MODULE_1__;var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + /** * Huebee PACKAGED v2.0.0 * 1-click color picker @@ -6,159 +218,309 @@ * Copyright 2018 Metafizzy */ -!function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var n=this._events=this._events||{},i=n[t]=n[t]||[];return i.indexOf(e)==-1&&i.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var n=this._onceEvents=this._onceEvents||{},i=n[t]=n[t]||{};return i[e]=!0,this}},e.off=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=n.indexOf(e);return i!=-1&&n.splice(i,1),this}},e.emitEvent=function(t,e){var n=this._events&&this._events[t];if(n&&n.length){var i=0,o=n[i];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),i+=r?0:1,o=n[i]}return this}},t}),function(t,e){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(n){return e(t,n)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.Unipointer=e(t,t.EvEmitter)}(window,function(t,e){function n(){}function i(){}var o=i.prototype=Object.create(e.prototype);o.bindStartEvent=function(t){this._bindStartEvent(t,!0)},o.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},o._bindStartEvent=function(e,n){n=void 0===n||!!n;var i=n?"addEventListener":"removeEventListener";t.navigator.pointerEnabled?e[i]("pointerdown",this):t.navigator.msPointerEnabled?e[i]("MSPointerDown",this):(e[i]("mousedown",this),e[i]("touchstart",this))},o.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},o.getTouch=function(t){for(var e=0;e.5;var o=this.colorGrid[e.toUpperCase()];this.updateCursor(o),this.setTexts(),this.setBackgrounds(),n||this.emitEvent("change",[e,t.hue,t.sat,t.lum])}},f.setTexts=function(){if(this.setTextElems)for(var t=0;t .5;var o = this.colorGrid[e.toUpperCase()];this.updateCursor(o), this.setTexts(), this.setBackgrounds(), n || this.emitEvent("change", [e, t.hue, t.sat, t.lum]); + } + }, f.setTexts = function () { + if (this.setTextElems) for (var t = 0; t < this.setTextElems.length; t++) { + var e = this.setTextElems[t], + n = "INPUT" == e.nodeName ? "value" : "textContent";e[n] = this.color; + } + }, f.setBackgrounds = function () { + if (this.setBGElems) for (var t = this.isLight ? "#222" : "white", e = 0; e < this.setBGElems.length; e++) { + var n = this.setBGElems[e];n.style.backgroundColor = this.color, n.style.color = t; + } + }, f.updateCursor = function (t) { + if (this.isOpen) { + var e = t ? "remove" : "add";if (this.cursor.classList[e]("is-hidden"), t) { + var n = this.gridSize, + i = this.canvasOffset, + o = this.cursorBorder;this.cursor.style.left = t.x * n + i.x - o + "px", this.cursor.style.top = t.y * n + i.y - o + "px"; + } + } + };var C = t.console, + S = document.readyState;"complete" == S || "interactive" == S ? o() : document.addEventListener("DOMContentLoaded", o), i.data = function (t) { + t = h(t);var e = t && t.huebeeGUID;return e && l[e]; + };var y = document.createElement("canvas");y.width = y.height = 1;var _ = y.getContext("2d");return i; +}); - $("#upload").change(function() { - readURL(this); - }); - /*$(".droppable").droppable({ - tolerance: "intersect", - drop: function( event, ui ) { - var tag = $( this ).data('id'); - var item = $( ui.draggable ).data('id'); +/***/ }), - $.get('tag/add/'+tag+'/'+item, function(data) { - if(data == 1) { - $( ui.draggable ).remove(); - } else { - alert('not added'); - } - }); - - } - });*/ +/***/ "./resources/assets/sass/app.scss": +/***/ (function(module, exports) { - $( "#sortable" ).sortable({ - stop: function (event, ui) { - var idsInOrder = $("#sortable").sortable('toArray', { - attribute: 'data-id' - }); - $.post( - '/order', - { order:idsInOrder } - ); - } - - }); - $("#sortable").sortable("disable"); +// removed by extract-text-webpack-plugin + +/***/ }), + +/***/ 0: +/***/ (function(module, exports, __webpack_require__) { + +__webpack_require__("./resources/assets/js/huebee.js"); +__webpack_require__("./resources/assets/js/app.js"); +module.exports = __webpack_require__("./resources/assets/sass/app.scss"); - - $('#app').on('click', '#config-button', function(e) { - e.preventDefault(); - var app = $('#app'); - var active = (app.hasClass('header')); - app.toggleClass('header'); - if(active) { - $('.add-item').hide(); - $('.item-edit').hide(); - $('#app').removeClass('sidebar'); - $("#sortable").sortable("disable") - } else { - $("#sortable").sortable("enable") - setTimeout( - function() - { - $('.add-item').fadeIn(); - $('.item-edit').fadeIn(); - }, 350); - - } - }).on('click', '#add-item, #pin-item', function(e) { - e.preventDefault(); - var app = $('#app'); - var active = (app.hasClass('sidebar')); - app.toggleClass('sidebar'); - - }).on('click', '.close-sidenav', function(e) { - e.preventDefault(); - var app = $('#app'); - app.removeClass('sidebar'); - - }).on('click', '#test_config', function(e) { - e.preventDefault(); - var apiurl = $('#create input[name=url]').val(); - - - var override_url = $('#override_url'); - if(override_url.length && override_url.val() != '') { - apiurl = override_url; - } - var data = {}; - data['url'] = apiurl; - $('input.config-item').each(function(index){ - var config = $(this).data('config'); - data[config] = $(this).val(); - }) +/***/ }) - $.post( - '/test_config', - { data }, function(data) { - alert(data); - } - ); - - }); - $('#pinlist').on('click', 'a', function(e) { - e.preventDefault(); - var current = $(this); - var id = current.data('id'); - $.get('items/pintoggle/'+id+'/true', function(data) { - var inner = $(data).filter('#sortable').html(); - $('#sortable').html(inner); - current.toggleClass('active'); - }); - }); - -}); \ No newline at end of file +/******/ }); \ No newline at end of file diff --git a/public/mix-manifest.json b/public/mix-manifest.json index aa923137..8a1763b6 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -1,4 +1,4 @@ { - "/css/app.css": "/css/app.css?id=7e76b8c135b6dbd38363", - "/js/app.js": "/js/app.js?id=24ea5e5c1fbea3461a14" + "/js/app.js": "/js/app.js?id=d7ae290137b7fd06f300", + "/css/app.css": "/css/app.css?id=ad5c7660f3763a242dfc" } \ No newline at end of file diff --git a/resources/assets/sass/_app.scss b/resources/assets/sass/_app.scss index 11d71d99..d80f938c 100644 --- a/resources/assets/sass/_app.scss +++ b/resources/assets/sass/_app.scss @@ -272,6 +272,12 @@ body { } .title { font-size: 16px; + &.black { + color: #000; + } + &.white { + color: #fff; + } } .details { width: 100%; diff --git a/resources/views/item.blade.php b/resources/views/item.blade.php index 333bdaa1..3525e1df 100644 --- a/resources/views/item.blade.php +++ b/resources/views/item.blade.php @@ -6,7 +6,7 @@ @endif
-
{{ $app->title }}
+
{{ $app->title }}
@if(isset($app->config->enabled) && ((bool)$app->config->enabled === true))
@endif