2021-07-27 14:46:32 +02:00
/ * *
* @ file
* A JavaScript file for the theme .
* /
2022-06-27 16:10:51 +02:00
( function ( $ ) {
2021-07-27 14:46:32 +02:00
'use strict' ;
// To understand behaviors, see https://drupal.org/node/756722#behaviors
2022-06-27 16:10:51 +02:00
/ * D r u p a l . b e h a v i o r s . m y _ c u s t o m _ b e h a v i o r = {
2021-07-27 14:46:32 +02:00
attach : function ( context , settings ) {
var adminMenu = '' ;
if ( jQuery ( '#admin-menu' ) . length > 0 ) {
adminMenu = 'fixed-admin' ;
2022-06-27 16:10:51 +02:00
} * /
2021-07-27 14:46:32 +02:00
jQuery ( document ) . ready ( function ( ) {
2022-07-18 16:42:20 +02:00
// Če je admin menu
if ( jQuery ( '#toolbar-administration' ) . length == 1 ) {
jQuery ( '.nav-menu' ) . css ( 'top' , '2%' ) ;
jQuery ( '.searchform' ) . css ( 'top' , '2%' ) ;
}
2022-07-18 17:41:17 +02:00
// Sidebar menu
if ( jQuery ( '.sidebar_menu .region-sidebar-menu' ) . length < 1 ) {
jQuery ( '.sidebar_menu' ) . hide ( ) ;
}
2022-06-27 16:10:51 +02:00
// Prikaži polje za iskanje
jQuery ( '.searchbutton' ) . on ( 'click' , function ( ) {
2022-07-18 16:42:20 +02:00
2022-06-27 16:10:51 +02:00
jQuery ( '.searchform' ) . css ( 'transform' , 'translate3d(0px, 0px, 0px)' ) ;
} ) ;
2022-05-03 15:24:29 +02:00
2022-09-29 19:19:45 +02:00
// toggle glavni menu na mobile
jQuery ( '.toggleMenu' ) . on ( 'click' , function ( ) {
let menu = jQuery ( '.mobile-nav-menu' ) [ 0 ] ;
let toggle _menu = jQuery ( '.toggleMenu' ) [ 0 ] ;
if ( menu . style . display == 'none' ) {
toggle _menu . src = "/tema1ka/svg/icons8-close-menu.svg" ;
menu . style . display = 'flex' ;
}
else {
toggle _menu . src = "/tema1ka/svg/icons8-menu.svg" ;
menu . style . display = 'none' ;
}
} ) ;
// togle side menu na mobile
jQuery ( '.sidenav-toggle' ) . on ( 'click' , function ( ) {
let menu = jQuery ( '.sidenav' ) [ 0 ] ;
if ( menu . style . display !== 'block' )
menu . style . display = 'block' ;
else
menu . style . display = 'none' ;
} ) ;
2022-06-27 16:10:51 +02:00
jQuery ( '.hide-search' ) . on ( 'click' , function ( ) {
jQuery ( '.searchform' ) . css ( 'transform' , 'translate3d(0px, -100%, 0px)' ) ;
} ) ;
2022-05-03 15:24:29 +02:00
2022-06-27 16:10:51 +02:00
// ISKANJE
2022-07-01 07:53:43 +02:00
jQuery ( '#forma-iskanje-header' ) . keyup ( function ( event ) {
2022-05-03 15:24:29 +02:00
2022-07-18 17:41:17 +02:00
if ( event . keyCode == 13 )
iskanjeBesede ( jQuery ( '#iskanje-input' ) . val ( ) ) ;
2022-07-01 07:53:43 +02:00
} ) ;
jQuery ( '#forma-iskanje-second' ) . keyup ( function ( event ) {
2022-07-18 17:41:17 +02:00
if ( event . keyCode == 13 )
iskanjeBesede ( jQuery ( '#iskanje-input-second' ) . val ( ) )
2022-05-03 15:24:29 +02:00
2022-07-18 17:41:17 +02:00
} ) ;
jQuery ( '#ikona-iskanje-input' ) . on ( 'click' , function ( ) {
iskanjeBesede ( jQuery ( '#iskanje-input' ) . val ( ) )
} ) ;
jQuery ( '#ikona-sikanje-second' ) . on ( 'click' , function ( ) {
iskanjeBesede ( jQuery ( '#iskanje-input-second' ) . val ( ) )
2022-06-27 16:10:51 +02:00
} ) ;
2022-05-03 15:24:29 +02:00
2021-07-27 14:46:32 +02:00
// Odjava v Drupalu
2022-07-01 16:49:03 +02:00
jQuery ( '#frontend-odjava-uporabnika' ) . on ( 'click' , function ( ) {
window . location = '/frontend/api/api.php?action=logout' ;
2021-07-27 14:46:32 +02:00
} ) ;
// JEZIK pustimo samo 3 črke
2022-06-27 16:10:51 +02:00
var jezikText = jQuery ( '.language-link:not(.is-active)' ) . text ( ) . substring ( 0 , 3 ) ;
jQuery ( '.language-link' ) . text ( jezikText ) ;
2021-07-27 14:46:32 +02:00
2022-09-08 10:03:15 +02:00
function pridobiJezik ( ) {
return jQuery ( 'html' ) [ 0 ] . lang ;
}
2021-07-27 14:46:32 +02:00
/ * *
* Napredno iskanje
* /
var drupalLang = 'sl' ;
var drupalButtonName = 'Iskanje po vprašalnikih' ;
if ( location . pathname . split ( "/" ) [ 2 ] == 'en' ) {
drupalLang = 'en' ;
drupalButtonName = 'Search surveys' ;
}
// Dodamo Gumb za napredno iskanje
if ( jQuery ( '#search-api-page-search-form' ) . length > 0 ) {
// Če je uporabnik prijavljen dodamo opcijo iskanja po mojih anketah
var piskotek = "; " + document . cookie ;
if ( piskotek . split ( "; unam=" ) . length == 2 ) {
jQuery ( '#search-api-page-search-form [type="submit"]' ) . after ( '<div id="prikazi-advance-search" class="povezava"><a href="/admin/survey/index.php?search=' + jQuery ( '#edit-keys-1' ) . val ( ) + '&lang=' + drupalLang + '" id="prikazi-moje-ankete" class="povezava">' + drupalButtonName + '</a></div>' ) ;
}
}
jQuery ( '#edit-keys' ) . bind ( 'keyup' , function ( ) {
jQuery ( '#prikazi-moje-ankete' ) . attr ( 'href' , '/admin/survey/index.php?search=' + jQuery ( this ) . val ( ) + '&lang=' + drupalLang ) ;
} ) ;
// Skrijemo napredno iskanje
jQuery ( document ) . on ( 'click' , '#prikazi-advance-search' , function ( ) {
if ( jQuery ( '.sprites' ) . hasClass ( 'plus' ) ) {
jQuery ( '.sprites' ) . removeClass ( 'plus' ) . addClass ( 'minus' ) ;
} else {
jQuery ( '.sprites' ) . removeClass ( 'minus' ) . addClass ( 'plus' ) ;
}
jQuery ( 'fieldset#edit-advanced' ) . toggle ( ) ;
} ) ;
/*** end napredno iskanje ***/
/ * *
* Quicktabs
* /
// Quick tabs dodamo ikone
jQuery ( '#quicktabs-tab-tabs_faq_priporocila_video_slo-0, #quicktabs-tab-tabs_faq_manuals_video_eng-0' ) . addClass ( 'tab-povezava' ) . prepend ( '<div class="ikona-tab ikona-faq"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1" fill="#1e88e5" width="50px" height="50px">' +
'<g id="surface1" fill="#1e88e5">' +
'<path style=" " d="M 22 0 C 19.757813 0 18 1.757813 18 4 L 18 20 C 18 22.242188 19.757813 24 22 24 L 37.625 24 L 45.34375 30.75 C 45.527344 30.910156 45.761719 31 46 31 C 46.140625 31 46.273438 30.96875 46.40625 30.90625 C 46.765625 30.746094 47 30.394531 47 30 L 47 23.875 C 48.742188 23.441406 50 21.898438 50 20 L 50 4 C 50 1.757813 48.242188 0 46 0 Z M 33 6.09375 L 35.09375 6.09375 L 37.5 17.59375 L 35.6875 17.59375 L 35.09375 14.59375 L 32.90625 14.59375 L 32.3125 17.59375 L 30.5 17.59375 Z M 34 8 C 33.898438 8.800781 33.695313 9.894531 33.59375 10.59375 L 33.09375 13.1875 L 35 13.1875 L 34.5 10.59375 C 34.300781 9.894531 34.195313 8.800781 34.09375 8 Z M 4 19 C 1.757813 19 0 20.757813 0 23 L 0 39 C 0 40.894531 1.257813 42.441406 3 42.875 L 3 49 C 3 49.394531 3.234375 49.746094 3.59375 49.90625 C 3.726563 49.96875 3.859375 50 4 50 C 4.238281 50 4.46875 49.910156 4.65625 49.75 L 12.375 43 L 28 43 C 30.242188 43 32 41.242188 32 39 L 32 26 L 22 26 C 18.636719 26 16 23.363281 16 20 L 16 19 Z M 15.59375 25 C 17.992188 25 18.90625 27.585938 18.90625 30.6875 C 18.90625 33.6875 18.195313 35.398438 17.09375 36 L 17.09375 36.09375 C 17.792969 36.394531 18.613281 36.707031 19.3125 36.90625 L 18.6875 38.3125 C 17.789063 37.914063 16.605469 37.304688 15.90625 36.90625 C 15.707031 36.804688 15.507813 36.6875 15.40625 36.6875 C 13.304688 36.6875 12 34.710938 12 30.8125 C 12 27.414063 13.292969 25 15.59375 25 Z M 15.5 26.5 C 14.300781 26.5 13.90625 28.585938 13.90625 30.6875 C 13.90625 33.085938 14.300781 35.09375 15.5 35.09375 C 16.601563 35.09375 17 33.085938 17 30.6875 C 17 28.488281 16.601563 26.5 15.5 26.5 Z " fill="#1e88e5"/>' +
'</g>' +
'</svg></div>' ) ;
jQuery ( '#quicktabs-tab-tabs_faq_priporocila_video_slo-1, #quicktabs-tab-tabs_faq_manuals_video_eng-1' ) . addClass ( 'tab-povezava' ) . prepend ( '<div class="ikona-tab ikona-prirocniki"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1" fill="#1e88e5" width="50px" height="50px">' +
'<g id="surface1" fill="#1e88e5">' +
'<path style=" " d="M 6 2 C 5.449219 2 5 2.449219 5 3 L 5 39 C 5 39.554688 5.449219 40 6 40 C 18.058594 40 22.824219 42.683594 24 43.5 L 24 6.65625 C 21.53125 4.746094 16.21875 2 6 2 Z M 44 2 C 33.78125 2 28.46875 4.746094 26 6.65625 L 26 43.5 C 27.175781 42.683594 31.945313 40 44 40 C 44.554688 40 45 39.554688 45 39 L 45 3 C 45 2.449219 44.554688 2 44 2 Z M 2.84375 8 C 1.273438 8 0 9.273438 0 10.84375 L 0 44.15625 C 0 45.726563 1.273438 47 2.84375 47 L 19.46875 47 C 20.179688 47.980469 21.996094 50 25 50 C 28.003906 50 29.820313 47.980469 30.53125 47 L 47.15625 47 C 48.726563 47 50 45.730469 50 44.15625 L 50 10.84375 C 50 9.273438 48.726563 8 47.15625 8 L 47 8 L 47 39 C 47 40.652344 45.652344 42 44 42 C 32.25 42 27.878906 44.601563 27.125 45.125 L 27 45.25 C 26.304688 45.800781 25.984375 46.6875 25.03125 46.6875 C 24.078125 46.6875 23.917969 45.886719 23.09375 45.3125 L 22.875 45.125 C 22.121094 44.601563 17.757813 42 6 42 C 4.347656 42 3 40.652344 3 39 L 3 8 Z " fill="#1e88e5"/>' +
'</g>' +
'</svg></div>' ) ;
jQuery ( '#quicktabs-tab-tabs_faq_priporocila_video_slo-2, #quicktabs-tab-tabs_faq_manuals_video_eng-2' ) . addClass ( 'tab-povezava' ) . prepend ( '<div class="ikona-tab ikona-video"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 50 50" version="1.1" fill="#1e88e5" width="50px" height="50px">' +
'<g id="surface1" fill="#1e88e5">' +
'<path style=" " d="M 12.8125 5 C 12.261719 5.050781 11.855469 5.542969 11.90625 6.09375 C 11.957031 6.644531 12.449219 7.050781 13 7 L 37 7 C 37.359375 7.003906 37.695313 6.816406 37.878906 6.503906 C 38.058594 6.191406 38.058594 5.808594 37.878906 5.496094 C 37.695313 5.183594 37.359375 4.996094 37 5 L 13 5 C 12.96875 5 12.9375 5 12.90625 5 C 12.875 5 12.84375 5 12.8125 5 Z M 7.8125 9 C 7.261719 9.050781 6.855469 9.542969 6.90625 10.09375 C 6.957031 10.644531 7.449219 11.050781 8 11 L 42 11 C 42.359375 11.003906 42.695313 10.816406 42.878906 10.503906 C 43.058594 10.191406 43.058594 9.808594 42.878906 9.496094 C 42.695313 9.183594 42.359375 8.996094 42 9 L 8 9 C 7.96875 9 7.9375 9 7.90625 9 C 7.875 9 7.84375 9 7.8125 9 Z M 3 13 C 2.445313 13 2 13.449219 2 14 L 2 44 C 2 44.550781 2.445313 45 3 45 L 47 45 C 47.554688 45 48 44.550781 48 44 L 48 14 C 48 13.449219 47.554688 13 47 13 Z M 20.1875 23 L 30.8125 29 L 20.1875 35 Z " fill="#1e88e5"/>' +
'</g>' +
'</svg></div>' ) ;
//Dodamo naslove za posamezne tabe
jQuery ( '[id^=quicktabs-tab-tabs_faq_priporocila_video_slo], [id^=quicktabs-tab-tabs_faq_manuals_video_eng]' ) . each ( function ( ) {
var id = jQuery ( this ) . attr ( 'id' ) . slice ( 14 ) ;
var ime = jQuery ( this ) . text ( ) ;
// Če je v imenu active tab potem to odstranimo v naslovu
var isci = ime . search ( '(active tab)' ) ;
if ( isci > 0 ) {
ime = ime . slice ( 0 , ( isci - 1 ) ) ;
}
jQuery ( '#quicktabs-tabpage-' + id + ' .item-list' ) . prepend ( '<h3>' + ime + '</h3>' ) ;
} ) ;
// Quicktabs odpremo ustreznega glede na izbran url
var urlPars = window . location . pathname . split ( '/' ) ;
if ( urlPars [ 4 ] == 'prirocniki' || urlPars [ 4 ] == 'manuals' ) {
jQuery ( '.quicktabs-tabs li' ) . removeClass ( 'active' ) ;
jQuery ( '.quicktabs-tabs li:eq(1)' ) . addClass ( 'active' ) ;
jQuery ( '.quicktabs-tabpage' ) . addClass ( 'quicktabs-hide' ) ;
jQuery ( '.quicktabs-tabpage:eq(1)' ) . removeClass ( 'quicktabs-hide' ) ;
}
if ( urlPars [ 4 ] == 'video' ) {
jQuery ( '.quicktabs-tabs li' ) . removeClass ( 'active' ) ;
jQuery ( '.quicktabs-tabs li:eq(2)' ) . addClass ( 'active' ) ;
jQuery ( '.quicktabs-tabpage' ) . addClass ( 'quicktabs-hide' ) ;
jQuery ( '.quicktabs-tabpage:eq(2)' ) . removeClass ( 'quicktabs-hide' ) ;
}
/*** end quictabs ***/
2022-08-26 08:45:00 +02:00
//Cenik
if ( urlPars [ 3 ] == 'cenik' || urlPars [ 3 ] == 'prices' ) {
jQuery ( 'h1.page-title' ) . hide ( ) ;
}
2021-07-27 14:46:32 +02:00
/** gumb svetovanje **/
if ( urlPars [ 3 ] == 'pomoc' || urlPars [ 3 ] == 'iskanje' ) {
2022-07-18 16:42:20 +02:00
jQuery ( '.container h1' ) . append ( '<div class="w-clearfix gumb-svetovanje"><div class="besedilo">Individualno <br />svetovanje</div></div>' ) ;
2021-07-27 14:46:32 +02:00
}
jQuery ( document ) . on ( 'click' , '.gumb-svetovanje' , function ( ) {
jQuery ( '.rexister-modal' ) . hide ( ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-individualno-svetovanje' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
/** end gumb svetovanje **/
// POMOČ
// Skrij moje ankete
if ( jQuery ( '.gumb1kazapri' ) . length > 0 ) {
jQuery ( '.menu-630' ) . hide ( ) ;
jQuery ( '.menu-489' ) . hide ( ) ;
jQuery ( '.menu-952' ) . hide ( ) ;
}
// Nova 1ka
// Prijava modal
jQuery ( '#modal-open-1ka' ) . on ( 'click' , function ( ) {
jQuery ( '.rexister-modal' ) . hide ( ) ;
if ( jQuery ( this ) . hasClass ( 'modal-goto-registration' ) ) {
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-registration' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} else {
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
}
} ) ;
jQuery ( '#modal-open-registration, .brezplacni-nakup-samo-registracija' ) . on ( 'click' , function ( ) {
jQuery ( '.modal-intro-title' ) . hide ( ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '.modal-intro-registration-text' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
2022-09-08 10:03:15 +02:00
if ( pridobiJezik ( ) == 'sl' ) {
jQuery ( '#modal-open-1ka' ) . removeClass ( 'modal-open-login-obrazec' ) . addClass ( 'modal-goto-registration' ) ;
jQuery ( '#modal-info-login' ) . css ( 'display' , 'flex' ) ;
}
else {
jQuery ( '.rexister-modal' ) . hide ( ) ;
jQuery ( '#modal-registration' ) . css ( 'display' , 'flex' ) ;
}
2021-07-27 14:46:32 +02:00
} ) ;
jQuery ( '.modal-open-intro-obrazec' ) . on ( 'click' , function ( ) {
jQuery ( '.rexister-modal' ) . hide ( ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-info-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
// Prijava modal
jQuery ( '.modal-open-login-obrazec' ) . on ( 'click' , function ( ) {
2022-06-27 07:58:26 +02:00
jQuery ( '.rexister-modal' ) . css ( 'display' , 'none' ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
//Registracija modal
jQuery ( '.modal-goto-registration, .brezplacni-nakup-samo-registracija-eng' ) . on ( 'click' , function ( ) {
jQuery ( '.rexister-modal' ) . hide ( ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-registration' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
jQuery ( '.closemodal' ) . on ( 'click' , function ( ) {
jQuery ( '.rexister-modal' ) . hide ( ) ;
jQuery ( '.w-input' ) . val ( '' ) ;
jQuery ( '.w-checkbox-input' ) . prop ( 'checked' , false ) ;
//Odstranimo piskotek za nakup paketa in skrijemo tekst
document . cookie = "nakup=1;expires=Thu, 01 Jan 1970 00:00:01 GMT" ;
jQuery ( '.nakup-prijava' ) . hide ( ) ;
} ) ;
// Če gr za napako pri loginu
if ( window . location . search . indexOf ( '?a=login' ) > - 1 ) {
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
jQuery ( '.w-form-fail' ) . show ( ) ;
}
jQuery ( '#gdpr-more' ) . on ( 'click' , function ( ) {
jQuery ( '#gdpr-vec-text' ) . toggle ( ) ;
} ) ;
jQuery ( '.checkbox-field .checkbox-display' ) . on ( 'click' , function ( ) {
var oznacen = true ;
if ( jQuery ( this ) . siblings ( 'input:checked' ) . length > 0 )
oznacen = false ;
jQuery ( this ) . siblings ( 'input' ) . prop ( 'checked' , oznacen ) ;
} ) ;
jQuery ( '.modal-telefonska-pomoc' ) . on ( 'click' , function ( ) {
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-telefonska-pomoc' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
2022-07-14 17:41:41 +02:00
2021-07-27 14:46:32 +02:00
//Prijava z ostalimi računi
jQuery ( '#agreelabel, #cutom-login-agree, .checkbox-agree' ) . on ( 'click' , function ( ) {
if ( jQuery ( '#cutom-login-agree' ) . is ( ':checked' ) ) {
jQuery ( '#submit-other-login' ) . show ( ) ;
} else {
jQuery ( '#submit-other-login' ) . hide ( ) ;
}
} ) ;
jQuery ( '.prijava-ostale-nazaj' ) . on ( 'click' , function ( ) {
jQuery ( '#modal-other-login' ) . hide ( ) ;
jQuery ( '.rexister-modal' ) . hide ( ) ;
jQuery ( '#modal-login' ) . show ( ) ;
jQuery ( '#modal-other-login h3' ) . show ( ) ;
} ) ;
jQuery ( '.ikona-custom-login' ) . on ( 'click' , function ( ) {
var atribut = jQuery ( this ) . attr ( 'data-login' ) ;
jQuery ( '#submit-other-login' ) . hide ( ) ;
jQuery ( '.rexister-modal' ) . hide ( ) ;
jQuery ( '#modal-other-login h3' ) . hide ( ) ;
jQuery ( '#cutom-login-agree' ) . attr ( 'checked' , false ) ;
// Če obstaja piškotek, potemgumb naprej prikažemo
if ( document . cookie . indexOf ( 'remember-me=' ) > 0 ) {
jQuery ( '#cutom-login-agree' ) . attr ( 'checked' , true ) ;
jQuery ( '#submit-other-login' ) . show ( ) ;
}
if ( atribut == 'aai' ) {
2022-05-03 15:24:29 +02:00
return jQuery ( '#modal-aai-obvestilo' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
}
jQuery ( '#modal-other-login #login-' + atribut + '-title' ) . show ( ) ;
jQuery ( '#submit-other-login' ) . attr ( 'data-redirect' , 'url-' + atribut ) ;
2022-08-19 00:48:36 +02:00
jQuery ( '#modal-other-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
jQuery ( '#modal-other-login #submit-other-login' ) . on ( 'click' , function ( ) {
var ikona = jQuery ( this ) . attr ( 'data-redirect' ) ;
var url = jQuery ( '[name="' + ikona + '"]' ) . val ( ) ;
//Preverimo, če gre za zapomni se me (remember)
if ( jQuery ( '#custom-login-remember-me' ) . attr ( 'checked' ) ) {
var date = new Date ( new Date ( ) . setFullYear ( new Date ( ) . getFullYear ( ) + 1 ) ) ;
document . cookie = 'remember-me=1; expires=' + date + '; path=/'
}
document . location . href = url ;
} ) ;
/**end prijava z ostalimi računi **/
// Če uporabnik ni prijavljen potem moje ankete odprejo možnost za prijavo
2022-08-19 00:48:36 +02:00
// preverimo če obstaja piškot, da je uporabnik prijavljen
2021-07-27 14:46:32 +02:00
if ( document . cookie . indexOf ( 'unam=' ) > 0 ) {
2022-08-19 00:48:36 +02:00
jQuery ( '[href="/d/admin/survey"]' ) . attr ( 'href' , '/admin/survey/index.php?lang=' + lang ( ) ) . removeClass ( 'gumb-spletna-uporaba' ) ;
2021-07-27 14:46:32 +02:00
} else {
2022-08-19 00:48:36 +02:00
jQuery ( '[href="/d/admin/survey"]' ) . attr ( 'href' , '#' ) . addClass ( 'gumb-spletna-uporaba' ) ;
2021-07-27 14:46:32 +02:00
}
2022-08-19 00:48:36 +02:00
2021-07-27 14:46:32 +02:00
// Meni za mobilnike
jQuery ( '.burger' ) . on ( 'click' , function ( ) {
if ( jQuery ( '.nav-container .navulwrap' ) . css ( 'display' ) == 'block' ) {
jQuery ( '.nav-container .navulwrap' ) . hide ( ) ;
jQuery ( this ) . css ( 'border-color' , '#979797' ) ;
jQuery ( '.div-block-13' ) . css ( 'background-color' , '#979797' ) ;
jQuery ( '.logolink' ) . css ( 'z-index' , '' ) ;
jQuery ( '.navwrapinner' ) . css ( 'position' , '' ) ;
} else {
jQuery ( '.nav-container .navulwrap' ) . show ( ) ;
jQuery ( '.nav-ul-2' ) . appendTo ( '.glavni-meni > li.active > a.active' ) . show ( ) ;
jQuery ( this ) . css ( 'border-color' , 'transparent' ) ;
jQuery ( '.div-block-13' ) . css ( 'background-color' , '#979797' ) ;
jQuery ( '.logolink' ) . css ( 'z-index' , '-9' ) ;
jQuery ( '.navwrapinner' ) . css ( 'position' , 'fixed' ) ;
}
// jQuery('ul.nav-ul').show();
// jQuery('ul.nav-ul').prepend('<img src="/d/sites/all/themes/pro1ka/img/ikone/zapri.svg" id="mobile-menu-close">');
// if (jQuery('.nav-ul > li.active-trail').length > 0) {
// jQuery('.nav-ul > li.active-trail').append(jQuery('aside.nav-ul-2 .menu-level-2').html());
// jQuery('.nav-ul > li.active-trail > .menu').addClass('nav-ul-2-mobile');
// }
} ) ;
jQuery ( document ) . on ( 'click' , '#mobile-menu-close' , function ( ) {
jQuery ( 'ul.nav-ul' ) . hide ( ) ;
jQuery ( '.nav-ul-2-mobile' ) . remove ( ) ;
jQuery ( this ) . remove ( ) ;
} ) ;
jQuery ( '.nakup-brez-registracije' ) . on ( 'click' , function ( ) {
var paket = jQuery ( this ) . attr ( 'data-paket' ) ;
var cas = new Date ( ) ;
cas . setMinutes ( cas . getMinutes ( ) + 30 ) ;
document . cookie = "nakup=1; expires=" + cas + ";path=/" ;
document . cookie = "paket=" + paket + "; expires=" + cas + ";path=/" ;
odpriAaiLoginObvestilo ( ) ;
} ) ;
// Naročila
jQuery ( '.racun-na-podjetje' ) . on ( 'click' , function ( ) {
jQuery ( '.podatki-za-podjetje' ) . toggle ( ) ;
prikaziPoljeEracun ( ) ;
if ( jQuery ( '#racun-na-podjetje' ) . is ( ':checked' ) ) {
jQuery ( '.polje-za-podjetje' ) . attr ( 'required' , 'required' ) ;
} else {
jQuery ( '.polje-za-podjetje' ) . removeAttr ( 'required' ) ;
jQuery ( '.polje-za-podjetje' ) . val ( '' ) ;
jQuery ( '#zavezanec-za-ddv' ) . prop ( 'checked' , false ) ;
}
} ) ;
2022-06-29 00:15:49 +02:00
// PRidobimo pakete za cenik
if ( window . location . pathname . indexOf ( 'zasebni-paketi' ) > - 1 || window . location . pathname . indexOf ( 'private-packages' ) > - 1 ) {
jQuery . post ( '/d/nakupovanje-api/get_paketi' ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
jQuery ( '[data-price="2"]' ) . text ( val . paketi [ 2 ] . price [ 12 ] . monthly ) ;
jQuery ( '[data-price="3"]' ) . text ( val . paketi [ 3 ] . price [ 12 ] . monthly ) ;
} ) ;
// jQuery.post('/frontend/payments/api.php?action=get_paketi').done(function (val) {
// val = JSON.parse(val);
//
// jQuery('[data-price="2"]').text(val.paketi[2].price[12].monthly);
// jQuery('[data-price="3"]').text(val.paketi[3].price[12].monthly);
// });
}
2021-07-27 14:46:32 +02:00
// Tuje bančno nakazilo
jQuery ( '#polje-drzava, [name="payment_method"]' ) . on ( 'change' , function ( ) {
if (
jQuery ( '[name="payment_method"]:checked' ) . val ( ) == 1 &&
jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) != 'Slovenija' &&
jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) != 'Slovenia'
) {
jQuery ( '.tuje-bancno-nakazilo' ) . show ( ) ;
jQuery ( '#tuje-bancno-nakazilo' ) . attr ( 'required' , 'required' ) ;
} else {
jQuery ( '#tuje-bancno-nakazilo' ) . removeAttr ( 'required' ) ;
jQuery ( '.tuje-bancno-nakazilo' ) . hide ( ) ;
}
} ) ;
jQuery ( '#zavezanec-za-ddv, .checkbox-zavezanec-za-ddv, [name="podjetje_drzava"]' ) . on ( 'click' , function ( ) {
posodobiCenoPaketa ( ) ;
} ) ;
// V kolikor gre za e-račun
jQuery ( '[name="podjetje_eracun"]' ) . on ( 'click' , function ( ) {
if ( jQuery ( '[name="podjetje_eracun"]' ) . is ( ':checked' ) ) {
jQuery ( '.p-e-racun' ) . show ( ) ;
} else {
jQuery ( '.p-e-racun' ) . hide ( ) ;
}
} ) ;
jQuery ( '#narocilo-paketa-podatki .naprej' ) . on ( 'click' , function ( e ) {
e . preventDefault ( ) ;
jQuery ( '.error-field' ) . removeClass ( 'error-field' ) ;
jQuery ( '.error-color' ) . removeClass ( 'error-color' ) ;
if ( ! jQuery ( '[name="payment_method"]' ) . is ( ":checked" ) ) {
jQuery ( '[name="payment_method"]' ) . siblings ( ) . addClass ( 'error-field' ) ;
}
if ( ! jQuery ( '[name="trajanje"]' ) . is ( ":checked" ) ) {
jQuery ( '[name="trajanje"]' ) . siblings ( ) . addClass ( 'error-field' ) ;
}
1
if ( jQuery ( '#tuje-bancno-nakazilo[required]' ) . is ( ':visible' ) ) {
if ( ! jQuery ( '#tuje-bancno-nakazilo[required]' ) . is ( ':checked' ) ) {
jQuery ( '#tuje-bancno-nakazilo' ) . parent ( ) . addClass ( 'error-field error-color' ) ;
}
}
//Preverjanje polja država
if ( jQuery ( '[name="podjetje_drzava"]' ) . is ( ':visible' ) && ( jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) == '' || jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) == undefined || jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) . length < 2 ) ) {
jQuery ( '#nakup-1ka #polje-drzava' ) . attr ( 'readonly' , false ) ;
jQuery ( '[name="podjetje_drzava"]' ) . addClass ( 'error error-field' ) ;
}
// Dodamo opozorilov input polja in tudi sklop obarvamo rdeče
jQuery ( ':input[required]:visible' ) . each ( function ( ) {
if ( jQuery ( this ) . val ( ) == '' ) {
jQuery ( this ) . addClass ( 'error-field' ) ;
}
}
) ;
jQuery ( '.error-field' )
. parents ( '.accordion-toggle' )
. siblings ( '.accordion-head' )
. find ( '.accordion-title' )
. addClass ( 'error-color' ) ;
if ( jQuery ( '.error-field' ) . length > 0 ) {
return '' ;
}
//Pridobi API klic, če gre za davčnega zavezanca
jQuery ( '#predogled-nakupa-1ka .cena-z-ddv-text' ) . show ( ) ;
var skupnaCena = jQuery ( '#narocilo-paketa-podatki .cena-paketa' ) . text ( ) ;
jQuery . post ( '/d/nakupovanje-api/check_ddv' , {
cena : skupnaCena ,
podjetje _drzava : jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) ,
podjetje _davcna : jQuery ( '[name="podjetje_davcna"]' ) . val ( )
} ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . success && val . cena ) {
jQuery ( '#predogled-nakupa-1ka .cena-paketa' ) . text ( val . cena ) ;
if ( ! val . ddv ) {
jQuery ( '#predogled-nakupa-1ka .cena-z-ddv-text' ) . hide ( ) ;
}
}
} ) ;
// Pri trajanju je pomembno,da pravilno sklanjamo
var trajanje = jQuery ( '[name="trajanje"]:checked' ) . val ( ) ;
if ( trajanje == 12 ) {
trajanje += ' mesecev' ;
} else if ( trajanje == 3 ) {
trajanje += ' mesece' ;
} else {
trajanje += ' mesec' ;
}
jQuery ( '#forma-trajanje' ) . text ( trajanje ) ;
jQuery ( '#forma-email' ) . text ( jQuery ( '#f-email' ) . val ( ) ) ;
jQuery ( '#forma-ime' ) . text ( jQuery ( '#f-ime' ) . val ( ) ) ;
if ( jQuery ( '#f-telefon' ) . val ( ) . length > 0 ) {
jQuery ( '#forma-telefon' ) . text ( jQuery ( '#f-telefon' ) . val ( ) ) ;
jQuery ( '#col-forma-telefon' ) . show ( ) ;
}
jQuery ( '#forma-d-drzava' ) . text ( jQuery ( '[name="podjetje_drzava"] :selected' ) . val ( ) ) ;
// Iz forme poberemo pdoatke o podjetju
if ( jQuery ( '#racun-na-podjetje' ) . is ( ':checked' ) ) {
jQuery ( '#forma-p-naziv' ) . text ( jQuery ( '[name="podjetje_ime"]' ) . val ( ) ) ;
jQuery ( '#forma-p-ddv' ) . text ( jQuery ( '[name="podjetje_davcna"]' ) . val ( ) ) ;
jQuery ( '#forma-d-naslov' ) . text ( jQuery ( '[name="podjetje_naslov"]' ) . val ( ) ) ;
jQuery ( '#forma-d-postna-st' ) . text ( jQuery ( '[name="podjetje_postna"]' ) . val ( ) ) ;
jQuery ( '#forma-d-posta-ime' ) . text ( jQuery ( '[name="podjetje_posta"]' ) . val ( ) ) ;
}
2022-09-13 09:38:01 +02:00
//Scrol on top
window . scrollTo ( 0 , 0 ) ;
2021-07-27 14:46:32 +02:00
var placilo = "" ;
2022-05-03 15:24:29 +02:00
if ( jQuery ( 'html' ) [ 0 ] . lang == 'sl' ) {
2021-07-27 14:46:32 +02:00
switch ( jQuery ( '[name="payment_method"]:checked' ) . val ( ) ) {
case "2" :
placilo = "Plačilo preko PayPal računa" ;
break ;
case "3" :
placilo = "Plačilo s kreditno kartico" ;
break ;
default :
placilo = "Plačilo po predračunu" ;
}
} else {
switch ( jQuery ( '[name="payment_method"]:checked' ) . val ( ) ) {
case "2" :
placilo = "Payment via PayPal account" ;
break ;
case "3" :
placilo = "Credit card payment" ;
break ;
default :
placilo = "Payment by pro forma invoice" ;
}
}
jQuery ( '#forma-nacin-placila' ) . text ( placilo ) ;
jQuery ( '#nakup-1ka' ) . hide ( ) ;
2022-06-22 15:33:20 +02:00
jQuery ( '#predogled-nakupa-1ka' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
} ) ;
// Vremo se en korak prej pri izbiri naročila
jQuery ( '#nazaj-na-nakup-1ka' ) . on ( 'click' , function ( ) {
jQuery ( '#nakup-1ka' ) . show ( ) ;
jQuery ( '#predogled-nakupa-1ka' ) . hide ( ) ;
} ) ;
// Oddamo naročilo
jQuery ( '#oddaj-narocilo' ) . on ( 'click' , function ( e ) {
e . preventDefault ( ) ;
oddajNarociloNaStreznik ( ) ;
} ) ;
jQuery ( '#button-placilo-po-predracunu' ) . on ( 'click' , function ( ) {
jQuery ( '.vrsta-placila' ) . hide ( ) ;
jQuery ( '.obvestila' ) . html ( 'Obdelujem . . .' ) ;
var narocilo = jQuery ( '#izbria-nacina-placila-1ka [name="narocilo_id"]' ) . val ( ) ;
} ) ;
// Uspešno oddan predračun ali plačilo preko spleta
if ( jQuery ( '.narocilo-1ka-pdf' ) . length > 0 ) {
if ( document . cookie . indexOf ( 'pdf=' ) < 1 ) {
return window . location . href = '/' ;
}
var piskotek = ";" + document . cookie ;
if ( piskotek . indexOf ( "; pdf=" ) > 0 ) {
// Pobrišemo vse nastavljene piškotke povezane z nakupom
document . cookie = "pdf=1;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/" ;
document . cookie = "vrsta_placila=0;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/" ;
document . cookie = "brezplacen_preklop=0;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/" ;
}
}
if (
( window . location . pathname . indexOf ( '/narocilo/paypal-cancel' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 ) ||
( window . location . pathname . indexOf ( '/paypal-purchase/cancel' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 )
) {
var parametri = window . location . search . substr ( 1 ) ;
jQuery . post ( '/d/nakupovanje-api/cancel_narocilo_paypal' , parametri ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . error ) {
return jQuery ( '.procesiram-narocilo' ) . text ( val . error ) ;
}
} ) ;
}
if (
2022-09-16 13:31:24 +02:00
( window . location . href . indexOf ( '/narocilo/paypal' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 ) ||
( window . location . href . indexOf ( '/paypal-purchase/success' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 )
2021-07-27 14:46:32 +02:00
) {
var parametri = window . location . search . substr ( 1 ) ;
jQuery . post ( '/d/nakupovanje-api/capture_narocilo_paypal' , parametri ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . error ) {
return jQuery ( '.procesiram-narocilo' ) . text ( val . error ) ;
}
} ) ;
}
//Stripe plačilo
if (
( window . location . pathname . indexOf ( '/narocilo/stripe-cancel' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 ) ||
( window . location . pathname . indexOf ( '/stripe-purchase/cancel' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 )
) {
var parametri = window . location . search . substr ( 1 ) ;
jQuery . post ( '/d/nakupovanje-api/stripe_checkout_cancel' , parametri ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . error ) {
return jQuery ( '.procesiram-narocilo' ) . text ( val . error ) ;
}
} ) ;
}
if (
( window . location . href . indexOf ( '/narocilo/stripe?narocilo_id' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 ) ||
( window . location . href . indexOf ( '/stripe-purchase/success?narocilo_id' ) > - 1 && location . search . split ( 'narocilo_id=' ) . length > 1 )
) {
var parametri = window . location . search . substr ( 1 ) ;
jQuery . post ( '/d/nakupovanje-api/stripe_checkout_success' , parametri ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . error ) {
return jQuery ( '.procesiram-narocilo' ) . text ( val . error ) ;
}
} ) ;
}
//Odpiranje funkcionalnosti pri paketih
2022-09-13 17:23:14 +02:00
/ * j Q u e r y ( ' . a c c o r d i o n - h e a d ' ) . o n ( ' c l i c k ' , f u n c t i o n ( ) {
2021-07-27 14:46:32 +02:00
jQuery ( this ) . toggleClass ( 'active' ) ;
jQuery ( this ) . siblings ( ) . toggleClass ( 'active' ) . removeStyle ( ) ;
} ) ;
jQuery ( '.razpri-zapri-vse' ) . on ( 'click' , function ( ) {
jQuery ( this ) . toggleClass ( 'active' ) ;
if ( jQuery ( this ) . hasClass ( 'active' ) ) {
jQuery ( '.accordion-head' ) . addClass ( 'active' ) ;
jQuery ( '.accordion-head' ) . siblings ( ) . addClass ( 'active' ) ;
} else {
jQuery ( '.accordion-head' ) . removeClass ( 'active' ) ;
jQuery ( '.accordion-head' ) . siblings ( ) . removeClass ( 'active' ) ;
}
2022-09-13 17:23:14 +02:00
} ) ; * /
2021-07-27 14:46:32 +02:00
/ *
* Posredujemo podatke za poslovne uporabnike
* /
jQuery ( '#narocilo-poslovni-uporabniki .submit-btn' ) . on ( 'click' , function ( e ) {
e . preventDefault ( ) ;
jQuery ( '.error-field' ) . removeClass ( 'error-field' ) ;
jQuery ( '.error-color' ) . removeClass ( 'error-color' ) ;
if ( ! jQuery ( '[name="vrsta_domene"]' ) . is ( ":checked" ) ) {
jQuery ( '[name="vrsta_domene"]' ) . siblings ( 'span' ) . addClass ( 'error-color' ) ;
}
if ( ! jQuery ( '#strinjanje_s_pogoji' ) . is ( ":checked" ) ) {
jQuery ( '#strinjanje_s_pogoji' ) . siblings ( 'span' ) . addClass ( 'error-color' ) ;
}
// Dodamo opozorilov input polja in tudi sklop obarvamo rdeče
jQuery ( ':input[required]:visible' ) . each ( function ( ) {
if ( jQuery ( this ) . val ( ) == '' ) {
jQuery ( this ) . addClass ( 'error-field' ) ;
}
}
) ;
if ( jQuery ( '.error-field, .error-color' ) . length > 0 ) {
return '' ;
}
//Onemogočimo dvojno pošiljanje
var pocakaj = jQuery ( this ) . attr ( 'data-wait' ) ;
jQuery ( this ) . val ( pocakaj ) . attr ( 'disabled' , 'disabled' ) ;
var podatki = jQuery ( '#narocilo-poslovni-uporabniki' ) . serialize ( ) ;
jQuery . post ( '/d/nakupovanje-api/send_poslovni_uporabniki' , podatki ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . success ) {
jQuery ( '#narocilo-poslovni-uporabniki' ) . hide ( ) ;
jQuery ( '#nakup-1ka-poslovni-uporabniki .uspesno-oddano-narocilo' ) . show ( ) ;
jQuery ( '.vsebina h1' ) . text ( 'Uspešno oddano naročilo' ) ;
}
} ) ;
// jQuery.post('/frontend/payments/api.php?action=send_poslovni_uporabniki', podatki).done(function (val) {
// val = JSON.parse(val);
//
// if (val.success) {
// jQuery('#narocilo-poslovni-uporabniki').hide();
// jQuery('#nakup-1ka-poslovni-uporabniki .uspesno-oddano-narocilo').show();
// jQuery('.vsebina h1').text('Uspešno oddano naročilo');
// }
// });
} ) ;
2022-06-09 13:23:25 +02:00
/ * v a r p r e v S c r o l l p o s = w i n d o w . p a g e Y O f f s e t ;
2021-07-27 14:46:32 +02:00
jQuery ( window ) . scroll ( function ( ) {
2022-06-09 13:23:25 +02:00
var menu = jQuery ( '.nav-menu > .container' ) ;
2021-07-27 14:46:32 +02:00
2022-06-09 13:23:25 +02:00
var currentScrollPos = window . pageYOffset ;
if ( currentScrollPos - prevScrollpos > 0 ) {
menu . addClass ( "hide" ) ;
2021-07-27 14:46:32 +02:00
} else {
2022-06-09 13:23:25 +02:00
menu . removeClass ( "hide" ) ;
2021-07-27 14:46:32 +02:00
}
2022-06-09 13:23:25 +02:00
prevScrollpos = currentScrollPos ;
} ) ; * /
2021-07-27 14:46:32 +02:00
// BREADCRUM ZAMENJAMO ZNAK
jQuery ( '.breadcrumb__separator' ) . text ( '' ) ;
// //Mnenje uporabnikom - dodamo manjkajoč DIV
jQuery ( '.slidearrow-mnenja.w-slider-arrow-right' ) . on ( 'click' , function ( ) {
// var width = jQuery('.w-slider-mask').width();
// var dataWidth = jQuery('.slide-mnenje').attr('data-width') || 0;
//
// var sumWidth = -width + +dataWidth;
// if((jQuery('.slide-mnenje').length/2 - 1)*width == -dataWidth){
// sumWidth = 0;
// }
//
// jQuery('.slide-mnenje').css({ transform: "translateX("+sumWidth+"px)", opacity: 1, transition: "transform 500ms ease 0s" });
// jQuery('.slide-mnenje').attr('data-width', sumWidth);
jQuery . each ( jQuery ( '[data-show]' ) , function ( i , val ) {
var st = jQuery ( this ) . attr ( 'data-show' ) ;
jQuery ( this ) . removeAttr ( 'data-show' ) . hide ( ) ;
st = + st + 1 ;
if ( st > 9 ) {
jQuery ( '.slide-mnenje' ) . eq ( 0 ) . attr ( 'data-show' , 1 ) . show ( ) ;
jQuery ( '.slide-mnenje' ) . eq ( 1 ) . attr ( 'data-show' , 2 ) . show ( ) ;
} else {
jQuery ( '.slide-mnenje' ) . eq ( st ) . attr ( 'data-show' , st + 1 ) . show ( ) ;
}
} ) ;
} ) ;
jQuery ( '.slidearrow-mnenja.w-slider-arrow-left' ) . on ( 'click' , function ( ) {
// var width = jQuery('.w-slider-mask').width();
// var dataWidth = jQuery('.slide-mnenje').attr('data-width') || 0;
//
// var sumWidth = +dataWidth + +width;
// if(dataWidth == 0){
// sumWidth = - (jQuery('.slide-mnenje').length/2 - 1) * width;
// }
//
// jQuery('.slide-mnenje').css({ transform: "translateX("+sumWidth+"px)", opacity: 1, transition: "transform 500ms ease 0s" });
// jQuery('.slide-mnenje').attr('data-width', sumWidth);
jQuery . each ( jQuery ( '[data-show]' ) , function ( i , val ) {
var st = jQuery ( this ) . attr ( 'data-show' ) ;
jQuery ( this ) . removeAttr ( 'data-show' ) . hide ( ) ;
st = + st - 2 ;
if ( st < 1 ) {
jQuery ( '.slide-mnenje' ) . eq ( 8 ) . attr ( 'data-show' , 9 ) . show ( ) ;
jQuery ( '.slide-mnenje' ) . eq ( 9 ) . attr ( 'data-show' , 10 ) . show ( ) ;
} else {
jQuery ( '.slide-mnenje' ) . eq ( st - 1 ) . attr ( 'data-show' , st ) . show ( ) ;
}
} )
} ) ;
// Prikaz novic
if ( jQuery ( '.submitted span' ) . attr ( 'content' ) ) {
var letoNovice = ( new Date ( jQuery ( '.submitted span' ) . attr ( 'content' ) ) ) . getFullYear ( ) ;
jQuery ( '.breadcrumb a[href="/d/en/news"]' ) . text ( 'News' ) ;
jQuery ( '.breadcrumb a[href="/d/en/news/' + letoNovice + '"]' ) . text ( letoNovice ) ;
jQuery ( '.breadcrumb a[href="/d/sl/novice"]' ) . text ( 'Novice' ) ;
jQuery ( '.breadcrumb a[href="/d/sl/novice/' + letoNovice + '"]' ) . text ( letoNovice ) ;
}
} ) ;
2022-06-27 16:10:51 +02:00
// }
2021-07-27 14:46:32 +02:00
2022-06-27 16:10:51 +02:00
//};
2021-07-27 14:46:32 +02:00
2022-06-27 16:10:51 +02:00
} ) ( jQuery ) ;
2021-07-27 14:46:32 +02:00
function CheckEmail ( text ) {
jQuery ( '#modal-registration .w-form-fail' ) . html ( '' ) . hide ( ) ;
jQuery ( '.w-input' ) . removeClass ( 'error' ) ;
var text = text || 'Prosimo, popravite email' ;
var Email = jQuery ( '#register-form [name="email"]' ) . val ( ) ;
if ( Email . length > 1 && ( Email . search ( '@' ) == - 1 || Email . indexOf ( '.' ) == - 1 ) ) {
jQuery ( '#modal-registration .w-form-fail' ) . html ( '<div>' + text + '</div>' ) . show ( ) ;
jQuery ( '#modal-registration [type="email"]' ) . addClass ( 'error' ) ;
return false ;
}
return true ;
}
function InsertName ( ) {
var Email = jQuery ( '#register-form [name="email"]' ) . val ( ) ;
var lokacija = Email . search ( '@' ) ;
if ( Email . search ( '@' ) == - 1 ) {
lokacija = Email . length ;
}
var Ime = Email . substring ( 0 , lokacija ) ;
if ( jQuery ( '#register-form [name="ime"]' ) . val ( ) . length < 2 ) {
jQuery ( '#register-form [name="ime"]' ) . val ( Ime ) ;
}
}
function CheckEmailTypo ( text ) {
var email = jQuery ( '#register-form [name="email"]' ) . val ( ) ;
var domains = [ 'gmail.com' , 'hotmail.com' , 'guest.arnes.si' , 'siol.net' ] ;
var splitEmail = email . split ( '@' ) ;
for ( var i = 0 ; i < domains . length ; i ++ ) {
var domain = domains [ i ] ;
if ( preveriZaTipkarskoNapakoVemailu ( splitEmail [ 1 ] , domain ) ) {
jQuery ( '#modal-registration .w-form-fail' ) . html ( '<div>' + text + ' <b>@' + domain + '</b>?</div>' ) . show ( ) ;
return jQuery ( '#modal-registration [type="email"]' ) . addClass ( 'error' ) ;
}
}
return '' ;
}
function preveriZaTipkarskoNapakoVemailu ( uporabnikovaDomena , domena ) {
// Domeni se ujemata
if ( uporabnikovaDomena && domena && uporabnikovaDomena . includes ( domena ) )
return false ;
//Preverimo če vsebuje dve piki ali vejico
if ( new RegExp ( '(\\.{2})|(\,)' ) . test ( uporabnikovaDomena ) && uporabnikovaDomena . substring ( 0 , 3 ) == domena . substring ( 0 , 3 ) ) {
return true ;
}
// domeno razbijemo, da preverimo napake za posamezne črke gm|ail
for ( var i = 1 ; i < domena . length ; i ++ ) {
var prviDel = domena . substring ( 0 , i ) ;
var preostenekBesede = domena . substring ( i ) ;
// preverimo, če so črke napačne
if ( new RegExp ( prviDel + '.' + preostenekBesede . substring ( 1 ) ) . test ( uporabnikovaDomena ) ) {
return true ;
}
// preverimo, če je dodana črka preveč
if ( new RegExp ( prviDel + '.' + preostenekBesede ) . test ( uporabnikovaDomena ) ) {
return true ;
}
// majkajoča črka
if ( preostenekBesede !== 'mail' && new RegExp ( '(' + prviDel + '{0}' + preostenekBesede + ')|(' + domena + '{0})' ) . test ( uporabnikovaDomena ) ) {
return true ;
}
if ( domena == 'gmail.com' && new RegExp ( 'gmail.si|gmail.net' ) . test ( uporabnikovaDomena ) ||
domena == 'guest.arnes.si' && new RegExp ( 'arnes.si' ) . test ( uporabnikovaDomena ) ||
domena == 'siol.net' && new RegExp ( 'siol.com' ) . test ( uporabnikovaDomena ) ) {
return true ;
}
if ( domena == 'hotmail.com' && new RegExp ( 'hotmail.si' ) . test ( uporabnikovaDomena ) ) {
return true ;
}
// test for switched letters
var switchedLetters = [
domena . substring ( 0 , i - 1 ) ,
domena . charAt ( i ) ,
domena . charAt ( i - 1 ) ,
domena . substring ( i + 1 )
] . join ( '' ) ;
if ( uporabnikovaDomena . includes ( switchedLetters ) ) {
return true ;
}
}
return false ;
}
//Fro APP install banner
window . addEventListener ( 'beforeinstallprompt' , function ( e ) {
var piskotek = "; " + document . cookie + ";" ;
//if cookies are not accepted, dont show install banner (because install banner covers cookie banner)
if ( piskotek . split ( "; cookie-agreed=2" ) . length != 2 ) {
e . preventDefault ( ) ;
}
} ) ;
function oddajNarociloNaStreznik ( ) {
2022-07-07 14:38:55 +02:00
jQuery ( '#predogled-nakupa-1ka' ) . hide ( ) ;
2021-07-27 14:46:32 +02:00
jQuery ( '.procesiram-posamezno-narocilo' ) . hide ( ) ;
2022-07-21 15:50:11 +02:00
jQuery ( '#procesiram-nakup-1ka' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
jQuery ( '.procesiram-narocilo' ) . show ( ) ;
var nacinPlacila = jQuery ( '[name="payment_method"]:checked' ) . val ( ) ;
jQuery ( '.procesiram-narocilo .procesiram-narocilo-' + nacinPlacila ) . show ( ) ;
if ( nacinPlacila == 2 ) {
jQuery ( '.procesiram-narocilo .procesiram-narocilo-ime' ) . text ( 'PayPal' ) ;
} else if ( nacinPlacila == 3 ) {
jQuery ( '.procesiram-narocilo .procesiram-narocilo-ime' ) . text ( 'Stripe' ) ;
}
// V kolikor je omenjeno polje izpolnjeno potem gre za robota in preusmerimo na začetno stran
if ( jQuery ( '[name="narocilo-robotsko-narocilo"]' ) . val ( ) . length > 0 ) {
return window . location = '/' ;
}
var podatki = jQuery ( 'form#narocilo-paketa-podatki' ) . serialize ( ) ;
jQuery . post ( '/d/nakupovanje-api/create_narocilo' , podatki ) . done ( function ( val ) {
val = JSON . parse ( val ) ;
if ( val . error ) {
jQuery ( '.procesiram-narocilo' ) . text ( val . error ) . css ( 'color' , 'red' ) ;
return setTimeout ( function ( ) {
jQuery ( '.pregled-narocila' ) . show ( ) ;
jQuery ( '#oddaj-narocilo' ) . show ( ) ;
jQuery ( '.submit-btn.naprej' ) . show ( ) ;
jQuery ( '#nazaj-na-nakup-1ka' ) . show ( ) ;
jQuery ( '.procesiram-narocilo' ) . hide ( ) ;
jQuery ( '.procesiram-narocilo' ) . text ( 'Poteka obdelava' ) . css ( 'color' , 'black' ) ;
} , 3000 ) ;
}
var cas = new Date ( ) ;
cas . setMinutes ( cas . getMinutes ( ) + 30 ) ;
document . cookie = "vrsta_placila=" + jQuery ( '[name="payment_method"]:checked' ) . val ( ) + ";expires=" + cas + ";path=/" ;
if ( val . success ) {
var paymentMethod = jQuery ( '[name="payment_method"]:checked' ) . val ( ) ;
var paymentLang = jQuery ( '#narocilo-paketa-podatki [name="lang"]' ) . val ( ) ;
var urlRedirect = '/' ;
if ( paymentMethod == 1 ) {
document . cookie = "pdf=" + val . payment _link + ";expires=" + cas + ";path=/" ;
// Glede na jezik preusmerimo na slovensko oz. angleško verzijo
var urlRedirect = "/d/narocilo-pregled/predracun/pdf" ;
if ( paymentLang == 'en' ) {
urlRedirect = "/d/en/purchase/payment-details/pdf" ;
}
} else if ( paymentMethod == 2 ) {
// PayPal redirect
return setTimeout ( function ( ) {
window . location = val . paypal _link
} , 1000 ) ;
} else if ( paymentMethod == 3 ) {
// Nastavimo Stripe instanco
var stripe = Stripe ( jQuery ( '#stripe-token' ) . val ( ) ) ;
return setTimeout ( function ( ) {
stripe . redirectToCheckout ( { sessionId : val . session _id } ) ;
} , 1000 ) ;
}
window . location = urlRedirect ;
}
} ) ;
}
function lang ( ) {
2022-05-03 15:24:29 +02:00
return jQuery ( 'html' ) [ 0 ] . lang ;
2021-07-27 14:46:32 +02:00
}
function odpriAaiLoginObvestilo ( ) {
jQuery ( '.modal-intro-title' ) . hide ( ) ;
jQuery ( '.nakup-prijava' ) . hide ( ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '.modal-intro-login-text' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
2022-05-03 15:24:29 +02:00
if ( jQuery ( 'html' ) [ 0 ] . lang == 'sl' ) {
2021-07-27 14:46:32 +02:00
jQuery ( '#modal-open-1ka' ) . removeClass ( 'modal-goto-registration' ) . addClass ( 'modal-open-login-obrazec' ) ;
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-info-login' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
// V kolikor gre za nakup prikažemo še obvestilo o nakupu
if ( document . cookie . indexOf ( 'nakup=' ) > 0 ) {
2022-05-03 15:24:29 +02:00
jQuery ( '.nakup-prijava' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
}
} else {
2022-05-03 15:24:29 +02:00
jQuery ( '#modal-open-login-obrazec' ) . css ( 'display' , 'flex' ) ;
2021-07-27 14:46:32 +02:00
}
}
2022-07-18 17:45:22 +02:00
function iskanjeBesede ( iskaniNiz ) {
2022-07-18 17:41:17 +02:00
var action = jQuery ( '#forma-iskanje-header' ) . attr ( 'data-action' ) ;
window . location . href = action + '/iskanje/' + iskaniNiz ;
}
2021-07-27 14:46:32 +02:00