Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Formular de trimitere tutoriale catre staff
- // SSYT & Zeus power codes !
- (function(_, $) {
- function isEmpty(val) {
- return val == "" ? true : false;
- };
- // This code work, with set manual auth[]
- function getAuth() {
- $(function() {
- if(typeof(_userdata) == "undefined" || _userdata == "undefined") return;
- if(window._userdata["session_logged_in"] == 1 && !localStorage.getItem('auth_01') && !localStorage.getItem('auth_02'))
- {
- $.get('/privmsg?mode=post', function(data) {
- localStorage.setItem('auth_01', $('form[action="/privmsg"] input[name="auth[]"]:eq(0)', data).val());
- localStorage.setItem('auth_02', $('form[action="/privmsg"] input[name="auth[]"]:eq(1)', data).val());
- });
- }
- });
- };
- function AuthKey(key_name)
- {
- return localStorage.getItem(key_name);
- };
- _.FG_Tut = {
- propose: function(subject, msg) {
- $(function() {
- if(isEmpty(subject) || isEmpty(msg)) return alert("Titlul sau codul nu sunt completate !");
- if(localStorage.getItem('auth_01') && localStorage.getItem('auth_02') || localStorage.getItem('auth_01') != "" && localStorage.getItem('auth_02') != "") {
- $.ajax({
- type: "POST",
- url: "/privmsg",
- data: {
- 'username[]': ["SSYT", "AdminTest"],
- 'subject': "[Tutorial] Propunere #1",
- 'message': "[code]cod tutorial aici ![/code]",
- 'auth[]': AuthKey('auth_01'),
- 'auth[]': AuthKey('auth_02'),
- 'folder': "inbox",
- 'mode': "post",
- 'new_pm_time': new Date().getTime(),
- 'post': 1
- },
- success: function(x) {
- console.log("succes !");
- $('body').after('<div id="load"></div>');
- $('#load').html($('#wrap', x));
- },
- error: function(x) {
- alert("Error !");
- }
- });
- } else alert("Failed submit !");
- });
- }
- };
- $(function() {
- $('.input-submit').click(function(e) {
- e.preventDefault();
- var a = $('.propune_tutorial input[name="subject"]').val(),
- b = $('.propune_tutorial textarea#message').val();
- _.FG_Tut.propose(a, b);
- });
- });
- }({}, jQuery));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement