summaryrefslogtreecommitdiffstats
path: root/epsdk-app-onap/src/main/webapp/app/fusion/external/ebz/js/footer.js
blob: 12fc210a2057d5931c660d934bafbc37d99226c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
var feedbackText, pageAddress, ECOMP_USAGE_A_PAGE_ID, ECOMP_USAGE_A_FUNCTION_ID, ECOMP_USAGE_A_ACTION_ID;
(function ( $ ) {
	$(document).on('click', '.feedbackButtonDiv', function (e) {
		$(".feedbackSection").slideToggle(600, function(){
			if($(".feedbackButton").hasClass("closeFeedbackButton")) {
				$(".footerContainer .feedbackButton").html("Feedback<span class='icon-chevron-down'></span>");
				$(".footerContainer .feedbackButton").removeClass("closeFeedbackButton");
			} else {
				$(".footerContainer .feedbackButton").html("Close<span class='icon-chevron-up'></span>");
				$(".footerContainer .feedbackButton").addClass("closeFeedbackButton");
				$(".footerContainer  .feedbackText").focus();
			}

		});
	});

	$(document).on('click', '.closeFeedback', function (e) {
		$(".feedbackSection").slideUp(600, function(){

		});
	});

	$(document).on('click keypress keyup blur paste','textarea[maxlength]', function(e) {
		var maxlength = $(this).attr('maxlength');
		var val = $(this).val();

		if (val.length > maxlength) {
			$(this).val(val.slice(0, maxlength));
		}
	});

	$(document).on('click', '.feedbackSubmitButton', function (e) {
		var feedbackTextTemp = $(".feedbackText").val();
		feedbackText = $.trim(feedbackTextTemp);
		var feedbackData = feedbackText;
		if (feedbackText != null && feedbackText != '') {
			$.ajax({
				type: "post",
				contentType :'application/json',
				dataType: 'json',
				data: feedbackData,
				url: "/ebiz/dashboard/feedback/createfeedback",
				success: function (data) {
					if (data.success) {
						$(".feedbackSection").slideUp(600, function() {
							$(".feedbackText").val("");
							$(".footerContainer .feedbackButton").html("Feedback<span class='icon-chevron-down'></span>");
							$(".footerContainer .feedbackButton").removeClass("closeFeedbackButton");
							$(".feedbackButtonDiv").slideUp(600);
							$(".readFeedBackMessage").text(data.feedBackMessage);
							$(".feedbackResultMsg, #feedbackResultDivider").slideDown(600);
							$(".readFeedBackMessage").focus();
						});
					} else if (typeof console == "object") {
							
						}
				},
				error: function () {
					
				}
			});
		} else {
			e.preventDefault();
			if (typeof console == 'object') {
				console.log("Invalid Input String");
			}
		}

	});
	
	// Click function definition for OK button in feedback success message
	$(document).on('click', '.feedbackMsgOKButton', function(e) {
		$(".feedbackResultMsg, #feedbackResultDivider").slideUp(600, function(){
			$(".readFeedBackMessage").text("");
		});
		$(".feedbackButtonDiv").slideDown(600, function() {
			$('.feedbackButton').focus();	
		});
	});
	
}( jQuery ));	

$(function() {
	var footerHeight = 0,
	footerTop = 0,
	$footer = $("#footer");

	positionFooter();
	
	portalHook();
	
	function portalHook() {
		
		var done = false;
		var script = document.createElement('script');	
		script.src = "api/analytics"
		script.async = true;			
		script.onload = function() {

		runAnalytics();

		}

		document.head.appendChild(script);

	}


 function positionFooter() {

        footerHeight = $footer.height();
        footerTop = ($(window).scrollTop() + $(window).height() - footerHeight) + "px";

        if (($(document.body).height() + footerHeight) < $(window).height()) {
            $footer.addClass('stickyFooter')
                .animate({
                    top: footerTop
                }, -1)
        } else {
            $footer.removeClass('stickyFooter');
        }

    }	

	$(window)
	.scroll(positionFooter)
	.resize(positionFooter)
});