Prvi commit: Začetna verzija vtičnika Wheel of Fortune
This commit is contained in:
commit
0d28b08727
21 files changed
+13814
No files matched your search
@@ -0,0 +1,197 @@
|
||||
/**
|
||||
* Kolo Sreče - CSS za administratorski vmesnik
|
||||
*/
|
||||
|
||||
/* Splošni stil administratorske strani */
|
||||
.wheel-admin-page {
|
||||
max-width: 1200px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.wheel-admin-page h1 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.wheel-admin-page .nav-tab-wrapper {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Kartice */
|
||||
.wheel-card {
|
||||
background: #fff;
|
||||
border: 1px solid #ccd0d4;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
||||
margin-bottom: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.wheel-card h2 {
|
||||
margin-top: 0;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
/* Tabela z nagradami */
|
||||
.wheel-prizes-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wheel-prizes-table th,
|
||||
.wheel-prizes-table td {
|
||||
padding: 12px;
|
||||
text-align: left;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.wheel-prizes-table th {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
.wheel-prizes-table tr:hover {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
/* Barve nagrad */
|
||||
.wheel-color-preview {
|
||||
display: inline-block;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
border-radius: 50%;
|
||||
margin-right: 10px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.wheel-color-blue {
|
||||
background-color: #5DADE2;
|
||||
}
|
||||
|
||||
.wheel-color-red {
|
||||
background-color: #E74C3C;
|
||||
}
|
||||
|
||||
.wheel-color-gray {
|
||||
background-color: #D5D8DC;
|
||||
}
|
||||
|
||||
/* Obrazci */
|
||||
.wheel-form-table {
|
||||
width: 100%;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.wheel-form-table th {
|
||||
width: 200px;
|
||||
padding: 15px 10px 15px 0;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wheel-form-table td {
|
||||
padding: 15px 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.wheel-form-table input[type="text"],
|
||||
.wheel-form-table input[type="number"],
|
||||
.wheel-form-table select,
|
||||
.wheel-form-table textarea {
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.wheel-form-table .description {
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
margin-top: 5px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Gumbi */
|
||||
.wheel-button-primary {
|
||||
background: #0073aa;
|
||||
border-color: #0073aa;
|
||||
color: #fff;
|
||||
padding: 5px 15px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wheel-button-secondary {
|
||||
background: #f7f7f7;
|
||||
border-color: #ccc;
|
||||
color: #555;
|
||||
padding: 5px 15px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.wheel-button-delete {
|
||||
background: #d63638;
|
||||
border-color: #d63638;
|
||||
color: #fff;
|
||||
padding: 5px 15px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Statistika */
|
||||
.wheel-stats-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 -10px;
|
||||
}
|
||||
|
||||
.wheel-stats-box {
|
||||
background: #fff;
|
||||
border: 1px solid #ccd0d4;
|
||||
box-shadow: 0 1px 1px rgba(0,0,0,.04);
|
||||
padding: 20px;
|
||||
margin: 10px;
|
||||
flex: 1 0 calc(33.333% - 20px);
|
||||
min-width: 250px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.wheel-stats-box h3 {
|
||||
margin-top: 0;
|
||||
color: #23282d;
|
||||
}
|
||||
|
||||
.wheel-stats-number {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
color: #0073aa;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
/* Predogled kolesa */
|
||||
.wheel-preview-container {
|
||||
max-width: 300px;
|
||||
margin: 20px auto;
|
||||
}
|
||||
|
||||
/* Odzivnost */
|
||||
@media screen and (max-width: 782px) {
|
||||
.wheel-form-table th {
|
||||
width: 100%;
|
||||
display: block;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.wheel-form-table td {
|
||||
width: 100%;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.wheel-stats-box {
|
||||
flex: 1 0 calc(50% - 20px);
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 600px) {
|
||||
.wheel-stats-box {
|
||||
flex: 1 0 calc(100% - 20px);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
/**
|
||||
* Wheel of Fortune - CSS for wheel styling
|
||||
* Modern game-show aesthetic with 3D effects and lighting
|
||||
*/
|
||||
|
||||
/* Main container */
|
||||
.wheel-container {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
border-radius: 0 !important;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
/* Dark theme */
|
||||
.wheel-container.theme-dark {
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
border-radius: 0 !important;
|
||||
padding: 0 !important;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Wheel sizes */
|
||||
.wheel-container.size-small {
|
||||
max-width: 300px;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.wheel-container.size-medium {
|
||||
max-width: 650px;
|
||||
}
|
||||
|
||||
.wheel-container.size-large {
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
/* Wheel wrapper with lighting effects */
|
||||
.wheel-wrapper {
|
||||
position: relative;
|
||||
margin: 0 auto;
|
||||
width: 100%;
|
||||
max-width: 700px;
|
||||
filter: drop-shadow(0 0 15px rgba(0, 200, 255, 0.3));
|
||||
padding-top: 80px;
|
||||
transition: transform 0.05s ease-out;
|
||||
}
|
||||
|
||||
/* Outer ring lighting effect - POENOSTAVLJENO */
|
||||
.wheel-wrapper::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -5%;
|
||||
width: 110%;
|
||||
height: 110%;
|
||||
border-radius: 50%;
|
||||
/* Manj kompleksen gradient */
|
||||
background: radial-gradient(
|
||||
circle at center,
|
||||
rgba(0, 150, 200, 0.1) 0%,
|
||||
rgba(0, 0, 0, 0) 70%
|
||||
);
|
||||
z-index: -1;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* Wheel */
|
||||
.wheel {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transform-origin: center;
|
||||
transition: none; /* POMEMBNO: ne uporabljamo CSS tranzicije, saj jo upravlja JS */
|
||||
display: block;
|
||||
will-change: transform;
|
||||
/* Enostavnejši shadow, ki ga podpirajo vse naprave */
|
||||
filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
|
||||
border: 4px solid #222;
|
||||
box-shadow: 0 0 10px 2px rgba(0, 223, 233, 0.5), 0 2px 8px rgba(0,0,0,0.3);
|
||||
border-radius: 50%;
|
||||
background: #111;
|
||||
}
|
||||
|
||||
/* Wheel frame - BREZ SVG FILTRA */
|
||||
.wheel-frame {
|
||||
fill: #0a4d6e;
|
||||
stroke: #0a7bb5;
|
||||
stroke-width: 8;
|
||||
}
|
||||
|
||||
/* LED lighting on wheel frame - BREZ SVG FILTRA */
|
||||
.wheel-light-track {
|
||||
fill: none;
|
||||
stroke: #00c8ff;
|
||||
stroke-width: 6;
|
||||
stroke-dasharray: 3, 8;
|
||||
animation: lightTrackAnimation 5s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes lightTrackAnimation {
|
||||
0% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 100;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fast light track animation for spinning */
|
||||
@keyframes fastLightTrackAnimation {
|
||||
0% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: 200;
|
||||
}
|
||||
}
|
||||
|
||||
/* Wheel segment - BREZ SVG FILTRA */
|
||||
.wheel-segment {
|
||||
stroke: #fff;
|
||||
stroke-width: 1px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
/* Simple gradients for cross-browser compatibility */
|
||||
.wheel-segment-yellow { fill: #ffdd00; }
|
||||
.wheel-segment-green { fill: #88ff00; }
|
||||
.wheel-segment-red { fill: #ff5500; }
|
||||
.wheel-segment-pink { fill: #ff44aa; }
|
||||
.wheel-segment-blue { fill: #00ccff; }
|
||||
|
||||
/* Divider between segments */
|
||||
.wheel-divider {
|
||||
stroke: rgba(255, 255, 255, 0.5);
|
||||
stroke-width: 2px;
|
||||
}
|
||||
|
||||
/* Pegs on the wheel */
|
||||
.wheel-peg {
|
||||
fill: #e0e0e0;
|
||||
stroke: #666;
|
||||
stroke-width: 1px;
|
||||
/* Enostavnejši shadow namesto glow filtra */
|
||||
filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
|
||||
}
|
||||
|
||||
@keyframes pegPulse {
|
||||
from {
|
||||
fill: #e0e0e0;
|
||||
filter: url(#pegGlow);
|
||||
}
|
||||
to {
|
||||
fill: #ffffff;
|
||||
filter: url(#pegGlow) drop-shadow(0 0 3px rgba(255, 255, 255, 0.8));
|
||||
}
|
||||
}
|
||||
|
||||
/* Faster peg pulse for spinning */
|
||||
@keyframes fastPegPulse {
|
||||
0% {
|
||||
fill: #e0e0e0;
|
||||
filter: url(#pegGlow);
|
||||
}
|
||||
50% {
|
||||
fill: #ffffff;
|
||||
filter: url(#pegGlow) drop-shadow(0 0 5px rgba(255, 255, 255, 0.9));
|
||||
}
|
||||
100% {
|
||||
fill: #e0e0e0;
|
||||
filter: url(#pegGlow);
|
||||
}
|
||||
}
|
||||
|
||||
/* Text on wheel - BREZ SVG FILTRA */
|
||||
.wheel-text {
|
||||
font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
|
||||
font-size: 24px;
|
||||
font-weight: 900;
|
||||
fill: #ffffff;
|
||||
stroke: #000000;
|
||||
stroke-width: 0.5px;
|
||||
paint-order: stroke fill;
|
||||
letter-spacing: 1px;
|
||||
pointer-events: none;
|
||||
text-anchor: middle;
|
||||
/* Enostavnejša senca, ki deluje povsod */
|
||||
text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
|
||||
text-overflow: ellipsis;
|
||||
max-width: 70px;
|
||||
}
|
||||
|
||||
/* Center hub - BREZ SVG FILTRA */
|
||||
.wheel-hub-outer {
|
||||
fill: #0a4d6e;
|
||||
stroke: #0a7bb5;
|
||||
stroke-width: 4;
|
||||
}
|
||||
|
||||
.wheel-hub-inner {
|
||||
fill: #999;
|
||||
}
|
||||
|
||||
.wheel-hub-button {
|
||||
fill: #330066;
|
||||
}
|
||||
|
||||
/* Hub text - BREZ SVG FILTRA */
|
||||
.wheel-hub-text {
|
||||
font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
fill: #ff00aa;
|
||||
text-anchor: middle;
|
||||
/* Enostavnejša senca namesto glow filtra */
|
||||
text-shadow: 0 0 10px #ff00aa;
|
||||
}
|
||||
|
||||
/* Pointer - BREZ SVG FILTRA */
|
||||
.wheel-pointer {
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
width: 60px;
|
||||
height: 70px;
|
||||
z-index: 10;
|
||||
pointer-events: none;
|
||||
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
|
||||
transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Pointer active state - BREZ SVG FILTRA */
|
||||
.wheel-pointer.active {
|
||||
filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
|
||||
animation: pointerPulse 1s infinite alternate;
|
||||
}
|
||||
|
||||
/* Pointer bounce effect when hitting a peg */
|
||||
.wheel-pointer.bounce {
|
||||
animation: pointerBounce 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes pointerPulse {
|
||||
from {
|
||||
opacity: 0.8;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pointerBounce {
|
||||
0% {
|
||||
transform: translateX(-50%) rotate(0deg);
|
||||
}
|
||||
25% {
|
||||
transform: translateX(-50%) rotate(-5deg);
|
||||
}
|
||||
75% {
|
||||
transform: translateX(-50%) rotate(5deg);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(-50%) rotate(0deg);
|
||||
}
|
||||
}
|
||||
|
||||
.wheel-pointer svg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Pointer parts */
|
||||
.pointer-mount {
|
||||
fill: #c0c0c0;
|
||||
stroke: #a0a0a0;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
.pointer-arm {
|
||||
fill: #a0a0a0;
|
||||
stroke: #808080;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
.pointer-tip {
|
||||
fill: #ff0066;
|
||||
stroke: #cc0055;
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
/* Wheel button with improved styling */
|
||||
.wheel-button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin: 20px auto 0 auto;
|
||||
padding: 0 40px;
|
||||
background: linear-gradient(135deg, #ff00c4, #00dfe9);
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 24px;
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
box-shadow: 0 3px 10px #00dfe9;
|
||||
transition: all 0.3s ease;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
height: 56px;
|
||||
min-width: 140px;
|
||||
letter-spacing: 2px;
|
||||
text-shadow: 0 2px 8px #000, 0 0 10px #0cf101;
|
||||
}
|
||||
|
||||
/* Button hover effect */
|
||||
.wheel-button:hover {
|
||||
transform: translateY(-2px) scale(1.04);
|
||||
box-shadow: 0 7px 30px #ff00c4, 0 0 30px #00dfe9;
|
||||
background: linear-gradient(135deg, #00dfe9, #ff00c4);
|
||||
}
|
||||
|
||||
/* Button active effect */
|
||||
.wheel-button:active {
|
||||
transform: translateY(1px) scale(0.98);
|
||||
box-shadow: 0 3px 10px #00dfe9;
|
||||
}
|
||||
|
||||
/* Button disabled state */
|
||||
.wheel-button:disabled {
|
||||
background: linear-gradient(135deg, #aa6699, #774466);
|
||||
cursor: not-allowed;
|
||||
transform: none;
|
||||
box-shadow: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
/* Button ripple effect */
|
||||
.wheel-button::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
background: rgba(255, 255, 255, 0.5);
|
||||
opacity: 0;
|
||||
border-radius: 100%;
|
||||
transform: scale(1, 1) translate(-50%, -50%);
|
||||
transform-origin: 50% 50%;
|
||||
}
|
||||
|
||||
.wheel-button:focus:not(:active)::after {
|
||||
animation: ripple 1s ease-out;
|
||||
}
|
||||
|
||||
@keyframes ripple {
|
||||
0% {
|
||||
transform: scale(0, 0);
|
||||
opacity: 0.5;
|
||||
}
|
||||
20% {
|
||||
transform: scale(25, 25);
|
||||
opacity: 0.3;
|
||||
}
|
||||
100% {
|
||||
opacity: 0;
|
||||
transform: scale(40, 40);
|
||||
}
|
||||
}
|
||||
|
||||
/* Spins counter */
|
||||
.wheel-spins-counter {
|
||||
text-align: center;
|
||||
margin: 18px 0 0 0;
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-shadow: 0 2px 8px #000, 0 0 10px #0cf101, 0 0 20px #00dfe9;
|
||||
letter-spacing: 1px;
|
||||
background: rgba(0,0,0,0.35);
|
||||
border-radius: 10px;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
/* Result display */
|
||||
.wheel-result {
|
||||
display: none;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
padding: 15px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
color: white;
|
||||
animation: resultGlow 2s infinite alternate;
|
||||
}
|
||||
|
||||
@keyframes resultGlow {
|
||||
from {
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
to {
|
||||
box-shadow: 0 5px 25px rgba(255, 0, 170, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
.wheel-result.win {
|
||||
background: rgba(255, 0, 170, 0.2);
|
||||
}
|
||||
|
||||
.wheel-result h3 {
|
||||
font-size: 24px;
|
||||
margin: 0 0 10px 0;
|
||||
color: #ffffff;
|
||||
text-shadow: 0 0 10px rgba(255, 0, 170, 0.8);
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
.wheel-result p {
|
||||
margin: 5px 0;
|
||||
}
|
||||
|
||||
.wheel-result strong {
|
||||
color: #ffcc00;
|
||||
font-size: 1.2em;
|
||||
text-shadow: 0 0 5px rgba(255, 204, 0, 0.8);
|
||||
}
|
||||
|
||||
/* Login required message */
|
||||
.wheel-login-required,
|
||||
.wheel-no-spins {
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
padding: 20px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.wheel-login-required a {
|
||||
color: #00c8ff;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
transition: all 0.3s ease;
|
||||
text-shadow: 0 0 5px rgba(0, 200, 255, 0.5);
|
||||
}
|
||||
|
||||
.wheel-login-required a:hover {
|
||||
color: #33d6ff;
|
||||
text-shadow: 0 0 10px rgba(0, 200, 255, 0.8);
|
||||
}
|
||||
|
||||
/* Error message */
|
||||
.wheel-error {
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
padding: 15px;
|
||||
background: rgba(255, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* Posodobljene medijske poizvedbe za manjše zaslone */
|
||||
@media (max-width: 768px) {
|
||||
.wheel-text {
|
||||
font-size: 10px;
|
||||
max-width: 60px;
|
||||
}
|
||||
|
||||
.wheel-container.size-large {
|
||||
max-width: 500px;
|
||||
transform: scale(0.95);
|
||||
}
|
||||
|
||||
.wheel-hub-text {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.wheel-pointer {
|
||||
width: 50px;
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
.wheel-wrapper {
|
||||
padding-top: 35px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.wheel-container {
|
||||
padding: 20px 0;
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.wheel-text {
|
||||
font-size: 8px;
|
||||
max-width: 50px;
|
||||
}
|
||||
|
||||
.wheel-container.size-medium,
|
||||
.wheel-container.size-small {
|
||||
max-width: 320px;
|
||||
transform: scale(0.85);
|
||||
}
|
||||
|
||||
.wheel-hub-text {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.wheel-button {
|
||||
padding: 8px 25px;
|
||||
font-size: 16px;
|
||||
margin: 15px auto;
|
||||
}
|
||||
|
||||
.wheel-pointer {
|
||||
width: 40px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
.wheel-wrapper {
|
||||
padding-top: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.wheel-container {
|
||||
transform: scale(0.8);
|
||||
padding: 15px 0;
|
||||
}
|
||||
|
||||
.wheel-text {
|
||||
font-size: 7px;
|
||||
max-width: 40px;
|
||||
}
|
||||
|
||||
.wheel-container.size-medium,
|
||||
.wheel-container.size-small,
|
||||
.wheel-container.size-large {
|
||||
max-width: 280px;
|
||||
transform: scale(0.75);
|
||||
}
|
||||
|
||||
.wheel-hub-text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.wheel-button {
|
||||
padding: 7px 20px;
|
||||
font-size: 14px;
|
||||
margin: 10px auto;
|
||||
}
|
||||
|
||||
.wheel-pointer {
|
||||
width: 35px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.wheel-wrapper {
|
||||
padding-top: 25px;
|
||||
}
|
||||
|
||||
.wheel-result h3 {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.wheel-result p {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dodana nova medijska poizvedba za zelo majhne zaslone */
|
||||
@media (max-width: 360px) {
|
||||
.wheel-container {
|
||||
transform: scale(0.7);
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.wheel-container.size-medium,
|
||||
.wheel-container.size-small,
|
||||
.wheel-container.size-large {
|
||||
max-width: 240px;
|
||||
transform: scale(0.65);
|
||||
}
|
||||
|
||||
.wheel-text {
|
||||
font-size: 6px;
|
||||
max-width: 30px;
|
||||
}
|
||||
|
||||
.wheel-hub-text {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.wheel-pointer {
|
||||
width: 30px;
|
||||
height: 45px;
|
||||
}
|
||||
|
||||
.wheel-wrapper {
|
||||
padding-top: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dodana možnost za ročno prilagajanje velikosti */
|
||||
.wheel-container.scale-90 {
|
||||
transform: scale(0.9);
|
||||
}
|
||||
|
||||
.wheel-container.scale-80 {
|
||||
transform: scale(0.8);
|
||||
}
|
||||
|
||||
.wheel-container.scale-70 {
|
||||
transform: scale(0.7);
|
||||
}
|
||||
|
||||
.wheel-container.scale-60 {
|
||||
transform: scale(0.6);
|
||||
}
|
||||
|
||||
.wheel-container.scale-50 {
|
||||
transform: scale(0.5);
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
* Wheel of Fortune - JavaScript for wheel functionality
|
||||
* Robust, smooth animation using requestAnimationFrame and easing functions.
|
||||
*/
|
||||
jQuery(document).ready(function($) {
|
||||
// Preveri, ali so podatki na voljo
|
||||
if (typeof wof_data === 'undefined') {
|
||||
console.error('WOF Data is missing.');
|
||||
return;
|
||||
}
|
||||
|
||||
// Elementi
|
||||
var wheelContainer = $('.wheel-container');
|
||||
var wheelElement = wheelContainer.find('.wheel');
|
||||
var spinButton = wheelContainer.find('.wheel-button');
|
||||
var resultDiv = wheelContainer.find('.wheel-result');
|
||||
var spinsCounter = wheelContainer.find('.wheel-spins-counter span');
|
||||
|
||||
// Stanje
|
||||
var isSpinning = false;
|
||||
var accumulatedRotation = 0;
|
||||
var wheelSpins = wof_data.spins_left;
|
||||
var l10n = wof_data.l10n;
|
||||
|
||||
// Nastavitve animacije
|
||||
var spinDuration = 8000;
|
||||
var baseRotations = 5;
|
||||
|
||||
// Funkcija za animacijo
|
||||
function easeOutCubic(t) {
|
||||
return 1 - Math.pow(1 - t, 3);
|
||||
}
|
||||
|
||||
function animateWheel(startTime, startRotation, totalRotation) {
|
||||
var currentTime = Date.now();
|
||||
var elapsedTime = currentTime - startTime;
|
||||
|
||||
if (elapsedTime >= spinDuration) {
|
||||
wheelElement.css('transform', 'rotate(' + (startRotation + totalRotation) + 'deg)');
|
||||
accumulatedRotation = (startRotation + totalRotation);
|
||||
finishSpin();
|
||||
return;
|
||||
}
|
||||
|
||||
var timeProgress = elapsedTime / spinDuration;
|
||||
var rotationProgress = easeOutCubic(timeProgress);
|
||||
var currentRotation = startRotation + (totalRotation * rotationProgress);
|
||||
wheelElement.css('transform', 'rotate(' + currentRotation + 'deg)');
|
||||
|
||||
requestAnimationFrame(function() {
|
||||
animateWheel(startTime, startRotation, totalRotation);
|
||||
});
|
||||
}
|
||||
|
||||
// Obdelava po koncu vrtenja
|
||||
function finishSpin() {
|
||||
var prize = window.wof_spin_result.prize;
|
||||
showPrizePopup(prize);
|
||||
isSpinning = false;
|
||||
|
||||
if (wheelSpins > 0) {
|
||||
spinButton.prop('disabled', false).text(l10n.spin_button);
|
||||
} else {
|
||||
spinButton.prop('disabled', true).text(l10n.no_spins_left);
|
||||
}
|
||||
}
|
||||
|
||||
// Prikaz nagrade
|
||||
function showPrizePopup(prize) {
|
||||
var html = '<h3>' + l10n.congratulations + '</h3><p>' + l10n.you_won + ' <strong>' + prize.name + '</strong></p>';
|
||||
if (window.wof_spin_result.discount_code) {
|
||||
html += '<p>' + l10n.discount_code_sent + '</p>';
|
||||
}
|
||||
resultDiv.html(html).addClass('win').fadeIn(300);
|
||||
}
|
||||
|
||||
// Posodobitev števca spinov
|
||||
function updateSpinsCounter() {
|
||||
if (spinsCounter.length) {
|
||||
spinsCounter.text(wheelSpins);
|
||||
}
|
||||
}
|
||||
|
||||
// Klik na gumb za vrtenje
|
||||
spinButton.on('click', function() {
|
||||
if (isSpinning || wheelSpins <= 0) return;
|
||||
|
||||
isSpinning = true;
|
||||
spinButton.prop('disabled', true).text(l10n.spinning);
|
||||
resultDiv.hide().removeClass('win error');
|
||||
|
||||
$.ajax({
|
||||
url: wof_data.rest_url,
|
||||
method: 'POST',
|
||||
beforeSend: function(xhr) {
|
||||
xhr.setRequestHeader('X-WP-Nonce', wof_data.nonce);
|
||||
},
|
||||
data: {
|
||||
wheel_id: wof_data.wheel_id,
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
window.wof_spin_result = response.data;
|
||||
wheelSpins = response.data.remaining_spins;
|
||||
updateSpinsCounter();
|
||||
|
||||
var targetAngle = response.data.degree;
|
||||
var fullSpinsRotation = baseRotations * 360;
|
||||
var currentAngle = accumulatedRotation % 360;
|
||||
|
||||
var rotationToTarget = targetAngle - currentAngle;
|
||||
if (rotationToTarget < 0) {
|
||||
rotationToTarget += 360;
|
||||
}
|
||||
|
||||
var totalRotationAmount = fullSpinsRotation + rotationToTarget;
|
||||
|
||||
animateWheel(Date.now(), accumulatedRotation, totalRotationAmount);
|
||||
|
||||
} else {
|
||||
handleError(response.data.message || l10n.error);
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
var errorMsg = xhr.responseJSON ? (xhr.responseJSON.message || l10n.error) : l10n.error;
|
||||
handleError(errorMsg);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function handleError(message) {
|
||||
resultDiv.html('<p>' + message + '</p>').addClass('error').fadeIn(300);
|
||||
isSpinning = false;
|
||||
if(wheelSpins > 0){
|
||||
spinButton.prop('disabled', false).text(l10n.spin_button);
|
||||
}
|
||||
}
|
||||
|
||||
// Inicializacija
|
||||
function init() {
|
||||
updateSpinsCounter();
|
||||
if (wheelSpins <= 0) {
|
||||
spinButton.prop('disabled', true).text(l10n.no_spins_left);
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
});
|
||||
Reference in new issue
Block a user