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

toplinks_behavior.js « js « assets - github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 58dbd149cd1fdb9e04cc12ac2602bcce7fae49ff (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
function shouldSkipRedirection() {
  return (
    window.inPopUp ||
    parent.frames.length ||
    stateObj.reload === 'other' ||
    stateObj.in_test !== '0' ||
    parent.location.href === location.href
  );
}

function addBehaviorToTopLinks(amIDetailFrame) {
  const parentHandle =
      amIDetailFrame && window.parent.document.querySelector('#detail'),
    toplink_logout =
      amIDetailFrame &&
      (parentHandle.contentDocument || document).querySelector(
        '#toplink_logout'
      );

  parentHandle &&
    [
      ...(parentHandle.contentDocument || document).querySelectorAll(
        '.toplink .toplink_popup'
      ),
    ].forEach((element) => {
      element.addEventListener('click', (e) => {
        window
          .open(
            `${element.getAttribute('rel')}`,
            '_blank', //`sqledit:${stateObj.server}`,
            'toolbar=no,width=750,height=520,resizable=yes,scrollbars=yes'
          )
          .focus();
      });
    });
  toplink_logout &&
    toplink_logout.addEventListener('click', (e) => {
      e.preventDefault();
      if (confirm(stateObj.strconfdropcred)) {
        window.location.href = e.target.href;
      }
    });

  return;
}

$.ready.then(() => {
  let amIDetailFrame = document.body.classList.contains('detailbody');
  if (shouldSkipRedirection()) {
    return addBehaviorToTopLinks(true || amIDetailFrame);
  }
});