Advertisement
FoxboyPrower

DeltaLogWeasyl

Jan 12th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. var cargo = {
  2. title: "I can post journals now",
  3. content: "Oh my gosh you guys, I made the hypest program ever. I'm gonna post pictures of my food and my cat and stuff. I hope you love it.",
  4. tags: ["These","tags","were","added","with","javascript"],
  5. ratings: ["all", "13+", "18+ nonsexual", "18+ sexual"],
  6. rating: 1,
  7. onlyFriends: true
  8. };
  9. var titlePort = function(x){
  10. console.log("title: " + x);
  11. var z = document.querySelector("input#journaltitle");
  12. z.value = x;
  13. };
  14.  
  15. var contentPort = function(x){
  16. var z = document.querySelector("#submit-journal-content #submit-form .description #journaldesc");
  17. z.innerHTML = x;
  18. };
  19.  
  20. var tagPort = function(x){
  21. //loop to pass through every tag
  22. var z = document.querySelector("#submit-journal-content #submit-form .tagging .listbuilder");
  23. var tagPadding = ['<li class="listbuilder-entry" unselectable="on"><span class="listbuilder-entry-text">','</span><a class="listbuilder-entry-remove" href="#" role="button" title="Remove sampletag from the list."></a>'];
  24. var package = "";
  25. for(var i = 0; i < x.length; i = i + 1)
  26. {
  27. package = tagPadding[0]+x[i]+tagPadding[1];
  28. console.log(package);
  29. z.innerHTML = z.innerHTML + package;
  30. }
  31. };
  32.  
  33. var ratingsPort = function(x){
  34. //ratings function
  35. var z = document.querySelector("#submit-journal-content #submit-form .info #journalrating");
  36. switch (x) {
  37. case 1:
  38. //"13+" will be selected
  39. z.value = 20;
  40. break;
  41. case 2:
  42. //"18+ nonsexual" will be selected
  43. z.value = 30;
  44. break;
  45. case 3:
  46. //"18+ sexual" will be selected
  47. z.value = 40;
  48. break;
  49. default:
  50. //"all" will be selected
  51. z.value = 10;
  52. }
  53. };
  54.  
  55. var onlyFriendsPort = function(x) {
  56. document.getElementById("submit-friends").checked = x;
  57. };
  58.  
  59. titlePort(cargo.title);
  60. contentPort(cargo.content);
  61. tagPort(cargo.tags);
  62. //call ratings function
  63. ratingsPort(cargo.rating);
  64. onlyFriendsPort(cargo.onlyFriends);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement