1// JavaScript Document 2//window.addEventListener('load', function() { 3//}, false); 4// ON LOAD FIX 5$(window).bind("pageshow", function (event) { 6 if (event.originalEvent.persisted) { 7 $("body").removeClass("navigated navigate"); 8 } 9 $("#aspnetForm").removeClass("done"); 10}); 11 12$(document).ready(function(){ 13 14$(".mainimgs .col img").not('.mainimgs .col .icon img').each(function () { 15 $(this).closest(".col").attr("style", "background-image:url(" + $(this).attr("src") + ");").addClass("bg-img"); 16 $(this).hide(); 17 }); 18 19 function _is_test() { 20 try { 21 return $('#_test').val() == '1'; 22 } catch (ex) { 23 24 } 25 return false; 26 } 27 $(".mainimgs").each(function (index) { 28 return false; 29if ( $(this).find('.col').length < 3) { 30$('.mainimgs .col').css( "width", "50%" ); 31} 32}); 33 34 function mainimgsresize() { 35 return; 36 _slide_Height = $(window).height() - 300; 37 $(window).resize(function () { 38 $(".mainimgs, .mainimgs .col").height(_slide_Height); 39 }); 40 $(".mainimgs, .mainimgs .col").height(_slide_Height); 41 42 $(window).resize(function () { 43 $(".mainimgs, .mainimgs .text").height(_slide_Height-80); 44 }); 45 $(".mainimgs, .mainimgs .text").height(_slide_Height - 80); 46} 47 48mainimgsresize(); 49 50 51 52 53function videosresize() { 54 jQuery.fn.center = function () { 55 this.css("position","absolute"); 56 this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + 57 $(window).scrollTop()) + "px"); 58 this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + 59 $(window).scrollLeft()) + "px"); 60 return this; 61} 62 _slide_Height = $(window).height() - 250; 63 if (_slide_Height < 480) { 64 _slide_Height = 480; 65 } 66 $(window).resize(function () { 67 68 $(".mainimg, .videocontainer").height(_slide_Height); 69 $('.mainimg').css('top', -_slide_Height); 70 $('.mainimg').css('margin-bottom', -_slide_Height); 71 }); 72 73 $(".mainimg, .videocontainer").height(_slide_Height); 74 $('.mainimg').css('top', -_slide_Height); 75 $('.mainimg').css('margin-bottom', -_slide_Height); 76} 77 78videosresize(); 79 80 81 82});//ready 83 84 85$(window).load(function(){ 86 87$('[data-toggle="tooltip"]').tooltip({ 88 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', 89 html: true, 90 container: 'body' 91 92}); 93 94 95 96$(function(){ 97 // bind change event to select 98 $('.searchbox select').on('change', function () { 99 var url = $(this).val(); // get selected value 100 window.location = url; // redirect 101 return false; 102 }); 103 }); 104 105 106 //new FastClick(document.body); 107 108 109 if ($("#page.utb-page").length !== 0 && $(window).width() < 767) { 110 //$("html, body").animate({ scrollTop: 90 }, 0); 111 112 $(".s1 .aside-footer .anm-button").clone().appendTo("#utb_header"); 113 $(window).scroll(function () { 114 if ($(window).scrollTop() > ($("#utb_header").offset().top + $("#utb_header").outerHeight())) { 115 } 116 }); 117 } 118 119 120 ////////////////////////////////////// 121 // // 122 // Image Caption Script // 123 // // 124 ////////////////////////////////////// 125 126 $(".has-caption").each(function(index){ 127 var caption = $(this).attr("title"); 128 var classes = $(this).attr("class"); 129 var cap_width = $(this).width(); 130 $(this).attr("class",''); 131 $(this).wrap("<figure class='s1 "+classes+"' />"); 132 $(this).parent("figure").append("<figcaption"+" style='width:"+cap_width+"px'"+">"+caption+"</figcaption>"); 133 }); 134 135 ////////////////////////////////////// 136}); 137 138var _device = { 139 touch:false, 140 tablet:false, 141 phone: false, 142 ie8: false, 143 ie7:false 144}; 145var _device_detected = false; 146function _device_detect() { 147 if (_device_detected) { 148 return; 149 } 150 var _uagent = navigator.userAgent; 151 if(_uagent.match(/(android|webos|iphone|ipad|ipod|x11)/i)){ 152 _device.touch = true; 153 $("body").addClass("touch"); 154 _device.tablet = $(window).width() > 768;
155 _device.phone = !_device.tablet; 156 } 157 else { 158 $("body").addClass("desktop"); 159 if (_uagent.match(/MSIE 8.0/i)) 160 _device.ie8 = true; 161 if (_uagent.match(/MSIE 7.0/i)) 162 _device.ie7 = true; 163 } 164 _device_detected = true; 165 166} 167 168function general_resize() 169{ 170 adjust_search_list_text(); 171 if($(".brick-slide").length !== 0) 172 { 173 $(".brick-slide").each(function(i){ 174 if($(this).find("#df_search_list > li").length > 4) 175 { 176 $(this).find(".brick-slide-inner").width 177 ( 178 $(this).outerWidth()+120 179 ); 180 } 181 $(this).find("#df_search_list").width 182 ( 183 $(this).find("#df_search_list > li").length*($("#df_search_list > li").width()+20) 184 ); 185 }); 186 } 187 // p-62: "Sök utbildning" 188 if($(window).width() < 767 && $("body.p-62").length !== 0) 189 { 190 $(".control.views .icon").removeClass("active"); 191 $(this).addClass("active"); 192 $("#df_search_list").removeClass("gallery-view").addClass("list-view"); 193 $.cookie("view", "list", {path: '/'}); 194 } 195 if($(window).width() < 767 && $("#samlingssida").length !== 0) 196 { 197 $("#samlingssida #df_search_list").removeClass("gallery-view").addClass("list-view"); 198 } 199 if($(window).width() < 767 && $(".foretag-nav-wrapper").length !== 0) 200 { 201 $(".foretag-nav-wrapper .phone-toggle").click(function () { 202 $(".foretag-nav-wrapper").toggleClass("open"); 203 }); 204 } 205 206} 207 208function resize_on_filter() 209{ 210 read_cookies(); 211 var _curr_height = $("#df_search_result").height(); 212 var _new_height = $("#df_search_list").height() + 50; 213 214 $("#df_search_result").animate({"height":_new_height}, 500); 215} 216 217function brick_slide() 218{ 219 $(".brick-slide").each(function(i){ 220 221 222 if($(this).find("#df_search_list > li").length < 1) 223 { 224 $(this).find(".brick-slide-inner").hide(); 225 $(this).find("#no-brick-items").show(); 226 } 227 228 if($(this).find("#df_search_list > li").length > 4) 229 { 230 $(this).find("#df_search_list > li:last-child") 231 .clone() 232 .prependTo($(this) 233 .find("#df_search_list")) 234 .addClass("clone-1"); 235 $(this).find("#df_search_list > li:nth-last-child(2)") 236 .clone() 237 .prependTo($(this) 238 .find("#df_search_list")) 239 .addClass("clone-2"); 240 $(this).find("#df_search_list > li:nth-last-child(3)") 241 .clone() 242 .prependTo($(this) 243 .find("#df_search_list")) 244 .addClass("clone-3"); 245 $(this).find("#df_search_list > li:nth-last-child(4)") 246 .clone() 247 .prependTo($(this) 248 .find("#df_search_list")) 249 .addClass("clone-4"); 250 251 $(this).find("#df_search_list") 252 .css("left",-(($("#df_search_list > li").width()+20)*4)+30) 253 } 254 else{ 255 $(this).find(".brick-slide-next, .brick-slide-prev").hide(); 256 $(this).find(".brick-slide-inner").css({"width":"auto","margin":0}); 257 $(this).find(".utb-result-wrapper").css({"margin":"auto","position":"relative"}) 258 $(this).find(".utb-outer").css({"margin":0}) 259 } 260 }); 261 262 $(".brick-slide-next").click(function(){ 263 $(this).siblings(".brick-slide-prev").addClass("active"); 264 var _curr_obj = $(this).parents(".brick-slide").find("#df_search_list"); 265 var _curr_left = parseInt(_curr_obj.css("left")); 266 var _curr_width = parseInt(_curr_obj.parents(".brick-slide-inner").width()); 267 var _item_width = parseInt(_curr_obj.children("li:first-child").width()+20); 268 var _new_left = _curr_left-_item_width; 269 if(-_new_left > (_curr_obj.width() - _curr_width) + _item_width) 270 { 271 _curr_obj 272 .stop(true,true) 273 .css("left",30) 274 .animate({"left":-_item_width+30},200); 275 } 276 else 277 { 278 _curr_obj.stop(true,true).animate({"left":_new_left},200); 279 } 280 }); 281 $(".brick-slide-prev").click(function(){ 282 $(this).siblings(".brick-slide-next").addClass("active"); 283 var _curr_obj = $(this).parents(".brick-slide").find("#df_search_list"); 284 var _curr_left = parseInt(_curr_obj.css("left")); 285 var _curr_width = parseInt(_curr_obj.parents(".brick-slide-inner").width()); 286 var _item_width = parseInt(_curr_obj.children("li:first-child").width()+20); 287 var _new_left = _curr_left+_item_width; 288 if(_new_left >= _item_width) 289 { 290 _new_left = _curr_obj.width(); 291 _curr_obj 292 .stop(true,true) 293 .css("left",-_new_left+(_item_width*4)+30) 294 .animate({"left":-_new_left+(_item_width*5)+30},200); 295 } 296 else 297 { 298 _curr_obj.stop(true,true).animate({"left":_new_left},200);
299 } 300 }); 301} 302 303function cal_slide() 304{ 305 var _rwd = $("#df_result_cal_dates").width(); 306 var _translate = 200; 307 308 $(".cal-scroll-right").click(function(){ 309 $(".cal-scroll-left").addClass("active"); 310 $(".cal-fade-fx-left").fadeIn(300); 311 var _width = $("#df_result_cal_dates .inner").width(); 312 var _curr_left = parseInt($("#df_result_cal_dates .inner").css("margin-left")); 313 var _new_left = _curr_left-_translate; 314 if(-_new_left >= (_width - _rwd)) 315 { 316 _new_left = (_width - _rwd); 317 $("#df_result_cal_dates .inner").animate({"margin-left":-(_new_left+20)},200); 318 $(".cal-scroll-right").removeClass("active"); 319 $(".cal-fade-fx-right").fadeOut(300); 320 } 321 else 322 $("#df_result_cal_dates .inner").animate({"margin-left":_new_left}, 200); 323 }); 324 325 $(".cal-scroll-left").click(function(){ 326 $(".cal-scroll-right").addClass("active"); 327 $(".cal-fade-fx-right").fadeIn(300); 328 var _width = $("#df_result_cal_dates .inner").width(); 329 var _curr_left = parseInt($("#df_result_cal_dates .inner").css("margin-left")); 330 var _new_left = _curr_left+_translate; 331 if(_new_left >= 0) 332 { 333 _new_left = 0; 334 $("#df_result_cal_dates .inner").animate({"margin-left":-(_new_left)},200); 335 $(".cal-scroll-left").removeClass("active"); 336 $(".cal-fade-fx-left").fadeOut(300); 337 } 338 else 339 $("#df_result_cal_dates .inner").animate({"margin-left":_new_left}, 200); 340 }); 341} 342 343function phone_init() 344{ 345 //$("#phone_menu").show(); 346 $("#taggar").click(function () { 347 $(this).addClass("hover"); 348 }); 349 350} 351 352function tablet_init() 353{ 354 $("#main_nav").on("click",".parent > a", function(){ 355 if(!$(this).closest(".parent").hasClass('touched')) 356 { 357 event.preventDefault(); 358 $("#main_nav .parent").removeClass("touched"); 359 $(this).closest(".parent").addClass("touched"); 360 } 361 }); 362} 363 364function adjust_search_list_text(){ 365 $("#df_search_list .li-header h2").each(function(i){ 366 if($(this).height() > 21) 367 { 368 $(this).closest("li").addClass("adjust"); 369 } 370 }); 371} 372 373var _likes = 0; 374function read_cookies() 375{ 376 _init4_likes(); 377 return; 378 /* 379 $("#like_list_listing ul li").remove(); 380 _likes = parseInt($.cookie('likes'), {path: '/'}); 381 $("#debug").text(_likes); 382 if (_likes > 0){ 383 $("#likes_n").text(_likes) 384 for(cnt = 0; _likes > cnt;cnt++) 385 { 386 var _name = $.cookie('like-name-'+(cnt+1)); 387 var _url = $.cookie('like-link-'+(cnt+1)); 388 389 $("#like_list_listing ul").append('<li><a href="'+_url+'">'+_name+'</a><span class="forget">Ã</span></li>'); 390 $(".button.like").each(function(i){ 391 if($(this).parents('li').find(".li-master-link").attr("href") == _url) 392 $(this).addClass('liked'); 393 }); 394 if(document.URL == _url) 395 $("#utb_buttons .like").addClass("liked"); 396 } 397 $("#like_list").fadeIn(300); 398 var _top = $("#like_list_listing").height(); 399 $("#like_list").css({"top":-_top-50}); 400 } 401 */ 402} 403 404function df_share(_clicked) 405{ 406 // rensa 407 $("head script").each(function(){ 408 if($(this).attr("src") == "//platform.linkedin.com/in.js"); 409 $(this).remove(); 410 }); 411 412 // LOAD IFRAMES 413 if($("#df_search_list").length !== 0) 414 var _share_url = _clicked.parents(".li-footer").siblings(".li-master-link").attr("href"); 415 if($("#page.utb-page").length !== 0) 416 var _share_url = document.URL; 417 418 var _fb_html = '<fb:like href="'+_share_url+'" layout="button_count" show_faces="false" action="like"></fb:like>'; 419 _clicked.find(".share-fb-li").html(_fb_html); 420 FB.XFBML.parse(_clicked.find('.share-fb-li')[0]); 421 422 var e = document.createElement('script'); 423 e.type="text/javascript"; 424 e.src = '//platform.linkedin.com/in.js'; 425 document.getElementsByTagName('head')[0].appendChild(e); 426 427 428 //TWITTER BUTTON 429 var _den = _clicked.find(".share-tw-li").get(0); 430 _clicked.find(".share-tw-li").html(""); 431 twttr.widgets.createShareButton(_share_url,_den); 432 433 // VISUALS 434 var _t = false; 435 _clicked.children(".share-wrapper").hover(function(){_t=true}); 436 setTimeout(function(){ 437 if(!_t) 438 _clicked.removeClass("active"); 439 },3000); 440 _clicked.children(".share-wrapper").hover(function(){},function(){ 441 _t = false; 442 setTimeout(function(){ 443 if(!_t) 444 _clicked.removeClass("active"); 445 },2000); 446 }); 447 448 if(!_clicked.hasClass("active")) 449 { 450 $(".share.active").removeClass("active"); 451 _clicked.addClass("active"); 452 } 453 else 454 { 455 _clicked.removeClass("active"); 456 } 457} 458 459var _navigate = false; 460 461function vilse() 462{ 463 $("input[name='url']").attr("value", document.URL); 464
465 if(!_device.phone) 466 { 467 setTimeout(function(){ 468 $("#vilse").removeClass("init"); 469 }, 4000); 470 471 if($(window).scrollTop() > $("#vilse_outer").offset().top-$(window).height()) 472 $("#vilse").addClass("relative-pos").removeClass("init"); 473 if($(window).scrollTop() < $("#vilse_outer").offset().top-$(window).height()) 474 $("#vilse").removeClass("relative-pos"); 475 476 $(window).scroll(function(){ 477 if($(window).scrollTop() > $("#vilse_outer").offset().top-$(window).height()) 478 $("#vilse").addClass("relative-pos").removeClass("init"); 479 if($(window).scrollTop() < $("#vilse_outer").offset().top-$(window).height()) 480 $("#vilse").removeClass("relative-pos"); 481 }); 482 483 $("#vilse").click(function(){ 484 $("html, body").animate({ scrollTop: $("#vilse_outer").offset().top-200 }, 500); 485 }); 486 } 487 else if(_device.phone) 488 { 489 $("#vilse").clone().addClass("clone").appendTo("#page"); 490 // if(!$("#vilse").is("#vilse.relative-pos")) 491 // { 492 // $("#vilse").css("top", $(window).scrollTop()); 493 // } 494 } 495 496} 497 498$(document).ready(function () { 499 500 _hide_paket_liknande_if_notfound(); 501 502 $("body").on("click", "a a:not(.ui-menu-item > a)", function () { 503 if ($(this).attr("target") !== "_blank") 504 $("body").addClass("navigated"); 505 }); 506 507 508 509 $("#page > .container, footer").show(); 510 511 // $("body").append("<div id='debug'></div>") 512 513 general_resize(); 514 if(!_device.tablet) 515 { 516 $(window).resize(function () { 517 general_resize(); 518 }); 519 } 520 521 _device_detect(); 522 if (_device.phone) { 523 phone_init(); 524 } 525 526 if (_device.tablet) { 527 tablet_init(); 528 } 529 530 531 // clicka upp referenser, p-64: referenser 532 if($("body.p-65").length !== 0) 533 { 534 535 $("#df_search_list li .ref-frame-1 .referens-inner .inner").each(function(){ 536 if($(this).height() < 130) 537 $(this).closest(".referens-outer").find(".cover").hide(); 538 }); 539 540 $("#df_search_list li .ref-frame-2 .ref-padding").each(function(){ 541 if($(this).height() > 330) 542 $(this).css("padding-bottom", 80); 543 }); 544 545 $("#df_search_list").on("click", ".ref-frame-2", function(){ 546 547 if($(window).width() < 768) 548 { 549 if($(this).hasClass("open")) 550 { 551 $(this).removeClass("open"); 552 $(this).find(".inner").animate({"max-height": 10}, 1000); 553 } 554 else 555 { 556 var _th = $(this).find(".ref-padding").height(); 557 $(this).find(".inner").animate({"max-height": _th}, 1000); 558 $(this).addClass("open"); 559 } 560 } 561 else 562 { 563 $("#ref_overlay").fadeIn(500); 564 565 var _obj = $(this); 566 var _obj2 = $(this).closest("li").find(".ref-frame-1"); 567 var _li = $(this).closest("li"); 568 569 _li.css("z-index", 12); 570 _obj.addClass("visible"); 571 _obj.css({ 572 "top": -30, 573 "left":0-_li.position().left + ($("#main").width() * 0.5) - 230, 574 "z-index": 5 575 }); 576 _obj2.stop(true,true).fadeTo(300, 0); 577 _li.addClass("shy"); 578 579 $("body").on("click", "#ref_overlay, .shy-click, .ref-close", function(){ 580 $("#ref_overlay").fadeOut(300); 581 _obj.removeClass("visible"); 582 _obj.css({ 583 "top": 0, 584 "left":0, 585 }); 586 _li.removeClass("open"); 587 _obj2.fadeTo(300, 1) 588 _li.removeClass("shy"); 589 setTimeout(function(){ 590 _li.css("z-index", 1); 591 },500); 592 }); 593 } 594 595 }); 596 } 597 598 // flags 599 if ($("#flags_wrapper").length !== 0) { 600 if ($("#flags_wrapper .flag").length === 0) 601 $("#flags_wrapper").hide(); 602 } 603 604 // check if brick-slide is present 605 if ($(".brick-slide").length !== 0) { 606 brick_slide(); 607 } 608 609 // check if cal-slide is present 610 if ($("#df_result_cal_wrapper").length !== 0) { 611 cal_slide(); 612 } 613 614 // show ONLY the video thumb if video attached 615 if ($(".post-video").length !== 0) { 616 $(".post-video").each(function (i) { 617 if ($(this).children().length === 0) 618 $(this).remove(); 619 else 620 $(this).next().remove(); 621 }); 622 } 623 624 // hide img/video wrapper if no img & video attached 625 if ($("img:hidden").length !== 0 && $(".video-container").length === 0) { 626 $("img:hidden").each(function (i) { 627 $(this).parent("p").remove(); 628 }); 629 } 630 631 // hide menu wrapper if not present 632 if ($("#submenu ul.menu").length === 0) { 633 $("aside#submenu").hide(); 634 } 635 636 site_search(); 637 638 // responsive phone menu
639// if(_device.phone) 640// { 641 $("#menu_button").click(function () { 642 if (_navigate) { 643 _navigate = false; 644 $("div#page").removeClass("navigate"); 645 $("#phone_menu").removeClass("navigate"); 646 } 647 else { 648 _navigate = true; 649 $("div#page").addClass("navigate"); 650 $("#phone_menu").addClass("navigate"); 651 $("#phone_menu").css("height", $(document).height()); 652 } 653 }); 654 //} 655 656 // CUSTOM PROMPTING 657 if ($(".prompt-wrapper").length !== 0) { 658 $(".prompt-wrapper").each(function () { 659 if ($(this).children("input").val() !== "") 660 $(this).children(".prompt").fadeOut(); 661 }); 662 663 $(".prompt").click(function(){ 664 $(this).siblings("input").focus(); 665 }); 666 667 $(".prompt-wrapper input").focus(function () { 668 $(this).siblings(".prompt").fadeOut(100); 669 }); 670 $(".prompt-wrapper input").blur(function () { 671 if ($(this).val() == "") 672 $(this).siblings(".prompt").fadeIn(100); 673 }); 674 } 675 676 // DFK likes 677 678 // Ãppna mail client 679 $("#like_list_mejl").click(function (event) { 680 event.preventDefault(); 681 682 // get body 683 var _body = $("#like_list_listing ul").html(); 684 _body = _body 685 .replace(/<li data-utb="+\d+">/g, "") 686 .replace(/<\/li>/g, "") 687 .replace(/<span class="forget">Ã?<\/span>/g, "%0D%0D") 688 .replace(/<a href="/g, "") 689 .replace(/">/g, "%0D") 690 .replace(/­/g, "") 691 .replace(/\/utbildning/g, "//www.dfkompetens.se/utbildning") 692 .replace(/<\/a>/g, ""); 693 694 // get mejl 695 var _mejl = $("#like_list_share_toggle input").val(); 696 697 $(this).attr("href", $(this).attr("href").replace(/_body/g, _body)); 698 $(this).attr("href", $(this).attr("href").replace(/_mejl/g, _mejl)); 699 window.location.href = $(this).attr("href"); 700 $("#like_list_share_toggle input").val(""); 701 $("#like_list_share .icon").removeClass("active"); 702 $("#js_overlay").remove(); 703 $("#like_list_share_toggle").hide(100); 704 _list_locked = false; 705 toggle_like_list($("#like_list"), _list_locked, 0); 706 }); 707 708 var _list_locked = false; 709 $("#like_list_share .icon").click(function () { 710 if (_list_locked) 711 { 712 $(this).removeClass("active"); 713 $("#js_overlay").remove(); 714 } 715 else 716 { 717 $("body").prepend("<div id='js_overlay'>"); 718 $(this).addClass("active"); 719 } 720 $("#like_list_share_toggle").toggle(100); 721 _list_locked = !_list_locked; 722 }); 723 724 $("body").on("click", "#js_overlay",function(){ 725 $("#like_list_share .icon").removeClass("active"); 726 $("#js_overlay").remove(); 727 $("#like_list_share_toggle").hide(100); 728 _list_locked = false; 729 toggle_like_list($("#like_list"), _list_locked, 0); 730 }); 731 732 733 734 735 736 737 738 739 740 //$("#like_list").animate({"top":-50, "width":220, "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.3)"}, 100); 741 742 if(_device.touch) 743 { 744 $("#like_list").click( 745 function () { 746 toggle_like_list_tablet($(this), _list_locked); 747 } 748 ); 749 } 750 else 751 { 752 $("#like_list").hover( 753 function () { 754 toggle_like_list($(this), _list_locked, 1); 755 }, 756 function () { 757 toggle_like_list($(this), _list_locked, 0); 758 } 759 ); 760 } 761 762 read_cookies(); 763 764 // bind for likes(hjärta)-vÃ¥ra utbildning sida 765 $("#df_search_list").on('click', '.button.like', function () { 766 _like_clicked($(this)); 767 }); 768 // bind for likes(hjärta)-utbildning sida 769 $("body").on('click', '.like', function () { 770 _like_clicked($(this)); 771 console.log("like"); 772 }); 773 774 // TA BORT MED KRYSSET 775 $("#like_list_listing").on('click', '.forget', function () { 776 var _li=$(this).parents('li:eq(0)'); 777 _remove_like(_li); 778 }); 779 780 // VILSE? 781 if ($("#vilse").length !== 0) 782 vilse(); 783 784 // scroll 785 if ($(window).width() > 767) { 786 fix_utb_header(); 787 $("#footer_address").append('<div id="to_top_desktop">Upp<span class="ar"></span></div>'); 788 $("body").on("click","#to_top_desktop",function(){ 789 $("html, body").animate({scrollTop: 0}, 500); 790 }); 791 $(window).scroll(function () 792 { 793 if ($(window).scrollTop() > 2) 794 { 795 $("#page > #top_header").addClass('lift'); 796 } 797 else 798 { 799 $("#page > #top_header").removeClass('lift'); 800 } 801 802 if($("#footer_address").length !== 0) { 803 if ($(window).scrollTop() > 200) { 804 $("#to_top_desktop").addClass("active"); 805 if ($(window).scrollTop() > $("#footer_address").offset().top - $(window).height()) { 806 $("#to_top_desktop").addClass("stuck"); 807 } else { 808 $("#to_top_desktop").removeClass("stuck"); 809 } 810 } else { 811 $("#to_top_desktop").removeClass("active"); 812 } 813 } 814 815 816 if ($("#page.utb-page").length !== 0) 817 { 818 fix_utb_header(); 819 } 820 }); 821 } 822 else 823 { 824 $(window).scroll(function(){ 825 $("#to_top_phone").css("top" , "0"); 826 $("#to_top_phone").css("top", $(window).scrollTop()+50); 827 }); 828 829 $("#page").on("click", "#to_top_phone", function () { 830 $("html, body").animate({ scrollTop: 0 }, 500); 831 }); 832 $("#top_header").after("<div id='to_top_phone'><div class='ar'></div></div>"); 833 } 834 835 $(".back-top").click(function () { 836 $("html, body").animate({ scrollTop: 0 }, 500); 837 });
838 839 if ($("#page.utb-page").length !== 0 && $("#utb_name_inner").height() > 66) 840 { 841 $("#utb_tagline").hide(); 842 } 843 844 845 // UTB ANCHOR MENU 846 if ($("#page.utb-page").length > 0 && $(".anchor").length > 0) { 847 $("#main").css("padding-top", 70); 848 $("nav#utb_nav").append("<div id='utb_submenu'><div class='container'><ul></ul></div></div>"); 849 850 $("#utb_submenu > .container > ul").append("<li class='to-top-item'>" + 851 "<a name='a-to-top' class='active a-to-top'>" + 852 "Start" + 853 "</a>" + 854 "</li>"); 855 856 $(".anchor").each(function (i) { 857 var _aText = $(this).text(); 858 var _aClass = _aText.replace(/ /g, '-'); 859 $(this).addClass("a-" + _aClass + " a-nr-" + i); 860 $(this).attr("name", "a-" + _aClass); 861 $("#utb_submenu > .container > ul").append("<li class='item-" + (i + 1) + "'>" + 862 "<a name='a-" + _aClass + "' class='a-" + _aClass + "'>" + 863 _aText + 864 "</a>" + 865 "</li>"); 866 }); 867 868 $("#utb_submenu a").click(function () { 869 if (!$(this).hasClass("a-to-top")) { 870 var _aClass = $(this).attr("name"); 871 var _offset = $(".anchor." + _aClass).offset(); 872 $("html, body").animate({ scrollTop: _offset.top - 140 }, 500); 873 } 874 else 875 $("html, body").animate({ scrollTop: 200 }, 500); 876 }); 877 878 $(window).scroll(function () { 879 var _scroll = $(window).scrollTop(); 880 var _first_a = $(".anchor.a-nr-0").offset(); 881 $(".anchor").each(function (i) { 882 var _aClass = $(this).attr("name"); 883 var _offsetMin = $(".anchor." + _aClass).offset(); 884 var _offsetMax = $(".anchor." + _aClass).nextUntil("p.anchor").last().next().offset(); 885 if (_scroll > _offsetMin.top - 161 && (_offsetMax == undefined || _scroll < _offsetMax.top - 161)) { 886 $("#utb_submenu a." + $(this).attr("name")).addClass('active'); 887 $("#utb_submenu a.to-top-item").removeClass("active"); 888 } 889 else { 890 $("#utb_submenu a." + $(this).attr("name")).removeClass('active'); 891 } 892 }); 893 if (_scroll < _first_a.top - 161) 894 $("#utb_submenu a.a-to-top").addClass("active"); 895 else 896 $("#utb_submenu a.a-to-top").removeClass("active"); 897 }); 898 } 899 900 // tabmenu 901 if ($(".tabmenu").length > 0) { 902 $(".tabmenu .tabs > div").click(function () { 903 $(this).siblings("div").removeClass('active'); 904 $(this).addClass('active'); 905 var _tabnr = $(this).attr("data-name"); 906 $(this).parents(".tabs").siblings(".tab-contents").children("div").removeClass('active'); 907 $(this).parents(".tabs").siblings(".tab-contents").children("div." + _tabnr).addClass('active'); 908 }); 909 } 910 // search views 911 912 // p-65: erferenser 913 if ($("body.p-65").length !== 0) { 914 $("#taggar").click(function () { 915 $(this).toggleClass("active-open"); 916 $("#df_search_current").toggle(300); 917 }); 918 } 919 920 // p-76: DFK Play 921 if ($("body.sok-v4,body.p-76, body.foretag-startpage-").length !== 0) { 922 923 $(".sortera-ddl-list").on("click", "li", function(){ 924 $(".sortera-ddl-list li").removeClass("active"); 925 $(this).addClass("active"); 926 }); 927 928 $("#taggar").click(function () { 929 $(this).toggleClass("active-open"); 930 $("#df_search_current").toggle(300); 931 }); 932 933 if (!_device.phone) { 934 935 if ($.cookie('view') == "list") { 936 $(".control.views .icon").removeClass("active"); 937 $(".control.views .icon.list").addClass("active"); 938 $("#df_search_list:not('.play-result-wrapper')").removeClass("gallery-view").addClass("list-view"); 939 $(".utb-outer").css("margin-bottom", 20); 940 } 941 942 $(".control.views .icon.list").click(function() { 943 $(".control.views .icon").removeClass("active"); 944 $(this).addClass("active"); 945 $("#df_search_list").removeClass("gallery-view").addClass("list-view"); 946 $(".utb-outer").css("margin-bottom", 20); 947 $.cookie("view", "list", {path: '/'}); 948 }); 949 950 $(".control.views .icon.gallery").click(function () { 951 $(".control.views .icon").removeClass("active"); 952 $(this).addClass("active"); 953 $("#df_search_list").removeClass("list-view").addClass("gallery-view"); 954 $(".utb-outer").css("margin-bottom", 0); 955 $.cookie("view", "gallery", {path: '/'}); 956 }); 957 general_resize(); 958 } 959 } 960 961 // p-69: Kalendarium 962 if($("body.p-69").length !== 0) 963 { 964 $(".control.views a.icon.list").click(function(event) { 965 event.preventDefault(); 966 $(".control.views .icon").removeClass("active"); 967 $(this).addClass("active"); 968 $.cookie("view", "list", {path: '/'}); 969 window.location = $(this).attr("href"); 970 });
971 $(".control.views a.icon.gallery").click(function(event) { 972 event.preventDefault(); 973 $(".control.views .icon").removeClass("active"); 974 $(this).addClass("active"); 975 $.cookie("view", "gallery", {path: '/'}); 976 window.location = $(this).attr("href"); 977 }); 978 } 979 980 // share 981 $("body").on("click", ".share", function () { 982 df_share($(this)); 983 $('#calendar_email_wrapper').removeClass("active"); 984 $('#subscribe_wrapper').removeClass("active"); 985 }); 986 987 $("body").on("click", "#buttons_overlay",function(){ 988 $("#utb_buttons .share").removeClass("active"); 989 $('#subscribe_wrapper').removeClass("active"); 990 $('#calendar_email_wrapper').removeClass("active"); 991 $("#buttons_overlay").remove(); 992 }); 993 994 /*$("body").on("click", ".calendar", function(){ 995 df_calendar($(this)); 996 });*/ 997 998 $('#utb_buttons .subscribe').click(function () { 999 $("#main").prepend("<div id='buttons_overlay' />"); 1000 $("#utb_buttons .share").removeClass("active"); 1001 $('#subscribe_wrapper').toggleClass("active"); 1002 $('#calendar_email_wrapper').removeClass("active"); 1003 }); 1004 1005 $('#utb_buttons .calendar').click(function () { 1006 $("#main").prepend("<div id='buttons_overlay' />"); 1007 $('#calendar_email_wrapper').toggleClass("active"); 1008 $('#subscribe_wrapper').removeClass("active"); 1009 $("#utb_buttons .share").removeClass("active"); 1010 }); 1011 1012 if($(".expand-btn").length) { 1013 $("body").on("click", ".expand-btn", function () { 1014 var _inner = $(this).closest("li").find(".inner"); 1015 if(_inner.is(":visible")) { 1016 $(this).text("+").removeClass("inactive");; 1017 } else { 1018 $(this).text("-").addClass("inactive"); 1019 } 1020 _inner.toggle(100); 1021 }); 1022 } 1023 1024}); 1025// 1026function _like_clicked(ele){ 1027 var _utb_id=false; 1028 if($('#_utb_id_').length>0){ 1029 _utb_id=$('#_utb_id_').val(); 1030 }else{ 1031 var _li=ele.parents('li.utb-item:eq(0)'); 1032 _utb_id=_li.attr('data-utb'); 1033 } 1034 var _stored=CookieHelper.get('_like_'); 1035 if(_stored==null){ 1036 _stored=''; 1037 } 1038 var _total=0; 1039 // 1040 if(!ele.hasClass('liked')){ 1041 if(_stored!=''){ 1042 _stored+=','; 1043 } 1044 _stored+=_utb_id; 1045 _total=_stored.split(',').length; 1046 // 1047 $("#like_list:hidden").addClass("cch").show(); 1048 var _top = $("#like_list_listing").height(); 1049 $("#like_list.ccs").removeClass('cch').hide(); 1050 $("#likes_n").text(_total) 1051 .animate({ "margin-top": -3 }, 0) 1052 .delay(100) 1053 .animate({ "margin-top": 0 }, 100); 1054 $("#like_list").fadeIn(300); 1055 $("#like_list").css({ "top": -_top - 50 }); 1056 $("#site_search").addClass("move-left"); 1057 ele.addClass('liked'); 1058 var _loc1 = ele.offset(); 1059 1060 $("body").append("<span class='like-bullet' style='left:" + _loc1.left + "px;top:" + _loc1.top + "px'></span>"); 1061 $(".like-bullet").animate({ "left": "50%", "top": $(window).scrollTop(), "margin-left": "420px" }, 800, function () { $(this).remove() }); 1062 }else{ 1063 ele.removeClass('liked'); 1064 var _array=_stored.split(','); 1065 var _ret=$.map(_array,function(val,i){ 1066 if(val==_utb_id){ 1067 return null;//do remove 1068 }else{ 1069 return val; 1070 } 1071 }); 1072 var _total=_ret.length; 1073 if (_total==0){ 1074 $("#like_list").fadeOut(300); 1075 $("#site_search").removeClass("move-left"); 1076 }else{ 1077 $('#likes_n').text(_total); 1078 } 1079 _stored=_ret.join(','); 1080 } 1081 CookieHelper.set('_like_',_stored,365); 1082 $('#like_list_listing').removeClass('populated'); 1083} 1084// 1085function _init4_likes(){ 1086 $("#like_list_listing ul li").remove(); 1087 // 1088 var _stored=CookieHelper.get('_like_'); 1089 if(_stored==null){ 1090 _stored=''; 1091 } 1092 var _array=_stored.split(','); 1093 _likes = _array.length; 1094 if(_stored=='' || _likes==0){ 1095 return; 1096 } 1097 $("#likes_n").text(_likes) 1098 $('li.utb-item').each(function(i){//våra utbildning 1099 var _item=$(this); 1100 var _utb=_item.attr('data-utb'); 1101 if($.inArray(_utb,_array)>=0){ 1102 _item.find('.button.like').addClass('liked'); 1103 } 1104 });
1105 var _utb_=$('#_utb_id_'); 1106 if(_utb_.length>0){//utbildning sidan 1107 if($.inArray(_utb_.val(),_array)>=0){ 1108 $('.like').addClass('liked'); 1109 } 1110 } 1111 // 1112 $('#like_list_listing').removeClass('populated'); 1113 $("#like_list").fadeIn(0); 1114 $("#site_search").addClass("move-left fast"); 1115 setTimeout(function(){$("#site_search").removeClass("fast")},100) 1116 var _top = $("#like_list_listing").height(); 1117 $("#like_list").css({"top":-_top-50}); 1118} 1119// 1120function _populate_likes(callback){ 1121 if($('#like_list_listing').hasClass('populated')){ 1122 if(callback){ 1123 callback(); 1124 } 1125 return; 1126 } 1127 var _likes=CookieHelper.get('_like_'); 1128 if(_likes==null){//ska inte hända 1129 return; 1130 } 1131 var _url=$('#approot').val()+'ajaxbase.aspx'; 1132 var _data='classpath=dfk.dfkutils.utbhelper,dfk&method=get_utb_4likes&utb_ids='+encodeURIComponent(_likes); 1133 Ajax.AsyncPost(_url,_data,function(responseText){ 1134 var _ret = eval("("+responseText+")"); 1135 var _sb=new StringBuilder(); 1136 var _permalink=''; 1137 for(var i=0;i<_ret.length;i++){ 1138 _permalink=$('#approot').val()+'utbildning/'+_ret[i].permalink; 1139 _sb.append('<li data-utb="'+_ret[i].id+'"><a href="'+_permalink+'">'+_ret[i].name+'</a><span class="forget">Ã</span></li>'); 1140 } 1141 $('#like_list_listing ul').html(_sb.toString()); 1142 $('#like_list_listing').addClass('populated'); 1143 if(callback){ 1144 callback(); 1145 } 1146 }); 1147} 1148// 1149function _remove_like(ele){ 1150 var _utb_id=ele.attr('data-utb'); 1151 var _stored=CookieHelper.get('_like_'); 1152 var _array=_stored.split(','); 1153 var _ret=$.map(_array,function(val,i){ 1154 if(val==_utb_id){ 1155 return null;//remove 1156 } 1157 return val; 1158 }); 1159 // 1160 var _likes=''; 1161 if(_ret.length>0){ 1162 _likes=_ret.join(','); 1163 } 1164 CookieHelper.set('_like_',_likes,365); 1165 ele.remove(); 1166 // 1167 $('li.utb-item').each(function(i){//vÃ¥ra utbildning 1168 var _item=$(this); 1169 var _utb=_item.attr('data-utb'); 1170 if(_utb==_utb_id){ 1171 _item.find('.button.like').removeClass('liked'); 1172 } 1173 }); 1174 var _utb_=$('#_utb_id_'); 1175 if(_utb_.length>0){//utbildning sidan 1176 if(_utb_.val()==_utb_id){ 1177 $('.like').removeClass('liked'); 1178 } 1179 } 1180 // 1181 $("#likes_n").text(_ret.length) 1182 .animate({ "margin-top": -3 }, 0) 1183 .delay(100) 1184 .animate({ "margin-top": 0 }, 100); 1185 if(_ret.length==0){//do hide 1186 } 1187 1188} 1189 1190 1191function toggle_like_list(_me, _locked, _d){ 1192 //alert(_d); 1193 if(_d == 1) 1194 { 1195 _populate_likes(function(){ 1196 var _top = $("#like_list_listing").height(); 1197 _me.stop(true, false).animate({ "top": -50, "width": 220, "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.3)" }, 100); 1198 $("#like_list_share").show(); 1199 }); 1200 } 1201 else 1202 { 1203 if (!_locked) { 1204 var _top = $("#like_list_listing").height(); 1205 _me.stop(true, false).animate({ "top": -_top - 50, "width": 60 }, 100); 1206 $("#like_list_share").hide(); 1207 if ($("#like_list_listing ul li").size() == 0) 1208 { 1209 $("#like_list").fadeOut(300); 1210 $("#site_search").removeClass("move-left"); 1211 } 1212 } 1213 } 1214} 1215 1216var _like_list_open = false; 1217 1218function toggle_like_list_tablet(_me, _locked){ 1219 if(!_like_list_open) 1220 { 1221 _like_list_open = true; 1222 _populate_likes(function(){ 1223 var _top = $("#like_list_listing").height(); 1224 _me.stop(true, false).animate({ "top": -50, "width": 220, "box-shadow": "0 2px 10px rgba(0, 0, 0, 0.3)" }, 100); 1225 $("#like_list_share").show(); 1226 }); 1227 } 1228 else 1229 { 1230 _like_list_open = false; 1231 if (!_locked) { 1232 var _top = $("#like_list_listing").height(); 1233 _me.stop(true, false).animate({ "top": -_top - 50, "width": 60 }, 100); 1234 $("#js_overlay").remove(); 1235 $("#like_list_share").hide(); 1236 if ($("#like_list_listing ul li").size() == 0) 1237 $("#like_list").fadeOut(300); 1238 1239 } 1240 } 1241} 1242// 1243function _hide_paket_liknande_if_notfound(){ 1244 if($("#utb_fler_tillfallen ul li").length < 2){ 1245 $("#utb_fler_tillfallen").hide(); 1246 } 1247 1248 if($('#_utb_id_').length==0){ 1249 return; 1250 } 1251 var _msg=''; 1252 var 1253 _liknande = true, 1254 _paket = true; 1255 1256 if($('#_has_paket_').length==0){ 1257 $("#liknande_paket_taggar").addClass('fifty'); 1258 //_msg+='no paket found\r\n'; 1259 _paket = false; 1260 $("#liknande_paket_taggar .tabs .tab1").removeClass('active').hide(); 1261 $("#liknande_paket_taggar .tabs .tab2").addClass('active'); 1262 $("#liknande_paket_taggar .tab-contents .tab1").removeClass('active').hide(); 1263 $("#liknande_paket_taggar .tab-contents .tab2").addClass('active'); 1264 } 1265 1266 if($('#_has_liknande_').length==0){ 1267 1268 $("#liknande_paket_taggar").addClass('fifty'); 1269 //_msg='no liknande found\r\n'; 1270 _liknande = false; 1271 $("#liknande_paket_taggar .tabs .tab2").hide(); 1272 $("#liknande_paket_taggar .tab-contents .tab2").hide(); 1273 1274 if(!_paket) 1275 { 1276 $("#liknande_paket_taggar .tabs .tab2").removeClass('active').hide(); 1277 $("#liknande_paket_taggar .tabs .tab3").addClass('active').hide(); 1278 $("#liknande_paket_taggar .tab-contents .tab2").removeClass('active').hide(); 1279 $("#liknande_paket_taggar .tab-contents .tab3").addClass('active'); 1280 } 1281 } 1282 // 1283 //if(_msg!=''){ 1284 // alert(_msg); 1285 //} 1286 1287 if(!_liknande && !_paket) 1288 { 1289 $("#liknande_paket_taggar .tabs").hide(); 1290 } 1291 1292} 1293 1294// 1295 1296function site_search(){ 1297 $("#site_search").click(function(){ 1298 if($(this).is(".active") && !$("#searchinput").is(":focus")) 1299 { 1300 $(this).addClass("no-delay").removeClass("active"); 1301 $(this).find("input[type='text']").val(""); 1302 setTimeout(function(){$("#site_search").removeClass("no-delay")},100); 1303 } 1304 else 1305 { 1306 $(this).find("input[type='text']").focus(); 1307 $(this).addClass("active"); 1308 } 1309 }); 1310} 1311 1312function fix_utb_header() 1313{ 1314 var banner_max_size = 160; 1315 var banner_min_size = 60; 1316 var text_max_size = 50; 1317 var text_min_size = 30; 1318 1319 if ($(window).scrollTop() > 100) 1320 { 1321 var headerheight = $("#page > #utb_header").height(); 1322 $("#page > .foretag-nav-wrapper").addClass('lift'); 1323 $("#page > #utb_header").addClass('lift'); 1324 $("#page > #utb_header").height(160 - $(window).scrollTop() + 100); 1325 1326 var textsize = (headerheight - banner_min_size) / (banner_max_size - banner_min_size) * (text_max_size - text_min_size) + text_min_size; 1327 $("#utb_header #utb_name").css("font-size", textsize) 1328 1329 1330 if ($("#page > #utb_header").height() < 60) { 1331 $("#page > #utb_header").height(60); 1332 $("#utb_header #utb_name").css("font-size", text_min_size) 1333 $("#page > #utb_header").addClass('fly'); 1334 } 1335 1336 } 1337 else 1338 { 1339 $("#page > #utb_header").removeClass('lift'); 1340 $("#page > .foretag-nav-wrapper").removeClass('lift'); 1341 $("#page > #utb_header").removeClass('fly'); 1342 $("#page > #utb_header").height(160); 1343 $("#utb_header #utb_name").css("font-size", text_max_size) 1344 } 1345} 1346 1347function valj_prompt(){ 1348 $("#valj_prompt").addClass("active"); 1349 $("body, html").animate({scrollTop: $("#utb_fler_tillfallen").offset().top - 170}, 100); 1350 setTimeout(function () { 1351 $("#valj_prompt").removeClass("active"); 1352 }, 8000); 1353 1354 $(".anm-button").addClass("inactive"); 1355} 1356// 1357$(function () { 1358 try { 1359 _apply_nyhetsbrev_med_omrader(); 1360 } catch (ex) { 1361 1362 } 1363}); 1364function _apply_nyhetsbrev_med_omrader() { 1365 /* 1366 var _is_test = window.location.href.indexOf('test') > 0; 1367 if (!_is_test) { 1368 return; 1369 } 1370 */ 1371 var _wrapper = $('div[name="nyhetsbrev"]'); 1372 var _gdpr_checkbox = _wrapper.find('.x-checkbox-gdpr'); 1373 var _html = 'Jag är intresserad av följande omrÃ¥den:<br />'; 1374 _gdpr_checkbox.before(_html); 1375 // 1376 var _list_omraden = [
1377 'Verksamhetsutveckling', 'IT-arkitektur' 1378 , 'Informationssäkerhet', 'Styrning' 1379 ]; 1380 for (var i = 0; i < _list_omraden.length; i++) { 1381 _gdpr_checkbox.before( 1382 $('<input />', { 1383 type: 'checkbox' 1384 , name: 'intresserad-omraden' 1385 , value: _list_omraden[i] 1386 }) 1387 ); 1388 // 1389 _gdpr_checkbox.before(_list_omraden[i]); 1390 // 1391 //if (i > 0 && (i + 1) % 2 == 0) 1392 { 1393 _gdpr_checkbox.before('<br />'); 1394 } 1395 } 1396 _gdpr_checkbox.before('<br />'); 1397 1398}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.