DocScripts


DocScripts is a repo that offers Quality of Life scripts for a browser game called Politics and War. These scripts do a wide range of things from small (hiding people's nation and alliance descriptions) to large (Changing the entire UI of pages.). DocScripts is available on all major platforms.

Scripts


aSyncly


Pages:

  • https://politicsandwar.com/*
  • Excluding: https://politicsandwar.com/human/

Descriptions

This script allows you to sync your config settings for other various scripts of this repository across multiple browsers by way of the Dossier Page. It runs in the background checking for updates at least every 5mins. If there is 500+ player online then it will push it's checking for updates to at least every 30mins. If the player count goes to 800+ then it won't check at all for updates.

Please Be Warned: Config settings may be lost or altered if scripts between browsers update out of sync.

City Manager


Pages:

  • https://politicsandwar.com/city/id=*

Descriptions

Prevents the need for a refresh to update the city's improvements when doing them one by one. If you're like me, and you update the first city manually before exporting and importing it to the rest of your cities, then this will be quite useful.

Create Trade


Pages:

  • https://politicsandwar.com/nation/trade/create/*
  • https://politicsandwar.com/index.php?id=27*

Descriptions

This script is designed to work in tandem with the View Trades script as many of what this script has to offer wouldn't work without it. What this script does do is:

  • Automatically scroll your page so the form is at the centre of it
  • Fill in the Quantity and Price of the form if said numbers are provided in the URL.
  • Removes the corresponding Sell/Buy button from the form if one was specified in the url. When one is removed, it will also skip the confirmation popup.
  • Will automatically return you to the create offer page if the Quantity, specified in the URL, was greater than 1,000,000 tons, and wasn't different when you click the Sell/Buy button. The Sell/Buy button will be disabled for 5s to not run into an error message.
  • Will automatically return you to the market page upon successfully creating your offer.

Hide Alliance Descriptions


Pages:

  • https://politicsandwar.com/alliance/id=*

Descriptions

This script runs on all Alliance's home page and will hide the Alliance's custom description set by their government. It will provide buttons at the top and bottom of the description to display and hide the Alliance's description. The Alliance's description will be displayed by default.

Hide Nation Descriptions


Pages:

  • https://politicsandwar.com/nation/id=*

Descriptions

This script runs on all Nation's home page and will hide the Nation's custom description set by the Player. It will provide buttons at the top and bottom of the description to display and hide the Nation's description. The Nation's description will be hidden by default.

Human


Pages:

  • https://politicsandwar.com/human/

Descriptions

This script simply plays a tone whenever the page loads.

Keno


Pages:

  • https://politicsandwar.com/casino/keno/*

Descriptions

Play a game where the odds are greatly stacked against you. Take the great risk in losing millions all for the tiny chance of making billions.
This script will automatically keep a total of how many times each number from 1 - 80 appeared in your games. It will also display the 10 most or 10 least hit numbers in all your games recorded. This script can also auto select the numbers based off one of things. The option to configure it is located at the bottom of the sidebar.

Military


Pages:

  • https://politicsandwar.com/nation/military/

Descriptions

Still under development

Nations


Pages:

  • https://politicsandwar.com/nations/
  • https://politicsandwar.com/index.php?id=15*

Descriptions

Provides an input box on the nation's page for you to provide a nation score in, and a refresh button to auto get your current nation score. With this score it changes the in spy range and in war range icons to adjust for that specified score. The war range icons have also been updated to be either green , red , or a mix of green and red . Green still meaning that they're in your range and red meaning that you're in theirs.

Play Baseball


Pages:

  • https://politicsandwar.com/obl/host/*
  • https://politicsandwar.com/obl/play/*

Descriptions

  • At the bottom of the sidebar, you'll be able to:
    • Toggle off notifications that display the total amount of money generated by the game and the amount of tip still owing/owed.
    • Toggle off the beep sound when a game has successfully been played.
    • Toggle on the built in captcha page. Which will display the Are You Human page inside the actual game page whenever it detects a redirect happened.
      • This feature might break around turn updates.
  • Replaces the default Host Home Game and Play Away Game, on their respective pages, with two new buttons, Host/Away Game and Cancel Game, which all function without a page refresh
    • Clicking the Host Game button will start hosting a game. The script will check in the background for if that game has been fulfilled, and at which point will re-enable the button for you to click again.
    • Clicking the Away Game button will make the script start looking for a game to play. Once it's found **one** it will attempt to play it, if successful, it will re-enable the button for you to click again. This script basically makes the Away Games work just like the Home Games.
    • Clicking the Cancel Game button will cancel hosting a game or looking for a game to play, on their respective pages.
    • A beep sound is played whenever a game successfully executes. If you click Cancel Game then no beep sound will be played.
  • When the page loads and after every game played, the script attempt to check for unrecorded games and calculate any tips owing/owed by either party.
    • Tips are calculated at 30% of ticket sales **and** winnings combined. Meaning it doesn't matter who wins the games, the pay is always 70:30.
      • After the initial calculation of the 30% tip, additional math is applied to figure out how much of what is owed/owing is still left to receive.
    • The debt owed/owing is displayed on screen along with the their team name, nation name and link to nation. Plus an Info button.
      • If the debt is displayed in red, then you owe said much to that player.
      • If the debt is displayed in green, then that player owes said much to you.
      • Tipping is not enforced by me whatsoever, but you might end up getting embargoed if you refuse to tip the opposing team.
  • Clicking the Info button will provide you with two more buttons on screen, a send offer button, and an adjust button.
    • The Send Offer button is designed to work in tandem with the Create Trade script as it will automatically fill out the forum for you, set to the correct person and displaying the correct button.
    • The Adjust button lets you change the amount of debt it says you owe. This only changes on your records and not theirs. It's intended to be used to update the amount once the tip has been accepted by either party.
      • If no game has been played for 7 days between both parties the debt is just written off and deleted from the books automatically.
      • Setting the amount of zero will cause the debt to be removed from the books, while setting it blank or an invalid number will cause nothing to change.
It is **not recommended** to view the market pages while running this script, or you might find it a bit hard to accept or create trade offers. This also goes for any other similar page.

Reward-Ads


Pages:

  • https://politicsandwar.com/rewarded-ads/

Descriptions

This script clicks the button so you don't have to. When you reach the maximum of 25 ads, it forwards you to your Nation page. It will work in it's own tab, but a window is suggested as the browser seems to pause or slow down JavaScript when inactive.

Aggressive Mode

At the bottom of the left sidebar you'll find a checkbox to toggle AggressiveMode on and off. If on, the script will keep it's own timer and force the button to reappear when it says 3 mins is up. If left off, it will just wait for the game to make the button reappear. The game's timer can count slow at times making what should only take a max of an hour and 15 mins much longer.

Send Message


Pages:

  • https://politicsandwar.com/inbox/message/
  • https://politicsandwar.com/inbox/message/receiver=*
  • https://politicsandwar.com/inbox/message/id=*

Descriptions

This script allows you to easily and seamlessly message people by their Nation ID or Leader Name. It is not restraint by the default 21 people, in fact, it does not have a maximum number of people it can accept. It will filter out any duplicates provided in the "To" field upon hitting the Send button.
This script does require you to provide it your API Key which can be found at the bottom of the Account's Page. To provide it with the key, when the script is installed, go to the New Message Page and at the bottom of the sidebar you'll see a button that says "Insert API Key".

Team Building


Pages:

  • https://politicsandwar.com/obl/team/id=*

Descriptions

This script will replace the default Red and Blue buttons that allow you to up players stats, and instead provide a new blue button. Clicking this button will cause this button to turn red, and all the other buttons get disabled. It will then start to up the players stats until it reaches the max, 100, or you click the red button telling it to stop. If it reaches 100 then a sound will play letting you know.

View Trade


Pages:

  • https://politicsandwar.com/index.php?id=26*
  • https://politicsandwar.com/index.php?id=90*
  • https://politicsandwar.com/nation/trade/*
  • Excluding: https://politicsandwar.com/nation/trade/create/*

Descriptions

This script is designed to work in tandem with the Create Trade script as some of what this script has to offer wouldn't work without it. This script does a lot. On the bottom of the sidebar you'll find some config settings for this script. These settings allow you to change how some aspects of the script work and are:

  • Infinite Scroll Toggle: When toggled on this script will load all offers, given the specific search filters, instead of the default 50, or whatever the link you used specified. By default this is toggled off.
  • Zero Accountability Toggle: When toggled on this script will affect the quantities in the links of the Outbid, Match, and TopUp buttons, so that they don't take into account your other current offers loaded on the page. By default this is toggled off. They will still take into account any Min and Max set as well as the current amount in the offer if its your offer being topped up.
  • Max Resource Button: When clicked, you'll be prompted with a box to enter a number in. This number will set a maximum quantity in the links of the Outbid, Match, and TopUp buttons. Providing an invalid number will result in nothing changing, while setting the number to zero or less will result in it being saved as zero. When set to zero, this feature will be disabled and there will be no maximum quantity in the specified links. By default this number is set to zero.
  • Min Resource Button: When clicked, you'll be prompted with a box to enter a number in. This number will set a minimum quantity that you do not want to accidentally sell. It will essentially reduce how much the script reads from your resource bar for when calculating the quantity in the Outbid, Match and TopUp buttons, and the trade offer boxes. Providing an invalid number will result in nothing changing, while setting the number to zero or less will result in it being saved as zero. You can also specify a minimum amount for Money by going to your personal trades page or by setting the search fields to "Any Resource". By default this number is set to zero.
    Note: The Max Resource Button and Min Resource Button are not opposites. The Max Resource Button only affects the quantities in the links for Outbid, Match, and TopUp buttons, setting a ceiling to any one given link. Meaning creating any offers will be at max that quantity. The Min Resource Button affects these quantities in these links as well, but by reducing what the script sees you have in your resource bar.. Meaning it affects all offers, and not only any given one. The Min Resource Button also affects the quantities calculated and listed in the trade offer boxes. The Zero Accountability Toggle will cause the Min Resource Button to be ignored when calculating the quantities for the Outbid, Match and ToUp buttons, causing the Min Resource Button to only have an affect on the trade offer boxes.
  • Market View Options: Allows you to choose between three options, Buy, Sell, and Both. This choice will affect the Market Links injected at the top of the page and the Resource Menu for users with small screens. The choice will set these specific links so when clicked, you'll view what side of the market you like most. By default this is set to Both.

The script also does other stuff besides give you options on the sidebar, which you've probably gathered from reading above as it talked about buttons and links that you've never heard of before. At the very top of the page you'll find:

  • When you accept a trade, you might find a Re-Sell/Buy for Profit button on the successful accepted trade message. Clicking this button will cause the script to remember this trade and adjust all the opposing trade offer boxes so the quantities in them only sell the desired amount. This button is meant to be clicked after accepting a mistrade, so you can easily re-gain what you lost plus profit. When you accept an opposing offer, the script will automatically subtract that amount and calculate how much profit you just made. If this quantity is greater than the remembered quantity then a Re-Sell/Buy for Profit button will also be displayed but only for the remaining quantity.
  • Market Links are a bunch of pre-filtered links to every resource market, your personal trades page, and your activity page since your personal trades page sorts your accepted offers by date created and not date accepted. Market Links also changes the links on the Resource Menu for users with small screens. The activity link is set to a 1000 instead of the default 50 that you'd normally experience when loading that page. Links that end with an asterisk indicate that the script is remembering trades for that resource.
  • The trades that the script remembers when clicking said Re-Sell/Buy for Profit button will appear under the Market Links and will list what it remembers. There is a Forget button, which causes the script to forget about that trade, and a Forget All button which will only appear if it's remembering at multiple prices.

The script also does a few things when the page loads, like:

  • Mistrade Detection: When viewing both sides of the global market, the script will check to see if any mistrades exist on the page. If it detects one, then it will auto scroll you to it, place a red outline around the offer and temporary switch your game's theme from light to dark or dark to light. It will also adjust the quantity in the smaller offer so you don't risk over extending and buying too much.
    A mistrade is when somebody creates an offer on the market where they're selling resources for less than the current best buy offer, or vice versa.
    E.g. You have an offer on the market buying food for $10/Ton. I then create an offer on the market selling food for $7/Ton. I've just created a mistrade as some third party can come, buy my food, and sell it to you for a $3/Ton.
    A mistrade is when there is money that can be instantly made.
  • Auto Scroll: The script will auto scroll you to the top offer when looking at either Buy or Sell markets, or the very center when looking at Both markets. When looking at Both markets, it will also inject a red break block where the Buy and Sell offers switch stating the profit gap between them. If you've accepted a trade successfully, it will first scroll to that message and wait 3s before continuing down. When it scrolls, it will make the element it's scrolling to the center of the page.

Finally the script changing the table itself. The script technically deletes the table and makes it's own, but the details you need to worry about are:

  • Firstly, users with small screens may find things in different places. The new table is designed to change as screens get smaller so you no longer have to deal with overflow from the old table.
  • The Date of the offer created as had it's format changed to `hh:mm DD/MMM/YYYY`.
  • On public trade offers created by other people, you'll find an Outbid and Match button. These buttons leads to the create trade offer page with unique links for the Create Trade Script to take over. The Outbid button will have it's price set to $1 better than that current offer, while the Match button will have the exact same price. Clicking these buttons will allow you to easily create a new offer at the desired price of the same type. Type being selling or buying. The quantities in these buttons will be calculated to the max you can afford to buy or sell without creating an error. If Zero Accountability is toggled off then the quantity will take into account other offers that exist on the page, and will remove any min amount, when calculating, set with the Min Resource Button. If the quantity calculated is zero or less then the button will be disabled and a line will be stuck through it indicating such. If a max amount is set by the Max Resource Button, then the quantity will cap off at that amount if it calculated a higher value.
  • On your personal trade offers, you'll find a TopUp button. This button is essentially just like the Match button for public offers created by other people, but for your own offers.
    Note: Opting to use the Outbid, Match, and TopUp buttons when creating offers instead of the normal method, will provide basic protection against making mistrades. As you won't need to remember what price to set it to, whether to click buy or sell, or forget to change the resource from the default, Food. Once clicked, you only need to decide whether the quantity listed is the one you want to go with, or if you want something less.
  • On Accepted offers and Embargo offers, you'll find a Duplicate button. This button will also lead to the create trade offer page with a unique link. However, this button will be set to match that exact offers price, resource, quantity, and type. It won't take into account whether you can actually duplicate that offer.
  • In the trade offer box, that you see on unaccepted offers created by other people, the quantity will be changed from the game default, of the offers amount, and lowered if you can't afford to buy or sell all of that offer. Meaning you don't need to do maths to know how much you can actually afford. When the script calculates this quantity, it does take into account any min amount set by the Min Resource Button. If the script is remembering trades for said resource and side of the market then said quantity may be lowered further, possibly down to zero, so you prioritise re-gaining from the mistrade.
  • The Delete buttons on your offers or offers sent personally to you no longer require a refresh. Instead when clicked, the script will proceed to delete the offer in the background and once complete, remove the offer from your screen. Outbid, Match, and TopUp buttons will have their links updated and the quantities in the trade offers boxes will be recalculated.
  • The sell buttons on offers will appear green, while the buy offers will appear blue. These colours match the ones of the create trade page.

Installation


Before you can install these scripts you'll need to download the necessary tools to run them. The tools required varies between browser and platform, so read the one that applies to you below.
Once that's done, simply scroll up and click on the install icon.

  • TamperMonkey or MeddleMonkey: Should then take over and prompt you with an installation button.
  • UserScripts:
    • MacOS: Select the UserScript icon </> and you should see a message that says "UserScript Detected: Tap to install". Tap it then scroll down and click install
    • iOS: Select the puzzle icon and then UserScripts from the menu. When the page opens you should see a message that says "UserScript Detected: Tap to install". Tap it then scroll down and click install.

Desktop/Laptop


Chrome, Microsoft Edge, Firefox, Opera Next, Dolphin Browser, and UC Browser

These users will need to install TamperMonkey, or alike, on their browser, through however extensions are installed on said browser. If you can't figure it out or don't know how to then I'd recommend YouTubing it as, I'd imagine, it's different for each one of these browsers.

Safari

Safari users can download TamperMonkey from the App Store, but it isn't free like it is for other browsers, so a free alternative for Safari users is MeddleMonkey or UserScripts. At the moment it's recommended you use MeddleMonkey unless you also plan to install these scripts on your iOS device as well. In that case its recommended that you use UserScripts as you'll be able to sync scripts and their versions across devices easily.

MeddleMonkey

Once installed, make sure you:

  1. Open Safari.
  2. Click Safari in the top left on the menu bar.
  3. Click Preferences which will appear in the drop down menu.
  4. Click Extensions in the new window that appeared,
  5. And tick the checkbox (if not already ticked) for the MeddleMonkey extension. MeddleMonkey should now be installed and activated on your Safari browser.
UserScripts

Once installed, make sure you:

  1. Open the UserScripts app.
  2. Click on Open Safari Preferences,
  3. And tick the checkbox (if not already ticked) for the UserScripts extension.
  4. Then click the Change button and set its location to a new folder called something like "UserScripts" somewhere in your iCloud Drive. UserScripts should now be installed and activated on your Safari browser.

Mobile


Android

Android users will need to download the an app called Kiwi Browser, which is available on the play store. Once the app is installed, open it and:

  1. Search Chrome Extensions with whatever the default search engine is or your search engine of choice.
  2. Select the Chrome Web Store option.
  3. Search for TamperMonkey and select it from the list.
  4. Hit the Add to Chrome button TamperMonkey should now be installed on the Kiwi Browser.

iOS

iOS users will need to use the Safari browser for their iPhone or iPad and be on iOS 15 or later. What you'll want to do is:

  1. Go into the App Store and search for UserScripts.
  2. Download the app called UserScripts.
  3. Once installed, open the UserScripts App and click "Set UserScripts Directory". Set it somewhere in your iCloud Drive so if you're using a Mac they can easily sync across.
  4. Then exit the UserScripts App and go to the Settings App.
  5. Select Safari.
  6. Click Extensions.
  7. The UserScripts app should be displayed there, and by default it should say that it's off.
  8. Select it and toggle it on. Now when you go to the Safari app, you should see a puzzle icon on the address bar, and when clicked on, you should see the UserScripts option listed there. Clicking it will open a new page that lets you control the installed scripts and enable/disable them by clicking on them. This bit does unfortunately seem to be buggy at the time of writing this in that it sometimes just has a loading page forever.
It's recommended that, if you have a Mac, you install UserScripts on it as well and go about installing the scripts there and having them sync over to here. To make sure that they sync go into the Files App and make sure that they are indeed downloaded to your iOS device.

Updates


TamperMonkey


TamperMonkey has the ability to check for updates and install them automatically. This feature is enabled by default. If you make any changes to the script in TamperMonkey yourself, or even just do Ctrl + S, then it will stop checking for updates until otherwise told to resume.
If you'd like to enable/disable it's auto updating then:

  1. Click on the TamperMonkey icon,
  2. And select its Dashboard button.
  3. Select the script you'd like to enable/disable so it's source code is displayed on screen.
  4. Select the Settings tab for said script. It's located on the left side, not the one located on the right side.
  5. Un/Tick the Check for Updates checkbox and hit the save button.

MeddleMonkey


MeddleMonkey has the ability to check for updates and install them automatically. This feature is enabled by default. If you make any changes to the script in MeddleMonkey yourself and hit the save button, it will lose its connection to this GitHub repository and no longer offer a Check for Updates option.
If you'd like to enable/disable MeddleMonkey checking for updates automatically then:

  1. Select the MeddleMonkey icon located at the top of the browser to the left of the address bar,
  2. And select Manage Scripts.
  3. Click on the Settings button located on the sidebar.
  4. Un/Tick the "Automatically check scripts for updates every day" checkbox.

UserScripts


UserScripts does not have the ability to check for updates automatically, so you'll have to check for them manually. Simply download the news and put them in your iCloud Drive where the others are stored. If on iOS make sure the files are downloaded from iCloud Drive onto your phone in the Files app.

iOS:

  1. Select the puzzle icon,
  2. And select the UserScripts button to display its page.
  3. Click the cloud icon button,
  4. And click the Check Again button for updates.

MacOS:

  1. Select the UserScripts icon.
  2. Click the cloud icon button,
  3. And click the Check Again button for updates.