﻿// ==UserScript==
// @name        BWI And GD SSN Registration for Stub server
// @namespace   bwin.it registration
// @description SSN Registration for Stub server
// @version     1.1.0
// @include     *.www.bwin.it/*/registration*
// @include     *qa*www.internal.giocodigitale.it/*/registration*
// @include     *dev.www.giocodigitale.it/*/registration*
// @grant       GM_xmlhttpRequest
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js
// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/fiscaleGenerator/UI.js
// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/fiscaleGenerator/codeFiscaleGenerator.js
// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/core/common.js
// ==/UserScript==

$(function () {
    if ($("#registration-form").length) {
        UI.createInterface(function (codeFiscale) {
            $("#Input_BirthData_FiscalCode").val(codeFiscale);
        });
    }
});
﻿// ==UserScript==
// @name        BWI And GD SSN Registration for Stub server
// @namespace   bwin.it registration
// @description SSN Registration for Stub server
// @version     2.0.0
// @include     *.www.bwin.it/*/registration*
// @include     *qa*www.internal.giocodigitale.it/*/registration*
// @include     *dev.www.giocodigitale.it/*/registration*
// @grant       GM_xmlhttpRequest
// @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js
// ==/UserScript==

$(function () {
    if ($("#registration-form").length) {
        $('<iframe>', {
            src: "http://VIW20022:7485/",
            frameborder: 0,
            css: {
                height: 300,
                width: 300,
                position: "absolute",
                top: 0,
                left: 0
            }
        }).appendTo('div.container');

        window.addEventListener("message", receiveMessage, false);
        function receiveMessage(event) {
            if (event.origin !== "http://VIW20022:7485")
                return;
            if (event.data.message == "fillCodeFiscale") {
                $("#Input_BirthData_FiscalCode").val(event.data.value);
            }
        }
    }
});
--- 
+++ 
@@ -2,35 +2,21 @@
 // @name        BWI And GD SSN Registration for Stub server
 // @namespace   bwin.it registration
 // @description SSN Registration for Stub server
-// @version     2.0.0
+// @version     1.1.0
 // @include     *.www.bwin.it/*/registration*
 // @include     *qa*www.internal.giocodigitale.it/*/registration*
 // @include     *dev.www.giocodigitale.it/*/registration*
 // @grant       GM_xmlhttpRequest
 // @require     https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js
+// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/fiscaleGenerator/UI.js
+// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/fiscaleGenerator/codeFiscaleGenerator.js
+// @require     https://raw.githubusercontent.com/drizet/PortalUserScripts/master/src/core/common.js
 // ==/UserScript==
 
 $(function () {
     if ($("#registration-form").length) {
-        $('<iframe>', {
-            src: "http://VIW20022:7485/",
-            frameborder: 0,
-            css: {
-                height: 300,
-                width: 300,
-                position: "absolute",
-                top: 0,
-                left: 0
-            }
-        }).appendTo('div.container');
-
-        window.addEventListener("message", receiveMessage, false);
-        function receiveMessage(event) {
-            if (event.origin !== "http://VIW20022:7485")
-                return;
-            if (event.data.message == "fillCodeFiscale") {
-                $("#Input_BirthData_FiscalCode").val(event.data.value);
-            }
-        }
+        UI.createInterface(function (codeFiscale) {
+            $("#Input_BirthData_FiscalCode").val(codeFiscale);
+        });
     }
 });
Revert "Added new version of stub registrator."

This reverts commit f1290352576071e93fc0b543d3ae6fafd2987ead.
