PageRenderTime 42ms CodeModel.GetById 13ms RepoModel.GetById 1ms app.codeStats 0ms

/Releases/Build1_6/js/scripts.js

https://github.com/sojeff/redvinef
JavaScript | 376 lines | 284 code | 58 blank | 34 comment | 22 complexity | 8cc627812e9ee05e8f6e69919d1440ad MD5 | raw file
  1. $(function() {
  2. // FIELD WATERMARKS
  3. $('input[type="text"].username').watermark('Username', {useNative: false});
  4. $('input[type="password"].password').watermark('Password', {useNative: false});
  5. $('input[type="password"].passwordconfirm').watermark('Confirm Password', {useNative: false});
  6. $('input[type="text"].firstname').watermark('First Name', {useNative: false});
  7. $('input[type="text"].lastname').watermark('Last Name', {useNative: false});
  8. $('input[type="text"].month').watermark('MM', {useNative: false});
  9. $('input[type="text"].day').watermark('DD', {useNative: false});
  10. $('input[type="text"].year').watermark('YYYY', {useNative: false});
  11. $('input[type="text"].city').watermark('City', {useNative: false});
  12. $('input[type="text"].zip').watermark('Zip Code', {useNative: false});
  13. $('input[type="text"].email').watermark('Email', {useNative: false});
  14. $('input[type="text"].emailconfirm').watermark('Re-enter Email', {useNative: false});
  15. $('input[type="text"].search').watermark('Find Knowledge by Entering a Keyword', {useNative: false});
  16. $('input[type="text"].title').watermark('Enter in the Title for this Thread', {useNative: false});
  17. $('input[type="text"].topic').watermark('Enter in the Topic', {useNative: false});
  18. $('.field-jumppad').watermark('Enter in the Title for this JumpPad', {useNative: false});
  19. $('.comment').watermark('Share Some Knowledge', {useNative: false});
  20. $('input[type="text"].link').watermark('Enter in a Link to Outside Content', {useNative: false});
  21. $('input[type="text"].content').watermark('Find Content within SO:KNO', {useNative: false});
  22. $('.field-post').watermark('Share Some Knowledge by Adding a Comment', {useNative: false});
  23. $('.field-persona').watermark('Find People to Join this JumpPad', {useNative: false});
  24. $('.field-link').watermark('http://', {useNative: false});
  25. $('.field-content').watermark('Connect to Content', {useNative: false});
  26. // LOGIN/SIGNUP TOGGLE
  27. $("#signup, #forgot").hide();
  28. $('a.signup').click(function() {
  29. $('#forgot, #login').hide();
  30. $('#signup').show();
  31. });
  32. $('a.forgot').click(function() {
  33. $('#signup, #login').hide();
  34. $('#forgot').show();
  35. });
  36. $('a.login, a.back').click(function() {
  37. $('#signup, #forgot').hide();
  38. $('#login').show();
  39. });
  40. // TOGGLE THREAD/CONTENT LISTS
  41. $(".list.threads").hide();
  42. $('a.threads').click(function() {
  43. $('a.content').removeClass('current');
  44. $(this).addClass('current');
  45. $('.list.content').hide();
  46. $('.list.threads').show();
  47. });
  48. $('a.content').click(function() {
  49. $('a.threads').removeClass('current');
  50. $(this).addClass('current');
  51. $('.list.threads').hide();
  52. $('.list.content').show();
  53. });
  54. // LINK/CONTENT FIELDS TOGGLE
  55. $('input[type="text"].link, input[type="text"].content').hide();
  56. $('.button-link').click(function() {
  57. $(this).toggleClass('active');
  58. $(this).parent().prev().find('input.link').toggle();
  59. });
  60. $('.button-content').click(function() {
  61. $(this).toggleClass('active');
  62. $(this).parent().prev().find('input.content').toggle();
  63. });
  64. // MODAL WINDOWS
  65. $('a.thread, a.jumppad').click(function (e) {
  66. e.preventDefault();
  67. // CALLBACK FUNCTION
  68. confirm(function () {
  69. window.location.href = '';
  70. });
  71. function confirm(callback) {
  72. $('#modal-create').modal({
  73. position: ["256px"],
  74. opacity: ["80"],
  75. focus: false,
  76. overlayId: 'modal-overlay',
  77. containerId: 'modal-container',
  78. onShow: function (dialog) {
  79. var modal = this;
  80. // IF CLICKS CREATE
  81. $('.create', dialog.data[0]).click(function () {
  82. // CALL CALLBACK
  83. if ($.isFunction(callback)) {
  84. callback.apply();
  85. }
  86. // CLOSE MODAL
  87. modal.close();
  88. });
  89. }
  90. });
  91. }
  92. });
  93. // MODAL CONTACT
  94. $('a.contact-us').click(function (e) {
  95. e.preventDefault();
  96. // CALLBACK FUNCTION
  97. confirm(function () {
  98. window.location.href = '';
  99. });
  100. function confirm(callback) {
  101. $('#modal-contact').modal({
  102. position: ["36px"],
  103. opacity: ["60"],
  104. focus: false,
  105. overlayId: 'modal-overlay',
  106. containerId: 'modal-container-contact',
  107. onShow: function (dialog) {
  108. var modal = this;
  109. // IF CLICKS CREATE
  110. $('.create', dialog.data[0]).click(function () {
  111. // CALL CALLBACK
  112. if ($.isFunction(callback)) {
  113. callback.apply();
  114. }
  115. // CLOSE MODAL
  116. modal.close();
  117. });
  118. }
  119. });
  120. }
  121. });
  122. // iFRAME MODAL
  123. $('a.iframe').click(function (e) {
  124. e.preventDefault();
  125. // CALLBACK FUNCTION
  126. confirm(function () {
  127. window.location.href = '';
  128. });
  129. function confirm(callback) {
  130. $('#modal-iframe').modal({
  131. opacity: ["80"],
  132. focus: false,
  133. overlayId: 'modal-overlay',
  134. containerId: 'modal-iframe-container',
  135. onShow: function (dialog) {
  136. var modal = this;
  137. // IF CLICKS CREATE
  138. $('.create', dialog.data[0]).click(function () {
  139. // CALL CALLBACK
  140. if ($.isFunction(callback)) {
  141. callback.apply();
  142. }
  143. // CLOSE MODAL
  144. modal.close();
  145. });
  146. }
  147. });
  148. }
  149. var modalHeight = $('#modal-iframe-container').height();
  150. $('#modal-iframe > iframe').height(modalHeight - 58);
  151. });
  152. // MODAL CONTAINER HEIGHT
  153. // CONNECT MODAL
  154. $('a.connect').click(function (e) {
  155. e.preventDefault();
  156. // CALLBACK FUNCTION
  157. confirm(function () {
  158. window.location.href = '';
  159. });
  160. function confirm(callback) {
  161. $('#modal-connect').modal({
  162. position: ["256px"],
  163. opacity: ["80"],
  164. focus: false,
  165. overlayId: 'modal-overlay',
  166. containerId: 'modal-container',
  167. onShow: function (dialog) {
  168. var modal = this;
  169. // IF CLICKS CREATE
  170. $('.create', dialog.data[0]).click(function () {
  171. // CALL CALLBACK
  172. if ($.isFunction(callback)) {
  173. callback.apply();
  174. }
  175. // CLOSE MODAL
  176. modal.close();
  177. });
  178. }
  179. });
  180. }
  181. });
  182. // TOGGLE FOLLOW
  183. $('.button-follow a').click(function(){
  184. $(this).toggleClass('active');
  185. }
  186. );
  187. $('.button.wide.follow').click(function(){
  188. $(this).toggleClass('follow unfollow', function() {
  189. if($(this).hasClass("unfollow")) {
  190. $("span.label-icon").html("<span class='check'></span>Not Following");
  191. }
  192. else if($(this).hasClass("follow")) {
  193. $("span.label-icon").html("<span class='check'></span>Following");
  194. }
  195. });
  196. });
  197. // COMMENT TEXTAREA RESIZE
  198. $('.comment').autosize();
  199. // CLICK FOLLOW ALL
  200. $('a.followall').click(function(){
  201. if($('.mini-persona > .button-follow a').hasClass('active')===false){
  202. $('.mini-persona > .button-follow a').addClass('active');
  203. }
  204. }
  205. );
  206. // DEFAULT TAB ACTIVE
  207. //$('.date').addClass('active');
  208. // SORT MENU TABS
  209. $('.date').click(function(){
  210. if($(this).hasClass('active')===false){
  211. $('#nav-sort > li > a').removeClass('active');
  212. $(this).addClass('active');
  213. }
  214. }
  215. );
  216. $('.new').click(function(){
  217. if($(this).hasClass('active')===false){
  218. $('#nav-sort > li > a').removeClass('active');
  219. $(this).addClass('active');
  220. }
  221. }
  222. );
  223. $('.alpha').click(function(){
  224. if($(this).hasClass('active')===false){
  225. $('#nav-sort > li > a').removeClass('active');
  226. $(this).addClass('active');
  227. }
  228. }
  229. );
  230. $('.relevance').click(function(){
  231. if($(this).hasClass('active')===false){
  232. $('#nav-sort > li > a').removeClass('active');
  233. $(this).addClass('active');
  234. }
  235. }
  236. );
  237. // CURATE MENU TABS
  238. $('a.like').click(function(){
  239. if($(this).hasClass('active')===false){
  240. $('a.flag').removeClass('active');
  241. $(this).addClass('active');
  242. }
  243. else {
  244. $(this).removeClass('active');
  245. }
  246. }
  247. );
  248. $('a.flag').click(function(){
  249. if($(this).hasClass('active')===false){
  250. $('a.like').removeClass('active');
  251. $(this).addClass('active');
  252. }
  253. else {
  254. $(this).removeClass('active');
  255. }
  256. }
  257. );
  258. $("#form-tags").hide();
  259. var setHeight = $('#modal-iframe > iframe').height();
  260. var tagger = function() {
  261. var tagsHeight = '138';
  262. var frameHeight = $('#modal-iframe > iframe').height();
  263. var minHeight = frameHeight - tagsHeight;
  264. var maxHeight = frameHeight + tagsHeight;
  265. $(this).toggleClass("active");
  266. $("#form-tags").slideToggle();
  267. $('#modal-iframe > iframe').animate({height: minHeight}, 400);
  268. };
  269. $("a.tag").click(tagger);
  270. // COMMENT MENU TABS
  271. $('.nav-comment > .like').click(function(){
  272. if($(this).hasClass('active')===false){
  273. $('.nav-comment > li > a').removeClass('active');
  274. $(this).addClass('active');
  275. }
  276. }
  277. );
  278. $('.nav-comment > .flag').click(function(){
  279. if($(this).hasClass('active')===false){
  280. $('.nav-comment > li > a').removeClass('active');
  281. $(this).addClass('active');
  282. }
  283. }
  284. );
  285. $('.nav-comment > .reply').click(function(){
  286. if($(this).hasClass('active')===false){
  287. $('.nav-comment > li > a').removeClass('active');
  288. $(this).addClass('active');
  289. }
  290. }
  291. );
  292. $('.nav-comment > .share').click(function(){
  293. if($(this).hasClass('active')===false){
  294. $('.nav-comment > li > a').removeClass('active');
  295. $(this).addClass('active');
  296. }
  297. }
  298. );
  299. // PERSONA CHARTS
  300. $('.cht-knowledge').easyPieChart({
  301. barColor: '#d97023',
  302. trackColor: '#f2f2f2',
  303. scaleColor: false,
  304. lineCap: 'butt',
  305. lineWidth: 40,
  306. size: 366,
  307. animate: 1000
  308. });
  309. $('.cht-interest').easyPieChart({
  310. barColor: '#2a8ecb',
  311. trackColor: '#f2f2f2',
  312. scaleColor: false,
  313. lineCap: 'butt',
  314. lineWidth: 40,
  315. size: 276,
  316. animate: 1000
  317. });
  318. });