Welcome to mirror list, hosted at ThFree Co, Russian Federation.

footer_scripts.twig « components « templates « assets - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8a1ce686fedfaadb5a040705d49183ec8a9f67c2 (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
{{script_footer|raw}} {% if print_bottom_link == true %}
<a data-footertemplate="{{footer_template}}" href="#" class="bottom_link">{{lang.strgotoppage}}</a> {% endif %}

<!--</div>
</div>-->
<script>
/* beautify preserve:start */

window.stateObj = {
	{%	for key, value in params %}
	'{{key}}': "{{value}}",
	{% endfor %}
	method: '{{METHOD}}'
};
/* beautify preserve:end */
</script>

<script>
var dir = '{{lang.applangdir}}';
var in_test = '{{in_test}}';
var reload = '{{reload}}';
if (!window.inPopUp) {


	if (reload !== 'none') {
		parent.frames && parent.frames.browser && parent.frames.browser.location.replace('{{subfolder}}/src/views/browser');
	}

	if (reload === 'other' && !parent.frames.length && in_test === '0') {
		var destination = location.href.replace('/src/views', '');
		console.log('will do location replace', destination);
		location.replace(destination);
	}

	$(document).ready(function () {

		$('#toplink_sql').click(function () {
			window.open($(this).attr('href'), 'sqledit:{{params.server}}', 'toolbar=no,width=750,height=520,resizable=yes,scrollbars=yes').focus();
			return false;
		});

		$('#toplink_history').click(function () {
			window.open($(this).attr('href'), 'history:{{params.server}}', 'toolbar=no,width=700,height=500,resizable=yes,scrollbars=yes').focus();
			return false;
		});

		$('#toplink_find').click(function () {
			window.open($(this).attr('href'), 'sqledit:{{params.server}}', 'toolbar=no,width=750,height=520,resizable=yes,scrollbars=yes').focus();
			return false;
		});

		$('#toplink_logout').click(function (e) {
			e.preventDefault();
			if (confirm('{{lang.strconfdropcred}}')) {
				window.location.href = $(this).attr('href');
			}
		});

		// Check if we are inside an iframe, in which case use history API to change top URL
		if (window.parent.frames.length !== 0) {

			window.parent.document.title = window.document.title;

			/* beautify preserve:start */
			stateObj.realurl= location.href.replace(location.origin, '');
			//path will only be defined inside a route
			stateObj.path= '{{path}}';
			stateObj.query_string= '{{query_string}}';

			/* beautify preserve:end */
			stateObj.newurl = '{{subfolder}}' + stateObj.realurl.replace('{{subfolder}}', '').replace('src/views/', '').replace('.php', '');
			stateObj.parenturl = window.parent.location.href.replace(window.parent.location.origin, '');


			if (window.location.href.indexOf('servers?action=logout') !== -1) {
				window.setTimeout(function () {
					window.parent.location.replace('{{subfolder}}/servers');
				}, 3000);
			} else if (stateObj.method === 'GET' && stateObj.newurl !== stateObj.parenturl) {
				//console.log('will pushState', stateObj);
				window.parent.history.pushState(stateObj, document.title, stateObj.newurl);
			}
			/* else if (stateObj.method === 'POST') {
							console.log('POST', stateObj.newurl);
						}*/

			if (jQuery.fn) {
				if (jQuery.fn.select2) {
					jQuery('.select2').select2();
				}
				if (jQuery.fn.DataTable) {
					$('.will_be_datatable').DataTable({
						"pageLength": 100
					});
				}
			}
			if (typeof hljs !== 'undefined') {
				$('pre code.hljs').each(function (i, block) {
					hljs.highlightBlock(block);
				});
			}


		} else if (in_test === '0') {
			var redirect_to,
				subject = location.pathname.replace('{{subfolder}}', '').replace('/src/views/', '').replace('.php', '');

			if (subject === '/redirect/server') {
				subject = '/servers';
			}
			redirect_to = '{{subfolder}}/' + subject + location.search;
			var redirection_msg = 'location subject ' + subject + ' will redirect_to ' + redirect_to;
			//console.log(redirection_msg);
			location.replace(redirect_to);
		}


	});
}
</script>