PageSourceSearch

https://shotcut.org/assets/js/platform-display.js

js shotcut.org collected 2026-09-24 07:02:59 UTC 3,768 bytes, 94 lines download raw bytes

1/*
2 * platform-display.js
3 *
4 * Used on /downloads/ to change download display blocks
5 * based on detected platform.
6 *
7 * Pat David, 2016
8 * Dan Dennedy, 2019
9 */
10
11if ( platform.os.family.indexOf('Win') !== -1 && platform.os.family.indexOf('Phone') == -1 ){
12    // Windows, _not_ Phone
13    document.getElementById('pOSTEST').innerHTML = 'Microsoft Windows.';
14    render('os_win')
15} else if ( platform.os.family.indexOf('OS X') !== -1 ){
16    // macOS
17    document.getElementById('pOSTEST').innerHTML = 'macOS.';
18    render('os_mac')
19} else if ( platform.os.family.indexOf('iOS') !== -1 || platform.os.family.indexOf('Android') !== -1 ){
20    // iOS or Android
21    document.getElementById('pOSTEST').innerHTML = platform.os.family + '.';
22    var nope = "<br/><strong>This platform is not currently supported.</strong>";
23    document.getElementById('pOSTEST').innerHTML += nope;
24    [].forEach.call(document.getElementsByClassName('win'), function(el) {
25        el.style.display = 'none';
26    });
27    [].forEach.call(document.getElementsByClassName('mac'), function(el) {
28        el.style.display = 'none';
29    });
30    [].forEach.call(document.getElementsByClassName('linux'), function(el) {
31        el.style.display = 'none';
32    });
33} else {
34    // Everything else (assuming *nix-type)
35    document.getElementById('pOSTEST').innerHTML = platform.os.family + '.';
36    render('os_linux')
37}
38
39function render(os) {
40    if (typeof(os) !== 'string')
41      os = this.id;
42    switch ( os ) {
43        case 'os_linux':
44            [].forEach.call(document.getElementsByClassName('win'), function(el) {
45                el.style.display = 'none';
46            });
47            [].forEach.call(document.getElementsByClassName('mac'), function(el) {
48                el.style.display = 'none';
49            });
50            [].forEach.call(document.getElementsByClassName('linux'), function(el) {
51                el.style.display = 'block';
52            });
53            break;
54        case 'os_win':
55            [].forEach.call(document.getElementsByClassName('win'), function(el) {
56                el.style.display = 'block';
57            });
58            [].forEach.call(document.getElementsByClassName('mac'), function(el) {
59                el.style.display = 'none';
60            });
61            [].forEach.call(document.getElementsByClassName('linux'), function(el) {
62                el.style.display = 'none';
63            });
64            break;
65        case 'os_mac':
66            [].forEach.call(document.getElementsByClassName('win'), function(el) {
67                el.style.display = 'none';
68            });
69            [].forEach.call(document.getElementsByClassName('mac'), function(el) {
70                el.style.display = 'block';
71            });
72            [].forEach.call(document.getElementsByClassName('linux'), function(el) {
73                el.style.display = 'none';
74            });
75            break;
76        default:
77            [].forEach.call(document.getElementsByClassName('win'), function(el) {
78                el.style.display = 'block';
79            });
80            [].forEach.call(document.getElementsByClassName('mac'), function(el) {
81                el.style.display = 'block';
82            });
83            [].forEach.call(document.getElementsByClassName('linux'), function(el) {
84                el.style.display = 'block';
85            });
86            break;
87    }
88    return false;
89}
90
91document.getElementById('os_all').addEventListener("click", render );
92document.getElementById('os_linux').addEventListener("click", render );
93document.getElementById('os_win').addEventListener("click", render );
94document.getElementById('os_mac').addEventListener("click", render );

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.