Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name A SG Train Making Script
- // @namespace http://steamcommunity.com/id/tragikos/
- // @version 0.4
- // @description A button that sets the correct ending time for your giveaway according to your timezone
- // @author tragikos updated by Leomoty
- // @match http://www.steamgifts.com/giveaways/new
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- var startDateUTC = '6/4/2015 18:59:00 UTC'; // 4th of June
- var eventDateUTC = '6/14/2015 14:00:00 UTC'; // 14th of June
- var startingTimeMinOffset = 0;
- var ContributorLevel = 3;
- var groupId = "1898";
- var description="##Description Here \n\n---------------- \n\n";
- 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() {
- var startDate = new Date(startDateUTC)
- $("input[name='start_time']").val(formatDate(startDate));
- var endDate = new Date(eventDateUTC);
- $("input[name='end_time']").val(formatDate(endDate));
- }
- 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(ContributorLevel);
- }
- 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> My Train</div>');
- $("#dateBtn").css({
- 'height': '32px'
- });
- $("#dateBtn").click(function() {
- applyDates();
- applyRegionRestrictions();
- applyGroup();
- applyLevel();
- applyGenericDescription();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement