diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index b523f32..7c44528 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -1,9844 +1,9844 @@ - -'use strict'; - -AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$log", "$location", "$timeout", "DA", "Modules", "$routeParams", "DataService","TermService","AIAConstants", - function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Modules, $routeParam, DataService, TermService, AIAConstants) { - - - $scope.genderId = ""; - $scope.BodyViewData; - $scope.selectedGenderBodyViewData; - $scope.imagePath = ""; - $rootScope.BodyRegionData; - $rootScope.BodyRegionCordinatesData; - $rootScope.isTransparencyActivated = false; - $scope.isTransparencyBtnClicked = false; - $rootScope.BodyLayerData; - $rootScope.VocabTermData; - - //for modesty image layers - $scope.lowerlayerNumberForModesty; - $scope.HigherlayerNumberForModesty; - $scope.layerInfoForModesty; - - $scope.VocabTermTxt; - $scope.CommonData - $rootScope.TermNumberData = null; - $rootScope.BodySystemData - $scope.bodyViewId = 0; - $rootScope.bgartData; - $scope.drawnBodyRegions; - //view specific constants - $rootScope.voId; - $scope.layerNumber; - $scope.daCounter = 1; - $scope.bagartDetails; - $scope.transNumber = 100; - - $rootScope.modestyCanvasZindex = 12100; - $rootScope.isTBoxModestyVisible = false; - //for transarency scale - $scope.TBDrawStartX; - $scope.TBDrawStartY; - $scope.isTBDrawnOnBodyRegion; - $rootScope.path = "~/../content/images/speeachBubbleClose.png"; - $rootScope.isHighLight = false; - $rootScope.coloredImageCanvasList = []; - $rootScope.coloredImageMRCanvasList = []; - $rootScope.ColoredCanvasData = []; - $rootScope.grayImageDataList = []; - - $rootScope.rawGrayImageDataList = []; - - $rootScope.grayImageMRDataList = []; - $rootScope.updatedGrayDataList = []; - $rootScope.updatedGrayMRDataList = []; - $scope.isEligibleForHighlight = false; - $scope.doHighlightOrExtract = false; - $scope.isClickedOnBodyForHighlight; - $scope.isEligibleForHighlightBodyByTermList = false; - - // $scope.AnteriorView = "active"; - - $rootScope.zoomInOut = 75; - $scope.speechBubbleCounter = 0; - $scope.j = 0; - $scope.speechbubbleList = []; - $scope.speachBubbleArrayAnnotation = []; - $rootScope.multiAnnotationIsON = false; - $scope.previousGrayImageDataVar; - $scope.previousGrayCanvas; - $rootScope.updatedImageDataList = []; - $rootScope.updatedImageMRDataList = []; - - $scope.previousSelectedTermList = []; - $scope.runningWorkers = []; - $scope.runningSearchWorkers = []; - $scope.runningBodyViewWorkers = []; - - // This variable is used for unhighlight previously highlighted body portion, if multiAnnotation is false. - $scope.machedIcolorInBodyRegion = []; - - $rootScope.MaskCanvasData = []; - - //extract - $rootScope.isExtract = false; - $rootScope.UIWrapperZIndex = 12000; - - $rootScope.whiteImageDataList = []; - $rootScope.whiteImageMRDataList = []; - $rootScope.previousHighlightList = []; - - $rootScope.isViewChange = false; - $rootScope.isGenderChnage = false; - - // to do it is setting but not using. need to check - $rootScope.updatedWhiteImageDataList = []; - $rootScope.updatedWhiteImageMRDataList = []; - - //normal mode - $rootScope.isNormalMode = true; - $rootScope.isZoomed = false; - - //navigator man functionality - $scope.navigatorImage; - $rootScope.NavigatorData; - $scope.navimgsrc; - - $scope.dragdivleft; - $scope.dragdivtop = 0; - - $rootScope.systemNumber = 0; - - $scope.IsSearchVisible = false; - $scope.shapesize = 1; - - $scope.CurrentStructure = "active"; - //array for bodyviewid correspoing to male female(used for gender change) - $scope.correspondingBodyViewIds = { - '1': '5', - '2': '6', - '3': '7', - '4': '8', - '9': '11', - '10': '12', - - '5': '1', - '6': '2', - '7': '3', - '8': '4', - '11': '9', - '12': '10', - - } - - $scope.bodyViews = { - 'Anterior': '1', - 'Lateral': '2', - 'Medial': '3', - 'Posterior': '4', - 'Lateral Arm': '5', - 'Medial Arm': '6' - } - - $scope.isBodylayerdataLoaded = false; - $scope.isBodyRegionDataLoaded = false; - //currentTitleFromJson shows the current BodyView Title - $scope.currentTitleFromJson; - $scope.showTabButton = false; - - $scope.IsVisible = function () { - $scope.scroll(); - - } - - - $scope.scroll = function () { - // $window.scrollTo(0, 0); - $("html,body").scrollTop(0); - //alert("scroll"); - } - - - $scope.switchGender = function () { - - var retrievedObject = $rootScope.getLocalStorageValue('currentViewTitle'); - - if (retrievedObject == "Male Anterior") { - $scope.male = "active"; - $scope.female = ""; - } - else if (retrievedObject == "Female Anterior") { - $scope.male = ""; - $scope.female = "active"; - } - } - - //get the DA body view list based on selected gender - //get the DA body view list based on selected gender - $scope.getDAViewList = function ($event) { - - - if ($('#MainImage') != null) { - $('#MainImage').remove(); - } - // $rootScope.currentActiveModuleTitle = Modules[0].Name; - $("#bodyViewList").empty(); - //for default load - if ($event == null || $event == undefined) { - //if (($rootScope.getLocalStorageValue("genderId") != "")||($rootScope.getLocalStorageValue("genderId")!="null")) { - // $scope.genderId = $rootScope.getLocalStorageValue("genderId"); - //} - var selectedGender = $rootScope.getLocalStorageValue("genderId"); - if ((selectedGender == null)) { - $scope.genderId = "Male"; - } - else - $scope.genderId = $rootScope.getLocalStorageValue("genderId"); - - } - else { - $scope.genderId = $event.currentTarget.id; - } - - localStorage.setItem("genderId", $scope.genderId); - - var selectedGender = $rootScope.getLocalStorageValue("genderId"); - - if (selectedGender != null) { - if (selectedGender == "Male") { - $('#Male').addClass('active'); - $('#Female').removeClass("active"); - } - else { - $('#Female').addClass('active'); - $('#Male').removeClass("active"); - } - - } - - $scope.selectedGenderBodyViewData = new jinqJs() - .from($scope.BodyViewData.BodyViews.view) - .where('_gender == ' + $scope.genderId) - .select(); - - if ($scope.selectedGenderBodyViewData != null || $scope.selectedGenderBodyViewData != undefined) { - angular.forEach($scope.selectedGenderBodyViewData, function (value, key) { - - - var userEthnicity; - var userModestysettings; - var curentEthnicity = $rootScope.getLocalStorageValue("globalEthnicity"); - if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) { - userEthnicity = curentEthnicity; - } - else { - userEthnicity = $rootScope.globalSetting.ethnicity; - } - - var curentmodesty = $rootScope.getLocalStorageValue("globalModesty"); - if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) { - userModestysettings = curentmodesty; - } - else { - userModestysettings = $rootScope.globalSetting.modesty; - } - - - - //var userSelectedSkintone = 'W'; - //$scope.userModestySetting = 'Y' - var thumbnailImage; - if ((value._id == 1) || (value._id == 3) || (value._id == 5) || (value._id == 6) || (value._id == 7) || (value._id == 11)) - thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userEthnicity + userModestysettings)) + '.jpg'; - else { - thumbnailImage = ((value._thumbnailImage).replace('.jpg', '_' + userEthnicity)) + '.jpg'; - - } - - $scope.imagePath = "~/../content/images/DA/" + $rootScope.zoomInOut + "/body-views/" + value._id + '/skintone/' + userEthnicity + '/' + thumbnailImage; - - - var $el = $('
' - + '' - + '

