Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Berlin train
- // @namespace http://steamcommunity.com/id/Per3zat/
- // @version 0.1
- // @description A button that sets the correct ending time for your giveaway according to your timezone
- // @author Per3zat
- // @match http://www.steamgifts.com/giveaways/new
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- // based on tragikos' SimGive script, thanks matey!
- var eventDateUTC = '5/1/2016 12:00:00 UTC'; // event end date
- var description="Replace this later with the Description provided by the line operator";
- function formatDate(date) {
- var formattedDate = $.datepicker.formatDate('M d, yy', date);
- var hours = date.getHours()%12 < 10 ? '0'+date.getHours()%12 : date.getHours()%12;
- var minutes = date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes();
- var ampm = date.getHours() >= 12 ? 'pm' : 'am';
- formattedDate += " " + hours + ":" + minutes + " " + ampm;
- return formattedDate;
- }
- function applyDates() {
- $("input[name='start_time']").val(formatDate(new Date(new Date().getTime())));
- var date = new Date(eventDateUTC);
- $("input[name='end_time']").val(formatDate(date));
- }
- function applyRegionRestrictions() {
- $("div[data-checkbox-value='0']").trigger("click");
- }
- function applyGroup() {
- $("div[data-checkbox-value='invite_only']").trigger("click");
- }
- function applyLevel() {
- $("input[name='contributor_level']").val('1');
- }
- function applyGenericDescription(){
- var newDesc = description + $("textarea[name='description']").val().replace(description, "");
- $("textarea[name='description']").val(newDesc);
- }
- $(".form__time-container").children('div').eq(1).after('<div id="dateBtn" class="form__submit-button js__submit-form"><i class="fa fa-arrow-circle-right"></i> Berlin Train</div>');
- $("#dateBtn").css({
- 'height': '32px'
- });
- $("#dateBtn").click(function() {
- applyDates();
- applyRegionRestrictions();
- applyGroup();
- applyLevel();
- applyGenericDescription();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement