1var CvManagementServices = (function ($) { 2 3 'use strict'; 4 5 // display 6 function displayCvFile(CvID, CvPath, CvName) { 7 8 // don't display popup if it's already open 9 if ($("div.cv-pages-container").length > 0 || $("div.notification-popup").length > 0) 10 return; 11 // show overlay loader 12 $("<div/>", { 13 'class': 'watch-cv-file-overlay', 14 'style': 'width:100%; height:100%; position:fixed; top:0; left:0; padding:0; margin:0; background-color:#000; filter:alpha(opacity=50); -moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5; z-index:11000' 15 }).appendTo($('body')); 16 17 // show loader 18 $("<img/>", { 19 'class': 'watch-cv-file-lodaer', 20 'src': '/images/Upload/Loader.gif', 21 'alt': '×××¢×', 22 'style': 'width:120px; height:120px; position:fixed; top:50%; left:50%; margin:-60px 0 0 -60px; border:0; display:block; z-index:11000' 23 }).appendTo($('body')); 24 25 // get cv pages count 26 getCvPageCount(CvPath).then( 27 function (CvPagesCounter) { 28 29 // check if ther is cv pages to display 30 if (CvPagesCounter > 0 && CvPagesCounter != false) { 31 32 $.get('/User/UserCVsPanel/template/WatchCvFile.html', function (template) { 33 var WatchCvPopUpParametersObject = {}; 34 WatchCvPopUpParametersObject.CvID = CvID; 35 WatchCvPopUpParametersObject.CvPath = CvPath; 36 WatchCvPopUpParametersObject.CvName = CvName; 37 WatchCvPopUpParametersObject.CvPages = []; 38 39 // append cv pages images to cv images container 40 for (var i = 0; i < CvPagesCounter; i++) { 41 if (getCookie("cvFileDisplayWidth") != null)// check if ther is saved cv file width display 42 WatchCvPopUpParametersObject.CvPages[i] = '<img class="cv-page" width="' + getCookie("cvFileDisplayWidth") + '%" src="/Employer/CvFlip/CvFlipHandler.ashx?action=ConvertCvToImage&CvPath=' + CvPath + '&PageNumber=' + i + '"/>'; 43 else // set default width display 44 WatchCvPopUpParametersObject.CvPages[i] = '<img class="cv-page" width="60%" src="/Employer/CvFlip/CvFlipHandler.ashx?action=ConvertCvToImage&CvPath=' + CvPath + '&PageNumber=' + i + '"/>'; 45 } 46 47 // remove loader from dom 48 if ($("img.watch-cv-file-lodaer").length > 0) 49 $("img.watch-cv-file-lodaer").remove(); 50 51 $.tmpl(template, WatchCvPopUpParametersObject).appendTo('body'); 52 53 if (window.location.href.indexOf('/Search/UploadSingle.aspx') == -1 && window.location.href.indexOf('SearchResultsGuest.aspx') == -1) 54 $('body').css({ 'overflow': 'hidden' }); 55 }); 56 } 57 else { 58 // show error get cv pages count message 59 OpenNotificationPopUP({ 60 content: "<div style='width:400px; height:auto; padding:0; margin:0; text-align:center'><p style='font-size:20px'>××פס ××¨×¢× ×©××××, × ×¡× ×©× ×ת ×× <a style='color:#ee771b' href='/ContactUs.aspx?Dep=0&Title=%u05D9%u05E6%u05D9%u05E8%u05EA%20%u05E7%u05E9%u05E8%20%u05DC%u05D0%u05D7%u05E8%20%u05D1%u05E2%u05D9%u05D4%20%u05D1%u05E6%u05E4%u05D9%u05D9%u05D4%20%u05D1%u05E7%u05D5%u05E8%u05D5%u05EA%20%u05D4%u05D7%u05D9%u05D9%u05DD&SubjectIssue=%u05D9%u05E6%u05D9%u05E8%u05EA%20%u05E7%u05E9%u05E8%20%u05DC%u05D0%u05D7%u05E8%20%u05D1%u05E2%u05D9%u05D4%20%u05D1%u05E6%u05E4%u05D9%u05D9%u05D4%20%u05D1%u05E7%u05D5%u05E8%u05D5%u05EA%20%u05D4%u05D7%u05D9%u05D9%u05DD&Subject=%u05D9%u05E6%u05D9%u05E8%u05EA%20%u05E7%u05E9%u05E8%20%u05DC%u05D0%u05D7%u05E8%20%u05D1%u05E2%u05D9%u05D4%20%u05D1%u05E6%u05E4%u05D9%u05D9%u05D4%20%u05D1%u05E7%u05D5%u05E8%u05D5%u05EA%20%u05D4%u05D7%u05D9%u05D9%u05DD&CloseSupportCategoryID=3209' target='_blank'>צ×ר ×××ª× × ×§×©×¨</a></p><div>", 61 width: 400 62 }); 63 64 // remove overlay from dom 65 if ($("div.watch-cv-file-overlay").length > 0) { 66 $("div.watch-cv-file-overlay").remove(); 67 } 68 69 // remove loader from dom
70 if ($("img.watch-cv-file-lodaer").length > 0) 71 $("img.watch-cv-file-lodaer").remove(); 72 } 73 } 74 ); 75 } 76 77 // get cv pages count 78 function getCvPageCount(CvPath) { 79 //create deferre object 80 var defer = $.Deferred(); 81 82 try{ 83 $.ajax({ 84 type: "POST", 85 url: '/Employer/CvFlip/CvFlipHandler.ashx', 86 cache: false, 87 timeout: 10000, // sets timeout to 10 seconds 88 data: { 89 action: 'getCvPagesCount', 90 CvPath: CvPath 91 }, 92 success: function (data, status) { 93 defer.resolve(data); // resolve promise 94 }, 95 error: function (xhr, statusText, errorThrown) { 96 defer.resolve(false); // resolve promise 97 } 98 }); 99 } 100 catch(e){ 101 defer.resolve(false); // resolve promise 102 } 103 finally{ 104 //return if blocker was opend 105 return defer.promise(); 106 } 107 } 108 109 // close display ui 110 function close() { 111 112 if (window.location.href.indexOf('/Search/UploadSingle.aspx') == -1 && window.location.href.indexOf('SearchResultsGuest.aspx') == -1) 113 $('body').css({ 'overflow': '' }); 114 115 if ($("div.watch-cv-file-window").length > 0) { 116 $("div.watch-cv-file-window").remove(); 117 } 118 119 if ($("div.watch-cv-file-overlay").length > 0) { 120 $("div.watch-cv-file-overlay").remove(); 121 } 122 123 if ($("style#watch-cv-file-css").length > 0) 124 $("style#watch-cv-file-css").remove(); 125 126 if ($("img.watch-cv-file-lodaer").length > 0) 127 $("img.watch-cv-file-lodaer").remove(); 128 129 window.scrollTo(0, 0); 130 } 131 132 // print cv file 133 function print(CvPath) { 134 /// Creat Window Elment 135 var printWin = window.open('/Employer/CvFlip/PrintCV.aspx?CvPath=' + CvPath, '_blank'); 136 137 // focus on window 138 printWin.focus(); 139 140 // on page ready print page 141 printWin.onload = new function () { 142 setTimeout(function () { 143 printWin.print(); 144 }, 300); 145 } 146 } 147 148 // download cv file 149 function download(CvID, CvPath, CvName) { 150 151 $("<iframe/>", { 152 id: "DownloadCvFileFrame", 153 name: "DownloadCvFileFrame", 154 width: "0px", 155 height: "0px" 156 }).appendTo($("body")); 157 158 var $form = $("<form/>", { 159 id: "DownloadCvFileForm", 160 name: "DownloadCvFileForm", 161 action: "/User/UserCVsPanel/CVCenterUploadCVHandler.ashx", 162 method: "POST", 163 target: "DownloadCvFileFrame" 164 }); 165 166 $("<input/>", { 167 id: "action", 168 name: "action", 169 value: "DownloadCvFile", 170 type: "hidden" 171 }).appendTo($form); 172 173 $("<input/>", { 174 id: "txtCvID", 175 name: "txtCvID", 176 value: CvID, 177 type: "hidden" 178 }).appendTo($form); 179 180 $("<input/>", { 181 id: "txtCvPath", 182 name: "txtCvPath", 183 value: CvPath, 184 type: "hidden" 185 }).appendTo($form); 186 187 $("<input/>", { 188 id: "txtCvName", 189 name: "txtCvName", 190 value: escape(CvName), 191 type: "hidden" 192 }).appendTo($form); 193 194 $("body").append($form); 195 196 $form.submit(); 197 } 198 199 // zoom in cv file 200 function ZoomIn() { 201 202 var $img = $("img.cv-page"); 203 204 var width = $img.attr('width'); 205 206 if (parseInt(width.replace('%', '')) < 90) { 207 width = parseInt(width.replace('%', '')) + 1; 208 209 $img.attr("width", width.toString() + "%"); 210 211 /* set cookie expires date 212 --------------------------- 213 * One Second = 1000 214 * One Minute = 1000 * 60 215 * One Hour = 1000 * 60 * 60 216 * One Day = 1000 * 60 * 60 * 24 217 */ 218 var Dt = new Date(); // cookie expires date 219 Dt.setTime(Dt.getTime() + 365 * (1000 * 60 * 60 * 24)) 220 221 //set cookie blocker display for 6 hours
222 setCookie({ 223 name: 'cvFileDisplayWidth', 224 value: width, 225 path: '/', 226 expires: Dt, 227 domain: null, 228 secure: null 229 }); 230 } 231 } 232 233 // zoom out cv file 234 function ZoomOut() { 235 var $img = $("img.cv-page"); 236 237 var width = $img.attr('width'); 238 239 if (parseInt(width.replace('%', '')) > 60) { 240 width = parseInt(width.replace('%', '')) - 1; 241 242 $img.attr("width", width.toString() + "%"); 243 244 /* set cookie expires date 245 --------------------------- 246 * One Second = 1000 247 * One Minute = 1000 * 60 248 * One Hour = 1000 * 60 * 60 249 * One Day = 1000 * 60 * 60 * 24 250 */ 251 var Dt = new Date(); // cookie expires date 252 Dt.setTime(Dt.getTime() + 365 * (1000 * 60 * 60 * 24)) 253 254 //set cookie blocker display for 6 hours 255 setCookie({ 256 name: 'cvFileDisplayWidth', 257 value: width, 258 path: '/', 259 expires: Dt, 260 domain: null, 261 secure: null 262 }); 263 } 264 } 265 266 // set cookie 267 function setCookie(paramsOBJ) { 268 try { 269 var curCookie = paramsOBJ.name + '=' + escape(paramsOBJ.value) + 270 ((paramsOBJ.expires) ? '; expires=' + paramsOBJ.expires.toGMTString() : '') + 271 ((paramsOBJ.path) ? '; path=' + paramsOBJ.path : '') + 272 ((paramsOBJ.domain) ? '; domain=' + paramsOBJ.domain : '') + 273 ((paramsOBJ.secure) ? '; secure' : ''); 274 document.cookie = curCookie; 275 } 276 catch (e) { 277 //send error mail message 278 SendErrorMailMessage({ 279 Description: e.description, 280 MethodName: 'setCookie', 281 ExtraData: 'message=' + e.message 282 283 }); 284 285 return; 286 } 287 } 288 289 // get cookie 290 function getCookie(cookieName) { 291 try { 292 var dc = document.cookie; 293 var prefix = cookieName + '='; 294 var begin = dc.indexOf('; ' + prefix); 295 if (begin == -1) { 296 begin = dc.indexOf(prefix); 297 if (begin != 0) return null; 298 } else 299 begin += 2; 300 var end = document.cookie.indexOf(';', begin); 301 if (end == -1) 302 end = dc.length; 303 return unescape(dc.substring(begin + prefix.length, end)); 304 } 305 catch (e) { return null; } 306 } 307 308 // open notification 309 function OpenNotificationPopUP(obj) { 310 311 $.get('/User/UserCVsPanel/template/NotificationPopUP.html', function (template) { 312 313 var NotificationPopUP = {}; 314 NotificationPopUP.content = obj.content; 315 316 // append notification popup html to body 317 $.tmpl(template, NotificationPopUP).appendTo('body'); 318 319 setTimeout(function () { 320 if ($("div.notification-popup").length > 0) { 321 $("div.notification-popup").css("margin", "0 0 0 -" + ((obj.width + 20) / 2) + "px");// set popup to screnn center 322 323 // display notification popup 324 setTimeout(function () { 325 $("div.notification-popup-overlay").fadeIn(100, function () { 326 $("div.notification-popup").fadeIn(100); 327 }); 328 }, 100); 329 } 330 }, 0) 331 }); 332 } 333 334 // close notification 335 function closeNotificationPopUP() { 336 if ($("div.notification-popup-overlay").length > 0) 337 $("div.notification-popup-overlay").remove(); 338 339 if($("div.notification-popup").length > 0) 340 $("div.notification-popup").remove(); 341 if($("style#notification-popup-overlay-css").length > 0) 342 $("style#notification-popup-overlay-css").remove(); 343 } 344 345 return { 346 displayCvFile: function () { displayCvFile.apply({}, arguments); }, 347 close: function () { close.apply({}, arguments); }, 348 print: function () { print.apply({}, arguments); }, 349 download: function () { download.apply({}, arguments); }, 350 ZoomIn: function () { ZoomIn.apply({}, arguments); }, 351 ZoomOut: function () { ZoomOut.apply({}, arguments); }, 352 closeNotificationPopUP: function () { closeNotificationPopUP.apply({}, arguments); } 353 } 354 355})(jQuery); 356 357 358// document ready 359$(function () { 360 361 // mouseup event listener 362 $(document).mouseup(function (e) { 363 364 // only if user click on overlay then closed the wtach cv window 365 if ($(e.target).hasClass("cv-pages-container")) 366 CvManagementServices.close(); 367 else if ($(e.target).hasClass("notification-popup-overlay")) 368 CvManagementServices.closeNotificationPopUP(); 369 });
370 371 // keyborad event listener 372 $(document).on('keyup', function (e) { 373 374 // only if user press on ESc button on keyborad 375 if (e.keyCode == 27 || e.which == 27) 376 if ($("div.cv-pages-container").length > 0) 377 CvManagementServices.close(); 378 else if ($("div.notification-popup").length > 0) 379 CvManagementServices.closeNotificationPopUP(); 380 381 }); 382 383});
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.