Gigya Job Openings

Page History

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

HTML
<style>
	 body {font-family:Arial;font-size: 12px; background-color:#fff; line-height:20px}
</style>
	
<div id="runningCodeExample"> 
 
	<script>
	    // Media Objects
        var video = {
            src: 'https://demogigyademo.gigya.com/squarespace/gigmain.mp4',
            previewImageURL: 'https://demogigyademo.gigya.com/images/300x250_myoss_3frames-lg.gif',
            type: 'flash'
        }
        var image = {
            src: 'https://demogigyademo.gigya.com/images/300x250_myoss_3frames-lg.gif',
            href: 'https://demogigyademo.gigya.com',
            type: 'image'
        }
        var swf = {
            src: 'http://dagobah.net/flash/Tic_Tac_Toe.swf',
            width: '800',
            height: '400',
            previewImageURL: 'http://0.tqn.com/d/boardgames/1/G/N/q/tic_tac_toe_200.jpg',
            previewImageWidth: '200',
            previewImageHeight: '90',
            type: 'flash'
        }
        var mp3 = {
            src: 'https://demogigyademo.gigya.com/squarespace/gigmain.mp4',
            title: 'Gigya',
            artist: 'Gigya',
            album: 'Gigya',
            type: 'mp3'
        }
       
        function onLoad()
        {
            // get user info
            gigya.socialize.getUserInfo({callback:renderUI});	    
            
            // register for connect status changes
            gigya.socialize.addEventHandlers({ onConnectionAdded: renderUI, onConnectionRemoved: renderUI });
            
        }

		function renderUI(res)
		{
		    document.getElementById('btnPublishAction').disabled = 
					(res.user == null || !res.user.isConnected);		    
		}
		// Create and Publish User's Action
		// This method is associated with the "btnPublishAction" click
		function publishAction() {
		    // Constructing a UserAction Object:
		    var act = new gigya.socialize.UserAction();
		    
		    // Setting the Title and subtitle
		    act.setTitle("This is my title");
		    act.setSubtitle("This is my subtitle");
		    // Setting Link Back
		    act.setLinkBack("http://raas-demogigyademo.gigya.com");
		    // Setting Description
		    act.setDescription("This is my Description.");
		    // Adding Action Links
		    act.addActionLink("Read More", "https://demogigyademo.gigya.com");  
		    // Add Media (Media type depends on the checked radio-button)
		    if (document.getElementById("Image").checked) {
		        // Add image
		        act.addMediaItem(image);
		    }
		    if (document.getElementById("Video").checked) {
		        // Add a video
		        act.addMediaItem(video);
		    }
		    if (document.getElementById("Mp3").checked) {
		        // Add mp3 audio
		        act.addMediaItem(mp3);
		    }
		    if (document.getElementById("Flash").checked) {
		        // Add a Flash file
		        act.addMediaItem(swf);
		    }
		    // Parameters for the publishUserAction	method, including the UserAction object
			var params = 
			{
			    userAction:act,
			    callback:publishAction_callback
			};
			
            // Publish the User Action
			gigya.socialize.publishUserAction(params);
		}
		// Display a status message according to the response from publishUserAction.
		function publishAction_callback(response)
		{
			switch (response.errorCode )
			{
				case 0:
					document.getElementById('status').style.color = "green";
					document.getElementById('status').innerHTML = "Newsfeed item sent.";
					break;
				default:
					document.getElementById('status').style.color = "red";
					document.getElementById('status').innerHTML = 
							"Unable to send newsfeed item. Error Code:" 
					        + response.errorCode + "; " + response.errorMessage;
			}
		}
    </script>

	<b>Step 1: Connect</b>
	<div id="divConnect"></div>
        <script type="text/javascript">
	        // show 'Add Connections' Plugin in "divConnect"
	        gigya.socialize.showAddConnectionsUI({ 
				height:65
				,width:175
				,showTermsLink:false // remove 'Terms' link
				, hideGigyaLink: true // remove 'Gigya' link
                , disabledProviders: "yahoo"//yahoo does not suppor sharing
				, containerID: 'divConnect' // The component will embed itself inside the divConnect Div
				, shortURLs: 'never'
			});
        </script>    
    <br />
    <b>Step 2: Select Media Type</b>
    <form>
    <input type=radio id="Image" name="mediaType" value="Image">Image<br />
    <input type=radio id="Video" name="mediaType" value="Video">Video<br />
    <input type=radio id="Mp3" name="mediaType" value="Mp3">Mp3<br />
    <input type=radio id="Flash" name="mediaType" value="Flash">Flash<br />
    </form>
    <br />
    <b>Step 3: Post Newsfeed item</b><br />
    Click the button below to post a Newsfeed item<br />
    <input type=button id="btnPublishAction" onclick="javascript:publishAction()" value="Post" />
    <div id="status"></div>
</div>

...