' + value._title + '

').appendTo('#bodyViewList'); - - - $compile($el)($scope); - $(".sidebar").mCustomScrollbar({ - autoHideScrollbar: true, - //theme:"rounded" - }); - - }); - } - - }; - - $scope.DisableUI = function () { - - //enable daBodyViewDiv which was disabled on thumbnail click so need not bother where to enable - //as jspanel disable/enable is working for all features - document.getElementById('daBodyview').style.pointerEvents = "auto"; - document.getElementById('daBodyview').style.opacity = "1"; - - var daImagePanelConetent = document.getElementsByClassName("jsPanel-content"); - for (var i = 0; i < daImagePanelConetent.length; i++) { - daImagePanelConetent[i].style.pointerEvents = "none"; - daImagePanelConetent[i].style.opacity = "0.5"; - - } - //to disbale layer change slider - $('.ui-slider').slider('disable'); - // document.getElementById('txtlayerNumber').style.pointerEvents = "none"; - $("#txtlayerNumber").prop('disabled', true); - - - $scope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - } - - $scope.EnableUI = function () { - - var daImagePanelConetent = document.getElementsByClassName("jsPanel-content"); - for (var i = 0; i < daImagePanelConetent.length; i++) { - daImagePanelConetent[i].style.pointerEvents = "auto"; - daImagePanelConetent[i].style.opacity = "1"; - } - //to enable layer change slider - $('.ui-slider').slider('enable'); - // document.getElementById('txtlayerNumber').style.pointerEvents = "auto"; - $("#txtlayerNumber").prop('disabled', false); - $scope.isLoading = false; - - $('#spinner').css('visibility', 'hidden'); - } - - $scope.openView = function ($event) { - - $rootScope.disableAnnotationTB = false; - $rootScope.MenuModuleName = "DA"; - $rootScope.isLoading = true; - $('#spinner').css('visibility', 'visible'); - - $rootScope.currentBodyViewId = $event.currentTarget.id; - $rootScope.ViewTitle = $event.currentTarget.textContent; - - localStorage.setItem("currentViewTitleFromJson", $event.currentTarget.textContent); - localStorage.setItem("currentViewTitle", $event.currentTarget.textContent); - localStorage.setItem("currentBodyViewId", $event.currentTarget.id); - - var u = $location.url(); - $location.url('/da-body-view'); - - - - var view_list = angular.element($event.currentTarget); - var view_list_male_female = view_list.attr('title'); - - if (($event.currentTarget.textContent == "Female Anterior" || $event.currentTarget.textContent == "Male Anterior")) { - $rootScope.AnteriorView = "active"; - $rootScope.LateralView = ""; - $rootScope.MedialView = ""; - $rootScope.PosteriorView = ""; - $rootScope.LateralArmView = ""; - $rootScope.MedialArmView = ""; - } - if (($event.currentTarget.textContent == "Female Lateral" || $event.currentTarget.textContent == "Male Lateral")) { - $rootScope.AnteriorView = ""; - $rootScope.LateralView = "active"; - $rootScope.MedialView = ""; - $rootScope.PosteriorView = ""; - $rootScope.LateralArmView = ""; - $rootScope.MedialArmView = ""; - - - } - if (($event.currentTarget.textContent == "Female Medial" || $event.currentTarget.textContent == "Male Medial")) { - $rootScope.AnteriorView = ""; - $rootScope.LateralView = ""; - $rootScope.MedialView = "active"; - $rootScope.PosteriorView = ""; - $rootScope.LateralArmView = ""; - $rootScope.MedialArmView = ""; - - - } - if (($event.currentTarget.textContent == "Female Posterior" || $event.currentTarget.textContent == "Male Posterior")) { - $rootScope.AnteriorView = ""; - $rootScope.LateralView = ""; - $rootScope.MedialView = ""; - $rootScope.PosteriorView = "active"; - $rootScope.LateralArmView = ""; - $rootScope.MedialArmView = ""; - - } - if (($event.currentTarget.textContent == "Female Lateral Arm" || $event.currentTarget.textContent == "Male Lateral Arm")) { - $rootScope.AnteriorView = ""; - $rootScope.LateralView = ""; - $rootScope.MedialView = ""; - $rootScope.PosteriorView = ""; - $rootScope.LateralArmView = "active"; - $rootScope.MedialArmView = ""; - - - } - if (($event.currentTarget.textContent == "Female Medial Arm" || $event.currentTarget.textContent == "Male Medial Arm")) { - $rootScope.AnteriorView = ""; - $rootScope.LateralView = ""; - $rootScope.MedialView = ""; - $rootScope.PosteriorView = ""; - $rootScope.LateralArmView = ""; - $rootScope.MedialArmView = "active"; - - - } - - //$rootScope.Normal = "LeftButtonsDefaultState"; - - if (view_list_male_female == "Male") { - - $rootScope.male = "active"; - $rootScope.female = ""; - } - else { - - $rootScope.male = ""; - $rootScope.female = "active"; - } - - - - - - } - - - //load json data for body view - $scope.loadDissectibleAnatomyData = function () { - - if ($rootScope.refreshcheck == null) { - $location.path('/'); - } - //get current path - var currentURL = $location.path(); - var selectedModuleName = ''; - angular.forEach($rootScope.userModules, function (value, key) { - if (value.slug === currentURL.replace('/', '')) { - selectedModuleName = value.name; - $rootScope.currentActiveModuleTitle = selectedModuleName; - } - }) - - - $rootScope.ClearIframe(); - - //load common data - var commondataJsonPath = '~/../content/data/json/da/da_dat_common.json'; - - DataService.getAnotherJson(commondataJsonPath) - .then( - function (result) { - - $rootScope.CommonData = result; - $http({ method: 'GET', url: '~/../content/data/json/da/da_dat_contentlist.json' }).success(function (data) { - - $scope.BodyViewData = data; - - $scope.getDAViewList(); - - }) - .error(function (data, status, headers, config) { - console.log(data); - }); - - - }, - function (error) { - console.log(error.statusText) - } - ) - //load body-views data - - - // $('#daLoaderLabel').css('visibility', 'hidden') - $rootScope.isLoading = false; - - - - //push the details of open module in array $rootScope.openModules - $rootScope.openModules.push({ "ModuleId": 1 }); - - - } - - - //da-body-views functions - - $scope.openBodyView = function () { - - //disable whole div because till now jspanel is not created. enable when jspanel gets disabled because - //than jspanel will take care of disabling/enabling ui - - if (document.getElementById('daBodyview') != null) { - document.getElementById('daBodyview').style.pointerEvents = "none"; - document.getElementById('daBodyview').style.opacity = "0.5"; - } - - //Check if browser 'REFRESHED' or 'RELOADED' - if ($rootScope.CommonData != null) { - //0. we will initially append container to load body - - //check if localstorage has any settings - var curentEthnicity = $rootScope.getLocalStorageValue("globalEthnicity"); - if (typeof (curentEthnicity) !== "undefined" && curentEthnicity !== null) { - $rootScope.globalSetting.ethnicity = curentEthnicity; - } - - var curentmodesty = $rootScope.getLocalStorageValue("globalModesty"); - if (typeof (curentmodesty) !== "undefined" && curentmodesty !== null) { - $rootScope.globalSetting.modesty = curentmodesty - } - - //0.1 - - var currentBodyViewId = $rootScope.getLocalStorageValue("currentBodyViewId"); - if (currentBodyViewId == null || currentBodyViewId == undefined) { - // document.location = '/'; - document.location = '/'; - $rootScope.isVisibleLogin = true; - - } - else { - $rootScope.isVisibleLogin = false; - - $rootScope.loadSearchData(); - - console.log('currentBodyViewId picked from localStorage: ' + currentBodyViewId); - - var openViews; - if ($rootScope.openViews != null || $rootScope.openViews != undefined) { - if ($rootScope.openViews.length > 0) { - openViews = new jinqJs() - .from($rootScope.openViews) - .where("BodyViewId == " + currentBodyViewId) - .select(); - } - } - - // 0.2 getting corresponding body view title - //var counter = 1; - var tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson"); - localStorage.setItem("currentViewTitle", tittle); - - //WILL BE USED WHEN MULTI VIEWOPEN FUNCTIONALITY IS IMPELMNETD - //if (openViews != null && openViews != undefined) { - // angular.forEach(openViews, function (value, key) { - - // if (value.bodyView == tittle) { - // tittle = $rootScope.getLocalStorageValue("currentViewTitleFromJson") + counter++; - // $rootScope.currentActiveViewTitle = tittle; - // localStorage.setItem("currentViewTitle", tittle); - // } - - // }); - //} - //else { - // localStorage.setItem("currentViewTitle", tittle); - //} - - //0.3 - - $.jsPanel({ - id: 'daImagePanel', - selector: '.daBodyView', - theme: 'success', - currentController: 'DAController', - parentSlug: 'da-view-list', - ajax: { - url: 'app/views/da/da-view.html' - }, - title: $rootScope.getLocalStorageValue("currentViewTitle"), - - position: { - top: 70, - left: 1, - }, - - size: { width: $(window).outerWidth() - 10, height: $(window).outerHeight() - 110 }, - - }); - - console.log('jsPanel loaded daImagePanel exist= ' + document.getElementById('daImagePanel')) - //0.1 - $rootScope.currentSlug = 'da-body-view'; - - //0.2 - $rootScope.openViews.push( - { - "module": $rootScope.currentActiveModuleTitle, "bodyView": tittle, "state": 'max', "BodyViewId": $rootScope.currentBodyViewId, - "slug": $rootScope.currentSlug - } - ); - - //0.3 - var daBodyviewElement = angular.element(document.getElementById("daBodyview")); - - $timeout(function () - { - $compile(daBodyviewElement.contents())($scope); - - console.log('html is compiled ' + document.getElementById('daView')) - - if (document.getElementById('daView') != null) { - $scope.loadDAView(currentBodyViewId); - } - else - { - // this is a work around solution for a bug where DA does not load for long and user need to close the DA partially opened - // view, now we are programmatically closing the hung view and when user will reopen the DA view from tile then it will - // open without any issue. - $("#daImagePanel .jsglyph-remove").click(); - - console.log('html is compiled in else ' + document.getElementById('daView')) - - } - - - if ($('#daImagePanel').offset().top == 0) - $('#daImagePanel').css("top", '70px'); - - if ($('#daImagePanel').offset().left == 0) - $('#daImagePanel').css("left", '1px'); - - }, 350); - } - } - else { - //for now we are redirecting user to index page on page refresh because on refresh we lost the rootscope data and some of application - //features stopped working which were depenedent of rootscope data like List manager, annotation toolbar, settings, usermodule list, etc. - - $location.path('/'); - - - } - } - - $scope.loadDAView = function (currentBodyViewId) - { - - //0.4 added some stylesheets - $('#daBodyview').css("height", (parseInt($(window).outerHeight()) - 62 - 20)); - - $('#daBodyview').css("width", $(window).outerWidth()); - - //1. load navigator man first - console.log('before LoadBodyViewNavigatorImage call') - $scope.LoadBodyViewNavigatorImage(); - - - $scope.currentTitleFromJson = $rootScope.getLocalStorageValue("currentViewTitle"); - - $scope.layerNumber = 0; - - //2. - console.log('currentBodyViewId just before sending: ' + currentBodyViewId); - $scope.loadBodyViewData(currentBodyViewId); - - //2. load bodyRegion data - $rootScope.isLoading = true; - $rootScope.voId = $rootScope.getLocalStorageValue("currentBodyViewId"); - - } - - - - - angular.element(document).ready(function (e) { - - var $ua = navigator.userAgent; - // var $event = ($ua.match(/(iPod|iPhone|iPad|android)/i)); - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - $("#layerChangeSlider").css("pointer-events", "auto"); - } - - - //to get slider working on ipad - var $ua = navigator.userAgent; - if (($ua.match(/(iPod|iPhone|iPad|android)/i))) { - var jspanelContainerWidth = $(".jsPanel-content").css("width"); - $(".jsPanel-content").css({ "width": "100%", "min-width": jspanelContainerWidth }); - $("#daImagePanel").css("width", "100%"); - $("#layerChangeSlider").css("pointer-events", "auto"); - // on identity mode click - $("#btnZoom").removeAttr("onclick"); - $("#btnZoom").on("touchstart", function () { - if ($(".btn-annotation").hasClass("activebtncolor")) //Bug #14928 - $(".btn-annotation").removeClass("activebtncolor"); - //Dissectible Anatomy > Extract and Annotations displays apart on the page after click on Zoom-in. - $(".com").remove(); - $("#bord").remove(); - console.log('OnZoom is called outside '); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.enableZoom(); - }); - }); - // on transparency mode click - $("#btnTranparency").removeAttr("onclick"); - $("#btnTranparency").on("touchstart", function () { - console.log('OnEnableExtract is called outside '); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.createTransparencyBox('true'); - }); - }); - // on normal mode click - $("#btnNormalMode").removeAttr("onclick"); - $("#btnNormalMode").on("touchstart", function () { - console.log('OnEnableNormalMode is called outside '); - $("#btnTranparency").removeClass("disabled"); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.enableNormalMode(); - }); - }); - // on extract mode click - $("#btnExtract").removeAttr("onclick"); - $("#btnExtract").on("touchstart", function () { - console.log('OnEnableExtract is called outside '); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.enableExtract('true'); - }); - }); - // on highlight mode click - $("#btnHighLight").removeAttr("onclick"); - $("#btnHighLight").on("touchstart", function () { - console.log('OnEnableHighlight is called outside '); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.enableHighlight(); - }); - }); - // on show/hide mode click - $("#btnStrutureBox").removeAttr("onclick"); - $("#btnStrutureBox").on("touchstart", function () { - console.log('OnBodySystem chnaged is called outside '); - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - scope.enableShowHideStructureBox(); - }); - }); - } - - $(document).on("click", "#daImagePanel .jsPanel-hdr .jsPanel-hdr-r .jsPanel-btn-close .jsglyph-remove", function () { - - $rootScope.selectedBodySystemName = 'All'; - $rootScope.selectedBodySystemId = 0; - $rootScope.searchSelectedText = ''; - }); - - var sliderVal = document.getElementById('layerChangeSlider'); - - console.log('on slider initialize:' + sliderVal); - - - $("#layerChangeSlider").slider({ - orientation: "vertical", - range: "max", - min: 0, - value: 0, - slide: function (event, ui) - { - var sliderVal = document.getElementById('layerChangeSlider'); - - console.log('on slider slide :' + sliderVal); - - var layerNum; - var daViewScope = angular.element(document.getElementById("daView")).scope(); - layerNum = parseInt(daViewScope.totalLayers) //- parseInt(scope.layerNumber); - var sliderVal = layerNum - ui.value; - $("#txtlayerNumber").val(sliderVal); - }, - - stop: function (event, ui) { - - var la; - var rootScope = angular.element(document.getElementById("bo")).scope(); - rootScope.$apply(function () { - rootScope.isLoading = true; - }) - var scope = angular.element(document.getElementById("daView")).scope(); - scope.$apply(function () { - if (scope.isTransparencyActivated) { - rootScope.isLoading = false; - } - la = parseInt(scope.totalLayers) //- parseInt(scope.layerNumber); - var slideVal = la - ui.value; - $("#txtlayerNumber").val(slideVal); - scope.layerNumber = slideVal; - scope.LayerChange(); - $("#annotationpaintbrushsize").removeClass("activebtncolor"); - $("#annotationpainteraser").removeClass("activebtncolor"); - }); - }, - - }); - - - $("#daImagePanel").resize(function () { - $("#canvasDiv").scrollLeft($rootScope.CanvasDivLeftPosition); - $("#canvasDiv").scrollTop($rootScope.CanvasDivTopPosition); - }); - - $(document).on("mouseover", "#termList option", function (e) { - $('#termList option[selected="selected"]').attr("selected", false); - $(this).attr("selected", true); - }); - - $(document).keypress(function (e) { - if ($('#termList option[selected="selected"]').attr("id") == "undefined") { - return false; - } - else { - var originator = e.keyCode || e.which; - // alert($('#termList option[selected="selected"]').attr("id")); - if ($('#termList option[selected="selected"]').attr("id")) { - if (e.keyCode == 13) { - onListManagerTermSelection($('#termList option[selected="selected"]').attr("id")); - } - } - } - }); - - - }) - // $rootScope.languageArray = []; - $rootScope.loadSearchData = function () { - var primaryLexiconIndex; - var languageArray = []; - $rootScope.vocabTermDataArray = []; - var languageArray = $rootScope.lexiconLanguageArray; - - console.log(languageArray.length); - console.log('loadSearchDataForBodyView'); - - var currentBodyViewId = $rootScope.getLocalStorageValue("currentBodyViewId"); - - for (var i = 0; i <= languageArray.length - 1; i++) { - var searchWorker = new Worker('search-wp.js'); - - //push workers in array to further used the refernece to delete the workers - $scope.runningSearchWorkers.push({ 'workerName': searchWorker }) - - //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")) - - - searchWorker.postMessage({ - - 'currentBodyViewId': currentBodyViewId, - 'languageName': languageArray[i].language, - 'languageID': languageArray[i].id - }) - - searchWorker.onmessage = function (e) { - - //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - $rootScope.TermNumberData = e.data.TermNumberData; - console.log("$rootScope.TermNumberData = " + $rootScope.TermNumberData.length); - $rootScope.VocabTermData = e.data.VocabTermData,//same - $scope.vocabTermTxt = e.data.vocabTermTxt, - $scope.vocabLanguage = e.data.language, - $rootScope.vocabTermDataArray.push({ "language": $scope.vocabLanguage, "VocabTermData": $rootScope.VocabTermData, "vocabTermTxt": $scope.vocabTermTxt }); - - for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) { - - - $rootScope.vocabTermDataArray[i].vocabTermTxt = new jinqJs() - .from($rootScope.vocabTermDataArray[i].vocabTermTxt) - .distinct('_TermText', '_ActualTermNumber') - .orderBy([{ field: '_TermText', sort: 'asc' }]) - .select('_ActualTermNumber', '_TermText', '_cdId'); - - // console.log("Language= " + $rootScope.lexiconLanguageArray[i].language + ", vocabTermTxt= " + $rootScope.vocabTermDataArray[i].vocabTermTxt[0]._TermText); - - } - - - if ($rootScope.vocabTermDataArray.length == $rootScope.lexiconLanguageArray.length) { - $("#setting-spinner").css("display", "none"); - - for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) { - if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) { - primaryLexiconIndex = i; - } - } - //alert(primaryLexiconIndex); - if ($rootScope.isListManagerMenuSelected) { - $scope.loadListManger(); - } - } - - - console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1")); - - if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) { - - var workerCount = $scope.runningSearchWorkers.length; - if (workerCount > 0) { - for (var i = workerCount - 1; i >= 0; i--) { - - var runningWorker = $scope.runningSearchWorkers[i].workerName; - runningWorker.terminate(); - $scope.runningSearchWorkers.splice(i, 1); - // workerCount--; - } - } - } - } - - - //console.log("s" + $rootScope.vocabTermDataArray); - //call watch on '$scope.VocabTermTxt and compile
  • and append to