PageSourceSearch

https://microwaveupdate.org/javascript/blog.js

js microwaveupdate.org collected 2026-10-04 22:37:13 UTC 6,513 bytes, 190 lines download raw bytes

1var PostClass = 'BlogPost';
2var PostHiddenClass = 'BlogPostHidden';
3
4function blogPostEdit(BlogId, BlogPostId, BlogSummaryId, PopupTitle) {
5	ShowPopupURL('BlogPostPopup', PopupTitle, '/blog.php?Mode=BlogPostEdit&BlogId=' + BlogId + '&BlogPostId=' + BlogPostId +'&BlogSummaryId=' + BlogSummaryId, 1);
6}
7
8
9function blogPostSave_callback(resp, xmlhttp) {
10	var Mode = "BlogPost";
11	var BlogPostId = evalJSON(resp);
12	if (BlogPostId) {
13		if (xmlhttp.params.BlogPostId == -1) {
14			var UpdateTarget = "blog_post_" + BlogPostId;
15			var new_post = document.createElement('div');
16			new_post.id = UpdateTarget;
17			if (xmlhttp.params.BlogSummaryId) {
18				$("#blogsummary_" + xmlhttp.params.BlogSummaryId).prepend(new_post);
19				Mode = "BlogPost&BlogSummaryId=" + xmlhttp.params.BlogSummaryId;
20			}
21			else if (xmlhttp.params.BlogId) {
22				$("#blog_" + xmlhttp.params.BlogId).prepend(new_post);
23			}
24		}
25		else {
26			BlogPostId = xmlhttp.params.BlogPostId;
27		}
28		UpdateContent("blog_post_" + BlogPostId, "/blog.php?Mode=" + Mode + "&BlogPostId=" + BlogPostId);
29		ClosePopup('BlogPostPopup', true);
30	}
31	else {
32		MessageBox('Unable to save blog post', 'Error');
33	}
34	RemoveWorking();
35}
36
37function blogPostSave(BlogId, BlogPostId, BlogSummaryId) {
38	var params = {"BlogId": BlogId, "BlogPostId": BlogPostId, "BlogSummaryId": BlogSummaryId};
39	ValidateForm('BlogPostPopup_Body', '/blog.php?Mode=BlogPostSave', 'blogpost_edit', false, blogPostSave_callback, params);
40}
41
42function blogPostDelete_callback(resp, xmlhttp) {
43	if (resp.match(/DONE/)) {
44		RemoveWorking();
45		var blog = $("#blog_" + xmlhttp.params.BlogId);
46		if (blog) {
47			$("#blog_post_" + xmlhttp.params.BlogPostId).remove();
48		}
49	}
50	else {
51		UpdateContent_callback(resp, xmlhttp);
52	}
53}
54
55function blogDeletePost(BlogId, BlogPostId) {
56	var params = {"BlogId": BlogId, "BlogPostId": BlogPostId};
57	UpdateContent("blog_post_" + BlogPostId, "/blog.php?Mode=BlogPostDelete&BlogId=" + BlogId + "&BlogPostId=" + BlogPostId, 'GET', blogPostDelete_callback, params);
58}
59
60function blogHidePost(BlogId, BlogPostId) {
61	UpdateContent("blog_post_" + BlogPostId, "/blog.php?Mode=HideBlogPost&BlogPostId=" + BlogPostId);
62}
63
64function blogScrollTo(pane_id, target_id, speed) {
65	pane_id = (pane_id == 'body') ? pane_id : '#' + pane_id;
66	window.setTimeout(function() {
67		$(pane_id).scrollTo($('#' + target_id), speed);
68	}, 500);
69}
70
71function blogShowComments_callback(resp, xmlhttp) {
72//	RemoveWorking();
73	$("#post_comments_" + xmlhttp.params.BlogPostId).hide().html(resp).slideToggle();
74	xmlhttp.EvalScripts(true);
75}
76
77function blogShowComments(BlogId, BlogPostId, CommentId) {
78	var obj = document.getElementById("post_comments_" + BlogPostId);
79	if (obj) {
80		if (obj.innerHTML === '') {
81			var params = {"BlogPostId":BlogPostId, "noworking":true};
82			UpdateContent("post_comments_" + BlogPostId, "/blog.php?Mode=CommentList&BlogId=" + BlogId + "&BlogPostId=" + BlogPostId + "&CommentId=" + CommentId, 'GET', blogShowComments_callback, params);
83		}
84		else {
85			$("#post_comments_" + BlogPostId).slideToggle();
86		}
87	}
88}
89
90function blogSubmitComment(form_id, BlogPostId) {
91	return ValidateForm('post_comments_' + BlogPostId, '/blog.php?Mode=CommentSave', form_id + '_' + BlogPostId, true);
92}
93
94function blogPreviewComment(form_id, BlogPostId) {
95	var id = 'post_comments_preview_' + BlogPostId;
96	CreatePopUp(id, "StandardPopUp", "body", 'Preview Comment');
97	var params = {"popup_id":id};
98	ValidateForm(id + '_Body', '/blog.php?Mode=CommentPreview', form_id + '_' + BlogPostId, false, AdminPopup_callback, params, null, true);
99}
100
101var BlogSummaries = [];
102
103function IncludeBlogSummary(PageId, ElementId, SummaryId) {
104	if (!BlogSummaries[PageId]) {
105		BlogSummaries[PageId] = [];
106	}
107	BlogSummaries[PageId][SummaryId] = ElementId;
108}
109
110function UpdateBlogSummaries_callback(resp, xmlhttp) {
111	for (var SummaryId in resp) {
112		if (BlogSummaries[xmlhttp.params.PageId][SummaryId]) {
113			UpdateStaticContent(BlogSummaries[xmlhttp.params.PageId][SummaryId], resp[SummaryId], true);
114		}
115	}
116	BlogSummaries[xmlhttp.params.PageId] = [];
117}
118
119function UpdateBlogSummaries(PageId) {
120	var GroupIds = [];
121	var strBlogSummaries = "";
122	for (var SummaryId in BlogSummaries[PageId]) {
123		GroupIds.push(SummaryId);
124	}
125	strBlogSummaries = GroupIds.join(",");
126	var params = {'PageId':PageId};
127	GetJSON('/blog.php?Mode=Summaries&SummaryIds='+strBlogSummaries, 'GET', UpdateBlogSummaries_callback, params);
128}
129
130function blogPinterest(id, url, title) {
131	var max_size = 200;
132	var scale = 1, t, l;
133	var pathArray = window.location.pathname.split( '/' );
134	host = pathArray[2];
135
136	if ($('#blog_post_' + id + ' img').length) {
137		CreatePopUp('Pinterest', 'StandardPopUp', 'body', 'Select image to pin', true);
138		var div = $('<div style="width:840px;"></div>');
139		$('#blog_post_' + id + ' img').each(function (i, v) {
140			var img = $('<img>');
141			img.attr('src', $(v).attr('src'));
142			if ($(v).height() > $(v).width()) {
143				scale = $(v).width() / max_size;
144				if (scale < 1) {
145					scale = 1;
146				}
147				t = -($(v).height() - max_size) / 2 / scale;
148				l = 0;
149			} else {
150				scale = $(v).height() / max_size;
151				if (scale < 1) {
152					scale = 1;
153				}
154				t = 0;
155				l = -($(v).width() - max_size) / 2 / scale;
156			}
157			var h = Math.ceil($(v).height() / scale);
158			var w = Math.ceil($(v).width() / scale);
159			img.css({ height: h, width: w, marginTop: t, marginLeft: l });
160
161			var media = null;
162			if ($(v).attr('src').indexOf('//') != -1) {
163				media = $(v).attr('src');
164			}
165			else {
166				media = window.location.protocol+"//"+window.location.host+$(v).attr('src');
167			}
168			var span = $('<a target="_blank" href="http://pinterest.com/pin/create/button/?url=' + encodeURIComponent(url) + '&media=' + encodeURIComponent(media) + '&description=' + encodeURIComponent(title) + '"></a>');
169			span.css({ height: max_size, width: max_size, display: 'inline-block', overflow: 'hidden', margin: 5 });
170			span.append(img);
171			div.append(span);
172		});
173		div.appendTo('#Pinterest_Body');
174		$('#Pinterest').center().fadeIn();
175	}
176	else {
177		MessageBox("There are no images to pin.", "Error");
178	}
179}
180
181function blogPostInsertImage(path, css_class) {
182	$('#blogpost_edit_row_body #Edit_body_note').summernote('insertImage', path, function($img) {
183		$img.attr('class', css_class);
184	});
185}
186
187function updateImageList(field, BlogId) {
188	$('#BlogPostFileDrop').html("<div id=\"DropArea\"></div><div id=\"BlogPostImageList\" class=\"BlogPostImageList\"></div>");
189	UpdateContent('BlogPostImageList', '/blog.php?Mode=ImageList&Folder=' + $(field).val() + '&BlogId=' + BlogId);
190}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.