{"version":3,"sources":["../js/Filter.js"],"names":["g_oFilter","Filter","this","oFilters","oFilterValues","oMatchingFilters","g_iActiveFilterId","oActiveFilters","g_bFiltersAnimating","c_szFilter_Key_User","c_szFilter_Key_Role","c_szFilter_Key_AnnotationStatus","c_szFilter_Key_AnnotationColour","c_szFilter_Key_AnnotationContent","c_szFilter_Key_ReplyContent","c_szFilter_Value_Blue","c_szFilter_Value_Red","c_szFilter_Value_Green","c_szFilter_Value_Orange","c_szFilter_Value_Purple","c_szFilter_Value_Cyan","c_szFilter_Value_Yellow","c_szFilter_Value_Magenta","c_szFilter_Value_Grey","c_szFilter_Value_Initial","c_szFilter_Value_Approved","c_szFilter_Value_Rejected","c_szFilter_Value_Query","c_szFilter_Value_ToDo","c_szFilter_Message_Filter","c_szFilter_Message_Help","c_szFilter_Message_Reset","c_szFilter_Message_Active","c_szFilter_Message_Remove","c_szFilter_Message_IncludeExclude","c_szFilter_Message_Unavailable","c_szFilter_Message_NoFilters","c_szFilter_Message_AnnotationCount","c_szFilter_Message_UnableToFilter","prototype","setupFilters","oApproval","setupFilters_System","setupFilters_Custom","setupActiveFilterAvailibility","resetFilterOptions","renderActiveFilters","setupFilters_System_AnnotationColour","setupFilters_System_AnnotationStatus","undefined","approvers","i","length","oApprover","userDetails","FirstName","indexOf","push","szUserName","LastName","Key","Value","EmailAddress","role","j","approverData","oApproverData","Available","isFilterAvailable","toggleAnnotationFilters","$","css","height","slideDown","duration","easing","progress","resizeAnnotationListItems","complete","hide","slideUp","html","toString","show","updateFilterOptions","id","text","children","remove","toLowerCase","addFilterOption","getMatchesByFilters","getMatchingFilters","concat","getMatchesByValues","getMatchingValues","sort","sortFilters","isActiveFilter","key","value","removeQuotesFromValue","append","val","scrollTop","clickFilterOption","click","find","selectFilterOption","oItem","removeClass","addClass","selectNextFilterOption","next","first","scrollToSelectedFilterOption","selectPreviousFilterOption","prev","last","offset","top","addActiveFilter","addQuotesToValue","Id","Include","removeActiveFilter","iActiveFilterIndex","getActiveFilterIndex","splice","toggleActiveFilter","resetActiveFilters","bRebuildAnnotationsList","renderActiveFilter","oAnnotationCanvas","g_oViewer","getCanvas","g_oCompare","getAnnotationCanvasId","oArtworkCanvas","getLinkedArtworkCanvas","g_szCanvasId","g_oAnnotations","rebuildAnnotationList","oActiveFilter","szClass","szIcon","szTitle","updateActiveFilterMessage","applyAnnotationFilters","oAnnotations","oFilteredAnnotations","annotationMatchesFilters","replace","countFullAnnotations","oAnnotation","bMatchesFilters","oFilter","annotationMatchesFilter","bMatchesFilter","getActiveOrFilters","annotationMatchesFilter_AnnotationContent","annotationMatchesFilter_ReplyContent","annotationMatchesFilter_Colour","annotationMatchesFilter_Status","annotationMatchesFilter_Custom","g_szTextContent","g_oReplies","filter","reply","getStringColour","g_szColour","getStringStatuses","g_oStatuses","match","g_szAuthorEmail","isContentFilter","include","filterValue","getMatchesByFilter","values","oLowerCaseValues","map","getMatchesByValue","a","b","getFilterList","szList","g_iParentAnnotationId","document","on","event","target","parents","window"],"mappings":"AAaA,IAAIA,UAAY,IAEf,WACA,aAKA,SAASC,SAGRC,KAAKC,SAAW,GAGhBD,KAAKE,cAAgB,GAGrBF,KAAKG,iBAAmB,GAGxBH,KAAKI,kBAAoB,EAGzBJ,KAAKK,eAAiB,GAGtBL,KAAKM,qBAAsB,EAG3BN,KAAKO,oBAAsB,GAC3BP,KAAKQ,oBAAsB,GAC3BR,KAAKS,gCAAkC,GACvCT,KAAKU,gCAAkC,GACvCV,KAAKW,iCAAmC,GACxCX,KAAKY,4BAA8B,GAGnCZ,KAAKa,sBAAwB,GAC7Bb,KAAKc,qBAAuB,GAC5Bd,KAAKe,uBAAyB,GAC9Bf,KAAKgB,wBAA0B,GAC/BhB,KAAKiB,wBAA0B,GAC/BjB,KAAKkB,sBAAwB,GAC7BlB,KAAKmB,wBAA0B,GAC/BnB,KAAKoB,yBAA2B,GAChCpB,KAAKqB,sBAAwB,GAC7BrB,KAAKsB,yBAA2B,GAChCtB,KAAKuB,0BAA4B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OAAQ,KAAMA,QAAQ,OAAQ,MAMpDlF,EAAEsH,UAAUC,GAAG,QAAS,SAAUC,OAG6B,GAA1DxH,EAAEwH,MAAMC,QAAQC,QAAQ,wBAAwB5I,QAAkC,uBAAnB0I,MAAMC,OAAO1G,IAG/Ef,EAAE,wBAAwBS,SAO5BkH,OAAOhM,OAASA,OAvkCjB","file":"Filter-58e77dfbb0.js","sourcesContent":["/*\r\n* Copyright (c) 2020 SGS Europe. All rights reserved.\r\n*\r\n* This program is the CONFIDENTIAL and PROPRIETARY property of 2020 SGS Europe.\r\n* Any unauthorised use, reproduction, or transfer of this program is strictly\r\n* prohibited.\r\n*\r\n* File Name:\tFilter.js\r\n*\r\n* Description:\tJavaScript code for Filter module.\r\n*\r\n*/\r\n\r\nvar g_oFilter = {};\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\r\n\t/**\r\n\t * Create the Filter object.\r\n\t */\r\n\tfunction Filter() {\r\n\r\n\t\t// The master list of filters.\r\n\t\tthis.oFilters = [];\r\n\r\n\t\t// The list of filter values.\r\n\t\tthis.oFilterValues = [];\r\n\r\n\t\t// The list of matching filters.\r\n\t\tthis.oMatchingFilters = [];\r\n\r\n\t\t// The id of the next active filter.\r\n\t\tthis.g_iActiveFilterId = 1;\r\n\r\n\t\t// The list of active filters.\r\n\t\tthis.oActiveFilters = [];\r\n\r\n\t\t// If a section is actively animating.\r\n\t\tthis.g_bFiltersAnimating = false;\r\n\r\n\t\t// Constant keys to be set.\r\n\t\tthis.c_szFilter_Key_User = \"\";\r\n\t\tthis.c_szFilter_Key_Role = \"\";\r\n\t\tthis.c_szFilter_Key_AnnotationStatus = \"\";\r\n\t\tthis.c_szFilter_Key_AnnotationColour = \"\";\r\n\t\tthis.c_szFilter_Key_AnnotationContent = \"\";\r\n\t\tthis.c_szFilter_Key_ReplyContent = \"\";\r\n\r\n\t\t// Constant values to be set.\r\n\t\tthis.c_szFilter_Value_Blue = \"\";\r\n\t\tthis.c_szFilter_Value_Red = \"\";\r\n\t\tthis.c_szFilter_Value_Green = \"\";\r\n\t\tthis.c_szFilter_Value_Orange = \"\";\r\n\t\tthis.c_szFilter_Value_Purple = \"\";\r\n\t\tthis.c_szFilter_Value_Cyan = \"\";\r\n\t\tthis.c_szFilter_Value_Yellow = \"\";\r\n\t\tthis.c_szFilter_Value_Magenta = \"\";\r\n\t\tthis.c_szFilter_Value_Grey = \"\";\r\n\t\tthis.c_szFilter_Value_Initial = \"\";\r\n\t\tthis.c_szFilter_Value_Approved = \"\";\r\n\t\tthis.c_szFilter_Value_Rejected = \"\";\r\n\t\tthis.c_szFilter_Value_Query = \"\";\r\n\t\tthis.c_szFilter_Value_ToDo = \"\";\r\n\r\n\t\t// Contant messages to be set.\r\n\t\tthis.c_szFilter_Message_Filter = \"\";\r\n\t\tthis.c_szFilter_Message_Help = \"\";\r\n\t\tthis.c_szFilter_Message_Reset = \"\";\r\n\t\tthis.c_szFilter_Message_Active = \"\";\r\n\t\tthis.c_szFilter_Message_Remove = \"\";\r\n\t\tthis.c_szFilter_Message_IncludeExclude = \"\";\r\n\t\tthis.c_szFilter_Message_Unavailable = \"\";\r\n\t\tthis.c_szFilter_Message_NoFilters = \"\";\r\n\t\tthis.c_szFilter_Message_AnnotationCount = \"\";\r\n\t\tthis.c_szFilter_Message_UnableToFilter = \"\";\r\n\t}\r\n\r\n\t/**\r\n\t * Setup the filters for an approval.\r\n\t * @param {object} oApproval - The approval to be used for setup.\r\n\t */\r\n\tFilter.prototype.setupFilters = function (oApproval) {\r\n\r\n\t\t// Reset the filters objects.\r\n\t\tg_oFilter.oFilters = [];\r\n\t\tg_oFilter.oFilterValues = [];\r\n\t\tg_oFilter.oMatchingFilters = [];\r\n\r\n\t\t// Setup the system filters.\r\n\t\tg_oFilter.setupFilters_System(oApproval);\r\n\r\n\t\t// Setup the custom filters.\r\n\t\tg_oFilter.setupFilters_Custom(oApproval);\r\n\r\n\t\t// Set the availibility of any existing filters.\r\n\t\tg_oFilter.setupActiveFilterAvailibility();\r\n\r\n\t\t// Set the filters to the inital list and render.\r\n\t\tg_oFilter.resetFilterOptions(\"divAnnListFilterBox\");\r\n\t\tg_oFilter.renderActiveFilters(false);\r\n\t};\r\n\r\n\t/**\r\n\t * Setup the system filter.\r\n\t * @param {object} oApproval - The approval to be used.\r\n\t */\r\n\tFilter.prototype.setupFilters_System = function (oApproval) {\r\n\t\t\r\n\t\t// Add the annotation colour system filter.\r\n\t\tg_oFilter.setupFilters_System_AnnotationColour();\r\n\r\n\t\t// Add the annotation status system filter.\r\n\t\tg_oFilter.setupFilters_System_AnnotationStatus();\r\n\r\n\t\t// If we have an approval and approvers.\r\n\t\tif (oApproval != null && oApproval.approvers != undefined) {\r\n\r\n\t\t\t// Loop through each of the approvers on the approval.\r\n\t\t\tfor (var i = 0; i < oApproval.approvers.length; i++) {\r\n\r\n\t\t\t\t// Extract the approver.\r\n\t\t\t\tvar oApprover = oApproval.approvers[i];\r\n\r\n\t\t\t\t// If this user has a first name.\r\n\t\t\t\tif (oApprover.userDetails.FirstName != \"\") {\r\n\r\n\t\t\t\t\t// If this does not exist in the filters.\r\n\t\t\t\t\tif (g_oFilter.oFilters.indexOf(g_oFilter.c_szFilter_Key_User) == -1) {\r\n\r\n\t\t\t\t\t\t// Add the filter.\r\n\t\t\t\t\t\tg_oFilter.oFilters.push(g_oFilter.c_szFilter_Key_User);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Determine the user name to be used as a filter value.\r\n\t\t\t\t\tvar szUserName = oApprover.userDetails.FirstName;\r\n\r\n\t\t\t\t\t// Add the last name if set.\r\n\t\t\t\t\tif (oApprover.userDetails.LastName != \"\") {\r\n\t\t\t\t\t\tszUserName += \" \" + oApprover.userDetails.LastName;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// If this user does not exist in the filter values.\r\n\t\t\t\t\tif (g_oFilter.oFilterValues.indexOf(szUserName) == -1) {\r\n\r\n\t\t\t\t\t\t// Add it to the list.\r\n\t\t\t\t\t\tg_oFilter.oFilterValues.push(szUserName);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Add the user to the list of matches.\r\n\t\t\t\t\tg_oFilter.oMatchingFilters.push({\r\n\t\t\t\t\t\tKey: g_oFilter.c_szFilter_Key_User,\r\n\t\t\t\t\t\tValue: szUserName,\r\n\t\t\t\t\t\tEmailAddress: oApprover.userDetails.EmailAddress\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// If this user has a role.\r\n\t\t\t\tif (oApprover.role != \"\") {\r\n\r\n\t\t\t\t\t// If this does not exist in the filters.\r\n\t\t\t\t\tif (g_oFilter.oFilters.indexOf(g_oFilter.c_szFilter_Key_Role) == -1) {\r\n\r\n\t\t\t\t\t\t// Add the filter.\r\n\t\t\t\t\t\tg_oFilter.oFilters.push(g_oFilter.c_szFilter_Key_Role);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// If this user does not exist in the filter values.\r\n\t\t\t\t\tif (g_oFilter.oFilterValues.indexOf(oApprover.role) == -1) {\r\n\r\n\t\t\t\t\t\t// Add it to the list.\r\n\t\t\t\t\t\tg_oFilter.oFilterValues.push(oApprover.role);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Add the user to the list of matches.\r\n\t\t\t\t\tg_oFilter.oMatchingFilters.push({\r\n\t\t\t\t\t\tKey: g_oFilter.c_szFilter_Key_Role,\r\n\t\t\t\t\t\tValue: oApprover.role,\r\n\t\t\t\t\t\tEmailAddress: oApprover.userDetails.EmailAddress\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Setup the annotation colour system filters. \r\n\t */\r\n\tFilter.prototype.setupFilters_System_AnnotationColour = function () {\r\n\r\n\t\t// Add the annotation colour filter.\r\n\t\tg_oFilter.oFilters.push(g_oFilter.c_szFilter_Key_AnnotationColour);\r\n\r\n\t\t// Add the annotation colour values.\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Blue);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Red);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Green);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Orange);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Purple);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Cyan);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Yellow);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Magenta);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Grey);\r\n\r\n\t\t// Add each of the matches.\r\n\t\tg_oFilter.oMatchingFilters.push({\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Blue,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Red,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Green,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Orange,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Purple,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Cyan,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Yellow,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Magenta,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationColour,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Grey,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Setup the annotation status system filters.\r\n\t */\r\n\tFilter.prototype.setupFilters_System_AnnotationStatus = function () {\r\n\r\n\t\t// Add the status colour filter.\r\n\t\tg_oFilter.oFilters.push(g_oFilter.c_szFilter_Key_AnnotationStatus);\r\n\r\n\t\t// Add the annotation status values.\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Initial);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Approved);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Rejected);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_Query);\r\n\t\tg_oFilter.oFilterValues.push(g_oFilter.c_szFilter_Value_ToDo);\r\n\r\n\t\t// Add each of the matches.\r\n\t\tg_oFilter.oMatchingFilters.push({\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationStatus,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Initial,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationStatus,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Approved,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationStatus,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Rejected,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationStatus,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_Query,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t}, {\r\n\t\t\tKey: g_oFilter.c_szFilter_Key_AnnotationStatus,\r\n\t\t\tValue: g_oFilter.c_szFilter_Value_ToDo,\r\n\t\t\tEmailAddress: \"\"\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Setup the custom filters.\r\n\t * @param {object} oApproval - The approval to be used for setup.\r\n\t */\r\n\tFilter.prototype.setupFilters_Custom = function (oApproval) {\r\n\r\n\t\t// If we have an approval and approvers.\r\n\t\tif (oApproval != null && oApproval.approvers != undefined) {\r\n\r\n\t\t\t// Loop through each of the approvers on the approval.\r\n\t\t\tfor (var i = 0; i < oApproval.approvers.length; i++) {\r\n\r\n\t\t\t\t// Extract the approver.\r\n\t\t\t\tvar oApprover = oApproval.approvers[i];\r\n\r\n\t\t\t\t// Loop through each of the filter values.\r\n\t\t\t\tfor (var j = 0; j < oApprover.approverData.length; j++) {\r\n\r\n\t\t\t\t\t// Extract the approver data.\r\n\t\t\t\t\tvar oApproverData = oApprover.approverData[j];\r\n\r\n\t\t\t\t\t// If this filter is not in our list.\r\n\t\t\t\t\tif (g_oFilter.oFilters.indexOf(oApproverData.Key) == -1) {\r\n\r\n\t\t\t\t\t\t// Add it to the list.\r\n\t\t\t\t\t\tg_oFilter.oFilters.push(oApproverData.Key);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// If this value does not exist in the filter values.\r\n\t\t\t\t\tif (g_oFilter.oFilterValues.indexOf(oApproverData.Value) == -1) {\r\n\r\n\t\t\t\t\t\t// Add it to the list.\r\n\t\t\t\t\t\tg_oFilter.oFilterValues.push(oApproverData.Value);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Add the match to the list against the user.\r\n\t\t\t\t\tg_oFilter.oMatchingFilters.push({\r\n\t\t\t\t\t\tKey: oApproverData.Key,\r\n\t\t\t\t\t\tValue: oApproverData.Value,\r\n\t\t\t\t\t\tEmailAddress: oApprover.userDetails.EmailAddress\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Setup the active filter availibility. \r\n\t */\r\n\tFilter.prototype.setupActiveFilterAvailibility = function () {\r\n\r\n\t\t// Loop through each of the active filters.\r\n\t\tfor (var i = 0; i < g_oFilter.oActiveFilters.length; i++) {\r\n\r\n\t\t\t// Set the availability of this filter.\r\n\t\t\tg_oFilter.oActiveFilters[i].Available = g_oFilter.isFilterAvailable(g_oFilter.oActiveFilters[i].Key, g_oFilter.oActiveFilters[i].Value);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Toggle the annotation filters section. \r\n\t */\r\n\tFilter.prototype.toggleAnnotationFilters = function () {\r\n\r\n\t\t// If we are not already animating the filters section.\r\n\t\tif (!g_oFilter.g_bFiltersAnimating) {\r\n\r\n\t\t\t// Set that the section is currently animating.\r\n\t\t\tg_oFilter.g_bFiltersAnimating = true;\r\n\r\n\t\t\t// If the user settings are currently shown.\r\n\t\t\tif ($(\"#divAnnFilters\").css(\"display\") == \"none\") {\r\n\r\n\t\t\t\t// Ensure the annotation divs are the correct height.\r\n\t\t\t\t$(\"#divAnnotationsContainer\").height($(\"#divViewerCell\").height());\r\n\t\t\t\t$(\"#divAnnDiv\").height($(\"#divViewerCell\").height());\r\n\r\n\t\t\t\t// Slide the div down.\r\n\t\t\t\t$(\"#divAnnFilters\").slideDown({\r\n\t\t\t\t\tduration: 200,\r\n\t\t\t\t\teasing: 'swing',\r\n\t\t\t\t\tprogress: function () {\r\n\r\n\t\t\t\t\t\t// Resize the annotations list items.\r\n\t\t\t\t\t\tresizeAnnotationListItems();\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: function () {\r\n\r\n\t\t\t\t\t\t// Set that we are no longer animating.\r\n\t\t\t\t\t\tg_oFilter.g_bFiltersAnimating = false;\r\n\r\n\t\t\t\t\t\t// Hide the annotation number.\r\n\t\t\t\t\t\t$(\"#divFilterAnnotationsNumber\").hide();\r\n\r\n\t\t\t\t\t\t// Resize the annotations list items.\r\n\t\t\t\t\t\tresizeAnnotationListItems();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t// If the user settings are currently not shown.\r\n\t\t\telse {\r\n\r\n\t\t\t\t// Slide the div up.\r\n\t\t\t\t$(\"#divAnnFilters\").slideUp({\r\n\t\t\t\t\tduration: 200,\r\n\t\t\t\t\teasing: 'swing',\r\n\t\t\t\t\tprogress: function () {\r\n\r\n\t\t\t\t\t\t// Resize the annotations list items.\r\n\t\t\t\t\t\tresizeAnnotationListItems();\r\n\t\t\t\t\t},\r\n\t\t\t\t\tcomplete: function () {\r\n\r\n\t\t\t\t\t\t// Set that we are no longer animating.\r\n\t\t\t\t\t\tg_oFilter.g_bFiltersAnimating = false;\r\n\r\n\t\t\t\t\t\t// Populate and show the annotation number if required.\r\n\t\t\t\t\t\tif (g_oFilter.oActiveFilters.length > 0) {\r\n\t\t\t\t\t\t\t$(\"#divFilterAnnotationsNumber\").html(g_oFilter.oActiveFilters.length.toString());\r\n\t\t\t\t\t\t\t$(\"#divFilterAnnotationsNumber\").show();\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t// Resize the annotations list items.\r\n\t\t\t\t\t\tresizeAnnotationListItems();\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Update the filter options in the drop down.\r\n\t * @param {string} id - The id of the dropdown to update.\r\n\t * @param {string} text - The text that has been entered into the textbox.\r\n\t */\r\n\tFilter.prototype.updateFilterOptions = function (id, text) {\r\n\r\n\t\t// Remove all filters from the list.\r\n\t\t$(\"#\" + id).children().remove();\r\n\r\n\t\t// Always add an option for the annotation content, unless the text already starts with this.\r\n\t\tif (text.toLowerCase().indexOf(g_oFilter.c_szFilter_Key_AnnotationContent.toLowerCase()) !== 0) {\r\n\t\t\tg_oFilter.addFilterOption(id, g_oFilter.c_szFilter_Key_AnnotationContent, text);\r\n\t\t}\r\n\r\n\t\t// Always add an option for the reply content, unless the text already starts with this.\r\n\t\tif (text.toLowerCase().indexOf(g_oFilter.c_szFilter_Key_AnnotationContent.toLowerCase()) !== 0) {\r\n\t\t\tg_oFilter.addFilterOption(id, g_oFilter.c_szFilter_Key_ReplyContent, text);\r\n\t\t}\r\n\r\n\t\t// Get filter matches where the key contains the text.\r\n\t\tvar oMatchingFilters = g_oFilter.getMatchesByFilters(g_oFilter.getMatchingFilters(text));\r\n\r\n\t\t// Add filter matches where the value contains the text.\r\n\t\toMatchingFilters = oMatchingFilters.concat(g_oFilter.getMatchesByValues(g_oFilter.getMatchingValues(text)));\r\n\r\n\t\t// Sort the filters alphabetically.\r\n\t\toMatchingFilters.sort(g_oFilter.sortFilters);\r\n\r\n\t\t// Add each of the filter matches to the dropdown.\r\n\t\tfor (var i = 0; i < oMatchingFilters.length; i++) {\r\n\r\n\t\t\t// If this is not already an active filter.\r\n\t\t\tif (!g_oFilter.isActiveFilter(oMatchingFilters[i].Key, oMatchingFilters[i].Value)) {\r\n\r\n\t\t\t\t// Add the filter option.\r\n\t\t\t\tg_oFilter.addFilterOption(id, oMatchingFilters[i].Key, oMatchingFilters[i].Value);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Adds an option to a filter.\r\n\t * @param {string} id - The id of the dropdown.\r\n\t * @param {string} key - The key of the option.\r\n\t * @param {string} value - The value of the option.\r\n\t */\r\n\tFilter.prototype.addFilterOption = function (id, key, value) {\r\n\r\n\t\t// If this is not already a filter option.\r\n\t\tif ($('.filterdropdown__item[data-filterkey=\"' + g_oFilter.removeQuotesFromValue(key).toLowerCase() + '\"][data-filtervalue=\"' + g_oFilter.removeQuotesFromValue(value).toLowerCase() + '\"]').length == 0) {\r\n\t\t\t\r\n\t\t\t// Add the option to the filter.\r\n\t\t\t$(\"#\" + id).append(\r\n\t\t\t\t'
' +\r\n\t\t\t\t\tkey + ': ' + value +\r\n\t\t\t\t'
'\r\n\t\t\t);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Resets the filter options.\r\n\t * @param {string} id - The id of the dropdown.\r\n\t */\r\n\tFilter.prototype.resetFilterOptions = function (id) {\r\n\r\n\t\t// Remove the input from the textbox.\r\n\t\t$(\"#txtAnnListFilterBox\").val(\"\");\r\n\r\n\t\t// Reset the scroll of the drop down.\r\n\t\t$(\"#divAnnListFilterBox\").scrollTop(0);\r\n\r\n\t\t// Remove all filters from the list.\r\n\t\t$(\"#\" + id).children().remove();\r\n\r\n\t\t// Sort the filters alphabetically.\r\n\t\tg_oFilter.oMatchingFilters.sort(g_oFilter.sortFilters);\r\n\r\n\t\t// Add all filter matches to the list.\r\n\t\tfor (var i = 0; i < g_oFilter.oMatchingFilters.length; i++) {\r\n\r\n\t\t\t// If this is not already an active filter.\r\n\t\t\tif (!g_oFilter.isActiveFilter(g_oFilter.oMatchingFilters[i].Key, g_oFilter.oMatchingFilters[i].Value)) {\r\n\r\n\t\t\t\t// Add the filter option.\r\n\t\t\t\tg_oFilter.addFilterOption(id, g_oFilter.oMatchingFilters[i].Key, g_oFilter.oMatchingFilters[i].Value);\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Clicks the current filter option. \r\n\t */\r\n\tFilter.prototype.clickFilterOption = function () {\r\n\r\n\t\t// If there is a selected item.\r\n\t\tif ($(\".filterdropdown__item--selected\").length > 0) {\r\n\r\n\t\t\t// Select this option.\r\n\t\t\t$(\".filterdropdown__item--selected\").click();\r\n\t\t}\r\n\t\t// If there is no selected item.\r\n\t\telse {\r\n\r\n\t\t\t// Select the first option.\r\n\t\t\t$(\"#divAnnListFilterBox\").find(\">:first-child\").click();\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Selects the current filter option.\r\n\t * @param {object} oItem - The filter option to be seleceted.\r\n\t */\r\n\tFilter.prototype.selectFilterOption = function (oItem) {\r\n\r\n\t\t// Remove the current selected option.\r\n\t\t$(\".filterdropdown__item--selected\").removeClass(\"filterdropdown__item--selected\");\r\n\r\n\t\t// Set this as the selected option.\r\n\t\t$(oItem).addClass(\"filterdropdown__item--selected\");\r\n\t};\r\n\r\n\t/**\r\n\t * selects the next filter option.\r\n\t */\r\n\tFilter.prototype.selectNextFilterOption = function () {\r\n\r\n\t\t// If there is a selected item.\r\n\t\tif ($(\".filterdropdown__item--selected\").length > 0) {\r\n\r\n\t\t\t// Select the next filter option.\r\n\t\t\tg_oFilter.selectFilterOption($(\".filterdropdown__item--selected\").next().length > 0 ? $(\".filterdropdown__item--selected\").next()[0] : $(\".filterdropdown__item--selected\")[0]);\r\n\t\t}\r\n\t\t// If there is no selected item.\r\n\t\telse {\r\n\r\n\t\t\t// Select the first filter option.\r\n\t\t\tg_oFilter.selectFilterOption($(\".filterdropdown__item\").first()[0]);\r\n\t\t}\r\n\r\n\t\t// Scroll to the selected option.\r\n\t\tg_oFilter.scrollToSelectedFilterOption();\r\n\t};\r\n\r\n\t/**\r\n\t* Selects the previous filter option.\r\n\t*/\r\n\tFilter.prototype.selectPreviousFilterOption = function () {\r\n\r\n\t\t// If there is a selected item.\r\n\t\tif ($(\".filterdropdown__item--selected\").length > 0) {\r\n\r\n\t\t\t// Select the previous selected item.\r\n\t\t\tg_oFilter.selectFilterOption($(\".filterdropdown__item--selected\").prev().length > 0 ? $(\".filterdropdown__item--selected\").prev()[0] : $(\".filterdropdown__item--selected\")[0]);\r\n\t\t}\r\n\t\t// If there is no selected item.\r\n\t\telse {\r\n\r\n\t\t\t// Select the last filter option.\r\n\t\t\tg_oFilter.selectFilterOption($(\".filterdropdown__item\").last()[0]);\r\n\t\t}\r\n\r\n\t\t// Scroll to the selected option.\r\n\t\tg_oFilter.scrollToSelectedFilterOption();\r\n\t};\r\n\r\n\t/**\r\n\t * Scrolls to the selected filter option.\r\n\t */\r\n\tFilter.prototype.scrollToSelectedFilterOption = function () {\r\n\r\n\t\t// Scroll to the selected option.\r\n\t\t$(\"#divAnnListFilterBox\").scrollTop($(\".filterdropdown__item--selected\").offset().top - $(\"#divAnnListFilterBox\").offset().top + $(\"#divAnnListFilterBox\").scrollTop());\r\n\t};\r\n\r\n\t/**\r\n\t * Adds an active filter.\r\n\t * @param {string} key - The key of the filter.\r\n\t * @param {string} value - The value of the filter.\r\n\t */\r\n\tFilter.prototype.addActiveFilter = function (key, value) {\r\n\t\t\r\n\t\t// Re-add any removed quote marks to the key and value.\r\n\t\tkey = g_oFilter.addQuotesToValue(key);\r\n\t\tvalue = g_oFilter.addQuotesToValue(value);\r\n\r\n\t\t// If the active filter does not already exist.\r\n\t\tif (!g_oFilter.isActiveFilter(key, value)) {\r\n\r\n\t\t\t// Add the active filter to the list.\r\n\t\t\tg_oFilter.oActiveFilters.push({\r\n\t\t\t\tId: g_oFilter.g_iActiveFilterId,\r\n\t\t\t\tInclude: true,\r\n\t\t\t\tKey: key,\r\n\t\t\t\tValue: value,\r\n\t\t\t\tAvailable: true\r\n\t\t\t});\r\n\r\n\t\t\t// Increment the active filter id.\r\n\t\t\tg_oFilter.g_iActiveFilterId++;\r\n\r\n\t\t\t// Reset the filter box.\r\n\t\t\tg_oFilter.resetFilterOptions(\"divAnnListFilterBox\");\r\n\r\n\t\t\t// Render the active filters.\r\n\t\t\tg_oFilter.renderActiveFilters(true);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Removes an active filter.\r\n\t * @param {string} id - The id of the active filter.\r\n\t */\r\n\tFilter.prototype.removeActiveFilter = function (id) {\r\n\t\t\r\n\t\t// Get the index of the active filter.\r\n\t\tvar iActiveFilterIndex = g_oFilter.getActiveFilterIndex(id);\r\n\r\n\t\t// If found.\r\n\t\tif (iActiveFilterIndex != -1) {\r\n\r\n\t\t\t// Remove the active filter.\r\n\t\t\tg_oFilter.oActiveFilters.splice(iActiveFilterIndex, 1);\r\n\r\n\t\t\t// Render the active filters.\r\n\t\t\tg_oFilter.renderActiveFilters(true);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Toggles an active filter.\r\n\t * @param {string} id - The id of the active filter.\r\n\t */\r\n\tFilter.prototype.toggleActiveFilter = function (id) {\r\n\r\n\t\t// Get the index of the active filter.\r\n\t\tvar iActiveFilterIndex = g_oFilter.getActiveFilterIndex(id);\r\n\r\n\t\t// If found.\r\n\t\tif (iActiveFilterIndex != -1) {\r\n\r\n\t\t\t// Toggle the active filter.\r\n\t\t\tg_oFilter.oActiveFilters[iActiveFilterIndex].Include = !g_oFilter.oActiveFilters[iActiveFilterIndex].Include;\r\n\r\n\t\t\t// Render the active filters.\r\n\t\t\tg_oFilter.renderActiveFilters(true);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Resets the active filters. \r\n\t */\r\n\tFilter.prototype.resetActiveFilters = function () {\r\n\r\n\t\t// Remove all active filters.\r\n\t\tg_oFilter.oActiveFilters = [];\r\n\r\n\t\t// Render the active filters.\r\n\t\tg_oFilter.renderActiveFilters(true);\r\n\t};\r\n\r\n\t/**\r\n\t * Renders the active filters.\r\n\t * @param {bool} bRebuildAnnotationsList - If the annotation list should be rebuilt.\r\n\t */\r\n\tFilter.prototype.renderActiveFilters = function (bRebuildAnnotationsList) {\r\n\t\t\r\n\t\t// Reset the active filter content.\r\n\t\t$(\"#divActiveFilterContent\").html(\"\");\r\n\r\n\t\t// Sort the filters into alphebetical order.\r\n\t\tg_oFilter.oActiveFilters.sort(g_oFilter.sortFilters);\r\n\r\n\t\t// Loop through each of our active filters.\r\n\t\tfor (var i = 0; i < g_oFilter.oActiveFilters.length; i++) {\r\n\r\n\t\t\t// Render the active filter.\r\n\t\t\tg_oFilter.renderActiveFilter(g_oFilter.oActiveFilters[i]);\r\n\t\t}\r\n\r\n\t\t// Resize the annotations list items.\r\n\t\tresizeAnnotationListItems();\r\n\r\n\t\t// If we want to re-build the list items.\r\n\t\tif (bRebuildAnnotationsList) {\r\n\r\n\t\t\t// Determine the canvas to used for rendering based on the annotation.\r\n\t\t\tvar oAnnotationCanvas = g_oViewer.getCanvas(g_oCompare.getAnnotationCanvasId());\r\n\t\t\tvar oArtworkCanvas = g_oViewer.getLinkedArtworkCanvas(oAnnotationCanvas.g_szCanvasId);\r\n\r\n\t\t\t// Reubild the annotations list.\r\n\t\t\tg_oAnnotations.rebuildAnnotationList(oArtworkCanvas, oAnnotationCanvas);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Renders an active filter.\r\n\t * @param {object} oActiveFilter - The active filter to be rendered.\r\n\t */\r\n\tFilter.prototype.renderActiveFilter = function (oActiveFilter) {\r\n\r\n\t\t// Determine the class, icon and class to be used.\r\n\t\tvar szClass = \"filter\";\r\n\t\tvar szIcon = (oActiveFilter.Include ? 'img/include_16.png' : 'img/exclude_16.png');\r\n\t\tvar szTitle = g_oFilter.c_szFilter_Message_IncludeExclude;\r\n\r\n\t\t// If this filter is not available.\r\n\t\tif (!oActiveFilter.Available) {\r\n\t\t\tszClass = \"filter filter--warning\";\r\n\t\t\tszIcon = 'img/bubble_dialog-warning24.png';\r\n\t\t\tszTitle = g_oFilter.c_szFilter_Message_Unavailable;\r\n\t\t}\r\n\r\n\t\t// Add the active filter.\r\n\t\t$(\"#divActiveFilterContent\").append(\r\n\t\t\t'
' +\r\n\t\t\t\t'' +\r\n\t\t\t\t'
' +\r\n\t\t\t\t\toActiveFilter.Key + \": \" + oActiveFilter.Value +\r\n\t\t\t\t'
' +\r\n\t\t\t\t'' +\r\n\t\t\t'
'\r\n\t\t);\r\n\t};\r\n\r\n\t/**\r\n\t * Updates the active filter message.\r\n\t * @param {string} text - The text to be used.\r\n\t */\r\n\tFilter.prototype.updateActiveFilterMessage = function (text) {\r\n\r\n\t\t// Update the active filter message.\r\n\t\t$(\"#divActiveFilterMessage\").html('' + text + '');\r\n\t};\r\n\r\n\t/**\r\n\t * Applies the active filters to the annotations.\r\n\t * @param {object} oAnnotations - The list of annotations.\r\n\t * @returns {object} - The filtered list of annotations.\r\n\t */\r\n\tFilter.prototype.applyAnnotationFilters = function (oAnnotations) {\r\n\t\t\r\n\t\t// If we have no filters.\r\n\t\tif (g_oFilter.oActiveFilters.length == 0) {\r\n\r\n\t\t\t// Update the active filter message to the placeholder.\r\n\t\t\tg_oFilter.updateActiveFilterMessage(g_oFilter.c_szFilter_Message_NoFilters);\r\n\r\n\t\t\t// Return all annotations.\r\n\t\t\treturn oAnnotations;\r\n\t\t}\r\n\r\n\t\t// Outline the annotations to be returned.\r\n\t\tvar oFilteredAnnotations = [];\r\n\r\n\t\t// Loop through each of the annotations.\r\n\t\tfor (var i = 0; i < oAnnotations.length; i++) {\r\n\r\n\t\t\t// If the annotation matches the filters.\r\n\t\t\tif (g_oFilter.annotationMatchesFilters(oAnnotations[i])) {\r\n\r\n\t\t\t\t// Add this annotation to the list to be returned.\r\n\t\t\t\toFilteredAnnotations.push(oAnnotations[i]);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// Update the active filter message message.\r\n\t\tg_oFilter.updateActiveFilterMessage(g_oFilter.c_szFilter_Message_AnnotationCount.replace(\"{FilteredAnnotationCount}\", g_oFilter.countFullAnnotations(oFilteredAnnotations).toString()).replace(\"{AnnotationCount}\", g_oFilter.countFullAnnotations(oAnnotations).toString()));\r\n\r\n\t\t// Return the list of filtered annotations.\r\n\t\treturn oFilteredAnnotations;\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches the active filters.\r\n\t * @param {object} oAnnotation - The annotation to be checked.\r\n\t * @returns {bool} - Boolean indicating the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilters = function (oAnnotation) {\r\n\t\t\r\n\t\t// Outline the result to be returned.\r\n\t\tvar bMatchesFilters = true;\r\n\r\n\t\t// Loop through each of the annotation filters.\r\n\t\tfor (var i = 0; i < g_oFilter.oActiveFilters.length; i++) {\r\n\r\n\t\t\t// Extract the filter.\r\n\t\t\tvar oFilter = g_oFilter.oActiveFilters[i];\r\n\r\n\t\t\t// If this is an available filter.\r\n\t\t\tif (oFilter.Available) {\r\n\r\n\t\t\t\t// If this annotation does not match the filter.\r\n\t\t\t\tif (!g_oFilter.annotationMatchesFilter(oAnnotation, oFilter)) {\r\n\r\n\t\t\t\t\t// Set that this annotation does not match our filters and stop.\r\n\t\t\t\t\tbMatchesFilters = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Return the result.\r\n\t\treturn bMatchesFilters;\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - Boolean indicating the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter = function (oAnnotation, oFilter) {\r\n\t\t\r\n\t\t// Outline the result to be returned.\r\n\t\tvar bMatchesFilter = false;\r\n\r\n\t\t// Get all filters that can be matched on an or basis to this filter.\r\n\t\tvar oFilters = g_oFilter.getActiveOrFilters(oFilter.Key, oFilter.Value, oFilter.Include);\r\n\r\n\t\t// Loop through each of the filters that can be matched on an or basis.\r\n\t\tfor (var i = 0; i < oFilters.length; i++) {\r\n\r\n\t\t\t// If this is an annotation content filter.\r\n\t\t\tif (oFilter.Key == g_oFilter.c_szFilter_Key_AnnotationContent) {\r\n\t\t\t\tbMatchesFilter = g_oFilter.annotationMatchesFilter_AnnotationContent(oAnnotation, oFilters[i]);\r\n\t\t\t}\r\n\t\t\t// If this is a reply content filter.\r\n\t\t\telse if (oFilter.Key == g_oFilter.c_szFilter_Key_ReplyContent) {\r\n\t\t\t\tbMatchesFilter = g_oFilter.annotationMatchesFilter_ReplyContent(oAnnotation, oFilters[i]);\r\n\t\t\t}\r\n\t\t\t// If this is an annotation colour filter.\r\n\t\t\telse if (oFilter.Key == g_oFilter.c_szFilter_Key_AnnotationColour) {\r\n\t\t\t\tbMatchesFilter = g_oFilter.annotationMatchesFilter_Colour(oAnnotation, oFilters[i]);\r\n\t\t\t}\r\n\t\t\t// If this is an annotation status filter.\r\n\t\t\telse if (oFilter.Key == g_oFilter.c_szFilter_Key_AnnotationStatus) {\r\n\t\t\t\tbMatchesFilter = g_oFilter.annotationMatchesFilter_Status(oAnnotation, oFilters[i]);\r\n\t\t\t}\r\n\t\t\t// If this is any other filter.\r\n\t\t\telse {\r\n\t\t\t\tbMatchesFilter = g_oFilter.annotationMatchesFilter_Custom(oAnnotation, oFilters[i]);\r\n\t\t\t}\r\n\r\n\t\t\t// If we have matched one of the filters, stop.\r\n\t\t\tif (bMatchesFilter) {\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Return the result.\r\n\t\treturn bMatchesFilter;\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter based on content.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - The result of the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter_AnnotationContent = function (oAnnotation, oFilter) {\r\n\t\treturn oFilter.Include == (oAnnotation.g_szTextContent.toLowerCase().indexOf(oFilter.Value.toLowerCase()) != -1);\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter based on reply content.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - The result of the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter_ReplyContent = function (oAnnotation, oFilter) {\r\n\t\treturn oFilter.Include == (oAnnotation.g_oReplies.filter(function (reply) { return reply.g_szTextContent.toLowerCase().indexOf(oFilter.Value.toLowerCase()) != -1 }).length > 0);\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter based on colour.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - The result of the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter_Colour = function (oAnnotation, oFilter) {\r\n\t\treturn oFilter.Include == (g_oAnnotations.getStringColour(oAnnotation.g_szColour).toLowerCase() == oFilter.Value.toLowerCase());\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter based on status.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - The result of the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter_Status = function (oAnnotation, oFilter) {\r\n\t\treturn oFilter.Include == (g_oAnnotations.getStringStatuses(oAnnotation.g_oStatuses).toLowerCase().indexOf(oFilter.Value.toLowerCase()) != -1);\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if an annotation matches a filter based on custom filter requirements.\r\n\t * @param {object} oAnnotation - The annotation.\r\n\t * @param {object} oFilter - The filter.\r\n\t * @returns {bool} - The result of the match.\r\n\t */\r\n\tFilter.prototype.annotationMatchesFilter_Custom = function (oAnnotation, oFilter) {\r\n\t\treturn oFilter.Include == (g_oFilter.oMatchingFilters.filter(function (match) { return match.Key.toLowerCase() == oFilter.Key.toLowerCase() && match.Value.toLowerCase() == oFilter.Value.toLowerCase() && oAnnotation.g_szAuthorEmail.toLowerCase() == match.EmailAddress.toLowerCase() }).length > 0);\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if a filter is available.\r\n\t * @param {object} key - The filter key.\r\n\t * @param {object} value - The filter value.\r\n\t * @returns {bool} - If the filter is available.\r\n\t */\r\n\tFilter.prototype.isFilterAvailable = function (key, value) {\r\n\t\treturn g_oFilter.oMatchingFilters.filter(function (match) { return (match.Key.toLowerCase() === key.toLowerCase() && match.Value.toLowerCase() === value.toLowerCase()) }).length > 0 || g_oFilter.isContentFilter(key);\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if the filter is a content filter.\r\n\t * @param {object} key - The filter key.\r\n\t * @returns {bool} - If the filter is a content filter.\r\n\t */\r\n\tFilter.prototype.isContentFilter = function (key) {\r\n\t\treturn key.toLowerCase() == g_oFilter.c_szFilter_Key_AnnotationContent.toLowerCase() || key.toLowerCase() == g_oFilter.c_szFilter_Key_ReplyContent.toLowerCase();\r\n\t};\r\n\r\n\t/**\r\n\t * Checks if the filter is an active filter.\r\n\t * @param {object} key - The filter key.\r\n\t * @param {object} value - The filter value.\r\n\t * @returns {bool} - If the filter is an active filter.\r\n\t */\r\n\tFilter.prototype.isActiveFilter = function (key, value) {\r\n\t\treturn g_oFilter.oActiveFilters.filter(function (match) { return match.Key.toLowerCase() == key.toLowerCase() && match.Value.toLowerCase() == value.toLowerCase() }).length > 0;\r\n\t};\r\n\r\n\t/**\r\n\t * Gets the active filter index.\r\n\t * @param {int} id - The id of the active filter.\r\n\t * @returns {int} - The index of the active filter.\r\n\t */\r\n\tFilter.prototype.getActiveFilterIndex = function (id) {\r\n\t\t// Get the index array of the matching value.\r\n\t\tfor (var i = 0; i < g_oFilter.oActiveFilters.length; i++) {\r\n\t\t\tif (g_oFilter.oActiveFilters[i].Id === id) {\r\n\t\t\t\treturn i;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn -1;\r\n\t};\r\n\r\n\t/**\r\n\t * Gets the active filters that can be used as ORs.\r\n\t * @param {string} key - The key of the filter.\r\n\t * @param {string} value - The value of the filter.\r\n\t * @param {bool} include - If the value is included or excluded.\r\n\t * @returns {object} - The list of matching or filters.\r\n\t */\r\n\tFilter.prototype.getActiveOrFilters = function (key, value, include) {\r\n\t\treturn g_oFilter.oActiveFilters.filter(function (match) { return match.Key.toLowerCase() == key.toLowerCase() && match.Available });\r\n\t\t// The below could be used if we wanted NOT filters to be matched on AND rather than OR.\r\n\t\t//return g_oFilter.oActiveFilters.filter(function (match) { return match.Available && match.Key.toLowerCase() == key.toLowerCase() && (match.Value.toLowerCase() == value.toLowerCase() || (include && match.Include)) });\r\n\t};\r\n\r\n\t/**\r\n\t * Gets the matching filters.\r\n\t * @param {string} value - The value to be matched on.\r\n\t * @returns {object} - The list of matching filters.\r\n\t */\r\n\tFilter.prototype.getMatchingFilters = function (value) {\r\n\t\treturn g_oFilter.oFilters.filter(function (filter) { return filter.toLowerCase().indexOf(value.toLowerCase()) != -1 })\r\n\t};\r\n\r\n\t/**\r\n\t * Gets the matching values.\r\n\t * @param {string} value - The value to be matched on.\r\n\t * @returns {bool} - The list of matching values.\r\n\t */\r\n\tFilter.prototype.getMatchingValues = function (value) {\r\n\t\treturn g_oFilter.oFilterValues.filter(function (filterValue) { return filterValue.toLowerCase().indexOf(value.toLowerCase()) != -1 })\r\n\t};\r\n\r\n\t/**\r\n\t * Gets a list of matches by filter.\r\n\t * @param {string} value - The filter to match on.\r\n\t * @returns {object} - The list of matches.\r\n\t */\r\n\tFilter.prototype.getMatchesByFilter = function (value) {\r\n\t\treturn g_oFilter.oMatchingFilters.filter(function (match) { return match.Key.toLowerCase().indexOf(value.toLowerCase()) != -1 })\r\n\t};\r\n\r\n\t/**\r\n\t * Gets a list of matches by filters.\r\n\t * @param {object} values - The filters to match on.\r\n\t * @returns {object} - The list of matches.\r\n\t */\r\n\tFilter.prototype.getMatchesByFilters = function (values) {\r\n\t\tvar oLowerCaseValues = values.map(function (value) { return value.toLowerCase(); });\r\n\t\treturn g_oFilter.oMatchingFilters.filter(function (match) { return oLowerCaseValues.indexOf(match.Key.toLowerCase()) != -1 });\r\n\t};\r\n\r\n\t/**\r\n\t * Gets a list of matches by value.\r\n\t * @param {string} value - The value to match on.\r\n\t * @returns {object} - The list of matches.\r\n\t */\r\n\tFilter.prototype.getMatchesByValue = function (value) {\r\n\t\treturn g_oFilter.oMatchingFilters.filter(function (match) { return match.Value.toLowerCase().indexOf(value.toLowerCase()) != -1 })\r\n\t};\r\n\r\n\t/**\r\n\t * Gets a list of matches by values.\r\n\t * @param {string} values - The values to match on.\r\n\t * @returns {object} - The list of matches.\r\n\t */\r\n\tFilter.prototype.getMatchesByValues = function (values) {\r\n\t\tvar oLowerCaseValues = values.map(function (value) { return value.toLowerCase(); });\r\n\t\treturn g_oFilter.oMatchingFilters.filter(function (match) { return oLowerCaseValues.indexOf(match.Value.toLowerCase()) != -1 });\r\n\t};\r\n\r\n\t/**\r\n\t * Sorts the filters.\r\n\t * @param {any} a - The first filter to sort.\r\n\t * @param {any} b - The second filter to sort.\r\n\t * @returns {int} - The sort.\r\n\t */\r\n\tFilter.prototype.sortFilters = function (a, b) {\r\n\t\tif (a.Key < b.Key) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\telse if (a.Key > b.Key) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\telse if (a.Value < b.Value) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\telse if (a.Value > b.Value) {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Gets the filter list.\r\n\t * @returns {string} - The list of filters.\r\n\t */\r\n\tFilter.prototype.getFilterList = function () {\r\n\t\tvar szList = \"\";\r\n\t\tfor (var i = 0; i < g_oFilter.oFilters.length; i++) {\r\n\t\t\tszList += (i == 0 ? \"\" : \", \") + g_oFilter.oFilters[i];\r\n\t\t}\r\n\t\treturn szList;\r\n\t};\r\n\r\n\t/**\r\n\t * Counts the full annotations.\r\n\t * @param {object} oAnnotations - The list of annotations to be counted.\r\n\t * @returns {int} - The number of full annotations.\r\n\t */\r\n\tFilter.prototype.countFullAnnotations = function (oAnnotations) {\r\n\t\treturn oAnnotations.filter(function (match) { return match.g_iParentAnnotationId == 0 }).length;\r\n\t};\r\n\r\n\t/**\r\n\t * Removes any quote marks from the value to allow HTML use.\r\n\t * @param {string} value - The value to have the quotes removed.\r\n\t * @returns {string} - The updated value.\r\n\t */\r\n\tFilter.prototype.removeQuotesFromValue = function (value) {\r\n\t\treturn value.replace(/\"/g, \"%22\").replace(/'/g, \"%27\");\r\n\t}\r\n\r\n\t/**\r\n\t * Adds any quote marks to the value after HTML use.\r\n\t * @param {string} value - The value to have the quotes added.\r\n\t * @returns {string} - The updated value.\r\n\t */\r\n\tFilter.prototype.addQuotesToValue = function (value) {\r\n\t\treturn value.replace(/%22/g, \"\\\"\").replace(/%27/g, \"'\");\r\n\t}\r\n\r\n\t/**\r\n\t * Filter dropdown auto closing.\r\n\t */\r\n\t$(document).on('click', function (event) {\r\n\r\n\t\t// If the click is outside of filter menu and not on the filter textbox.\r\n\t\tif ($(event.target).parents(\"#divAnnListFilterBox\").length == 0 && event.target.id != \"txtAnnListFilterBox\") {\r\n\r\n\t\t\t// Hide the filter options dropdown.\r\n\t\t\t$(\"#divAnnListFilterBox\").hide();\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t * Add the Filter object to the window.\r\n\t */\r\n\twindow.Filter = Filter;\r\n\r\n}());"]}