PageSourceSearch

https://orbispatches.com/assets/js/titleview.js

js orbispatches.com collected 2026-10-02 10:23:25 UTC 25,430 bytes, 530 lines download raw bytes

1(() => {
2    'use strict'
3
4    const adblockerdetected = function() {
5	return true;
6
7        if(window.tagApi != undefined) {
8            return true;
9        }
10
11        return false;
12    }
13
14    const patchevent = async function(event) {
15        event.preventDefault();
16    
17        var title = this.getAttribute('data-title'),
18            titleid = this.getAttribute('data-titleid'),
19            contentver = this.getAttribute('data-contentver'),
20            key = this.getAttribute('data-key');
21    
22        if(adblockerdetected()) {
23            createModal({
24                title: title,
25                size: 'modal-md',
26                bodyTemplate: loadingTemplate
27            });
28
29            grecaptcha.ready(function () {
30                grecaptcha.execute(orbispatches.extServices.recaptchaKey, { action: 'patch' }).then(async(token) => {
31                    var request = await httpPost(orbispatches.apiUri + '/patch', {
32                        titleid: titleid,
33                        contentver: contentver,
34                        key: key,
35                        token: token
36                    });
37        
38                    if(!request.success) {
39                        $('#modal-dyn').innerHTML = '<div class="alert alert-danger">' + request.message + '</div>';
40                        return;
41                    }
42        
43                    $('#modal-dyn').innerHTML = '';
44        
45                    if(request.pieces.length == 0) {
46                        $('#modal-dyn').innerHTML = '<p class="mt-3 p-3 lead">There is no data to be displayed. It may still be processing, please check back in 30 minutes.</p>';
47                        return;
48                    }
49
50                    // Delta packages aren't always used
51                    if(request.delta_pkg_url) {
52                        var delta_part = $C()
53                            .div({'class': 'part-container'})
54                                .h4()
55                                    .text('Delta PKG')
56                                .end()
57                                .a({'href': request.delta_pkg_url, 'class': 'btn btn-download d-block fw-semibold mt-3'})
58                                    .text('Download Delta PKG')
59                                .end()
60                            .end()
61                        .end();
62
63                        $('#modal-dyn').appendChild(delta_part);
64                    }
65
66                    for (var i = 0; i < request.pieces.length; i++) {
67                        var piece = request.pieces[i];
68        
69                        var piece_part = $C()
70                            .test(i === 0)
71                                .div({'class': 'd-flex justify-content-end align-items-center sticky-top banner-copyall'})
72                                    .div({'class': 'me-auto', 'id': 'banner-copyall-text'})
73                                        .text('Using a download manager?')
74                                    .end()
75                                    .a({'href': '#', 'class': 'btn btn-primary-muted', 'style': 'background: #1b72c7; color: #fff'})
76                                        .act(function() {
77                                            this.addEventListener('click', function(event) {
78                                                event.preventDefault();
79
80                                                var links = $$('[data-patch-piece-link]'),
81                                                    partcontainers = $$('[data-part-container]'),
82                                                    ii,
83                                                    links_dumpster = '',
84                                                    _this = this;
85
86                                                for (ii = 0; ii < links.length; ++ii) {
87                                                    links_dumpster += (links[ii].href + "\n");
88                                                }
89
90                                                navigator.clipboard.writeText(links_dumpster);
91
92                                                this.innerText = 'Copied!';
93
94                                                for (ii = 0; ii < partcontainers.length; ++ii) {
95                                                    partcontainers[ii].style.background = 'var(--copyall-banner-bg)';
96                                                }
97
98                                                setTimeout(function() {
99                                                    _this.innerText = 'Copy all PKG links';
100
101                                                    for (ii = 0; ii < partcontainers.length; ++ii) {
102                                                        partcontainers[ii].style.removeProperty('background');
103                                                    }
104                                                }, 500);
105                                            }, false);
106                                        })
107                                        .text('Copy all PKG links')
108                                    .end()
109                                .end()
110                            .end()
111                            .div({'class': 'part-container', 'data-part-container': ''})
112                                .h4()
113                                    .text('Piece ' + piece.order)
114                                .end()
115                                .div({'class': 'row'})
116                                    .div({'class': 'col-md-4 fw-normal'})
117                                        .text('Size')
118                                    .end()
119                                    .div({'class': 'col-md-8 fw-light'})
120                                        .text(piece.size)
121                                    .end()
122                                .end()
123                                .div({'class': 'row'})
124                                    .div({'class': 'col-md-4 fw-normal'})
125                                        .text('Hash')
126                                    .end()
127                                    .div({'class': 'col-md-8 fw-light'})
128                                        .code()
129                                            .text(piece.hash)
130                                        .end()
131                                    .end()
132                                .end()
133                                .div({'class': 'mt-4'})
134                                    .a({'href': piece.pkg_url, 'class': 'btn btn-download d-block fw-semibold', 'data-patch-piece-link': ''})
135                                        .text('Download Piece PKG')
136                                    .end()
137                                .end()
138                            .end()
139                        .end();
140
141                        $('#modal-dyn').appendChild(piece_part);
142                    }
143                });
144            });
145        } else {
146            alert('Unable to load patch. Please disable your adblocker.');
147        }
148    }
149
150    const detailsevent = async function(event) {
151        event.preventDefault();
152        
153        var titleid = this.getAttribute('data-titleid'),
154            contentver = this.getAttribute('data-contentver'),
155            key = this.getAttribute('data-key'),
156            title = this.getAttribute('data-title'),
157            details = document.createElement('span');
158        
159        createModal({
160            title: title,
161            size: 'modal-lg',
162            bodyTemplate: loadingTemplate
163        });
164        
165        grecaptcha.ready(function () {
166            grecaptcha.execute(orbispatches.extServices.recaptchaKey, { action: 'patchdetails' }).then(async(token) => {
167                var request = await httpPost(orbispatches.apiUri + '/patchdetails', {
168                    titleid: titleid,
169                    contentver: contentver,
170                    key: key,
171                    token: token
172                });
173                
174                if(!request.success) {
175                    $('#modal-dyn').innerHTML = '<div class="alert alert-danger">' + request.message + '</div>';
176                    return;
177                }
178    
179                $('#modal-dyn').innerHTML = '';
180    
181                if(request.creation_date == '') {
182                    $('#modal-dyn').innerHTML = '<div class="alert alert-danger">This title is currently being processed. More data will be available at a later moment.</div>';
183                    return;
184                }
185    
186                $C(details)
187                    .div({'class': 'row mb-2'})
188                        .div({'class': 'col-lg lead fw-semibold'})
189                            .text('Creation Date')
190                        .end()
191                        .div({'class': 'col-lg lead'})
192                            .text(request.creation_date)
193                        .end()
194                    .end()
195                    .div({'class': 'row mb-2'})
196                        .div({'class': 'col-lg lead fw-semibold'})
197                            .text('SDK Version')
198                        .end()
199                        .div({'class': 'col-lg lead'})
200                            .text(request.sdk_version)
201                        .end()
202                    .end()
203                    .div({'class': 'row mb-2'})
204                        .div({'class': 'col-lg lead fw-semibold'})
205                            .text('ST Type')
206                        .end()
207                        .div({'class': 'col-lg lead'})
208                            .text(request.st_type)
209                        .end()
210                    .end()
211                    .div({'class': 'row mb-2'})
212                        .div({'class': 'col-lg lead fw-semibold'})
213                            .text('Mandatory')
214                        .end()
215                        .div({'class': 'col-lg lead'})
216                            .text(request.mandatory ? 'Yes' : 'No')
217                        .end()
218                    .end()
219                    .div({'class': 'row mb-2'})
220                        .div({'class': 'col-lg lead fw-semibold'})
221                            .text('Remaster')
222                        .end()
223                        .div({'class': 'col-lg lead'})
224                            .text(request.remaster ? 'Yes' : 'No')
225                        .end()
226                    .end()
227                    .div({'class': 'row mb-2'})
228                        .div({'class': 'col-lg lead fw-semibold'})
229                            .text('PatchGo')
230                        .end()
231                        .div({'class': 'col-lg lead'})
232                            .text(request.patchgo ? 'Yes' : 'No')
233                        .end()
234                    .end()
235                    .div({'class': 'row mb-2'})
236                        .div({'class': 'col-lg lead fw-semibold'})
237                            .text('Splitted Files #')
238                        .end()
239                        .div({'class': 'col-lg lead'})
240                            .text(request.number_splitfiles)
241                        .end()
242                    .end()
243                    .div({'class': 'row mb-2'})
244                        .div({'class': 'col-lg lead fw-semibold'})
245                            .text('PlayGo Manifest')
246                        .end()
247                        .div({'class': 'col-lg lead'})
248                            .a({'href': request.playgo_manifest_url, 'target': '_blank'})
249                                .text('playgo-manifest.xml')
250                            .end()
251                        .end()
252                    .end()
253                    .div({'class': 'row mb-2'})
254                        .div({'class': 'col-lg lead fw-semibold'})
255                            .text('Raw URL')
256                        .end()
257                        .div({'class': 'col-lg lead'})
258                            .a({'href': request.raw_url, 'target': '_blank'})
259                                .text(request.raw_url.substring(request.raw_url.lastIndexOf('/')+1))
260                            .end()
261                        .end()
262                    .end()
263                    .div({'class': 'row mb-2'})
264                        .div({'class': 'col-lg-6 lead fw-semibold'})
265                            .text('Digest')
266                        .end()
267                        .div({'class': 'col-lg-6 lead'})
268                            .code({'class': 'text-wrap'})
269                                .text(request.digest)
270                            .end()
271                        .end()
272                    .end()
273                .end();
274                    
275                $('#modal-dyn').insertAdjacentHTML('beforeend', details.innerHTML);
276            });
277        });
278    }
279
280    const changeinfoevent = async function(event) {
281        event.preventDefault();
282    
283        var titleid = this.getAttribute('data-titleid'),
284            contentver = this.getAttribute('data-contentver'),
285            key = this.getAttribute('data-key'),
286            title = this.getAttribute('data-title'),
287            changelog = document.createElement('span');
288    
289        createModal({
290            title: title,
291            size: 'modal-lg',
292            bodyTemplate: loadingTemplate
293        });
294        
295        grecaptcha.ready(function () {
296            grecaptcha.execute(orbispatches.extServices.recaptchaKey, { action: 'changelogs' }).then(async(token) => {
297                var request = await httpPost(orbispatches.apiUri + '/changelogs', {
298                    titleid: titleid,
299                    contentver: contentver,
300                    key: key,
301                    token: token
302                });
303    
304                if(!request.success) {
305                    $('#modal-dyn').innerHTML = '<div class="alert alert-danger">' + request.message + '</div>';
306                    return;
307                }
308                
309                $('#modal-dyn').innerHTML = '';
310    
311                if(request.changelog == '' || request.changelog === '0') {
312                    $('#modal-dyn').innerHTML = '<p class="m-0">This title is currently being processed. More data will be available at a later moment.</p>';
313                    return;
314                }
315    
316                $C(changelog)
317                    .span({'class': 'lead changelog-container'})
318                        .text(request.changelog, true)
319                    .end()
320                .end();
321                    
322                $('#modal-dyn').insertAdjacentHTML('beforeend', changelog.innerHTML);
323            });
324        });
325    }
326
327    const shareevent = async function(event) {
328        event.preventDefault();
329    
330        var contentver = this.getAttribute('data-contentver'),
331            titlename = this.getAttribute('data-titlename'),
332            contents = document.createElement('span');
333    
334        var shareUrl = window.location.protocol + '//' + window.location.hostname + window.location.pathname + '?v=' + contentver;
335    
336        if (navigator.share) {
337            await navigator.share({
338                title: titlename + ' on ORBISPatches.com',
339                text: 'View PlayStation 4 game patches for ' + titlename + '.',
340                url: shareUrl,
341            })
342            .catch((error) => {
343                console.log('Error sharing', error)
344            });
345        } else {
346            createModal({
347                title: 'Share',
348                size: 'modal-md',
349                bodyTemplate: loadingTemplate
350            });
351            
352            $('#modal-dyn').innerHTML = '';
353    
354            $C(contents)
355                .input({'type': 'text', 'value': shareUrl, 'class': 'form-control'}).end()
356            .end();
357    
358            $('#modal-dyn').insertAdjacentHTML('beforeend', contents.innerHTML);
359        }
360    }
361    
362    const loadpatches = async function(element, titleid, key) {
363        var request = await httpPost(orbispatches.apiUri + '/loadpatches', {
364            titleid: titleid,
365            key: key
366        });
367    
368        if(request && request.success && request.patches.length > 0) {
369            element.innerHTML = '';
370    
371            for (var i = 0; i < request.patches.length; i++) {
372                var patch = request.patches[i];
373    
374                var tmpl = $C()
375                    .div({'class': 'mb-4 patch-wrapper'})
376                        .div({'class': (patch.is_latest) ? 'patch-container latest' : 'patch-container'})
377                            .a({'href': '#', 'class': 'patch-link d-block p-4', 'data-titleid': titleid, 'data-contentver': patch.version, 'data-key': patch.keyset.patch, 'data-title': 'Patch ' + patch.version })
378                                .act(function() {
379                                    this.addEventListener('click', patchevent, false);
380                                })
381                                .h4()
382                                    .text('Patch ' + patch.version)
383                                .end()
384                                .div({'class': 'row mt-4'})
385                                    .div({'class': 'col-auto flex-fill text-start fw-normal'})
386                                        .text('PKG Size')
387                                    .end()
388                                    .div({'class': 'col-auto text-end'})
389                                        .text(patch.filesize)
390                                    .end()
391                                .end()
392                                .div({'class': 'row mt-1'})
393                                    .div({'class': 'col-auto flex-fill text-start fw-normal'})
394                                        .text('Required Firmware')
395                                    .end()
396                                    .div({'class': 'col-auto text-end'})
397                                        .text(patch.required_firmware ?? 'Unknown')
398                                    .end()
399                                .end()
400                                .div({'class': 'row mt-1'})
401                                    .div({'class': 'col-auto flex-fill text-start fw-normal'})
402                                        .text('Creation Date')
403                                    .end()
404                                    .div({'class': 'col-auto text-end'})
405                                        .text(patch.creation_date ?? 'Unknown')
406                                    .end()
407                                .end()
408                            .end()
409                            .choose()
410                                .when(patch.changelog_charcount > 0)
411                                    .div({'class': 'changelog-wrapper'})
412                                        .table({'class': 'changelog-table'})
413                                            .tbody()
414                                                .tr()
415                                                    .td()
416                                                        .a({ 'href': '#', 'class': 'changeinfo-preview d-block text-truncate py-2 px-4', 'data-titleid': titleid, 'data-contentver': patch.version, 'data-key': patch.keyset.changeinfo, 'data-title': 'Patch ' + patch.version + ' - Patch Notes', 'data-patchnotes-charcount': patch.changelog_charcount })
417                                                            .act(function() {
418                                                                this.addEventListener('click', changeinfoevent, false);
419                                                            })
420                                                            .text(patch.changelog_preview)
421                                                        .end()
422                                                    .end()
423                                                .end()
424                                            .end()
425                                        .end()
426                                    .end()
427                                .end()
428                            .end()
429                            .div({'class': (patch.changelog_charcount > 0) ? 'text-end' : 'text-end border-top'})
430                                .nav({ 'class': 'nav patch-options text-center' })
431                                    .a({'href': '#', 'class': 'nav-link flex-fill share-icon', 'data-titleid': titleid, 'data-contentver': patch.version, 'data-titlename': request.name })
432                                        .act(function() {
433                                            this.addEventListener('click', shareevent, false);
434                                        })
435                                        .span({ 'class': 'd-none d-md-inline-block ms-2' })
436                                            .text('Share')
437                                        .end()
438                                    .end()
439                                    .a({'href': '#', 'class': 'nav-link flex-fill details-icon', 'data-titleid': titleid, 'data-contentver': patch.version, 'data-key': patch.keyset.details, 'data-title': 'Patch ' + patch.version + ' - Details' })
440                                        .act(function() {
441                                            this.addEventListener('click', detailsevent, false);
442                                        })
443                                        .span({ 'class': 'd-none d-md-inline-block ms-2' })
444                                            .text('Details')
445                                        .end()
446                                    .end()
447                                    .a({'href': '#', 'class': (patch.changelog_charcount > 0) ? 'nav-link flex-fill notes-icon' : 'nav-link flex-fill notes-icon disabled', 'data-titleid': titleid, 'data-contentver': patch.version, 'data-key': patch.keyset.changeinfo, 'data-title': 'Patch ' + patch.version + ' - Patch Notes', 'data-patchnotes-charcount': patch.changelog_charcount })
448                                        .act(function() {
449                                            this.addEventListener('click', changeinfoevent, false);
450                                        })
451                                        .span({ 'class': 'd-none d-md-inline-block ms-2' })
452                                            .text('Patch Notes')
453                                        .end()
454                                    .end()
455                                .end()
456                            .end()
457                        .end()
458                    .end()
459                .end();
460    
461                element.appendChild(tmpl);
462            }
463    
464            orbispatches.patchObs.fireEvent("patchload", { titleid: titleid, count: request.patches.length });
465        }
466    }
467
468    const initpatches = function() {
469        var dynelement = $('#dynpatch');
470        var params = dynelement.getAttribute('data-loadparams');
471    
472        var requestParams = {};
473        var paramObj = params.replace(/'/g, '"');
474            paramObj = JSON.parse(paramObj);
475    
476        for(var index in paramObj) {
477            requestParams[index] = paramObj[index];
478        }
479    
480        loadpatches(dynelement, requestParams['titleid'], requestParams['key']);
481    }
482
483    const initheader = function() {
484        if($('#titleview-header') && window.innerWidth > 992) {
485            const positions = [];
486            const bg = $('body');
487            
488            window.addEventListener('mousemove', (e) => {
489                const x = (e.pageX + bg.offsetLeft) / 25;
490                const y = (e.pageY + bg.offsetTop) / 25;
491        
492                positions.push({ x, y });
493        
494                const averageCount = 10;
495                if (positions.length > averageCount) {
496                    positions.splice(0, 1);
497                }
498                
499                const current = positions.reduce((acc, e) => {
500                    acc.x += e.x;
501                    acc.y += e.y;
502        
503                    return acc;
504                }, {
505                    x: 0, y: 0
506                });
507        
508                current.x /= positions.length;
509                current.y /= positions.length;
510        
511                $('#titleview-header').style['background-position-x'] = "calc(50% - " + current.x + "px)";
512                $('#titleview-header').style['background-position-y'] = "calc(50% - " + current.y + "px)";
513                $('#titleview-header').style['background-size'] = '110%';
514            });
515        }
516    }
517
518    window.addEventListener('DOMContentLoaded', () => {
519        initpatches();
520        initheader();
521
522        if($('#compat_notices_expander')) {
523            $('#compat_notices_expander').addEventListener('click', function(event) {
524                $('#links-compatnotices').style.removeProperty('height');
525                $('#links-compatnotices').style.removeProperty('overflow');
526                $('#compat_notices_expander').style.display = 'none';
527            });
528        }
529    });
530})()

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.