",options:{classes:{},disabled:!1,create:null},_createWidget:function(i,s){s=t(s||this.defaultElement||this)[0],this.element=t(s),this.uuid=e++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=t(),this.hoverable=t(),this.focusable=t(),this.classesElementLookup={},s!==this&&(t.data(s,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===s&&this.destroy()}}),this.document=t(s.style?s.ownerDocument:s.document||s),this.window=t(this.document[0].defaultView||this.document[0].parentWindow)),this.options=t.widget.extend({},this.options,this._getCreateOptions(),i),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:t.noop,_create:t.noop,_init:t.noop,destroy:function(){var e=this;this._destroy(),t.each(this.classesElementLookup,function(t,i){e._removeClass(i,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:t.noop,widget:function(){return this.element},option:function(e,i){var s,n,o,a=e;if(0===arguments.length)return t.widget.extend({},this.options);if("string"==typeof e)if(a={},s=e.split("."),e=s.shift(),s.length){for(n=a[e]=t.widget.extend({},this.options[e]),o=0;s.length-1>o;o++)n[s[o]]=n[s[o]]||{},n=n[s[o]];if(e=s.pop(),1===arguments.length)return void 0===n[e]?null:n[e];n[e]=i}else{if(1===arguments.length)return void 0===this.options[e]?null:this.options[e];a[e]=i}return this._setOptions(a),this},_setOptions:function(t){var e;for(e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(e){var i,s,n;for(i in e)n=this.classesElementLookup[i],e[i]!==this.options.classes[i]&&n&&n.length&&(s=t(n.get()),this._removeClass(n,i),s.addClass(this._classes({element:s,keys:i,classes:e,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(e){function i(i,o){var a,r;for(r=0;i.length>r;r++)a=n.classesElementLookup[i[r]]||t(),a=e.add?t(t.unique(a.get().concat(e.element.get()))):t(a.not(e.element).get()),n.classesElementLookup[i[r]]=a,s.push(i[r]),o&&e.classes[i[r]]&&s.push(e.classes[i[r]])}var s=[],n=this;return e=t.extend({element:this.element,classes:this.options.classes||{}},e),this._on(e.element,{remove:"_untrackClassesElement"}),e.keys&&i(e.keys.match(/\S+/g)||[],!0),e.extra&&i(e.extra.match(/\S+/g)||[]),s.join(" ")},_untrackClassesElement:function(e){var i=this;t.each(i.classesElementLookup,function(s,n){-1!==t.inArray(e.target,n)&&(i.classesElementLookup[s]=t(n.not(e.target).get()))})},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){s="boolean"==typeof s?s:i;var n="string"==typeof t||null===t,o={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s};return o.element.toggleClass(this._classes(o),s),this},_on:function(e,i,s){var n,o=this;"boolean"!=typeof e&&(s=i,i=e,e=!1),s?(i=n=t(i),this.bindings=this.bindings.add(i)):(s=i,i=this.element,n=this.widget()),t.each(s,function(s,a){function r(){return e||o.options.disabled!==!0&&!t(this).hasClass("ui-state-disabled")?("string"==typeof a?o[a]:a).apply(o,arguments):void 0}"string"!=typeof a&&(r.guid=a.guid=a.guid||r.guid||t.guid++);var l=s.match(/^([\w:-]*)\s*(.*)$/),h=l[1]+o.eventNamespace,c=l[2];c?n.on(h,c,r):i.on(h,r)})},_off:function(e,i){i=(i||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.off(i).off(i),this.bindings=t(this.bindings.not(e).get()),this.focusable=t(this.focusable.not(e).get()),this.hoverable=t(this.hoverable.not(e).get())},_delay:function(t,e){function i(){return("string"==typeof t?s[t]:t).apply(s,arguments)}var s=this;return setTimeout(i,e||0)},_hoverable:function(e){this.hoverable=this.hoverable.add(e),this._on(e,{mouseenter:function(e){this._addClass(t(e.currentTarget),null,"ui-state-hover")},mouseleave:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-hover")}})},_focusable:function(e){this.focusable=this.focusable.add(e),this._on(e,{focusin:function(e){this._addClass(t(e.currentTarget),null,"ui-state-focus")},focusout:function(e){this._removeClass(t(e.currentTarget),null,"ui-state-focus")}})},_trigger:function(e,i,s){var n,o,a=this.options[e];if(s=s||{},i=t.Event(i),i.type=(e===this.widgetEventPrefix?e:this.widgetEventPrefix+e).toLowerCase(),i.target=this.element[0],o=i.originalEvent)for(n in o)n in i||(i[n]=o[n]);return this.element.trigger(i,s),!(t.isFunction(a)&&a.apply(this.element[0],[i].concat(s))===!1||i.isDefaultPrevented())}},t.each({show:"fadeIn",hide:"fadeOut"},function(e,i){t.Widget.prototype["_"+e]=function(s,n,o){"string"==typeof n&&(n={effect:n});var a,r=n?n===!0||"number"==typeof n?i:n.effect||i:e;n=n||{},"number"==typeof n&&(n={duration:n}),a=!t.isEmptyObject(n),n.complete=o,n.delay&&s.delay(n.delay),a&&t.effects&&t.effects.effect[r]?s[e](n):r!==e&&s[r]?s[r](n.duration,n.easing,o):s.queue(function(i){t(this)[e](),o&&o.call(s[0]),i()})}}),t.widget,t.extend(t.expr[":"],{data:t.expr.createPseudo?t.expr.createPseudo(function(e){return function(i){return!!t.data(i,e)}}):function(e,i,s){return!!t.data(e,s[3])}}),t.fn.scrollParent=function(e){var i=this.css("position"),s="absolute"===i,n=e?/(auto|scroll|hidden)/:/(auto|scroll)/,o=this.parents().filter(function(){var e=t(this);return s&&"static"===e.css("position")?!1:n.test(e.css("overflow")+e.css("overflow-y")+e.css("overflow-x"))}).eq(0);return"fixed"!==i&&o.length?o:t(this[0].ownerDocument||document)},t.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var s=!1;t(document).on("mouseup",function(){s=!1}),t.widget("ui.mouse",{version:"1.12.1",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(i){return!0===t.data(i.target,e.widgetName+".preventClickEvent")?(t.removeData(i.target,e.widgetName+".preventClickEvent"),i.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(e){if(!s){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(e),this._mouseDownEvent=e;var i=this,n=1===e.which,o="string"==typeof this.options.cancel&&e.target.nodeName?t(e.target).closest(this.options.cancel).length:!1;return n&&!o&&this._mouseCapture(e)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(e)!==!1,!this._mouseStarted)?(e.preventDefault(),!0):(!0===t.data(e.target,this.widgetName+".preventClickEvent")&&t.removeData(e.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return i._mouseMove(t)},this._mouseUpDelegate=function(t){return i._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),e.preventDefault(),s=!0,!0)):!0}},_mouseMove:function(e){if(this._mouseMoved){if(t.ui.ie&&(!document.documentMode||9>document.documentMode)&&!e.button)return this._mouseUp(e);if(!e.which)if(e.originalEvent.altKey||e.originalEvent.ctrlKey||e.originalEvent.metaKey||e.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(e)}return(e.which||e.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(e),e.preventDefault()):(this._mouseDistanceMet(e)&&this._mouseDelayMet(e)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,e)!==!1,this._mouseStarted?this._mouseDrag(e):this._mouseUp(e)),!this._mouseStarted)},_mouseUp:function(e){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,e.target===this._mouseDownEvent.target&&t.data(e.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(e)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,s=!1,e.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),t.widget("ui.sortable",t.ui.mouse,{version:"1.12.1",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return t>=e&&e+i>t},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var e=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),t.each(this.items,function(){e._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;t>=0;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(e,i){var s=null,n=!1,o=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(e),t(e.target).parents().each(function(){return t.data(this,o.widgetName+"-item")===o?(s=t(this),!1):void 0}),t.data(e.target,o.widgetName+"-item")===o&&(s=t(e.target)),s?!this.options.handle||i||(t(this.options.handle,s).find("*").addBack().each(function(){this===e.target&&(n=!0)}),n)?(this.currentItem=s,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(e,i,s){var n,o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(e),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},t.extend(this.offset,{click:{left:e.pageX-this.offset.left,top:e.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(e),this.originalPageX=e.pageX,this.originalPageY=e.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&"auto"!==a.cursor&&(o=this.document.find("body"),this.storedCursor=o.css("cursor"),o.css("cursor",a.cursor),this.storedStylesheet=t("").appendTo(o)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",e,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!s)for(n=this.containers.length-1;n>=0;n--)this.containers[n]._trigger("activate",e,this._uiHash(this));return t.ui.ddmanager&&(t.ui.ddmanager.current=this),t.ui.ddmanager&&!a.dropBehaviour&&t.ui.ddmanager.prepareOffsets(this,e),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this._mouseDrag(e),!0},_mouseDrag:function(e){var i,s,n,o,a=this.options,r=!1;for(this.position=this._generatePosition(e),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-e.pageY=0;i--)if(s=this.items[i],n=s.item[0],o=this._intersectsWithPointer(s),o&&s.instance===this.currentContainer&&n!==this.currentItem[0]&&this.placeholder[1===o?"next":"prev"]()[0]!==n&&!t.contains(this.placeholder[0],n)&&("semi-dynamic"===this.options.type?!t.contains(this.element[0],n):!0)){if(this.direction=1===o?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(s))break;this._rearrange(e,s),this._trigger("change",e,this._uiHash());break}return this._contactContainers(e),t.ui.ddmanager&&t.ui.ddmanager.drag(this,e),this._trigger("sort",e,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(e,i){if(e){if(t.ui.ddmanager&&!this.options.dropBehaviour&&t.ui.ddmanager.drop(this,e),this.options.revert){var s=this,n=this.placeholder.offset(),o=this.options.axis,a={};o&&"x"!==o||(a.left=n.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),o&&"y"!==o||(a.top=n.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,t(this.helper).animate(a,parseInt(this.options.revert,10)||500,function(){s._clear(e)})}else this._clear(e,i);return!1}},cancel:function(){if(this.dragging){this._mouseUp(new t.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var e=this.containers.length-1;e>=0;e--)this.containers[e]._trigger("deactivate",null,this._uiHash(this)),this.containers[e].containerCache.over&&(this.containers[e]._trigger("out",null,this._uiHash(this)),this.containers[e].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),t.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?t(this.domPosition.prev).after(this.currentItem):t(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},t(i).each(function(){var i=(t(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);i&&s.push((e.key||i[1]+"[]")+"="+(e.key&&e.expression?i[1]:i[2]))}),!s.length&&e.key&&s.push(e.key+"="),s.join("&")},toArray:function(e){var i=this._getItemsAsjQuery(e&&e.connected),s=[];return e=e||{},i.each(function(){s.push(t(e.item||this).attr(e.attribute||"id")||"")}),s},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,u="x"===this.options.axis||s+h>r&&l>s+h,d="y"===this.options.axis||e+c>o&&a>e+c,p=u&&d;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?p:e+this.helperProportions.width/2>o&&a>i-this.helperProportions.width/2&&s+this.helperProportions.height/2>r&&l>n-this.helperProportions.height/2},_intersectsWithPointer:function(t){var e,i,s="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),n="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width),o=s&&n;return o?(e=this._getDragVerticalDirection(),i=this._getDragHorizontalDirection(),this.floating?"right"===i||"down"===e?2:1:e&&("down"===e?2:1)):!1},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this._getDragVerticalDirection(),n=this._getDragHorizontalDirection();return this.floating&&n?"right"===n&&i||"left"===n&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!==t&&(t>0?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!==t&&(t>0?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(e){function i(){r.push(this)}var s,n,o,a,r=[],l=[],h=this._connectWith();if(h&&e)for(s=h.length-1;s>=0;s--)for(o=t(h[s],this.document[0]),n=o.length-1;n>=0;n--)a=t.data(o[n],this.widgetFullName),a&&a!==this&&!a.options.disabled&&l.push([t.isFunction(a.options.items)?a.options.items.call(a.element):t(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(l.push([t.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):t(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),s=l.length-1;s>=0;s--)l[s][0].each(i);return t(r)},_removeCurrentsFromItems:function(){var e=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=t.grep(this.items,function(t){for(var i=0;e.length>i;i++)if(e[i]===t.item[0])return!1;return!0})},_refreshItems:function(e){this.items=[],this.containers=[this];var i,s,n,o,a,r,l,h,c=this.items,u=[[t.isFunction(this.options.items)?this.options.items.call(this.element[0],e,{item:this.currentItem}):t(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(i=d.length-1;i>=0;i--)for(n=t(d[i],this.document[0]),s=n.length-1;s>=0;s--)o=t.data(n[s],this.widgetFullName),o&&o!==this&&!o.options.disabled&&(u.push([t.isFunction(o.options.items)?o.options.items.call(o.element[0],e,{item:this.currentItem}):t(o.options.items,o.element),o]),this.containers.push(o));for(i=u.length-1;i>=0;i--)for(a=u[i][1],r=u[i][0],s=0,h=r.length;h>s;s++)l=t(r[s]),l.data(this.widgetName+"-item",a),c.push({item:l,instance:a,width:0,height:0,left:0,top:0})},refreshPositions:function(e){this.floating=this.items.length?"x"===this.options.axis||this._isFloating(this.items[0].item):!1,this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var i,s,n,o;for(i=this.items.length-1;i>=0;i--)s=this.items[i],s.instance!==this.currentContainer&&this.currentContainer&&s.item[0]!==this.currentItem[0]||(n=this.options.toleranceElement?t(this.options.toleranceElement,s.item):s.item,e||(s.width=n.outerWidth(),s.height=n.outerHeight()),o=n.offset(),s.left=o.left,s.top=o.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(i=this.containers.length-1;i>=0;i--)o=this.containers[i].element.offset(),this.containers[i].containerCache.left=o.left,this.containers[i].containerCache.top=o.top,this.containers[i].containerCache.width=this.containers[i].element.outerWidth(),this.containers[i].containerCache.height=this.containers[i].element.outerHeight();return this},_createPlaceholder:function(e){e=e||this;var i,s=e.options;s.placeholder&&s.placeholder.constructor!==String||(i=s.placeholder,s.placeholder={element:function(){var s=e.currentItem[0].nodeName.toLowerCase(),n=t("",e.document[0]);return e._addClass(n,"ui-sortable-placeholder",i||e.currentItem[0].className)._removeClass(n,"ui-sortable-helper"),"tbody"===s?e._createTrPlaceholder(e.currentItem.find("tr").eq(0),t("",e.document[0]).appendTo(n)):"tr"===s?e._createTrPlaceholder(e.currentItem,n):"img"===s&&n.attr("src",e.currentItem.attr("src")),i||n.css("visibility","hidden"),n},update:function(t,n){(!i||s.forcePlaceholderSize)&&(n.height()||n.height(e.currentItem.innerHeight()-parseInt(e.currentItem.css("paddingTop")||0,10)-parseInt(e.currentItem.css("paddingBottom")||0,10)),n.width()||n.width(e.currentItem.innerWidth()-parseInt(e.currentItem.css("paddingLeft")||0,10)-parseInt(e.currentItem.css("paddingRight")||0,10)))}}),e.placeholder=t(s.placeholder.element.call(e.element,e.currentItem)),e.currentItem.after(e.placeholder),s.placeholder.update(e,e.placeholder)},_createTrPlaceholder:function(e,i){var s=this;e.children().each(function(){t(" ",s.document[0]).attr("colspan",t(this).attr("colspan")||1).appendTo(i)})},_contactContainers:function(e){var i,s,n,o,a,r,l,h,c,u,d=null,p=null;for(i=this.containers.length-1;i>=0;i--)if(!t.contains(this.currentItem[0],this.containers[i].element[0]))if(this._intersectsWith(this.containers[i].containerCache)){if(d&&t.contains(this.containers[i].element[0],d.element[0]))continue;d=this.containers[i],p=i}else this.containers[i].containerCache.over&&(this.containers[i]._trigger("out",e,this._uiHash(this)),this.containers[i].containerCache.over=0);if(d)if(1===this.containers.length)this.containers[p].containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1);else{for(n=1e4,o=null,c=d.floating||this._isFloating(this.currentItem),a=c?"left":"top",r=c?"width":"height",u=c?"pageX":"pageY",s=this.items.length-1;s>=0;s--)t.contains(this.containers[p].element[0],this.items[s].item[0])&&this.items[s].item[0]!==this.currentItem[0]&&(l=this.items[s].item.offset()[a],h=!1,e[u]-l>this.items[s][r]/2&&(h=!0),n>Math.abs(e[u]-l)&&(n=Math.abs(e[u]-l),o=this.items[s],this.direction=h?"up":"down"));if(!o&&!this.options.dropOnEmpty)return;if(this.currentContainer===this.containers[p])return this.currentContainer.containerCache.over||(this.containers[p]._trigger("over",e,this._uiHash()),this.currentContainer.containerCache.over=1),void 0;o?this._rearrange(e,o,null,!0):this._rearrange(e,null,this.containers[p].element,!0),this._trigger("change",e,this._uiHash()),this.containers[p]._trigger("change",e,this._uiHash(this)),this.currentContainer=this.containers[p],this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[p]._trigger("over",e,this._uiHash(this)),this.containers[p].containerCache.over=1}},_createHelper:function(e){var i=this.options,s=t.isFunction(i.helper)?t(i.helper.apply(this.element[0],[e,this.currentItem])):"clone"===i.helper?this.currentItem.clone():this.currentItem;return s.parents("body").length||t("parent"!==i.appendTo?i.appendTo:this.currentItem[0].parentNode)[0].appendChild(s[0]),s[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!s[0].style.width||i.forceHelperSize)&&s.width(this.currentItem.width()),(!s[0].style.height||i.forceHelperSize)&&s.height(this.currentItem.height()),s},_adjustOffsetFromHelper:function(e){"string"==typeof e&&(e=e.split(" ")),t.isArray(e)&&(e={left:+e[0],top:+e[1]||0}),"left"in e&&(this.offset.click.left=e.left+this.margins.left),"right"in e&&(this.offset.click.left=this.helperProportions.width-e.right+this.margins.left),"top"in e&&(this.offset.click.top=e.top+this.margins.top),"bottom"in e&&(this.offset.click.top=this.helperProportions.height-e.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var e=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])&&(e.left+=this.scrollParent.scrollLeft(),e.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&t.ui.ie)&&(e={top:0,left:0}),{top:e.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:e.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var e,i,s,n=this.options;"parent"===n.containment&&(n.containment=this.helper[0].parentNode),("document"===n.containment||"window"===n.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===n.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===n.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(n.containment)||(e=t(n.containment)[0],i=t(n.containment).offset(),s="hidden"!==t(e).css("overflow"),this.containment=[i.left+(parseInt(t(e).css("borderLeftWidth"),10)||0)+(parseInt(t(e).css("paddingLeft"),10)||0)-this.margins.left,i.top+(parseInt(t(e).css("borderTopWidth"),10)||0)+(parseInt(t(e).css("paddingTop"),10)||0)-this.margins.top,i.left+(s?Math.max(e.scrollWidth,e.offsetWidth):e.offsetWidth)-(parseInt(t(e).css("borderLeftWidth"),10)||0)-(parseInt(t(e).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,i.top+(s?Math.max(e.scrollHeight,e.offsetHeight):e.offsetHeight)-(parseInt(t(e).css("borderTopWidth"),10)||0)-(parseInt(t(e).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(e,i){i||(i=this.position);var s="absolute"===e?1:-1,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return{top:i.top+this.offset.relative.top*s+this.offset.parent.top*s-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop())*s,left:i.left+this.offset.relative.left*s+this.offset.parent.left*s-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())*s} },_generatePosition:function(e){var i,s,n=this.options,o=e.pageX,a=e.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&t.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(e.pageX-this.offset.click.left this.containment[2]&&(o=this.containment[2]+this.offset.click.left),e.pageY-this.offset.click.top>this.containment[3]&&(a=this.containment[3]+this.offset.click.top)),n.grid&&(i=this.originalPageY+Math.round((a-this.originalPageY)/n.grid[1])*n.grid[1],a=this.containment?i-this.offset.click.top>=this.containment[1]&&i-this.offset.click.top =this.containment[1]?i-n.grid[1]:i+n.grid[1]:i,s=this.originalPageX+Math.round((o-this.originalPageX)/n.grid[0])*n.grid[0],o=this.containment?s-this.offset.click.left>=this.containment[0]&&s-this.offset.click.left =this.containment[0]?s-n.grid[0]:s+n.grid[0]:s)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){function i(t,e,i){return function(s){i._trigger(t,s,e._uiHash(e))}}this.reverting=!1;var s,n=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(s in this._storedCSS)("auto"===this._storedCSS[s]||"static"===this._storedCSS[s])&&(this._storedCSS[s]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!e&&n.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||n.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(n.push(function(t){this._trigger("remove",t,this._uiHash())}),n.push(function(t){return function(e){t._trigger("receive",e,this._uiHash(this))}}.call(this,this.currentContainer)),n.push(function(t){return function(e){t._trigger("update",e,this._uiHash(this))}}.call(this,this.currentContainer)))),s=this.containers.length-1;s>=0;s--)e||n.push(i("deactivate",this,this.containers[s])),this.containers[s].containerCache.over&&(n.push(i("out",this,this.containers[s])),this.containers[s].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(s=0;n.length>s;s++)n[s].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){t.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(e){var i=e||this;return{helper:i.helper,placeholder:i.placeholder||t([]),position:i.position,originalPosition:i.originalPosition,offset:i.positionAbs,item:i.currentItem,sender:e?e.element:null}}})});
',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(a.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusin"==b.type?"focus":"hover"]=!0),c.tip().hasClass("in")||"in"==c.hoverState?void(c.hoverState="in"):(clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.isInStateTrue=function(){for(var a in this.inState)if(this.inState[a])return!0;return!1},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);if(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),b instanceof a.Event&&(c.inState["focusout"==b.type?"focus":"hover"]=!1),!c.isInStateTrue())return clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.getPosition(this.$viewport);h="bottom"==h&&k.bottom+m>o.bottom?"top":"top"==h&&k.top-m o.width?"left":"left"==h&&k.left-l g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j g.right&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){if(!this.$tip&&(this.$tip=a(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),b?(c.inState.click=!c.inState.click,c.isInStateTrue()?c.enter(c):c.leave(c)):c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type),a.$tip&&a.$tip.detach(),a.$tip=null,a.$arrow=null,a.$viewport=null,a.$element=null})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;!e&&/destroy|hide/.test(b)||(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.7",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'

'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.7",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b =e[a]&&(void 0===e[a+1]||b .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.7",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return e =a-d&&"bottom"},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=Math.max(a(document).height(),a(document.body).height());"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery); ",{"class":"jq-toast-single"}),o+=' ',this.options.allowToastClose&&(o+='×'),this.options.text instanceof Array){this.options.heading&&(o+='

'+this.options.heading+"

"),o+='
    ';for(var i=0;i '+this.options.text[i]+"";o+=""}else this.options.heading&&(o+='

    '+this.options.heading+"

    "),o+=this.options.text;this._toastEl.html(o),this.options.bgColor!==!1&&this._toastEl.css("background-color",this.options.bgColor),this.options.textColor!==!1&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),this.options.icon!==!1&&(this._toastEl.addClass("jq-has-icon"),-1!==t.inArray(this.options.icon,this._defaultIcons)&&this._toastEl.addClass("jq-icon-"+this.options.icon))},position:function(){"string"==typeof this.options.position&&-1!==t.inArray(this.options.position,this._positionClasses)?"bottom-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,bottom:20}):"top-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:20}):"mid-center"===this.options.position?this._container.css({left:t(o).outerWidth()/2-this._container.outerWidth()/2,top:t(o).outerHeight()/2-this._container.outerHeight()/2}):this._container.addClass(this.options.position):"object"==typeof this.options.position?this._container.css({top:this.options.position.top?this.options.position.top:"auto",bottom:this.options.position.bottom?this.options.position.bottom:"auto",left:this.options.position.left?this.options.position.left:"auto",right:this.options.position.right?this.options.position.right:"auto"}):this._container.addClass("bottom-left")},bindToast:function(){var t=this;this._toastEl.on("afterShown",function(){t.processLoader()}),this._toastEl.find(".close-jq-toast-single").on("click",function(o){o.preventDefault(),"fade"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut(function(){t._toastEl.trigger("afterHidden")})):"slide"===t.options.showHideTransition?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp(function(){t._toastEl.trigger("afterHidden")})):(t._toastEl.trigger("beforeHide"),t._toastEl.hide(function(){t._toastEl.trigger("afterHidden")}))}),"function"==typeof this.options.beforeShow&&this._toastEl.on("beforeShow",function(){t.options.beforeShow()}),"function"==typeof this.options.afterShown&&this._toastEl.on("afterShown",function(){t.options.afterShown()}),"function"==typeof this.options.beforeHide&&this._toastEl.on("beforeHide",function(){t.options.beforeHide()}),"function"==typeof this.options.afterHidden&&this._toastEl.on("afterHidden",function(){t.options.afterHidden()})},addToDom:function(){var o=t(".jq-toast-wrap");if(0===o.length?(o=t(" ",{"class":"jq-toast-wrap"}),t("body").append(o)):(!this.options.stack||isNaN(parseInt(this.options.stack,10)))&&o.empty(),o.find(".jq-toast-single:hidden").remove(),o.append(this._toastEl),this.options.stack&&!isNaN(parseInt(this.options.stack),10)){var i=o.find(".jq-toast-single").length,s=i-this.options.stack;s>0&&t(".jq-toast-wrap").find(".jq-toast-single").slice(0,s).remove()}this._container=o},canAutoHide:function(){return this.options.hideAfter!==!1&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||this.options.loader===!1)return!1;var t=this._toastEl.find(".jq-toast-loader"),o=(this.options.hideAfter-400)/1e3+"s",i=this.options.loaderBg,s=t.attr("style")||"";s=s.substring(0,s.indexOf("-webkit-transition")),s+="-webkit-transition: width "+o+" ease-in; -o-transition: width "+o+" ease-in; transition: width "+o+" ease-in; background-color: "+i+";",t.attr("style",s).addClass("jq-toast-loaded")},animate:function(){var t=this;if(this._toastEl.hide(),this._toastEl.trigger("beforeShow"),"fade"===this.options.showHideTransition.toLowerCase()?this._toastEl.fadeIn(function(){t._toastEl.trigger("afterShown")}):"slide"===this.options.showHideTransition.toLowerCase()?this._toastEl.slideDown(function(){t._toastEl.trigger("afterShown")}):this._toastEl.show(function(){t._toastEl.trigger("afterShown")}),this.canAutoHide()){var t=this;o.setTimeout(function(){"fade"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.fadeOut(function(){t._toastEl.trigger("afterHidden")})):"slide"===t.options.showHideTransition.toLowerCase()?(t._toastEl.trigger("beforeHide"),t._toastEl.slideUp(function(){t._toastEl.trigger("afterHidden")})):(t._toastEl.trigger("beforeHide"),t._toastEl.hide(function(){t._toastEl.trigger("afterHidden")}))},this.options.hideAfter)}},reset:function(o){"all"===o?t(".jq-toast-wrap").remove():this._toastEl.remove()},update:function(t){this.prepareOptions(t,this.options),this.setup(),this.bindToast()}};t.toast=function(t){var o=Object.create(i);return o.init(t,this),{reset:function(t){o.reset(t)},update:function(t){o.update(t)}}},t.toast.options={text:"",heading:"",showHideTransition:"fade",allowToastClose:!0,hideAfter:3e3,loader:!0,loaderBg:"#9EC600",stack:5,position:"bottom-left",bgColor:!1,textColor:!1,textAlign:"left",icon:!1,beforeShow:function(){},afterShown:function(){},beforeHide:function(){},afterHidden:function(){}}}(jQuery,window,document);

    " + journal + " (" + year + ")

    "; content += "

    " + authors.join(", ") + "

    "; content += '

    View paper

    '; // Make the popover el.popover({ title: title, content: content, html: true, trigger: "focus", placement: "auto left", }); el.popover("show"); }).fail(function () { el.addClass("no-doi-details"); window.open(el.attr("href"), "_blank"); }); }); }); Copied!'); setTimeout(function () { btn.removeClass("active").html(' Copy table'); }, 2000); }); // Make table headers fixed when table body scrolls (use CSS transforms) // http://stackoverflow.com/a/25902860/713980 $(".mqc-table-responsive").scroll(function () { $(this) .find("thead") .css("transform", "translate(0," + $(this).scrollTop() + "px)"); }); // Table header-specific bootstrap tooltips $(".mqc_table_tooltip").tooltip({ container: "body" }); // Expand tables to full height $(".mqc-table-expand").click(function () { if ($(this).find("span").hasClass("glyphicon-chevron-down")) { $(this).parent().find(".mqc-table-responsive").css("max-height", "none"); $(this).find("span").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"); } else { $(this).parent().find(".mqc-table-responsive").css("max-height", "400px"); $(this).find("span").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-down"); } }); /////// COLUMN CONFIG // show + hide columns $(".mqc_table_col_visible").change(function () { var target = $(this).data("target"); mqc_table_col_updateVisible(target); }); // Bulk set visible / hidden $(".mqc_configModal_bulkVisible").click(function (e) { e.preventDefault(); var target = $(this).data("target"); var visible = $(this).data("action") == "showAll"; $(target + "_configModal_table tbody .mqc_table_col_visible").prop("checked", visible); mqc_table_col_updateVisible(target); }); function mqc_table_col_updateVisible(target) { $(target + "_configModal_table .mqc_table_col_visible").each(function () { var cclass = $(this).val(); if ($(this).is(":checked")) { $(target + " ." + cclass).removeClass("hidden"); $(target + "_configModal_table ." + cclass).removeClass("text-muted"); } else { $(target + " ." + cclass).addClass("hidden"); $(target + "_configModal_table ." + cclass).addClass("text-muted"); } }); // Hide empty rows $(target + " tbody tr").show(); $(target + " tbody tr").each(function () { var hasVal = false; $(this) .find("td:visible") .each(function () { if (!$(this).hasClass("sorthandle") && $(this).text() !== "") { hasVal = true; } }); if (!hasVal) { $(this).hide(); } }); // Update counts $(target + "_numrows").text($(target + " tbody tr:visible").length); $(target + "_numcols").text($(target + " thead th:visible").length - 1); } // Make rows in MultiQC tables sortable $(".mqc_table.mqc_sortable tbody").sortable({ handle: ".sorthandle", helper: function fixWidthHelper(e, ui) { ui.children().each(function () { $(this).width($(this).width()); }); return ui; }, }); // Change order of columns $(".mqc_configModal_table").on("sortstop", function (e, ui) { change_mqc_table_col_order($(this)); }); $(".mqc_configModal_table").bind("sortEnd", function () { change_mqc_table_col_order($(this)); }); // TOOLBOX LISTENERS // highlight samples $(document).on("mqc_highlights", function (e, f_texts, f_cols, regex_mode) { $(".mqc_table_sortHighlight").hide(); $(".mqc_table tbody th").removeClass("highlighted").removeData("highlight"); $(".mqc_table tbody th").each(function (i) { var th = $(this); var thtext = $(this).text(); var thiscol = "#333"; $.each(f_texts, function (idx, f_text) { if ((regex_mode && thtext.match(f_text)) || (!regex_mode && thtext.indexOf(f_text) > -1)) { thiscol = f_cols[idx]; th.addClass("highlighted").data("highlight", idx); $(".mqc_table_sortHighlight").show(); } }); $(this).css("color", thiscol); }); }); // Sort MultiQC tables by highlight $(".mqc_table_sortHighlight").click(function (e) { e.preventDefault(); var target = $(this).data("target"); // collect highlighted rows var hrows = $(target + " tbody th.highlighted") .parent() .detach(); hrows = hrows.sort(function (a, b) { return $(a).find("th").data("highlight") - $(b).find("th").data("highlight"); }); if ($(this).data("direction") == "desc") { hrows = hrows.get().reverse(); $(target + " tbody").prepend(hrows); $(this).data("direction", "asc"); } else { $(target + " tbody").append(hrows); $(this).data("direction", "desc"); } }); // Rename samples $(document).on("mqc_renamesamples", function (e, f_texts, t_texts, regex_mode) { $(".mqc_table tbody th").each(function () { var s_name = String($(this).data("original-sn")); $.each(f_texts, function (idx, f_text) { if (regex_mode) { var re = new RegExp(f_text, "g"); s_name = s_name.replace(re, t_texts[idx]); } else { s_name = s_name.replace(f_text, t_texts[idx]); } }); $(this).text(s_name); }); }); // Hide samples $(document).on("mqc_hidesamples", function (e, f_texts, regex_mode) { // Hide rows in MultiQC tables $(".mqc_table tbody th").each(function () { var match = false; var hfilter = $(this).text(); $.each(f_texts, function (idx, f_text) { if ((regex_mode && hfilter.match(f_text)) || (!regex_mode && hfilter.indexOf(f_text) > -1)) { match = true; } }); if (window.mqc_hide_mode == "show") { match = !match; } if (match) { $(this).parent().hide().addClass("hidden"); } else { $(this).parent().show().removeClass("hidden"); } }); $(".mqc_table_numrows").each(function () { var tid = $(this).attr("id").replace("_numrows", ""); $(this).text($("#" + tid + " tbody tr:visible").length); }); // Hide empty columns $(".mqc_table").each(function () { var table = $(this); var gsthidx = 0; table.find("thead th, tbody tr td").show(); table.find("thead th").each(function () { if (gsthidx == 0) { gsthidx += 1; return true; } var count = 0; var empties = 0; table .find("tbody tr td:nth-child(" + (gsthidx + 2) + ")") .filter(":visible") .each(function () { count += 1; if ($(this).text() == "") { empties += 1; } }); if (count > 0 && count == empties) { $(this).hide(); table.find("tbody tr td:nth-child(" + (gsthidx + 2) + ")").hide(); } gsthidx += 1; }); }); $(".mqc_table_numcols").each(function () { var tid = $(this).attr("id").replace("_numcols", ""); $(this).text($("#" + tid + " thead th:visible").length - 1); }); }); } // End of check for table // Table Scatter Modal $("#tableScatterForm").submit(function (e) { e.preventDefault(); }); $(".mqc_table_makeScatter").click(function (e) { // Reset dropdowns if ($("#tableScatter_tid").val() != $(this).data("table")) { $("#tableScatter_col1, #tableScatter_col2").html(''); // Add columns to dropdowns $($(this).data("table") + " thead tr th").each(function (e) { var c_id = $(this).attr("id"); if (c_id != undefined) { var c_name = $(this).attr("data-namespace") + ": " + $(this).text(); $("#tableScatter_col1, #tableScatter_col2").append(' Please select two table columns.").addClass("not_rendered"); } }); $("#tableScatterForm select").change(function (e) { var tid = $("#tableScatter_tid").val(); var col1 = $("#tableScatter_col1").val().replace("header_", ""); var col2 = $("#tableScatter_col2").val().replace("header_", ""); var col1_name = $("#tableScatter_col1 option:selected").text(); var col2_name = $("#tableScatter_col2 option:selected").text(); var col1_max = parseFloat($(tid + " thead th#header_" + col1).data("dmax")); var col1_min = parseFloat($(tid + " thead th#header_" + col1).data("dmin")); var col2_max = parseFloat($(tid + " thead th#header_" + col2).data("dmax")); var col2_min = parseFloat($(tid + " thead th#header_" + col2).data("dmin")); if (isNaN(col1_max)) { col1_max = undefined; } if (isNaN(col1_min)) { col1_min = undefined; } if (isNaN(col2_max)) { col2_max = undefined; } if (isNaN(col2_min)) { col2_min = undefined; } if (col1 != "" && col2 != "") { $("#tableScatterPlot").html("loading.."); if ($(tid).attr("data-title")) { plot_title = $(tid).attr("data-title"); } else { plot_title = tid.replace(/^#/, "").replace(/_/g, " "); } // Get the data values mqc_plots["tableScatterPlot"] = { plot_type: "scatter", config: { id: "tableScatter_" + tid, title: plot_title, xlab: col1_name, ylab: col2_name, xmin: col1_min, xmax: col1_max, ymin: col2_min, ymax: col2_max, }, datasets: [[]], }; $(tid + " tbody tr").each(function (e) { var s_name = $(this).children("th.rowheader").text(); var val_1 = $(this) .children("td." + col1) .text() .replace(/[^\d\.]/g, ""); var val_2 = $(this) .children("td." + col2) .text() .replace(/[^\d\.]/g, ""); if (!isNaN(parseFloat(val_1)) && isFinite(val_1) && !isNaN(parseFloat(val_2)) && isFinite(val_2)) { mqc_plots["tableScatterPlot"]["datasets"][0].push({ name: s_name, x: parseFloat(val_1), y: parseFloat(val_2), }); } }); if (Object.keys(mqc_plots["tableScatterPlot"]["datasets"][0]).length > 0) { if (plot_scatter_plot("tableScatterPlot") == false) { $("#tableScatterPlot").html("Error: Something went wrong when plotting the scatter plot."); $("#tableScatterPlot").addClass("not_rendered"); } else { $("#tableScatterPlot").removeClass("not_rendered"); } } else { $("#tableScatterPlot").html("Error: No data pairs found for these columns."); $("#tableScatterPlot").addClass("not_rendered"); } } else { $("#tableScatterPlot").html("Please select two table columns."); $("#tableScatterPlot").addClass("not_rendered"); } }); }); // Reorder columns in MultiQC tables. // Note: Don't have to worry about floating headers, as 'Configure Columns' // button is only visible when this is hidden. Ace! function change_mqc_table_col_order(table) { // Find the targets of this sorting var tid = table.attr("id"); var target = tid.replace("_configModal_table", ""); // Collect the desired order of columns var classes = []; $("#" + tid + " tbody tr").each(function () { classes.push($(this).attr("class")); }); // Go through each row $("#" + target + " tr").each(function () { var cols = {}; var row = $(this); // Detach any cell that matches a known class from above row.find("td, th").each(function () { var cell = $(this); $.each(classes, function (idx, c) { if (cell.hasClass(c)) { cols[c] = cell.detach(); } }); }); // Insert detached cells back in the order given in the sorted table for (var idx in classes) { var c = classes[idx]; if (cols[c] !== undefined) { row.append(cols[c]); } } }); } Export Plot', symbol: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAXNJREFUOBHNUsuqwkAMPX2g4kJd+wOCuKgL//8btAXXIogvtOhCax9xzkBqveLg8gamHZKck+RMgP9mnquh5XIpaZrC8zx0Oh1EUfQ1P3QRkeR6vcL3fdxuN1cqnERhGIKHREEQOIl8V1RE0DyuXCeRC/g39iFeHMdSlqUV+HK5oCgKeyew1+vZEauqwnQ6fcN+aJTnObbbLdrtttWGL0bjiBT/fr9jMBhYX/PzxsrA4/EQ8+zY7/dotVpgdRoFZ5F+v4/ZbPaBCw+Hg8znc5s8Ho8J9kxV04DAxCwZg6aAJWEO7XQ6yWKxQJZlGI1Gr+fXEZhkls8zCTUZfexkMpmg2+2+dUMci1qNlKS5K0YjC0iSRDgSO1EfiblfxOmpxaaDr3Q8HqWpC1+NFbnhu91OSMKC5/OZ19pqIoq5Xq+xWq3qIAnoZxFdCQ3Sx65o9WisqsYENb0rofr1T3Iexi1qs9mIgjTp1z9JhsPhq/qvwG95Tw3FukJt8JteAAAAAElFTkSuQmCC)", symbolX: 23, symbolY: 19, }, }, }, }); // Render plots on page load $(".hc-plot.not_rendered:visible:not(.gt_max_num_ds)").each(function () { var target = $(this).attr("id"); // Only one point per dataset, so multiply limit by arbitrary number. var max_num = mqc_config["num_datasets_plot_limit"] * 50; // Deferring each plot call prevents browser from locking up setTimeout(function () { plot_graph(target, undefined, max_num); if ($(".hc-plot.not_rendered:visible:not(.gt_max_num_ds)").length == 0) { $(".mqc_loading_warning").hide(); } }, 50); }); if ($(".hc-plot.not_rendered:visible:not(.gt_max_num_ds)").length == 0) { $(".mqc_loading_warning").hide(); } // Render a plot when clicked $("body").on("click", ".render_plot", function (e) { var target = $(this).parent().attr("id"); plot_graph(target); if ($(".hc-plot.not_rendered").length == 0) { $("#mqc-warning-many-samples").hide(); } }); // Render all plots from header $("#mqc-render-all-plots").click(function () { $(".hc-plot.not_rendered").each(function () { var target = $(this).attr("id"); plot_graph(target); }); $("#mqc-warning-many-samples").hide(); }); // Replot graphs when something changed in filters $(document).on("mqc_highlights mqc_renamesamples mqc_hidesamples", function () { // Replot graphs $(".hc-plot:not(.not_rendered)").each(function () { var target = $(this).attr("id"); plot_graph(target); }); }); // Switch a HighCharts axis or data source $(".hc_switch_group button").click(function (e) { e.preventDefault(); $(this).siblings("button.active").removeClass("active"); $(this).addClass("active"); var target = $(this).data("target"); var action = $(this).data("action"); // Switch between values and percentages if (action == "set_percent" || action == "set_numbers") { var sym = action == "set_percent" ? "%" : "#"; var stack_type = action == "set_percent" ? "percent" : "normal"; mqc_plots[target]["config"]["stacking"] = stack_type; mqc_plots[target]["config"]["ytype"] = "linear"; // Workaround for manually set y-axis maximums on the % stacked plot if (action == "set_percent") { mqc_plots[target]["config"]["old_ymax"] = mqc_plots[target]["config"]["ymax"]; delete mqc_plots[target]["config"]["ymax"]; } else { if ("old_ymax" in mqc_plots[target]["config"]) { mqc_plots[target]["config"]["ymax"] = mqc_plots[target]["config"]["old_ymax"]; } } plot_graph(target); var ylab = $(this).data("ylab"); if (ylab != undefined) { $("#" + target) .highcharts() .yAxis[0].setTitle({ text: ylab }); } var xlab = $(this).data("xlab"); if (xlab != undefined) { $("#" + target) .highcharts() .xAxis[0].setTitle({ text: xlab }); } } // Switch to log10 axis if (action == "set_log") { mqc_plots[target]["config"]["ytype"] = "logarithmic"; plot_graph(target); } // Switch data source if (action == "set_data") { var ds = $(this).data("newdata"); plot_graph(target, ds); var ylab = $(this).data("ylab"); var xlab = $(this).data("xlab"); var ymax = $(this).data("ymax"); if (ylab != undefined) { $("#" + target) .highcharts() .yAxis[0].setTitle({ text: ylab }); } if (xlab != undefined) { $("#" + target) .highcharts() .xAxis[0].setTitle({ text: xlab }); } if (ymax != undefined) { $("#" + target) .highcharts() .yAxis[0].setExtremes(null, ymax); } } }); // Make HighCharts divs height-draggable // http://jsfiddle.net/Lkwb86c8/ $(".hc-plot:not(.no-handle)").each(function () { if (!$(this).parent().hasClass("hc-plot-wrapper")) { $(this).wrap(' '); } if (!$(this).siblings().hasClass("hc-plot-handle")) { $(this).after('
    '); } $(this).css({ height: "auto", top: 0, bottom: "10px", position: "absolute" }); }); $(".hc-plot-handle").on("mousedown", function (e) { var wrapper = $(this).parent(); var handle = $(this); var startHeight = wrapper.height(); var pY = e.pageY; $(document).on("mouseup", function (e) { // Clear listeners now that we've let go $(document).off("mousemove"); $(document).off("mouseup"); // Fire off a custom jQuery event for other javascript chunks to tie into // Bind to the plot div, which should have a custom ID $(wrapper.parent().find(".hc-plot, .beeswarm-plot")).trigger("mqc_plotresize"); }); $(document).on("mousemove", function (me) { wrapper.css("height", startHeight + (me.pageY - pY)); }); }); // Trigger HighCharts reflow when a plot is resized $(".hc-plot, .beeswarm-plot").on("mqc_plotresize", function (e) { if ($(this).highcharts()) { $(this).highcharts().reflow(); } }); // Switch a y axis limit on or off $(".mqc_hcplot_plotgroup").on("click", ".mqc_hcplot_yaxis_limit_toggle .mqc_switch_wrapper", function () { var target = $($(this).data("target")).highcharts(); var ymax = $(this).data("ymax"); var ymin = $(this).data("ymin"); ymax = ymax == "undefined" ? null : ymax; ymin = ymin == "undefined" ? null : ymin; var mqc_switch = $(this).find(".mqc_switch"); if (mqc_switch.hasClass("on")) { target.yAxis[0].update({ max: null, min: null }); mqc_switch.removeClass("on").addClass("off").text("off"); } else { target.yAxis[0].update({ max: ymax, min: ymin }); mqc_switch.removeClass("off").addClass("on").text("on"); } }); // Sort a heatmap by highlighted names $(".mqc_heatmap_sortHighlight").click(function (e) { e.preventDefault(); var target = $(this).data("target").substr(1); if (mqc_plots[target]["config"]["sortHighlights"] == true) { mqc_plots[target]["config"]["sortHighlights"] = false; $(this).removeClass("active"); } else { mqc_plots[target]["config"]["sortHighlights"] = true; $(this).addClass("active"); } $(this).blur(); plot_heatmap(target); }); }); // Call to render any plot function plot_graph(target, ds, max_num) { if (mqc_plots[target] === undefined) { return false; } // If no dataset specified, check if there is an active button and set automatically if (ds === undefined) { var ds_btns = $('.hc_switch_group button[data-action="set_data"][data-target="' + target + '"]'); if (ds_btns.length) { ds = ds_btns.filter(".active").data("newdata"); } } // If log status is not set and button is there, check whether it's active by default var config = mqc_plots[target]["config"]; if (config === undefined) { mqc_plots[target]["config"] = {}; config = {}; } if (config["ytype"] === undefined) { var log_btn = $('.hc_switch_group button[data-action="set_log"][data-target="' + target + '"]'); if (log_btn.length && log_btn.hasClass("active")) { config["ytype"] = "logarithmic"; } } // XY Line charts if (mqc_plots[target]["plot_type"] == "xy_line") { if (max_num === undefined || mqc_plots[target]["datasets"][0].length < max_num) { plot_xy_line_graph(target, ds); $("#" + target).removeClass("not_rendered"); } else { $("#" + target) .addClass("not_rendered gt_max_num_ds") .html(''); } } // Bar graphs else if (mqc_plots[target]["plot_type"] == "bar_graph") { if (max_num === undefined || mqc_plots[target]["samples"][0].length < max_num) { plot_stacked_bar_graph(target, ds); $("#" + target).removeClass("not_rendered"); } else { $("#" + target) .addClass("not_rendered gt_max_num_ds") .html(''); } } // Scatter plots else if (mqc_plots[target]["plot_type"] == "scatter") { if (max_num === undefined || Object.keys(mqc_plots[target]["datasets"][0]).length < max_num) { plot_scatter_plot(target, ds); $("#" + target).removeClass("not_rendered"); } else { $("#" + target) .addClass("not_rendered gt_max_num_ds") .html(''); } } // Beeswarm graphs else if (mqc_plots[target]["plot_type"] == "beeswarm") { if (max_num === undefined || mqc_plots[target]["samples"][0].length < max_num) { plot_beeswarm_graph(target, ds); $("#" + target).removeClass("not_rendered"); } else { $("#" + target) .addClass("not_rendered gt_max_num_ds") .html(''); } } // Heatmap plots else if (mqc_plots[target]["plot_type"] == "heatmap") { if (max_num === undefined || mqc_plots[target]["xcats"][0].length < max_num) { plot_heatmap(target, ds); $("#" + target).removeClass("not_rendered"); } else { $("#" + target) .addClass("not_rendered gt_max_num_ds") .html(''); } } // Not recognised else { console.log("Did not recognise plot type: " + mqc_plots[target]["plot_type"]); } } // Basic Line Graph function plot_xy_line_graph(target, ds) { if (mqc_plots[target] === undefined || mqc_plots[target]["plot_type"] !== "xy_line") { return false; } var config = mqc_plots[target]["config"]; var data = mqc_plots[target]["datasets"]; if (ds === undefined) { ds = 0; } if (config["tt_label"] === undefined) { config["tt_label"] = "{point.x}: {point.y:.2f}"; if (config["categories"]) { config["tt_formatter"] = function () { yval = Highcharts.numberFormat(this.y, config["tt_decimals"] == undefined ? 0 : config["tt_decimals"]) + (config["tt_suffix"] || ""); return ( ' ' + this.series.name + "
    " + this.key + ": " + yval ); }; } } if (config["click_func"] === undefined) { config["click_func"] = function () {}; } else { config["click_func"] = eval("(" + config["click_func"] + ")"); if (config["cursor"] === undefined) { config["cursor"] = "pointer"; } } if (config["xDecimals"] === undefined) { config["xDecimals"] = true; } if (config["yDecimals"] === undefined) { config["yDecimals"] = true; } if (config["pointFormat"] === undefined) { config["pointFormat"] = ' {series.name}
    ' + config["tt_label"]; } if (config["ytype"] === undefined) { config["ytype"] = config["yLog"] ? "logarithmic" : "linear"; } if (config["ytype"] == "logarithmic") { if (config["ymin"] == 0) { config["ymin"] = undefined; } var minTickInt = "auto"; } else { var minTickInt = undefined; } // Make a clone of the data, so that we can mess with it, // while keeping the original data in tact var data = JSON.parse(JSON.stringify(mqc_plots[target]["datasets"][ds])); // Rename samples if (window.mqc_rename_f_texts.length > 0) { $.each(data, function (j, s) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); data[j]["name"] = data[j]["name"].replace(re, window.mqc_rename_t_texts[idx]); } else { data[j]["name"] = data[j]["name"].replace(f_text, window.mqc_rename_t_texts[idx]); } }); }); } // Highlight samples if (window.mqc_highlight_f_texts.length > 0) { $.each(data, function (j, s) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if ( (window.mqc_highlight_regex_mode && data[j]["name"].match(f_text)) || (!window.mqc_highlight_regex_mode && data[j]["name"].indexOf(f_text) > -1) ) { data[j]["color"] = window.mqc_highlight_f_cols[idx]; } }); }); } // Hide samples $("#" + target) .closest(".mqc_hcplot_plotgroup") .parent() .find(".samples-hidden-warning") .remove(); $("#" + target) .closest(".mqc_hcplot_plotgroup") .show(); if (window.mqc_hide_f_texts.length > 0) { var num_hidden = 0; var num_total = data.length; var j = data.length; while (j--) { var match = false; for (i = 0; i < window.mqc_hide_f_texts.length; i++) { var f_text = window.mqc_hide_f_texts[i]; if (window.mqc_hide_regex_mode) { if (data[j]["name"].match(f_text)) { match = true; } } else { if (data[j]["name"].indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } if (match) { data.splice(j, 1); num_hidden += 1; } } // Some series hidden. Show a warning text string. if (num_hidden > 0) { var alert = '
    Warning: ' + num_hidden + ' samples hidden. See toolbox.
    '; $("#" + target) .closest(".mqc_hcplot_plotgroup") .before(alert); } // All series hidden. Hide the graph. if (num_hidden == num_total) { $("#" + target) .closest(".mqc_hcplot_plotgroup") .hide(); return false; } } // Toggle buttons for y-axis limis // Handler for this is at top, so doesn't get created multiple times if (config["ymax"] != undefined || config["ymin"] != undefined) { var pgroup = $("#" + target).closest(".mqc_hcplot_plotgroup"); var wrapper = $(' ').prependTo(pgroup); wrapper.append( 'Y-Limits: on' ); wrapper.after(' '); } // Make the highcharts plot Highcharts.chart(target, { chart: { type: "line", zoomType: "x", }, title: { text: config["title"], x: 30, // fudge to center over plot area rather than whole plot }, xAxis: { title: { text: config["xlab"], }, labels: { format: config["xLabelFormat"] ? config["xLabelFormat"] : "{value}" }, type: config["xLog"] ? "logarithmic" : "linear", categories: config["categories"], ceiling: config["xCeiling"], floor: config["xFloor"], max: config["xmax"], min: config["xmin"], minRange: config["xMinRange"], allowDecimals: config["xDecimals"], plotBands: config["xPlotBands"], plotLines: config["xPlotLines"], }, yAxis: { title: { text: config["ylab"], }, labels: { format: config["yLabelFormat"] ? config["yLabelFormat"] : "{value}" }, type: config["ytype"], ceiling: config["yCeiling"], floor: config["yFloor"], max: config["ymax"], min: config["ymin"], minRange: config["yMinRange"], allowDecimals: config["yDecimals"], plotBands: config["yPlotBands"], plotLines: config["yPlotLines"], }, plotOptions: { series: { marker: { enabled: false }, cursor: config["cursor"], point: { events: { click: config["click_func"], }, }, }, }, legend: { enabled: false, }, tooltip: { headerFormat: "", pointFormat: config["pointFormat"], formatter: config["tt_formatter"], useHTML: true, }, series: data, }); } // Stacked Bar Graph function plot_stacked_bar_graph(target, ds) { if (mqc_plots[target] === undefined || mqc_plots[target]["plot_type"] !== "bar_graph") { return false; } if (ds === undefined) { ds = 0; } // Make a clone of the everything, so that we can mess with it, // while keeping the original data in tact var data = JSON.parse(JSON.stringify(mqc_plots[target]["datasets"][ds])); var cats = JSON.parse(JSON.stringify(mqc_plots[target]["samples"][ds])); var config = JSON.parse(JSON.stringify(mqc_plots[target]["config"])); if (config["stacking"] === undefined) { config["stacking"] = "normal"; } if (config["stacking"] === "normal") { config["groupPadding"] = "0.02"; config["pointPadding"] = "0.1"; } else { config["groupPadding"] = "0.1"; config["pointPadding"] = 0; } if (config["ytype"] === undefined) { config["ytype"] = "linear"; } if (config["reversedStacks"] === undefined) { config["reversedStacks"] = false; } if (config["use_legend"] === undefined) { config["use_legend"] = true; } if (config["yDecimals"] === undefined) { config["yDecimals"] = true; } if (config["click_func"] === undefined) { config["click_func"] = function () {}; } else { if (config["cursor"] === undefined) { config["cursor"] = "pointer"; } } if (config["tt_percentages"] === undefined) { config["tt_percentages"] = true; } if (config["borderWidth"] === undefined) { config["borderWidth"] = 0; } if (config["ytype"] == "logarithmic") { if (config["ymin"] == 0 || config["ymin"] == undefined) { config["ymin"] = 1; } var minTickInt = "auto"; } else { var minTickInt = undefined; } // Rename samples if (window.mqc_rename_f_texts.length > 0) { $.each(cats, function (j, s_name) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); cats[j] = cats[j].replace(re, window.mqc_rename_t_texts[idx]); } else { cats[j] = cats[j].replace(f_text, window.mqc_rename_t_texts[idx]); } }); }); } // Highlight samples if (window.mqc_highlight_f_texts.length > 0) { $.each(cats, function (j, s_name) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { return true; } // skip blanks if ( (window.mqc_highlight_regex_mode && s_name.match(f_text)) || (!window.mqc_highlight_regex_mode && s_name.indexOf(f_text) > -1) ) { // Make the data point in each series with this index have a border colour $.each(data, function (k, d) { data[k]["data"][j] = { y: data[k]["data"][j], borderColor: window.mqc_highlight_f_cols[idx], }; }); } }); }); // Bump the borderWidth to make the highlights more obvious if (config["borderWidth"] <_ _2="_2" _="_" configborderwidth="2;" hide="hide" samples="samples" target="target" _.closest.mqc_hcplot_plotgroup="_.closest.mqc_hcplot_plotgroup" _.parent="_.parent" _.find.samples-hidden-warning="_.find.samples-hidden-warning" _.remove="_.remove" _.show="_.show" if="if" window.mqc_hide_f_texts.length="window.mqc_hide_f_texts.length"> 0) { var num_hidden = 0; var num_total = cats.length; var j = cats.length; while (j--) { var s_name = cats[j]; var match = false; for (i = 0; i < window.mqc_hide_f_texts.length; i++) { var f_text = window.mqc_hide_f_texts[i]; if (window.mqc_hide_regex_mode) { if (s_name.match(f_text)) { match = true; } } else { if (s_name.indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } if (match) { cats.splice(j, 1); $.each(data, function (k, d) { data[k]["data"].splice(j, 1); }); num_hidden += 1; } } // Some series hidden. Show a warning text string. if (num_hidden > 0) { var alert = '
    Warning: ' + num_hidden + ' samples hidden. See toolbox.
    '; $("#" + target) .closest(".mqc_hcplot_plotgroup") .before(alert); } // All series hidden. Hide the graph. if (num_hidden == num_total) { $("#" + target) .closest(".mqc_hcplot_plotgroup") .hide(); return false; } } // Make the highcharts plot Highcharts.chart(target, { chart: { type: "bar", zoomType: "x", }, title: { text: config["title"], }, xAxis: { categories: cats, min: 0, title: { text: config["xlab"], }, }, yAxis: { title: { text: config["ylab"], }, labels: { format: config["yLabelFormat"] ? config["yLabelFormat"] : "{value}" }, ceiling: config["yCeiling"], floor: config["yFloor"], minRange: config["yMinRange"], max: config["ymax"], min: config["ymin"], type: config["ytype"], labels: { format: config["ylab_format"], }, allowDecimals: config["yDecimals"], reversedStacks: config["reversedStacks"], minorTickInterval: minTickInt, }, plotOptions: { series: { stacking: config["stacking"], pointPadding: config["pointPadding"], groupPadding: config["groupPadding"], borderWidth: config["borderWidth"], }, cursor: config["cursor"], point: { events: { click: config["click_func"], }, }, }, legend: { enabled: config["use_legend"], }, tooltip: { formatter: function () { var colspan = config["tt_percentages"] ? 3 : 2; var s = '
    ' + this.x + "
    "; $.each(this.points, function () { yval = Highcharts.numberFormat(this.y, config["tt_decimals"] == undefined ? 0 : config["tt_decimals"]) + (config["tt_suffix"] || ""); ypct = Highcharts.numberFormat(this.percentage, 1); s += ' \ ' + this.series.name + ': \ ' + yval + " "; if (config["tt_percentages"]) { s += ' (' + ypct + "%)"; } s += ""; }); s += ""; return s; }, shared: true, useHTML: true, }, series: data, }); } // Scatter plot function plot_scatter_plot(target, ds) { if (mqc_plots[target] === undefined || mqc_plots[target]["plot_type"] !== "scatter") { return false; } var config = mqc_plots[target]["config"]; var data = mqc_plots[target]["datasets"]; if (ds === undefined) { ds = 0; } if (config["marker_colour"] === undefined) { config["marker_colour"] = "rgba(124, 181, 236, .5)"; } if (config["marker_size"] === undefined) { config["marker_size"] = 5; } if (config["marker_line_colour"] === undefined) { config["marker_line_colour"] = "#999"; } if (config["marker_line_width"] === undefined) { config["marker_line_width"] = 1; } if (config["tt_label"] === undefined) { config["tt_label"] = "X: {point.x:.2f}
    Y: {point.y:.2f}"; } if (config["click_func"] === undefined) { config["click_func"] = function () {}; } else { config["click_func"] = eval("(" + config["click_func"] + ")"); if (config["cursor"] === undefined) { config["cursor"] = "pointer"; } } if (config["xDecimals"] === undefined) { config["xDecimals"] = true; } if (config["yDecimals"] === undefined) { config["yDecimals"] = true; } if (config["pointFormat"] === undefined) { config["pointFormat"] = ' {point.name}
    ' + config["tt_label"]; } // Make a clone of the data, so that we can mess with it, // while keeping the original data in tact var data = JSON.parse(JSON.stringify(mqc_plots[target]["datasets"][ds])); // Rename samples if (window.mqc_rename_f_texts.length > 0) { $.each(data, function (j, s) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); data[j]["name"] = data[j]["name"].replace(re, window.mqc_rename_t_texts[idx]); } else { data[j]["name"] = data[j]["name"].replace(f_text, window.mqc_rename_t_texts[idx]); } }); }); } // Highlight samples if (window.mqc_highlight_f_texts.length > 0) { $.each(data, function (j, s) { if ("marker" in data[j]) { data[j]["marker"]["lineWidth"] = 0; } else { data[j]["marker"] = { lineWidth: 0 }; } var match = false; $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { return true; } if ( (window.mqc_highlight_regex_mode && data[j]["name"].match(f_text)) || (!window.mqc_highlight_regex_mode && data[j]["name"].indexOf(f_text) > -1) ) { data[j]["color"] = window.mqc_highlight_f_cols[idx]; match = true; } }); if (!match) { data[j]["color"] = "rgba(100,100,100,0.2)"; } }); } // Hide samples $("#" + target) .closest(".mqc_hcplot_plotgroup") .parent() .find(".samples-hidden-warning") .remove(); $("#" + target) .closest(".mqc_hcplot_plotgroup") .show(); if (window.mqc_hide_f_texts.length > 0) { var num_hidden = 0; var num_total = data.length; var j = data.length; while (j--) { var match = false; for (i = 0; i < window.mqc_hide_f_texts.length; i++) { var f_text = window.mqc_hide_f_texts[i]; if (window.mqc_hide_regex_mode) { if (data[j]["name"].match(f_text)) { match = true; } } else { if (data[j]["name"].indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } if (match) { data.splice(j, 1); num_hidden += 1; } } // Some series hidden. Show a warning text string. if (num_hidden > 0) { var alert = '
    Warning: ' + num_hidden + ' samples hidden. See toolbox.
    '; $("#" + target) .closest(".mqc_hcplot_plotgroup") .before(alert); } // All series hidden. Hide the graph. if (num_hidden == num_total) { $("#" + target) .closest(".mqc_hcplot_plotgroup") .hide(); return false; } } // Make the highcharts plot Highcharts.chart( target, { chart: { type: "scatter", zoomType: "xy", plotBorderWidth: 1, height: config["square"] ? 500 : undefined, width: config["square"] ? 500 : undefined, }, title: { text: config["title"], x: 30, // fudge to center over plot area rather than whole plot }, xAxis: { title: { text: config["xlab"], }, type: config["xLog"] ? "logarithmic" : "linear", gridLineWidth: 1, categories: config["categories"], ceiling: config["xCeiling"], floor: config["xFloor"], max: config["xmax"], min: config["xmin"], minRange: config["xMinRange"], allowDecimals: config["xDecimals"], plotBands: config["xPlotBands"], plotLines: config["xPlotLines"], }, yAxis: { title: { text: config["ylab"], }, type: config["yLog"] ? "logarithmic" : "linear", ceiling: config["yCeiling"], floor: config["yFloor"], max: config["ymax"], min: config["ymin"], minRange: config["yMinRange"], allowDecimals: config["yDecimals"], plotBands: config["yPlotBands"], plotLines: config["yPlotLines"], }, plotOptions: { series: { animation: false, marker: { radius: config["marker_size"], lineColor: config["marker_line_colour"], lineWidth: config["marker_line_width"], states: { hover: { enabled: config["enableHover"] == undefined ? true : config["enableHover"], lineColor: "rgb(100,100,100)", }, }, }, turboThreshold: config["turboThreshold"], enableMouseTracking: config["enableMouseTracking"], cursor: config["cursor"], point: { events: { click: config["click_func"], }, }, }, }, legend: { enabled: false, }, tooltip: { headerFormat: "", pointFormat: config["pointFormat"], useHTML: true, formatter: function () { if (!this.point.noTooltip) { // Formatter function doesn't do name for some reason fstring = config["pointFormat"].replace("{point.name}", this.point.name); return Highcharts.Point.prototype.tooltipFormatter.call(this, fstring); } return false; }, }, series: [ { color: config["marker_colour"], data: data, }, ], }, // Maintain aspect ratio as chart size changes function (this_chart) { if (config["square"]) { var resizeCh = function (chart) { // Extra width for legend var lWidth = chart.options.legend.enabled ? 30 : 0; // Work out new chart width, assuming needs to be narrower var chHeight = $(chart.renderTo).height(); var chWidth = $(chart.renderTo).width(); var nChHeight = chHeight; var nChWidth = chHeight + lWidth; // Chart is already too narrow, make it less tall if (chWidth < nChWidth) { nChHeight = chWidth - lWidth; nChWidth = chWidth; } chart.setSize(nChWidth, nChHeight); }; // Resize on load resizeCh(this_chart); // Resize on graph resize $(this_chart.renderTo).on("mqc_plotresize", function (e) { resizeCh(this_chart); }); } } ); } // Beeswarm plot function plot_beeswarm_graph(target, ds) { if (mqc_plots[target] === undefined || mqc_plots[target]["plot_type"] !== "beeswarm") { return false; } var config = mqc_plots[target]["config"]; if (ds === undefined) { ds = 0; } // Make a clone of the data, so that we can mess with it, // while keeping the original data in tact var datasets = JSON.parse(JSON.stringify(mqc_plots[target]["datasets"])); var samples = JSON.parse(JSON.stringify(mqc_plots[target]["samples"])); var categories = JSON.parse(JSON.stringify(mqc_plots[target]["categories"])); // Rename samples if (window.mqc_rename_f_texts.length > 0) { for (i = 0; i < samples.length; i++) { for (j = 0; j < samples[i].length; j++) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); samples[i][j] = samples[i][j].replace(re, window.mqc_rename_t_texts[idx]); } else { samples[i][j] = samples[i][j].replace(f_text, window.mqc_rename_t_texts[idx]); } }); } } } // Highlight samples var baseColour = "rgb(55,126,184)"; // Blue points by default var seriesColours = {}; if (window.mqc_highlight_f_texts.length > 0) { baseColour = "rgb(80,80,80)"; // Grey points if no highlight for (i = 0; i < samples.length; i++) { for (j = 0; j < samples[i].length; j++) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if ( (window.mqc_highlight_regex_mode && samples[i][j].match(f_text)) || (!window.mqc_highlight_regex_mode && samples[i][j].indexOf(f_text) > -1) ) { seriesColours[samples[i][j]] = window.mqc_highlight_f_cols[idx]; } }); } } } // Hide samples $("#" + target) .closest(".hc-plot-wrapper") .parent() .find(".samples-hidden-warning") .remove(); $("#" + target) .closest(".hc-plot-wrapper") .show(); if (window.mqc_hide_f_texts.length > 0) { var num_hidden = 0; var num_total = 0; for (i = 0; i < samples.length; i++) { num_total = Math.max(num_total, samples[i].length); var j = samples[i].length; var hidden_here = 0; while (j--) { var s_name = samples[i][j]; var match = false; for (k = 0; k < window.mqc_hide_f_texts.length; k++) { var f_text = window.mqc_hide_f_texts[k]; if (window.mqc_hide_regex_mode) { if (s_name.match(f_text)) { match = true; } } else { if (s_name.indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } if (match) { samples[i].splice(j, 1); datasets[i].splice(j, 1); hidden_here += 1; } } num_hidden = Math.max(num_hidden, hidden_here); } // Some series hidden. Show a warning text string. if (num_hidden > 0) { var alert = '
    Warning: ' + num_hidden + ' samples hidden. See toolbox.
    '; $("#" + target) .closest(".hc-plot-wrapper") .before(alert); } // All series hidden. Hide the graph. if (num_hidden == num_total) { $("#" + target) .closest(".hc-plot-wrapper") .hide(); return false; } } // Figure out how tall to make each plot var ph_min = 40; var ph_max = 100; var pheight = 600 / categories.length; pheight = Math.min(ph_max, Math.max(ph_min, pheight)); // Clear the loading text and add hover text placeholder $("#" + target).html( '
    Hover over a data point for more information
    ' ); // Resize the parent draggable div $("#" + target) .parent() .css("height", pheight * categories.length + 40 + "px"); for (var i = 0; i < categories.length; i++) { var borderCol = categories[i]["bordercol"]; if (borderCol == undefined) { borderCol = "#cccccc"; } var data = datasets[i]; var s_names = samples[i]; if (categories[i]["namespace"] == "") { var label = categories[i]["title"]; var label_long = categories[i]["description"]; } else { var label = categories[i]["namespace"] + "
    " + categories[i]["title"]; var label_long = categories[i]["namespace"] + ": " + categories[i]["description"]; } var ttSuffix = categories[i]["suffix"]; var decimalPlaces = categories[i]["decimalPlaces"]; var minx = categories[i]["min"]; var maxx = categories[i]["max"]; // Size and spacing options var markerRadius = 2.5; var yspace = 70; var ysep = 10; if (data.length > 50) { markerRadius = 1.8; yspace = 50; ysep = 20; } if (data.length > 200) { markerRadius = 1; yspace = 30; ysep = 30; } if (maxx == undefined) { maxx = Math.max.apply(null, data); } if (minx == undefined) { minx = Math.max.apply(null, data); } var range = maxx - minx; var sep = range / yspace; // Get an array of indexes from a sorted data array // Leaves the data order in tact so we don't lose s_name association var indices = new Array(data.length); for (var n = 0; n < data.length; n++) { indices[n] = n; } indices.sort(function (a, b) { return data[a] < data[b] ? -1 : data[a] > data[b] ? 1 : 0; }); var xydata = []; var last = undefined; var side = 1; for (var s_idx = 0; s_idx < indices.length; s_idx++) { row = indices[s_idx]; s_name = s_names[row]; d = data[row]; if (Math.floor(d / sep) !== last) { last = Math.floor(d / sep); side = 1; } else { side += 1; } multiplier = side % 2 == 0 ? 1 : -1; var y = (Math.floor(side / 2) * multiplier) / ysep; // Don't let jitter get too big while (y > 1 || y < -1) { var n = Math.floor(Math.abs(y)) + 1; y = (Math.floor(side / 2) * multiplier) / (ysep * n); } // Get the point colour var thisCol = baseColour; if (s_name in seriesColours) { thisCol = seriesColours[s_name]; } xydata.push({ x: d, y: y, name: s_name, color: thisCol, }); } $(' ') .appendTo("#" + target + " .beeswarm-plots") .css({ "border-left": "2px solid " + borderCol, height: 100 / categories.length + "%", }) .highcharts({ chart: { type: "scatter", spacingTop: 0, marginBottom: 0, marginRight: 20, marginLeft: 180, backgroundColor: "transparent", // Horrible hacky HighCharts reflow problem. // TODO: Come back and find a better solution! events: { load: function (chart) { setTimeout(function () { chart.target.reflow(); }, 200); }, }, }, title: { text: label, align: "left", verticalAlign: "middle", y: 10, useHTML: true, style: { fontSize: "12px", }, }, yAxis: { title: { text: null }, max: 1, min: -1, gridLineWidth: 0, title: { text: null }, labels: { enabled: false }, lineWidth: 0, }, xAxis: { lineWidth: 0, tickWidth: 0, tickPixelInterval: 200, labels: { reserveSpace: false, y: -1 * (pheight / 2) + 5, zIndex: 1, style: { color: "#999999", }, }, min: minx, max: maxx, }, tooltip: { valueSuffix: ttSuffix, valueDecimals: decimalPlaces, formatter: function () { var value = Highcharts.numberFormat(this.point.x, this.series.tooltipOptions.valueDecimals); var suff = this.series.tooltipOptions.valueSuffix; var ttstring = '' + this.series.name + "" + this.point.name + ":   " + value + " " + suff + ""; $("#" + target + " .beeswarm-hovertext").html(ttstring); return false; }, }, plotOptions: { series: { name: label_long, turboThreshold: 0, marker: { radius: markerRadius, states: { hover: { radiusPlus: 4, lineWidthPlus: 2, lineColor: "#333333", }, }, }, stickyTracking: false, point: { events: { mouseOver: function (e) { var hovName = this.name; $("#" + target + " .beeswarm-plot").each(function () { var plot = $(this).highcharts(); for (i = 0; i < plot.series[0].data.length; ++i) { if (plot.series[0].data[i].name == hovName) { plot.series[0].data[i].setState("hover"); } } }); }, mouseOut: function () { $("#" + target + " .beeswarm-plot").each(function () { var plot = $(this).highcharts(); for (i = 0; i < plot.series[0].data.length; ++i) { plot.series[0].data[i].setState(); } }); $("#" + target + " .beeswarm-hovertext").html( 'Hover over a data point for more information' ); }, }, }, }, }, legend: { enabled: false }, credits: { enabled: false }, exporting: { enabled: false }, series: [ { data: xydata, // Workaround for HighCharts bug. See https://github.com/highcharts/highcharts/issues/1440 marker: { states: { hover: { fillColor: {} } } }, }, ], }); } } // Heatmap plot function plot_heatmap(target, ds) { if (mqc_plots[target] === undefined || mqc_plots[target]["plot_type"] !== "heatmap") { return false; } var config = mqc_plots[target]["config"]; if (config["square"] === undefined) { config["square"] = true; } if (config["xcats_samples"] === undefined) { config["xcats_samples"] = true; } if (config["ycats_samples"] === undefined) { config["ycats_samples"] = true; } // Make a clone of the data, so that we can mess with it, // while keeping the original data in tact var data = JSON.parse(JSON.stringify(mqc_plots[target]["data"])); var xcats = JSON.parse(JSON.stringify(mqc_plots[target]["xcats"])); var ycats = JSON.parse(JSON.stringify(mqc_plots[target]["ycats"])); // "xcats" and "ycats" are labels of columns and rows respectively // data[n] has form of [x,y,value], x/y are indices of columns/rows // Rename samples if (window.mqc_rename_f_texts.length > 0) { if (config["xcats_samples"]) { for (i = 0; i < xcats.length; i++) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); xcats[i] = xcats[i].replace(re, window.mqc_rename_t_texts[idx]); } else { xcats[i] = xcats[i].replace(f_text, window.mqc_rename_t_texts[idx]); } }); } } if (config["ycats_samples"]) { for (i = 0; i < ycats.length; i++) { $.each(window.mqc_rename_f_texts, function (idx, f_text) { if (window.mqc_rename_regex_mode) { var re = new RegExp(f_text, "g"); ycats[i] = ycats[i].replace(re, window.mqc_rename_t_texts[idx]); } else { ycats[i] = ycats[i].replace(f_text, window.mqc_rename_t_texts[idx]); } }); } } } // Sort samples by highlight $(".mqc_heatmap_sortHighlight").attr("disabled", false); if (config["sortHighlights"] == true) { if (window.mqc_highlight_f_texts.length > 0) { // Collect the highlighting indices var xcat_hl = Array(); var ycat_hl = Array(); for (i = 0; i < xcats.length; i++) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { xcat_hl[i] = 0; } else if ( (window.mqc_highlight_regex_mode && xcats[i].match(f_text)) || (!window.mqc_highlight_regex_mode && xcats[i].indexOf(f_text) > -1) ) { xcat_hl[i] = window.mqc_highlight_f_texts.length - idx; } }); } for (i = 0; i < ycats.length; i++) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { ycat_hl[i] = 0; } else if ( (window.mqc_highlight_regex_mode && ycats[i].match(f_text)) || (!window.mqc_highlight_regex_mode && ycats[i].indexOf(f_text) > -1) ) { ycat_hl[i] = window.mqc_highlight_f_texts.length - idx; } }); } // Reshape the data - needs deepcopy as indexes are updated var newdata = JSON.parse(JSON.stringify(mqc_plots[target]["data"])); var new_xcats = [], new_ycats = []; var xidx = 0, yidx = 0; for (hl = window.mqc_highlight_f_texts.length; hl >= 0; hl--) { if (config["xcats_samples"]) { for (i = 0; i < xcats.length; i++) { if (xcat_hl[i] == hl) { new_xcats.push(xcats[i]); for (j = 0; j < data.length; j++) { // data[j] element is [x,y,val], get "x" if (data[j][0] == i) { newdata[j][0] = xidx; } } xidx += 1; } } } if (config["ycats_samples"]) { for (i = 0; i < ycats.length; i++) { if (ycat_hl[i] == hl) { new_ycats.push(ycats[i]); for (j = 0; j < data.length; j++) { // data[j] element is [x,y,val], get "y" if (data[j][1] == i) { newdata[j][1] = yidx; } } yidx += 1; } } } } data = newdata; if (config["xcats_samples"]) { xcats = new_xcats; } if (config["ycats_samples"]) { ycats = new_ycats; } } } // Hide samples var num_total = Math.max(xcats.length, ycats.length); $("#" + target) .closest(".hc-plot-wrapper") .parent() .find(".samples-hidden-warning") .remove(); $("#" + target) .closest(".hc-plot-wrapper") .show(); if (window.mqc_hide_f_texts.length > 0) { var remove = Array(); if (config["xcats_samples"]) { var i = xcats.length; var xhidden = 0; // iterate over x-categories (columns) while (i--) { var match = false; for (j = 0; j < window.mqc_hide_f_texts.length; j++) { var f_text = window.mqc_hide_f_texts[j]; if (window.mqc_hide_regex_mode) { if (xcats[i].match(f_text)) { match = true; } } else { if (xcats[i].indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } // modify data if "i" is match for "hiding": // mark elements from "i"-th column (x) for removal, // shift "x" of elements from "i+" columns to the left if (match) { xcats.splice(i, 1); for (n = 0; n < data.length; n++) { // data[n] element is [x,y,val], get "x" let x = data[n][0]; if (x == i) { remove.push(n); } else if (x > i) { data[n][0] = x - 1; } } xhidden += 1; } } } if (config["ycats_samples"]) { var i = ycats.length; var yhidden = 0; // iterate over y-categories (rows) while (i--) { var match = false; for (j = 0; j < window.mqc_hide_f_texts.length; j++) { var f_text = window.mqc_hide_f_texts[j]; if (window.mqc_hide_regex_mode) { if (ycats[i].match(f_text)) { match = true; } } else { if (ycats[i].indexOf(f_text) > -1) { match = true; } } } if (window.mqc_hide_mode == "show") { match = !match; } // modify data if "i" is match for "hiding" // mark elements from "i"-th row (y) for removal, // shift "y" of elements from "i+" rows up if (match) { ycats.splice(i, 1); for (n = 0; n < data.length; n++) { // data[n] element is [x,y,val], get "y" let y = data[n][1]; if (y == i) { if (remove.indexOf(n) < 0) { remove.push(n); } } else if (y > i) { data[n][1] = y - 1; } } yhidden += 1; } } } // Remove the data values that matched remove = remove.sort(function (a, b) { return a - b; }); // Sorts alphabetically by default, even with integers var r = remove.length; while (r--) { data.splice(remove[r], 1); } // Report / hide the plot if we're hiding stuff var num_hidden = Math.max(xhidden, yhidden); // Some series hidden. Show a warning text string. if (num_hidden > 0) { var alert = '
    Warning: ' + num_hidden + ' samples hidden. See toolbox.
    '; $("#" + target) .closest(".hc-plot-wrapper") .before(alert); } // All series hidden. Hide the graph. if (num_hidden >= num_total) { $("#" + target) .closest(".hc-plot-wrapper") .hide(); return false; } } // Highlight samples - do this last as we convert numerical arrays to associative if (window.mqc_highlight_f_texts.length > 0) { $(".mqc_heatmap_sortHighlight").attr("disabled", false); var highlight_cells = Array(); if (config["ycats_samples"]) { for (i = 0; i < xcats.length; i++) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { return true; } if ( (window.mqc_highlight_regex_mode && xcats[i].match(f_text)) || (!window.mqc_highlight_regex_mode && xcats[i].indexOf(f_text) > -1) ) { for (n = 0; n < data.length; n++) { highlight_cells[idx] = typeof highlight_cells[idx] != "undefined" && highlight_cells[idx] instanceof Array ? highlight_cells[idx] : []; // data[n] element is [x,y,val], get "x" if (data[n][0] == i) { highlight_cells[idx].push(n); } } } }); } } if (config["ycats_samples"]) { for (i = 0; i < ycats.length; i++) { $.each(window.mqc_highlight_f_texts, function (idx, f_text) { if (f_text == "") { return true; } if ( (window.mqc_highlight_regex_mode && ycats[i].match(f_text)) || (!window.mqc_highlight_regex_mode && ycats[i].indexOf(f_text) > -1) ) { for (n = 0; n < data.length; n++) { // data[n] element is [x,y,val], get "y" if (data[n][1] == i) { highlight_cells[idx] = typeof highlight_cells[idx] != "undefined" && highlight_cells[idx] instanceof Array ? highlight_cells[idx] : []; if (highlight_cells[idx].indexOf(n) < 0) { highlight_cells[idx].push(n); } } } } }); } } // Give highlighted cells a border for (var idx in highlight_cells) { var hl = highlight_cells[idx]; hl = hl.sort(function (a, b) { return a - b; }); // Sorts alphabetically by default, even with integers var h = hl.length; while (h--) { var i = hl[h]; data[i] = { // data[i] element is [x,y,val] x: data[i][0] === undefined ? data[i]["x"] : data[i][0], y: data[i][1] === undefined ? data[i]["y"] : data[i][1], value: data[i][2] === undefined ? data[i]["value"] : data[i][2], borderWidth: 2, borderColor: window.mqc_highlight_f_cols[idx], }; } } } else { $(".mqc_heatmap_sortHighlight").attr("disabled", true); } // Build scale if (config["colstops"] === undefined) { config["colstops"] = [ [0, "#313695"], [0.1, "#4575b4"], [0.2, "#74add1"], [0.3, "#abd9e9"], [0.4, "#e0f3f8"], [0.5, "#ffffbf"], [0.6, "#fee090"], [0.7, "#fdae61"], [0.8, "#f46d43"], [0.9, "#d73027"], [1, "#a50026"], ]; } if (config["reverseColors"] === undefined) { config["reverseColors"] = false; } if (config["decimalPlaces"] === undefined) { config["decimalPlaces"] = 2; } if (config["legend"] === undefined) { config["legend"] = true; } if (config["borderWidth"] === undefined) { config["borderWidth"] = 0; } var datalabels = config["datalabels"]; if (datalabels === undefined) { if (data.length < 20) { datalabels = true; } else { datalabels = false; } } // Clone the colstops before we mess around with them var colstops = JSON.parse(JSON.stringify(config["colstops"])); // Reverse the colour scale if the axis is reversed if (config["reverseColors"]) { for (var i = 0; i < colstops.length; i++) { colstops[i][0] = 1 - colstops[i][0]; } colstops.reverse(); } // Make the highcharts plot Highcharts.chart( target, { chart: { type: "heatmap", zoomType: "xy", height: config["square"] ? 500 : undefined, width: config["square"] ? 530 : undefined, marginTop: config["title"] ? 60 : 50, }, plotOptions: { series: { states: { hover: { borderWidth: 2, borderColor: "red", }, }, }, }, title: { text: config["title"], }, xAxis: { endOnTick: false, maxPadding: 0, categories: xcats, title: { enabled: true, text: config["xTitle"] }, labels: { formatter: function () { try { return this.value.substr(0, 20); } catch (err) { return this.value; } }, }, }, yAxis: { endOnTick: false, maxPadding: 0, categories: ycats, reversed: true, opposite: true, title: config["yTitle"], labels: { formatter: function () { try { return this.value.substr(0, 20); } catch (err) { return this.value; } }, }, }, colorAxis: { reversed: config["reverseColors"], stops: colstops, min: config["min"], max: config["max"], }, legend: { align: "right", layout: "vertical", margin: 0, verticalAlign: "top", y: 25, symbolHeight: 280, enabled: config["legend"], }, tooltip: { useHTML: true, formatter: function () { return ( 'X: ' + this.series.xAxis.categories[this.point.x] + "
    " + 'Y: ' + this.series.yAxis.categories[this.point.y] + "
    " + ' ' + '' + Highcharts.numberFormat(this.point.value, config["decimalPlaces"]) + "" ); }, }, series: [ { turboThreshold: 0, borderWidth: config["borderWidth"], data: data, dataLabels: { enabled: datalabels, format: "{point.value:." + config["decimalPlaces"] + "f}", color: config["datalabel_colour"], }, }, ], }, function (this_chart) { // Maintain aspect ratio as chart size changes if (config["square"]) { var resizeCh = function (chart) { // Extra width for legend var lWidth = chart.options.legend.enabled ? 30 : 0; // Work out new chart width, assuming needs to be narrower var chHeight = $(chart.renderTo).height(); var chWidth = $(chart.renderTo).width(); var nChHeight = chHeight; var nChWidth = chHeight + lWidth; // Chart is already too narrow, make it less tall if (chWidth < nChWidth) { nChHeight = chWidth - lWidth; nChWidth = chWidth; } chart.setSize(nChWidth, nChHeight); }; // Resize on load resizeCh(this_chart); // Resize on graph resize $(this_chart.renderTo).on("mqc_plotresize", function (e) { try { resizeCh(this_chart); } catch (e) { plot_heatmap($(this).attr("id")); } }); } } ); // Listeners for range slider $(".mqc_hcplot_range_sliders input").on("keyup change input", function () { target = $(this).data("target"); minmax = $(this).data("minmax"); var chart = $("#" + target).highcharts(); if (minmax == "min") { chart.colorAxis[0].update({ min: $(this).val() }); } if (minmax == "max") { chart.colorAxis[0].update({ max: $(this).val() }); } $("#" + target + "_range_slider_" + minmax + ", #" + target + "_range_slider_" + minmax + "_txt").val( $(this).val() ); }); } // Highlight text with a fadeout background colour highlight function highlight_fade_text(obj) { var orig_col = $(obj).css("color"); obj.css({ display: "inline-block", "background-color": "#5bc0de", color: "#FFFFFF", WebkitTransition: "background-color 0s, color 0s", MozTransition: "background-color 0s, color 0s", MsTransition: "background-color 0s, color 0s", OTransition: "background-color 0s, color 0s", transition: "background-color 0s, color 0s", }); setTimeout(function () { obj.css({ "background-color": "#FFFFFF", color: orig_col, WebkitTransition: "background-color 0.5s, color 0.5s", MozTransition: "background-color 0.5s, color 0.5s", MsTransition: "background-color 0.5s, color 0.5s", OTransition: "background-color 0.5s, color 0.5s", transition: "background-color 0.5s, color 0.5s", }); }, 500); }
  • \ \ \
  • ' ); } apply_mqc_renamesamples(); } }); // Show/hide buttons $(".mqc_hide_switches").click(function (e) { e.preventDefault(); if ($(this).hasClass("active")) { return false; } $("#mqc_hide_switches button").removeClass("active"); $(this).addClass("active"); // Clear previous show/hide group $("#mqc_hidesamples_filters").empty(); // Get requested pattern and whether to show or hide the pattern var j = $(this).data("index"); var pattern = mqc_config["show_hide_patterns"][j]; var show_hide_mode = mqc_config["show_hide_mode"][j]; var regex = mqc_config["show_hide_regex"][j]; if (!Array.isArray(pattern)) { pattern = [pattern]; } if (show_hide_mode === undefined) { show_hide_mode = "show"; } // click the regex button if we want it turned on/off var button = document.getElementsByClassName("mqc_switch re_mode")[2]; if (button.className.includes(" on") && !regex) { button.click(); } if (button.className.includes(" off") && regex) { button.click(); } // Apply the changes $(".mqc_hidesamples_showhide[value=" + show_hide_mode + "]").prop("checked", true); $(pattern).each(function (idx, val) { $("#mqc_hidesamples_filters").append( '
  • ' ); }); apply_mqc_hidesamples(show_hide_mode); }); // Hide toolbox when clicking outside $(document).mouseup(function (e) { if (!$(".mqc-toolbox").is(e.target) && $(".mqc-toolbox").has(e.target).length === 0) { if ($(".mqc-toolbox").hasClass("active")) { mqc_toolbox_openclose(undefined, false); } } }); // Hide toolbox when a modal is shown $(".modal").on("show.bs.modal", function (e) { if ($(".mqc-toolbox").hasClass("active")) { mqc_toolbox_openclose(undefined, false); } }); // Listener to re-plot graphs if config loaded $(document).on("mqc_config_loaded", function (e) { $(".hc-plot").each(function () { var target = $(this).attr("id"); plot_graph(target, undefined, mqc_config["num_datasets_plot_limit"]); }); }); // Toolbox buttons $(".mqc-toolbox-buttons a").click(function (e) { e.preventDefault(); var target = $(this).attr("href"); mqc_toolbox_openclose(target); }); // Download DOIs $(".download-citations-btn").click(function (e) { e.preventDefault(); var format = $(this).data("format"); var doi_list = { "10.1093/bioinformatics/btw354": "MultiQC" }; $(".module-doi").each(function () { var module_id = $(this).closest(".mqc-module-section-first").find("h2").attr("id"); doi_list[$(this).data("doi")] = module_id; }); // Get BibTeX if (format == "bibtex") { var bibtex_string = ""; // Kick off crossref api calls var ajax_promises = []; for (var doi in doi_list) { ajax_promises.push( $.get("https://api.crossref.org/works/" + doi + "/transform/application/x-bibtex", function (data) { bibtex_string += data + "\n"; }) ); } // Wait until all API calls are done $.when.apply(null, ajax_promises).then(function () { var blob = new Blob([bibtex_string], { type: "text/plain;charset=utf-8" }); saveAs(blob, "multiqc_references.bib"); }); } // Download list of DOIs else { var doi_string = ""; for (var doi in doi_list) { doi_string += doi + new Array(50 - doi.length).join(" ") + " # " + doi_list[doi] + "\n"; } var blob = new Blob([doi_string], { type: "text/plain;charset=utf-8" }); saveAs(blob, "multiqc_dois.txt"); } }); // Highlight colour filters $("#mqc_color_form").submit(function (e) { e.preventDefault(); var f_text = $("#mqc_colour_filter").val().trim(); var f_col = $("#mqc_colour_filter_color").val().trim(); $("#mqc_col_filters").append( '
  • ' ); $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); $("#mqc_colour_filter").val(""); mqc_colours_idx += 1; if (mqc_colours_idx >= mqc_colours.length) { mqc_colours_idx = 0; } $("#mqc_colour_filter_color").val(mqc_colours[mqc_colours_idx]); }); $("#mqc_cols_apply").click(function (e) { if (apply_mqc_highlights()) { $(this).attr("disabled", true).removeClass("btn-primary").addClass("btn-default"); } }); // Rename samples var mqc_renamesamples_idx = 300; $("#mqc_renamesamples_form").submit(function (event) { event.preventDefault(); var from_text = $("#mqc_renamesamples_from").val().trim(); var to_text = $("#mqc_renamesamples_to").val().trim(); if (from_text.length == 0) { alert('Error - "From" text must not be blank.'); return false; } var li = '
  • '; li += ''; li += '
  • '; $("#mqc_renamesamples_filters").append(li); $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); // Reset form $("#mqc_renamesamples_from").val(""); $("#mqc_renamesamples_to").val(""); mqc_renamesamples_idx += 2; $("#mqc_renamesamples_form input:first").focus(); }); $("#mqc_rename_apply").click(function (e) { if (apply_mqc_renamesamples()) { $(this).attr("disabled", true).removeClass("btn-primary").addClass("btn-default"); } }); // Bulk rename samples $("#mqc_renamesamples_bulk_collapse").on("shown.bs.collapse", function () { $("#mqc_renamesamples_bulk_form textarea").focus(); }); $("#mqc_renamesamples_bulk_form").submit(function (e) { e.preventDefault(); var raw = $(this).find("textarea").val(); var lines = raw.match(/^.*([\n\r]+|$)/gm); $.each(lines, function (i, l) { var sections = l.split("\t", 2); if (sections.length < 2) { return true; } var from_text = sections[0].trim(); var to_text = sections[1].trim(); if (from_text.length == 0) { return true; } var li = '
  • '; li += ''; li += '
  • '; $("#mqc_renamesamples_filters").append(li); }); $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); $(this).find("textarea").val(""); $("#mqc_renamesamples_bulk_collapse").collapse("hide"); }); // Hide sample filters var mqc_hidesamples_idx = 200; $("#mqc_hidesamples_form").submit(function (e) { e.preventDefault(); var f_text = $("#mqc_hidesamples_filter").val().trim(); if (f_text.length == 0) { alert("Error - filter text must not be blank."); return false; } $("#mqc_hidesamples_filters").append( '
  • ' ); $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); $("#mqc_hidesamples_filter").val(""); mqc_hidesamples_idx += 1; }); $(".mqc_hidesamples_showhide").change(function (e) { $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); }); $("#mqc_hide_apply").click(function (e) { if (apply_mqc_hidesamples()) { $(this).attr("disabled", true).removeClass("btn-primary").addClass("btn-default"); } }); // EXPORTING PLOTS // Change text on download button $('#mqc_exportplots a[data-toggle="tab"]').on("shown.bs.tab", function (e) { if ($(e.target).attr("href") == "#mqc_data_download") { $("#mqc-dl-plot-txt").text("Data"); } else { $("#mqc-dl-plot-txt").text("Images"); } }); // Load the plot exporter if ($(".hc-plot").length > 0) { $(".hc-plot").each(function () { var fname = $(this).attr("id"); $("#mqc_export_selectplots").append( '
    " ); }); // Select all / none for checkboxes $("#mqc_export_sall").click(function (e) { e.preventDefault(); $("#mqc_export_selectplots input").prop("checked", true); }); $("#mqc_export_snone").click(function (e) { e.preventDefault(); $("#mqc_export_selectplots input").prop("checked", false); }); // Aspect ratio fixed var mqc_exp_aspect_ratio = $("#mqc_exp_width").val() / $("#mqc_exp_height").val(); $("#mqc_export_aspratio").change(function () { if ($(this).is(":checked")) { mqc_exp_aspect_ratio = $("#mqc_exp_width").val() / $("#mqc_exp_height").val(); } }); $("#mqc_exp_width").keyup(function () { if ($("#mqc_export_aspratio").is(":checked")) { $("#mqc_exp_height").val($(this).val() / mqc_exp_aspect_ratio); } }); $("#mqc_exp_height").keyup(function () { if ($("#mqc_export_aspratio").is(":checked")) { $("#mqc_exp_width").val($(this).val() * mqc_exp_aspect_ratio); } }); // Export the plots $("#mqc_exportplots").submit(function (e) { e.preventDefault(); var skipped_plots = 0; ////// EXPORT PLOT IMAGES ////// if ($("#mqc_image_download").is(":visible")) { var ft = $("#mqc_export_ft").val(); var f_scale = parseInt($("#mqc_export_scaling").val()); var f_width = parseInt($("#mqc_exp_width").val()) / f_scale; var f_height = parseInt($("#mqc_exp_height").val()) / f_scale; $("#mqc_export_selectplots input:checked").each(function () { var fname = $(this).val(); var hc = $("#" + fname).highcharts(); var cfg = { type: ft, filename: fname, sourceWidth: f_width, sourceHeight: f_height, scale: f_scale, }; if (hc !== undefined) { hc.exportChartLocal(cfg); } else if ($("#" + fname).hasClass("has-custom-export")) { $("#" + fname).trigger("mqc_plotexport_image", cfg); } else { skipped_plots += 1; } }); if (skipped_plots > 0) { alert( "Warning: " + skipped_plots + " plots skipped.\n\nNote that it is not currently possible to export dot plot images from reports. Data exports do work." ); } } ////// EXPORT PLOT DATA ////// else if ($("#mqc_data_download").is(":visible")) { $("#mqc_export_selectplots input:checked").each(function () { try { var target = $(this).val(); var ft = $("#mqc_export_data_ft").val(); var fname = target + "." + ft; var sep = ft == "tsv" ? "\t" : ","; // Custom plot not in mqc_plots if (mqc_plots[target] == undefined) { if ($("#" + target).hasClass("has-custom-export")) { $("#" + target).trigger("mqc_plotexport_data", { target: target, ft: ft, fname: fname, sep: sep }); } else { skipped_plots += 1; } } // If JSON then just dump everything else if (ft == "json") { json_str = JSON.stringify(mqc_plots[target], null, 2); var blob = new Blob([json_str], { type: "text/plain;charset=utf-8" }); saveAs(blob, fname); } // Beeswarm plots must be done manually else if (mqc_plots[target]["plot_type"] == "beeswarm") { // Header line datastring = "Sample"; for (var j = 0; j < mqc_plots[target]["categories"].length; j++) { datastring += sep + mqc_plots[target]["categories"][j]["description"]; } datastring += "\n"; // This assumes that the same samples are in all rows // TODO: Check and throw error if this isn't the case var rows = Array(); for (var j = 0; j < mqc_plots[target]["samples"][0].length; j++) { rows[j] = Array(mqc_plots[target]["samples"][0][j]); } for (var j = 0; j < mqc_plots[target]["datasets"].length; j++) { for (var k = 0; k < mqc_plots[target]["datasets"][j].length; k++) { rows[k].push(mqc_plots[target]["datasets"][j][k]); } } for (var j = 0; j < rows.length; j++) { datastring += rows[j].join(sep) + "\n"; } var blob = new Blob([datastring], { type: "text/plain;charset=utf-8" }); saveAs(blob, fname); } // Normal plot - use HighCharts plugin to get the data from the plot else if (ft == "tsv" || ft == "csv") { var hc = $("#" + target).highcharts(); if (hc !== undefined) { hc.update({ exporting: { csv: { itemDelimiter: sep } } }); var blob = new Blob([hc.getCSV()], { type: "text/plain;charset=utf-8" }); saveAs(blob, fname); } else { skipped_plots += 1; } } else { skipped_plots += 1; } } catch (e) { console.error(e); skipped_plots += 1; } }); if (skipped_plots > 0) { alert("Warning: Could not export data from " + skipped_plots + " plots."); } } else { alert("Error - don't know what to export!"); } }); } else { $("#mqc_exportplots").hide(); $(".mqc-toolbox-buttons a[href=#mqc_exportplots]").parent().hide(); } /// SAVING STUFF // Load the saved setting names populate_mqc_saveselect(); // Save config $("#mqc_saveconfig_form").submit(function (e) { e.preventDefault(); var name = $(this).find("input").val().trim(); if (name == "") { alert("Error - you must name the saved settings."); } else { mqc_save_config(name); } }); // Load config $("#mqc_loadconfig_form").submit(function (e) { e.preventDefault(); var name = $(this).find("select").val().trim(); if (name == "") { alert("Error - No saved setting selected."); } else { load_mqc_config(name); } }); // Delete config $(".mqc_config_clear").click(function (e) { e.preventDefault(); var name = $("#mqc_loadconfig_form select").val().trim(); if (name == "") { alert("Error - no saved settings selected."); } else { if (confirm("Delete saved settings '" + name + "'?")) { mqc_save_config(name, true); } } }); // Set current config as default $(".mqc_config_set_default").click(function (e) { e.preventDefault(); var name = $("#mqc_loadconfig_form select").val().trim(); if (name == "") { alert("Error - no saved settings selected."); } else { load_mqc_config(name); mqc_save_config(name, false, true); } }); // Clear current config default $(".mqc_config_clear_default").click(function (e) { e.preventDefault(); mqc_clear_default_config(); }); // Filter text is changed $(".mqc_filters").on("blur", "li input", function () { var target = $(this).parent().parent().attr("id"); if (target == "mqc_col_filters") { $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_renamesamples_filters") { $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_hidesamples_filters") { $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } }); // 'Enter' key pressed whilst editing a filter $(".mqc_filters").on("keyup", "li input", function (e) { if (e.keyCode == 13) { // Pressed enter $(this).blur(); $(this).parent().next("li").find("input").focus().select(); } }); // Remove filter button $(".mqc_filters").on("click", "li button", function () { var target = $(this).parent().parent().attr("id"); $(this).parent().remove(); if (target == "mqc_col_filters") { $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_hidesamples_filters") { $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_renamesamples_filters") { $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } }); // Clear all filters button $(".mqc_toolbox_clear").click(function () { var target = $(this).closest(".mqc_filter_section").find(".mqc_filters").attr("id"); $("#" + target).empty(); if (target == "mqc_col_filters") { $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_hidesamples_filters") { $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if (target == "mqc_renamesamples_filters") { $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } }); // Use jQuery UI to make the colour filters sortable $("#mqc_col_filters").sortable(); $("#mqc_col_filters").on("sortstop", function (event, ui) { $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); }); // Regex mode text $(".mqc_regex_mode").click(function () { var rswitch = $(this).find(".re_mode"); if (rswitch.text() == "off") { rswitch.removeClass("off").addClass("on").text("on"); } else { rswitch.removeClass("on").addClass("off").text("off"); } if ($(this).data("target") == "mqc_cols") { $("#mqc_cols_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if ($(this).data("target") == "mqc_renamesamples") { $("#mqc_rename_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } if ($(this).data("target") == "mqc_hidesamples") { $("#mqc_hide_apply").attr("disabled", false).removeClass("btn-default").addClass("btn-primary"); } }); ///////////////////////// // REGEX HELP MODAL ///////////////////////// $(".regex_example_buttons button").click(function (e) { e.preventDefault(); $(".regex_example_demo input").val($(this).data("example")); regex_example_test(); }); $(".regex_example_demo input").keyup(function (e) { regex_example_test(); }); function regex_example_test() { var re = $(".regex_example_demo input").val(); console.log("Testing " + re); $(".regex_example_demo pre span").each(function () { $(this).removeClass(); if ($(this).text().match(re)) { console.log("Matches " + $(this).text()); $(this).addClass("mark text-success"); } else { console.log("Matches " + $(this).text()); $(this).addClass("text-muted"); } }); } }); ////////////////////////////////////////////////////// // UTILITY FUNCTIONS ////////////////////////////////////////////////////// function hashCode(str) { var hash = 0; if (str.length == 0) return hash; for (i = 0; i < str.length; i++) { char = str.charCodeAt(i); hash = (hash << 5) - hash + char; hash = hash & hash; // Convert to 32bit integer } return hash; } ////////////////////////////////////////////////////// // GENERAL TOOLBOX FUNCTIONS ////////////////////////////////////////////////////// function mqc_toolbox_openclose(target, open) { // Hide any open tooltip so it's not left dangling $(".mqc-toolbox-buttons li a").tooltip("hide"); // Find if what we clicked is already open var btn = $('.mqc-toolbox-buttons li a[href="' + target + '"]'); if (open === undefined) { if (btn.hasClass("active")) { open = false; } else { open = true; } } var already_open = $(".mqc-toolbox").hasClass("active"); if (open) { if (already_open) { mqc_toolbox_confirmapply(); } $(".mqc-toolbox, .mqc-toolbox-buttons li a, .mqc_filter_section").removeClass("active"); btn.addClass("active"); $(".mqc-toolbox, " + target).addClass("active"); $(document).trigger("mqc_toolbox_open"); var timeout = already_open ? 0 : 510; setTimeout(function () { if (target == "#mqc_cols") { $("#mqc_colour_filter").focus(); } if (target == "#mqc_renamesamples") { $("#mqc_renamesamples_from").focus(); } if (target == "#mqc_hidesamples") { $("#mqc_hidesamples_filter").focus(); } }, timeout); } else { mqc_toolbox_confirmapply(); btn.removeClass("active"); $(".mqc-toolbox, .mqc-toolbox-buttons li a").removeClass("active"); $(document).trigger("mqc_toolbox_close"); } } function mqc_toolbox_confirmapply() { // Check if there's anything waiting to be applied if ($("#mqc_cols_apply").is(":enabled") && $("#mqc_cols").is(":visible")) { $.toast({ heading: "Highlights Not Applied", text: "Careful - your changes haven't been applied yet! Click the Apply button in the toolbox to set your changes.", icon: "warning", position: "bottom-right", hideAfter: 5000, }); } if ($("#mqc_rename_apply").is(":enabled") && $("#mqc_renamesamples").is(":visible")) { $.toast({ heading: "Rename Patterns Not Applied", text: "Careful - your changes haven't been applied yet! Click the Apply button in the toolbox to set your changes.", icon: "warning", position: "bottom-right", hideAfter: 5000, }); } if ($("#mqc_hide_apply").is(":enabled") && $("#mqc_hidesamples").is(":visible")) { $.toast({ heading: "Hide Samples Not Applied", text: "Careful - your changes haven't been applied yet! Click the Apply button in the toolbox to set your changes.", icon: "warning", position: "bottom-right", hideAfter: 5000, }); } } function validate_regexp(pattern) { try { new RegExp(pattern, "g"); return true; } catch (error) { $.toast({ heading: "Invalid Regular Expression!", text: "Apologies, your regular expression pattern is invalid: " + pattern + "

    " + 'For more help and testing, try it out at regex101.com.', icon: "error", position: "bottom-right", hideAfter: 5000, }); return false; } } ////////////////////////////////////////////////////// // HIGHLIGHT SAMPLES ////////////////////////////////////////////////////// function apply_mqc_highlights() { // Collect the filters into an array var f_texts = []; var f_cols = []; var regex_mode = $("#mqc_cols .mqc_regex_mode .re_mode").hasClass("on"); var num_errors = 0; $("#mqc_col_filters li").each(function () { var inputElement = $(this).find(".f_text"); var pattern = inputElement.val(); // Validate RegExp $(this).removeClass("bg-danger"); if (regex_mode && !validate_regexp(pattern)) { $(this).addClass("bg-danger"); num_errors++; } // Only add pattern if it hasn't already been added if (f_texts.indexOf(pattern) < 0) { f_texts.push(pattern); f_cols.push(inputElement.css("color")); } else { f_cols[f_texts.indexOf(pattern)] = inputElement.css("color"); } }); if (num_errors > 0) { return false; } // Apply a 'background' highlight to remove default colouring first // Also highlight toolbox drawer icon if (f_texts.length > 0 && f_texts.indexOf("") < 0) { f_texts.unshift(""); f_cols.unshift("#cccccc"); $('.mqc-toolbox-buttons a[href="#mqc_cols"]').addClass("in_use"); } else { $('.mqc-toolbox-buttons a[href="#mqc_cols"]').removeClass("in_use"); } window.mqc_highlight_f_texts = f_texts; window.mqc_highlight_f_cols = f_cols; window.mqc_highlight_regex_mode = regex_mode; // Fire off a custom jQuery event for other javascript chunks to tie into $(document).trigger("mqc_highlights", [f_texts, f_cols, regex_mode]); return true; } ////////////////////////////////////////////////////// // RENAME SAMPLES ////////////////////////////////////////////////////// function apply_mqc_renamesamples() { var valid_from_texts = []; var valid_to_texts = []; var regex_mode = $("#mqc_renamesamples .mqc_regex_mode .re_mode").hasClass("on"); var num_errors = 0; // Collect filters var f_texts = $("#mqc_renamesamples_filters > li").each(function () { var from_text = $(this).find(".from_text").val(); var to_text = $(this).find(".to_text").val(); // Validate RegExp $(this).removeClass("bg-danger"); if (regex_mode && !validate_regexp(from_text)) { $(this).addClass("bg-danger"); num_errors++; } valid_from_texts.push(from_text); valid_to_texts.push(to_text); }); if (num_errors > 0) { return false; } // If something was renamed, highlight the toolbox icon if (valid_from_texts.length > 0) { $('.mqc-toolbox-buttons a[href="#mqc_renamesamples"]').addClass("in_use"); } else { $('.mqc-toolbox-buttons a[href="#mqc_renamesamples"]').removeClass("in_use"); } window.mqc_rename_f_texts = valid_from_texts; window.mqc_rename_t_texts = valid_to_texts; window.mqc_rename_regex_mode = regex_mode; // Fire off a custom jQuery event for other javascript chunks to tie into $(document).trigger("mqc_renamesamples", [window.mqc_rename_f_texts, window.mqc_rename_t_texts, regex_mode]); return true; } ////////////////////////////////////////////////////// // HIDE SAMPLES ////////////////////////////////////////////////////// function apply_mqc_hidesamples(mode) { // Collect the filters into an array if (mode === undefined) { mode = $(".mqc_hidesamples_showhide:checked").val() == "show" ? "show" : "hide"; } var regex_mode = $("#mqc_hidesamples .mqc_regex_mode .re_mode").hasClass("on"); var f_texts = []; var num_errors = 0; $("#mqc_hidesamples_filters li").each(function () { var pattern = $(this).find(".f_text").val(); // Validate RegExp $(this).removeClass("bg-danger"); if (regex_mode && !validate_regexp(pattern)) { $(this).addClass("bg-danger"); num_errors++; } f_texts.push(pattern); }); if (num_errors > 0) { return false; } // If something was hidden, highlight the toolbox icon if (f_texts.length > 0) { $('.mqc-toolbox-buttons a[href="#mqc_hidesamples"]').addClass("in_use"); } else { $('.mqc-toolbox-buttons a[href="#mqc_hidesamples"]').removeClass("in_use"); } window.mqc_hide_mode = mode; window.mqc_hide_f_texts = f_texts; window.mqc_hide_regex_mode = regex_mode; // Fire off a custom jQuery event for other javascript chunks to tie into $(document).trigger("mqc_hidesamples", [f_texts, regex_mode]); return true; } ////////////////////////////////////////////////////// // SAVE TOOLBOX SETTINGS ////////////////////////////////////////////////////// // Save the current configuration setup function mqc_save_config(name, clear, as_default) { if (name === undefined) { return false; } var config = {}; // Collect the toolbox vars config["highlights_f_texts"] = window.mqc_highlight_f_texts; config["highlights_f_cols"] = window.mqc_highlight_f_cols; config["highlight_regex"] = window.mqc_highlight_regex_mode; config["rename_from_texts"] = window.mqc_rename_f_texts; config["rename_to_texts"] = window.mqc_rename_t_texts; config["rename_regex"] = window.mqc_rename_regex_mode; config["hidesamples_mode"] = window.mqc_hide_mode; config["hidesamples_f_texts"] = window.mqc_hide_f_texts; config["hidesamples_regex"] = window.mqc_hide_regex_mode; var prev_config = {}; // Load existing configs (inc. from other reports) try { try { prev_config = localStorage.getItem("mqc_config"); if (prev_config !== null && prev_config !== undefined) { prev_config = JSON.parse(prev_config); } else { prev_config = {}; } // Update config obj with current config if (clear == true) { delete prev_config[name]; } else { prev_config[name] = config; prev_config[name]["last_updated"] = Date(); if (as_default) { for (var c in prev_config) { if (prev_config.hasOwnProperty(c)) { prev_config[c]["default"] = false; } } } prev_config[name]["default"] = as_default; if (as_default) console.log("Set new default config!"); } localStorage.setItem("mqc_config", JSON.stringify(prev_config)); } catch (e) { console.log("Could not access localStorage"); } if (clear == true) { // Remove from load select box $("#mqc_loadconfig_form select option:contains('" + name + "')").remove(); // Successfully deleted message $('

    Settings deleted.

    ') .hide() .insertBefore($("#mqc_loadconfig_form .actions")) .slideDown(function () { setTimeout(function () { $("#mqc-cleared-success").slideUp(function () { $(this).remove(); }); }, 5000); }); } else { // Remove from load select box $("#mqc_loadconfig_form select option:contains('" + name + "')").remove(); // Add new name to load select box and select it $("#mqc_loadconfig_form select") .prepend(" ") .val(name + (as_default ? " [default]" : "")); // Success message $('

    Settings saved.

    ') .hide() .insertBefore($("#mqc_saveconfig_form")) .slideDown(function () { setTimeout(function () { $("#mqc-save-success").slideUp(function () { $(this).remove(); }); }, 5000); }); } } catch (e) { console.log("Error updating localstorage: " + e); } } // Clear current default configuration function mqc_clear_default_config() { try { var config = localStorage.getItem("mqc_config"); if (!config) { return; } else { config = JSON.parse(config); } for (var c in config) { if (config.hasOwnProperty(c)) { config[c]["default"] = false; } } localStorage.setItem("mqc_config", JSON.stringify(config)); $('

    Unset default.

    ') .hide() .insertBefore($("#mqc_loadconfig_form .actions")) .slideDown(function () { setTimeout(function () { $("#mqc-cleared-success").slideUp(function () { $(this).remove(); }); }, 5000); var name = $('#mqc_loadconfig_form select option:contains("default")').text(); $('#mqc_loadconfig_form select option:contains("default")').remove(); name = name.replace(" [default]", ""); $("#mqc_loadconfig_form select") .append(" ") .val(name); }); } catch (e) { console.log("Could not access localStorage"); } } ////////////////////////////////////////////////////// // LOAD TOOLBOX SAVE NAMES ////////////////////////////////////////////////////// function populate_mqc_saveselect() { var default_config = ""; try { var local_config = localStorage.getItem("mqc_config"); if (local_config !== null && local_config !== undefined) { local_config = JSON.parse(local_config); default_name = false; for (var name in local_config) { if (local_config[name]["default"]) { console.log("Loaded default config!"); load_mqc_config(name); default_config = name; name = name + " [default]"; default_name = name; } $("#mqc_loadconfig_form select") .append(" ") .val(name); } // Set the selected select option if (default_name !== false) { $('#mqc_loadconfig_form select option:contains("' + default_name + '")').prop("selected", true); } else { $("#mqc_loadconfig_form select option:first").prop("selected", true); } } } catch (e) { console.log("Could not load local config: " + e); $("#mqc_saveconfig").html( "

    Error accessing localStorage

    " + '

    This feature uses a web browser feature called "localStorage". ' + "We're not able to access this at the moment, which probably means that " + 'you have the "Block third-party cookies and site data" setting ticked (Chrome) ' + "or equivalent in other browsers.

    Please " + 'change this browser setting' + " to save MultiQC report configs.

    " ); } } ////////////////////////////////////////////////////// // LOAD TOOLBOX SETTINGS ////////////////////////////////////////////////////// function load_mqc_config(name) { if (name === undefined) { return false; } var config = {}; try { try { var local_config = localStorage.getItem("mqc_config"); } catch (e) { console.log("Could not access localStorage"); } if (local_config !== null && local_config !== undefined) { local_config = JSON.parse(local_config); for (var attr in local_config[name]) { config[attr] = local_config[name][attr]; } } } catch (e) { console.log("Could not load local config: " + e); } // Apply config - rename samples if (notEmptyObj(config["rename_regex"])) { if (config["rename_regex"] == true) { $("#mqc_renamesamples .mqc_regex_mode .re_mode").removeClass("off").addClass("on").text("on"); window.mqc_rename_regex_mode = true; } } if (notEmptyObj(config["rename_from_texts"]) && notEmptyObj(config["rename_to_texts"])) { window.mqc_rename_f_texts = []; window.mqc_rename_t_texts = []; $.each(config["rename_from_texts"], function (idx, from_text) { var to_text = config["rename_to_texts"][idx]; if (from_text.length == 0) { return true; } var li = '
  • '; li += ''; li += '
  • '; window.mqc_rename_f_texts.push(from_text); window.mqc_rename_t_texts.push(to_text); $("#mqc_renamesamples_filters").append(li); }); $(document).trigger("mqc_renamesamples", [ window.mqc_rename_f_texts, window.mqc_rename_t_texts, config["rename_regex"], ]); } // Apply config - highlights if (notEmptyObj(config["highlight_regex"])) { if (config["highlight_regex"] == true) { $("#mqc_cols .mqc_regex_mode .re_mode").removeClass("off").addClass("on").text("on"); window.mqc_highlight_regex_mode = true; } } if (notEmptyObj(config["highlights_f_texts"]) && notEmptyObj(config["highlights_f_cols"])) { window.mqc_highlight_f_texts = []; window.mqc_highlight_f_cols = []; $.each(config["highlights_f_texts"], function (idx, f_text) { var f_col = config["highlights_f_cols"][idx]; $("#" + hashCode(f_text + f_col)).remove(); $("#mqc_col_filters").append( '
  • ' ); window.mqc_highlight_f_texts.push(f_text); window.mqc_highlight_f_cols.push(f_col); mqc_colours_idx += 1; }); $("#mqc_colour_filter_color").val(mqc_colours[mqc_colours_idx]); $(document).trigger("mqc_highlights", [ window.mqc_highlight_f_texts, window.mqc_highlight_f_cols, config["highlight_regex"], ]); } // Apply config - hide samples if (notEmptyObj(config["hidesamples_regex"])) { if (config["hidesamples_regex"] == true) { $("#mqc_hidesamples .mqc_regex_mode .re_mode").removeClass("off").addClass("on").text("on"); window.mqc_hide_regex_mode = true; } } if (notEmptyObj(config["hidesamples_mode"])) { if (config["hidesamples_mode"] == "show") { $(".mqc_hidesamples_showhide").prop("checked", false); $(".mqc_hidesamples_showhide[val=show]").prop("checked", true); window.mqc_hide_mode = "show"; } } if (notEmptyObj(config["hidesamples_f_texts"])) { window.mqc_hide_f_texts = []; $.each(config["hidesamples_f_texts"], function (idx, f_text) { if (f_text.length == 0) { return true; } $("#mqc_hidesamples_filters").append( '
  • ' ); window.mqc_hide_f_texts.push(f_text); }); $(document).trigger("mqc_hidesamples", [window.mqc_hide_f_texts, config["hidesamples_regex"]]); } // Trigger loaded event to initialise plots $(document).trigger("mqc_config_loaded"); }

    Highlight Samples

    Regex mode off

    Rename Samples

    Click here for bulk input.

    Paste two columns of a tab-delimited table here (eg. from Excel).

    First column should be the old name, second column the new name.