Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 1.99 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // User Defined Page: module.js
  2.  
  3. (function(){
  4.  var querystring=document.location.search;
  5.  
  6.  if (/dlta=mog/.test(querystring)) {
  7.   //GRID EDIT PAGE ========================================
  8.   //alert("You are on the Grid Edit Page");
  9.  
  10.  } else if(/a=er/.test(querystring)) {
  11.   //EDIT RECORD PAGE ========================================
  12.   //alert("You are on the Edit Record Page");
  13.  
  14.  } else if (/GenNewRecord/.test(querystring)) {
  15.   //ADD RECORD PAGE ========================================
  16.   //alert("You are on the Add Record Page");
  17.  
  18.   //Method 1 using Math.random()
  19.   $("#_fid_6").val(Math.floor(Math.random()*100+1));
  20.  
  21.   //Method 2 using YQL and random.org datatable
  22.   var url="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fscooterlabs.com%2Fyql%2Frandom.integers.xml%22%3B%0Aselect%20*%20from%20random.integers%20where%20num%3D%221%22%20and%20min%3D%221%22%20and%20max%3D%22100%22%3B&format=json&diagnostics=true&callback=?"
  23.   $.getJSON(url,function(data){
  24.    $("#_fid_8").val(data.query.results.data.value);
  25.   });
  26.  
  27.   // See http://www.cantoni.org/2010/02/22/random-numbers-via-yql
  28.   //YQL Console Query:
  29.   //use "http://scooterlabs.com/yql/random.integers.xml";
  30.   //select * from random.integers where num="1" and min="1" and max="100";
  31.  
  32.  } else if(/a=dr/.test(querystring)) {
  33.   //DISPLAY RECORD PAGE
  34.   //alert("You are on the Display Record Page");
  35.   $("img[qbu=module]").closest("td").css("background-color","#FFFFFF");
  36.  
  37.  } else if(/a=q/.test(querystring)) {
  38.   //REPORT PAGE ========================================
  39.   //alert("You are on the Report Listing Page");
  40.  
  41.  } else {
  42.   //OTHER PAGE ========================================
  43.   //alert("You are on the Some Other Page");
  44.  }
  45.  
  46. })();
  47.  
  48. // Formula: [- (text w/ some HTML)]=
  49. //
  50. // "<img qbu=\"module\" src=\"/i/clear2x2.gif\" " &
  51. // "onload=\"javascript:if(typeof QBU=='undefined'){QBU={};$.getScript('" &
  52. // URLRoot() &
  53. // "db/" &
  54. // Dbid() &
  55. // "?a=dbpage&pagename=module.js&rand='+Math.random())}\">"