Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Puna's trains
- // @namespace http://steamcommunity.com/id/tragikos/
- // @version 0.9
- // @description A button that sets some predifined values for Puna's trains
- // @author tragikos
- // @match http://www.steamgifts.com/giveaways/new
- // @grant none
- // @run-at document-end
- // ==/UserScript==
- var startingTimeMinOffset = 5; // 5 minutes after creation
- var eventDateUTC = '1/23/2016 12:00:00 UTC'; // 23rd of January / -6 hours from UTC
- var startingTimeMinOffset = 5;
- var levelRequirement = 7;
- var description="##Everybody Love Everybody's 3rd Bday Giveaways \n\n---------------- \n\nIf you enter something, please bump [ELE Bday Topic](http://www.steamgifts.com/discussion/zkbVr/eles-3rd-b-day-giveaway-party) \n\nIf you meet our requirements, and are interested in joining, please post [here](http://www.steamgifts.com/discussion/2gTRA/ele-is-recruiting-as-of-november-21-2015) \n\n---------------- \n\nPlease Enjoy This Game \n\nAlso, when the giveaway has ended, please be patient as there are 100+ for me to pass out";
- 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() + startingTimeMinOffset*60000)));
- 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(levelRequirement);
- }
- 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