· 5 years ago · May 21, 2020, 08:10 AM
1// ==UserScript==
2// @name Tumblr - Mass Post Editor Features
3// @namespace https://jakejilg.com/mass_post_features
4// @description MassReblog ArchiveDashTaggedLikes BatchPhotoset SelectShowBy:TagType MouseMultiSelect BackdateSchedule CaptionLink SortFollowersFollowees +more
5// @include https://www.tumblr.com/mega-editor
6// @include https://www.tumblr.com/mega-editor/*
7// @include https://www.tumblr.com/mega-editor/*/*/*
8// @include https://*/archive?fetch=first_post_timestamp&jump=*&name=*&to=*&year=*
9// @version 4
10// @grant none
11// @run-at document-start
12// ==/UserScript==
13
14// May 2020, Mass Post Editor Features 4 (from scratch) by Jake Jilg (benign-mx)
15
16// this month widget stuff for both includes pages
17var MassPostEditorFeatures4 = function () {
18 // and I begin my own flurb src="greasemonkey.user.js"... :)
19 var doubleCheckDisabledMonths = function (currentYr, lTs, fTs, jump, jumpTo) {
20 var mw = document.getElementById("browse_months_widget");
21 var cy = mw.getElementsByClassName(
22 "current_year"
23 )[0].innerText;
24 var yr1 = parseInt(cy);
25 var timestampF;
26 var timestampL;
27 var mo = mw.getElementsByClassName("months")[0].
28 getElementsByTagName("li");
29 var a;
30 var span;
31 for (var i = 0; i < 12; i++) {
32 timestampF = new Date(yr1, i+1, 1).getTime();
33 timestampL = new Date(yr1, i, 1).getTime();
34 if (timestampL >= lTs || timestampF <= fTs) {
35 if (!mo[i].classList.contains("empty")) {
36 mo[i].classList.add("empty");
37 }
38 a = mo[i].getElementsByTagName("a");
39 if (a.length > 0) {
40 span = document.createElement("span");
41 span.appendChild(
42 document.createTextNode(
43 a[0].innerText
44 )
45 );
46 mo[i].replaceChild(span, a[0]);
47 }
48 } else {
49 if (mo[i].classList.contains("empty")) {
50 mo[i].removeAttribute("class");
51 }
52 a = mo[i].getElementsByTagName("span");
53 var month = i;
54 var ts = (new Date(yr1, month + 1, 0)).getTime() / 1000;
55 var href2g2 = "http://www.tumblr.com/mega-editor/published/" +
56 name + "?" + jump + "&" + jumpTo + "&" + ts +
57 "#month" + (i+1) + "year" + yr1;
58 if (a.length > 0) {
59 span = document.createElement("a");
60 span.href = href2g2;
61 span.target = "_top";
62 span.setAttribute("data-month-index", i.toString());
63 span.appendChild(
64 document.createTextNode(
65 a[0].innerText
66 )
67 );
68 mo[i].replaceChild(span, a[0]);
69 } else {
70 mo[i].getElementsByTagName("a")[0].href = href2g2;
71 }
72 }
73 }
74 };
75 // these ^v functions function on both includes pages... coding in 3D! :)
76 var i;
77 var lTs;
78 var fTs;
79 var name;
80 var makeBrowseMonthsWidget = function (currentYr, lTs, fTs, jump, jumpTo) {
81 // last timestamp, first timestamp
82 var browseMonthsWidget2 = document.createElement("div");
83 browseMonthsWidget2.classList.add("popover");
84 browseMonthsWidget2.classList.add("popover_gradient");
85 browseMonthsWidget2.id = "browse_months_widget";
86 var browseMonthsPopInner = document.createElement("div");
87 browseMonthsPopInner.classList.add("popover_inner");
88 var browseMonthsYear = document.createElement("div");
89 browseMonthsYear.classList.add("year");
90 var browseMonthsYearNavigation = document.createElement("div");
91 browseMonthsYearNavigation.classList.add("year_navigation");
92 var prevYearVis = function (e) {
93 e.preventDefault();
94 e.stopPropagation();
95 e.cancelBubble = true;
96 var cy = document.getElementsByClassName(
97 "current_year"
98 )[0];
99 var yr = parseInt(cy.innerText);
100 if (this.classList.contains("previous_year")) {
101 --yr;
102 cy.innerText = yr;
103 } else {
104 ++yr;
105 cy.innerText = yr;
106 }
107 doubleCheckDisabledMonths(yr, lTs, fTs, jump, jumpTo);
108 };
109 var browseMonthPrevYearA = document.createElement("a");
110 browseMonthPrevYearA.href = "#";
111 browseMonthPrevYearA.addEventListener("click", prevYearVis);
112 var prevYearSpan = document.createElement("span");
113 prevYearSpan.appendChild(
114 document.createTextNode("prev")
115 );
116 browseMonthPrevYearA.classList.add("previous_year");
117 browseMonthPrevYearA.appendChild(prevYearSpan);
118 var browseMonthNextYearA = document.createElement("a");
119 browseMonthNextYearA.href = "#";
120 browseMonthNextYearA.addEventListener("click", prevYearVis);
121 var nextYearSpan = document.createElement("span");
122 nextYearSpan.appendChild(
123 document.createTextNode("next")
124 );
125 browseMonthNextYearA.classList.add("next_year");
126 browseMonthNextYearA.appendChild(nextYearSpan);
127 var currentYearSpan = document.createElement("span");
128 currentYearSpan.classList.add("current_year");
129 currentYearSpan.appendChild(
130 document.createTextNode(currentYr)
131 );
132 browseMonthsYearNavigation.appendChild(browseMonthPrevYearA);
133 browseMonthsYearNavigation.appendChild(currentYearSpan);
134 browseMonthsYearNavigation.appendChild(browseMonthNextYearA);
135 browseMonthsYear.appendChild(browseMonthsYearNavigation);
136 browseMonthsPopInner.appendChild(browseMonthsYear);
137 var clear1 = document.createElement("div");
138 clear1.classList.add("clear");
139 browseMonthsYearNavigation.appendChild(clear1);
140 var browseMonths = document.createElement("div");
141 browseMonths.classList.add("months");
142 var browseMonthsUl = document.createElement("ul");
143 var month = [
144 "January", "February", "March",
145 "April", "May", "June", "July",
146 "August", "September", "October",
147 "November", "December"
148 ];
149 var browseMonthsLi;
150 var browseMonthsA;
151 for (i = 0; i < 12; i++) {
152 browseMonthsA = document.createElement("span");
153 browseMonthsA.appendChild(
154 document.createTextNode(month[i])
155 );
156 browseMonthsLi = document.createElement("li");
157 browseMonthsLi.appendChild(browseMonthsA);
158 browseMonthsUl.appendChild(browseMonthsLi);
159 }
160 browseMonths.appendChild(browseMonthsUl);
161 browseMonthsYear.appendChild(browseMonths);
162 browseMonthsPopInner.appendChild(browseMonthsYear);
163 browseMonthsWidget2.appendChild(browseMonthsPopInner);
164 return browseMonthsWidget2;
165 };
166 if (
167 document.location.href.match( // really big RegEx
168/\/archive\?fetch=first_post_timestamp&jump=[^&]+&name=[^&]+&to=[^&]+&year=\d+/i
169 ) !== null
170 ) {
171 var megaCss = document.createElement("link");
172 megaCss.setAttribute("rel", "stylesheet");
173 megaCss.setAttribute("type", "text/css");
174 megaCss.setAttribute(
175 "href", 'https://assets.tumblr.com/assets/styles/mega-editor.css'
176 );
177 var glbCss = document.createElement("link");
178 glbCss.setAttribute("rel", "stylesheet");
179 glbCss.setAttribute("type", "text/css");
180 glbCss.setAttribute(
181 "href", "https://assets.tumblr.com/client/prod/app/global.build.css"
182 );
183 var iCss = document.createElement("style");
184 iCss.type = "text/css";
185 iCss.appendChild(
186 document.createTextNode(
187(function () {/*
188body {
189 background: none transparent;
190}
191#browse_months_widget {
192 height: 422px;
193 width: 225px;
194 padding: 0px;
195 top: 0px;
196 left: 0px;
197}
198*/}).toString().slice(16, -3))
199 );
200 // this browMoWidget ^ is inside the iframe
201 var newH = document.createElement("html");
202 var head = document.createElement("head");
203 head.appendChild(glbCss);
204 head.appendChild(megaCss);
205 head.appendChild(iCss);
206 newH.appendChild(head);
207 var body = document.createElement("body");
208 var currentYr = document.location.href.match(/year=(\d+)/i)[1];
209 name = document.location.href.match(/&name=([^&]+)/i)[1];
210 var jump = document.location.href.match(/jump=([^&]+)/i)[1];
211 var jumpTo = document.location.href.match(/to=([^&]+)/i)[1];
212 var html = document.documentElement.innerHTML;
213 fTs = parseInt(html.match(
214 /"firstPostTimestamp":(\d+)/
215 )[1]) * 1000;
216 lTs = parseInt(html.match(
217 /"updated":(\d+)/
218 )[1]) * 1000;
219 // the default archive URL makes weird dead pages...
220 // I want to replace the default glitchy/month/panel/2014
221 // with a more simple yet functional panel ?month&beforetimestamp
222 body.appendChild(makeBrowseMonthsWidget(currentYr, lTs, fTs, jump, jumpTo));
223 newH.appendChild(body);
224 document.getElementsByTagName("html")[0].parentNode.replaceChild(
225 newH,
226 document.getElementsByTagName("html")[0]
227 );
228 doubleCheckDisabledMonths(currentYr, lTs, fTs, jump, jumpTo);
229 return;
230 }
231 // this ^ runs on archive page only :)
232
233 // this v runs on the megaEditor page only
234 var removeS = document.getElementsByTagName("script");
235 for (i = 0; i < removeS.length; i++) {
236 if (
237 typeof removeS[i].src.split(/\/+/g)[1] === "undefined" ||
238 removeS[i].src.split(/\/+/g)[1] !== "assets.tumblr.com"
239 ) {
240 removeS[i].parentNode.removeChild(removeS[i]);
241 }
242 }
243 var rewrite1 = function () { // <= outside of plugin scope
244 // Tumblr was animating with
245 // JQuery DOM manipulation instead of CSS3 >:P
246 window.way_too_big_to_animate = true;
247 window.neueCorrectionIndex = 0;
248 // Tumblr was written with prototype.js in 2014 and
249 // it used a lot of clumsy intervals as listeners
250 // which were passed down the the jQuery Tumbr MPE
251 // in 2016 and are still being used...
252 for (var i = 100; i > 0; i--) {
253 clearInterval(i); // their intervals have no var names
254 }
255 // but we use intervals too because it's still Tumblr in 2014 :)
256 window.cleanCssAnimate = setInterval(function () {
257 var href = document.location.href.split(/[\/\?&#=]+/g);
258 var l = document.getElementsByClassName("l-content")[0];
259 var data = document.getElementById(
260 "mass_post_features-plugin_data"
261 );
262 if (typeof l === "undefined") {
263 return;
264 }
265 if (typeof l !== "undefined" && !l.classList.contains("albino")) {
266 l.innerHTML = "";
267 return;
268 }
269 var pause = document.getElementById(
270 "pause_button"
271 );
272 var canvas = document.getElementById("status");
273 var ctx = canvas.getContext("2d");
274 if (
275 typeof canvas !== "undefined" &&
276 data.classList.contains("fetching-from-tumblr-api") &&
277 pause !== null &&
278 typeof pause !== "undefined" &&
279 pause.classList.contains("playing")
280 ) {
281 var toSeconds = parseFloat(
282 data.getAttribute("data-to-seconds")
283 );
284 toSeconds++;
285 if (toSeconds > 30) {
286 toSeconds = 0;
287 }
288 ctx.fillStyle = "#9da6af";
289 ctx.fillRect(
290 0, 0, canvas.width, canvas.height
291 );
292 var width = (canvas.width - 16) * (toSeconds / 30);
293 ctx.fillStyle = "#74797e";
294 ctx.fillRect(
295 0, canvas.height / 2 + 2, canvas.width - 16, canvas.height / 2
296 );
297 ctx.fillStyle = "turquoise";
298 ctx.fillRect(0, canvas.height/ 2 + 2, width, canvas.height/ 2);
299 ctx.fillStyle = "#9da6af";
300 for (var i = canvas.width/11; i < canvas.width; i+=canvas.width/11) {
301 ctx.fillRect(
302 i - 3, canvas.height/ 2 + 2, 2, canvas.height / 2
303 );
304 }
305 ctx.font = "bold 10px Arial, sans-serif";
306 ctx.fillStyle = "#fff"
307 ctx.fillText(
308 "Posts Loaded",
309 canvas.width/2 - ctx.measureText("Posts Loaded").width / 2 - 3,
310 canvas.height / 2
311 );
312 data.setAttribute("data-to-seconds", toSeconds);
313 } else if (
314 pause !== null &&
315 typeof pause !== "undefined" &&
316 pause.classList.contains("paused")
317 ) {
318 ctx.font = "bold 10px Arial, sans-serif";
319 ctx.fillStyle = "#9da6af";
320 ctx.fillRect(
321 0, 0, canvas.width, canvas.height / 2
322 );
323 ctx.fillStyle = "#fff";
324 ctx.fillText(
325 "Paused",
326 canvas.width/2 - ctx.measureText("Paused").width / 2 - 6,
327 canvas.height / 2
328 );
329 }
330 var fChild = l.querySelectorAll(":scope > :not(.laid)");
331 if (fChild.length !== 0) {
332 fChild[0].classList.add("laid");
333 } else if (data.classList.contains("next_page_false")) {
334 clearInterval(window.cleanCssAnimate);
335 // we clear our own animate interval Tumblr...
336 var p = l.querySelectorAll(":scope > a");
337 document.getElementById("p_loaded").innerHTML = "x" + p.length;
338 pause.classList.add("done");
339 pause.classList.remove("playing");
340 pause.classList.remove("paused");
341 var allDone = "All posts loaded.";
342 pause.setAttribute("title", allDone);
343 document.getElementById(
344 "ajax-info_button"
345 ).setAttribute("title", allDone);
346 var smi = new Image();
347 smi.addEventListener("load", function() {
348 var canvas = document.getElementById("status");
349 var ctx = canvas.getContext("2d");
350 ctx.font = "bold 10px Arial, sans-serif";
351 ctx.fillStyle = "#9da6af";
352 ctx.fillRect(
353 0, 0, canvas.width, canvas.height
354 );
355 ctx.fillStyle = "#fff";
356 ctx.fillText(
357 "All Posts",
358 14,
359 7
360 );
361 ctx.fillText(
362 "Loaded",
363 17,
364 15
365 );
366 ctx.drawImage(this, 1, 1);
367 });
368 smi.src = "data:image/gif;base64,R0lGODlhDAAMAKIFAF5LAP/zxAAAANyu" +
369 "AP/gaP///wAAAAAAACH5BAEAAAUALAAAAAAMAAwAAAMlWLPcGjDKFYi9lxKBOa" +
370 "GcF35DhWHamZUW0K4mAbiwWtuf0uxFAgA7";
371 }
372 }, 25);
373 // we will need to rebuild on show only too
374 (function (alias) {
375 window.columns_need_rebuilding = function () {
376 var data = document.getElementById(
377 "mass_post_features-plugin_data"
378 );
379 if (document.getElementById("p_loaded") !== null) {
380 var lcontent = document.getElementsByClassName("l-content");
381 var p = lcontent[0].querySelectorAll(":scope > a");
382 document.getElementById("p_loaded").innerHTML = "x" + p.length;
383 }
384 var rebuildAnyway = data.classList.contains("rebuild_anyway");
385 window.column_gutter = parseInt(
386 data.getAttribute("data-column_gutter")
387 );
388 window.column_full_width = window.column_width + window.column_gutter;
389 if (
390 rebuildAnyway ||
391 document.documentElement.scrollWidth >
392 document.documentElement.clientWidth
393 ) {
394 data.classList.remove("rebuild_anyway");
395 return true;
396 }
397 return alias.apply(this, arguments);
398 }
399 })(window.columns_need_rebuilding);
400 (function (alias) {
401 // this fires after a delete...
402 window.get_selected_post_ids = function () {
403 var data = document.getElementById(
404 "mass_post_features-plugin_data"
405 );
406 data.classList.add("rebuild_anyway");
407 var masonry = new CustomEvent("resize");
408 window.dispatchEvent(masonry);
409 return alias.apply(this, arguments);
410 };
411 })(window.get_selected_post_ids);
412 // this ^ the pro way to alias
413 clearInterval(window.timerid_auto_paginator);
414 window.fetch_next_page = function () {};
415 window.auto_paginator = function () {};
416 // pagination? where we are going, we do not need pagination
417 };
418 var rewrite2 = function () {
419 // my batch photos doesn't need certain functions :0
420 var href = document.location.href.split(/[\/\?&#=]+/g);
421 (function (alias) {
422 // don't fear. these window scope references are
423 // NOT unSafeWindow breaches from the plugin scope.
424 // these rewrites are going into the DOM, and then
425 // the plugin can no longer touch them.
426 window.add_tags_to_selected_posts = function() {
427 var data = document.getElementById(
428 "mass_post_features-plugin_data"
429 );
430 // we must remove the tag from our own custom data first
431 var tagsAllArr = JSON.parse(
432 data.getAttribute("data-tags_all_arr")
433 );
434 var tagToIds = JSON.parse(
435 data.getAttribute("data-tag_to_ids")
436 );
437 var idToTags = JSON.parse(
438 data.getAttribute("data-id_to_tags")
439 );
440 var hl = document.getElementsByClassName("highlighted");
441 var tokens = document.getElementById("tokens");
442 var tags = tokens.getElementsByClassName("tag");
443 var tag;
444 var id;
445 var tc;
446 for (var i = 0; i < tags.length; i++) {
447 tag = tags[i].innerHTML;
448 if (tagsAllArr.indexOf(tag) === -1) {
449 tagsAllArr.push(tag); // new Tag
450 }
451 for (var l = 0; l < hl.length; l++) {
452 id = hl[l].getAttribute("data-id");
453 if (typeof idToTags[id] === "undefined") {
454 idToTags[id] = [tags];
455 }
456 if (idToTags[id].indexOf(tag) === -1) {
457 idToTags[id].push(tag);
458 }
459 if (typeof tagToIds[tag] === "undefined") {
460 tagToIds[tag] = [id];
461 }
462 if (tagToIds[tag].indexOf(id) === -1) {
463 tagToIds[tag].push(id);
464 }
465 tc = hl[l].getElementsByClassName("tag-container")[0];
466 if (
467 typeof idToTags[id] !== "undefined" ||
468 idToTags[id].length !== 0
469 ) {
470 // this will happen always
471 tc.innerHTML = "#" + idToTags[id].join(" #");
472 } else {
473 tc.innerHTML = ""; // < this might not happen
474 }
475 }
476 }
477 data.setAttribute("data-tags_all_arr", JSON.stringify(tagsAllArr));
478 data.setAttribute("data-tag_to_ids", JSON.stringify(tagToIds));
479 data.setAttribute("data-id_to_tags", JSON.stringify(idToTags));
480 return alias.apply(this, arguments);
481 };
482 })(window.add_tags_to_selected_posts);
483 // this takes tags out of elements when removed...
484 // pry easier/better than reloading each post
485 (function (alias) {
486 window.remove_tags_from_selected_posts = function() {
487 var data = document.getElementById(
488 "mass_post_features-plugin_data"
489 );
490 // we must remove the tag from our own custom data first
491 var tagsAllArr = JSON.parse(
492 data.getAttribute("data-tags_all_arr")
493 );
494 var tagToIds = JSON.parse(
495 data.getAttribute("data-tag_to_ids")
496 );
497 var idToTags = JSON.parse(
498 data.getAttribute("data-id_to_tags")
499 );
500 // you can take the w3c out of the jQuery,
501 // but you can't take the jQuery out of w3c
502 var tags2remove = document.querySelectorAll("#tags input:checked");
503 // I love these new querySelector ^ things :)
504 var hl = document.getElementsByClassName("highlighted");
505 var id;
506 var alt;
507 var index;
508 var tc;
509 for (var i = 0; i < hl.length; i++) {
510 id = hl[i].getAttribute("data-id");
511 for (var l = 0; l < tags2remove.length; l++) {
512 alt = tags2remove[l].getAttribute("alt");
513 index = idToTags[id].indexOf(alt);
514 idToTags[id].splice(index, 1);
515 tc = hl[i].getElementsByClassName("tag-container")[0];
516 if (
517 typeof idToTags[id] !== "undefined" ||
518 idToTags[id].length !== 0
519 ) {
520 tc.innerHTML = "#" + idToTags[id].join(" #");
521 } else {
522 tc.innerHTML = "";
523 }
524 index = tagToIds[alt].indexOf(id);
525 tagToIds[alt].splice(index, 1);
526 // remove when last tag removed
527 if (
528 typeof tagToIds[alt] === "undefined" ||
529 tagToIds[alt].length === 0 // it could become undefined on shift
530 ) {
531 index = tagsAllArr.indexOf(alt);
532 tagsAllArr.splice(index, 1);
533 }
534 }
535 }
536 data.setAttribute("data-tags_all_arr", JSON.stringify(tagsAllArr));
537 data.setAttribute("data-tag_to_ids", JSON.stringify(tagToIds));
538 data.setAttribute("data-id_to_tags", JSON.stringify(idToTags));
539 return alias.apply(this, arguments);
540 };
541 })(window.remove_tags_from_selected_posts);
542 // I've been told: this is the best way to alias a function
543 (function (alias) {
544 window.get_selected_post_ids = function () {
545 window.postCountMake();
546 return alias.apply(this, arguments);
547 };
548 })(window.get_selected_post_ids);
549 };
550 // some rewrites ^ to Tumblr's default code, to use later...
551 // this function is plugin scope
552 var appendRichButtons = function(pbe, rich, brick) {
553 // pbe meanse photo brick edit, but I recycled this
554 // to make buttons for the caption adder thing too :)
555 var addTextFormatting = function(e) {
556 e.preventDefault();
557 e.stopPropagation();
558 var sel = window.getSelection();
559 if(
560 typeof sel.rangeCount !== "undefined" &&
561 sel.rangeCount === 0
562 ) {
563 return;
564 }
565 var rng = sel.getRangeAt(0);
566 var preRange = 0;
567 var postRange = 0;
568 var nod;
569 var isNode = this.getAttribute("data-node") !== "none";
570 if (isNode) {
571 nod = document.createElement(this.getAttribute("data-node"));
572 nod.appendChild(
573 document.createTextNode(sel.toString())
574 );
575 if (this.getAttribute("data-class") !== "none") {
576 nod.classList.add(
577 this.getAttribute("data-class")
578 );
579 }
580 if (
581 this.getAttribute("data-node") === "a" &&
582 this.getAttribute("data-attr") === "href"
583 ) {
584 nod.href = pbe.getElementsByClassName(
585 "a_button_input"
586 )[0].value;
587 }
588 } else {
589 nod = document.createTextNode(sel.toString());
590 }
591 rng.deleteContents();
592 if (this.getAttribute("data-parent") !== "none") {
593 var pnt = document.createElement(
594 this.getAttribute("data-parent")
595 );
596 pnt.appendChild(nod);
597 rng.insertNode(pnt);
598 } else {
599 rng.insertNode(nod);
600 }
601 if (!isNode) {
602 if (rng.commonAncestorContainer !== rich) {
603 rng.commonAncestorContainer.parentNode.replaceChild(
604 document.createTextNode(
605 rng.commonAncestorContainer.innerText
606 ),
607 rng.commonAncestorContainer
608 );
609 }
610 }
611 brick.classList.remove("visible-colors");
612 brick.classList.remove("visible-url");
613 window.getSelection().removeAllRanges();
614 };
615 var xb = butt("X");
616 xb.classList.add(xb.id);
617 xb.setAttribute("data-node", "none");
618 xb.setAttribute("data-class", "none");
619 xb.setAttribute("data-attr", "none");
620 xb.setAttribute("data-parent", "none");
621 xb.removeAttribute("id");
622 xb.setAttribute(
623 "title", "Remove Formatting"
624 );
625 xb.addEventListener("click", addTextFormatting);
626 var hb = butt("H");
627 hb.classList.add(hb.id);
628 hb.setAttribute("data-node", "h2");
629 hb.setAttribute("data-class", "none");
630 hb.setAttribute("data-attr", "none");
631 hb.setAttribute("data-parent", "none");
632 hb.removeAttribute("id");
633 hb.setAttribute(
634 "title", "Heading"
635 );
636 hb.addEventListener("click", addTextFormatting);
637 var bb = butt("B");
638 bb.classList.add(bb.id);
639 bb.setAttribute("data-node", "b");
640 bb.setAttribute("data-class", "none");
641 bb.setAttribute("data-attr", "none");
642 bb.setAttribute("data-parent", "none");
643 bb.removeAttribute("id");
644 bb.setAttribute(
645 "title", "Bold"
646 );
647 bb.addEventListener("click", addTextFormatting);
648 var ib = butt("i");
649 ib.classList.add(ib.id);
650 ib.setAttribute("data-node", "i");
651 ib.setAttribute("data-class", "none");
652 ib.setAttribute("data-attr", "none");
653 ib.setAttribute("data-parent", "none");
654 ib.removeAttribute("id");
655 ib.setAttribute(
656 "title", "Italic"
657 );
658 ib.addEventListener("click", addTextFormatting);
659 var so = butt("S");
660 so.classList.add(so.id);
661 so.removeAttribute("id");
662 so.setAttribute("data-node", "strike");
663 so.setAttribute("data-class", "none");
664 so.setAttribute("data-attr", "none");
665 so.setAttribute("data-parent", "none");
666 so.setAttribute(
667 "title", "Strike"
668 );
669 so.addEventListener("click", addTextFormatting);
670 var ab = butt("a");
671 ab.classList.add(ab.id);
672 ab.removeAttribute("id");
673 var ok = butt("ok");
674 ok.classList.add(ok.id);
675 ok.removeAttribute("id");
676 var urlInput = document.createElement("input");
677 urlInput.type = "text";
678 urlInput.addEventListener("focus", function () {
679 this.select();
680 });
681 urlInput.classList.add("a_button_input");
682 urlInput.value = "https://";
683 ok.setAttribute("data-node", "a");
684 ok.setAttribute("data-class", "none");
685 ok.setAttribute("data-attr", "href");
686 ok.setAttribute("data-parent", "none");
687 ab.setAttribute(
688 "title", "Link"
689 );
690 ok.addEventListener("click", addTextFormatting);
691 ab.addEventListener("click", function() {
692 brick.classList.add("visible-url");
693 });
694 var ol = butt("ol");
695 ol.classList.add(ol.id);
696 ol.removeAttribute("id");
697 ol.setAttribute("data-node", "li");
698 ol.setAttribute("data-class", "none");
699 ol.setAttribute("data-attr", "none");
700 ol.setAttribute("data-parent", "ol");
701 ol.firstChild.innerHTML = "1.";
702 ol.setAttribute(
703 "title", "Ordered List"
704 );
705 ol.addEventListener("click", addTextFormatting);
706 var ul = butt("ul");
707 ul.classList.add(ul.id);
708 ul.removeAttribute("id");
709 ul.setAttribute("data-node", "li");
710 ul.setAttribute("data-class", "none");
711 ul.setAttribute("data-attr", "none");
712 ul.setAttribute("data-parent", "ul");
713 ul.firstChild.innerHTML = "⚫";
714 ul.setAttribute(
715 "title", "Unordered List (Bullet Point)"
716 );
717 ul.addEventListener("click", addTextFormatting);
718 var bq = butt("bq");
719 bq.classList.add(bq.id);
720 bq.removeAttribute("id");
721 bq.setAttribute("data-node", "blockquote");
722 bq.setAttribute("data-class", "none");
723 bq.setAttribute("data-attr", "none");
724 bq.setAttribute("data-parent", "none");
725 bq.firstChild.innerHTML = "▐";
726 bq.setAttribute(
727 "title", "Blockquote"
728 );
729 bq.addEventListener("click", addTextFormatting);
730 var colorB = butt("colors");
731 colorB.classList.add(colorB.id);
732 colorB.removeAttribute("id");
733 var color = document.createElement("div");
734 color.classList.add("color");
735 colorB.firstChild.innerHTML = color.outerHTML;
736 colorB.setAttribute(
737 "title", "Text Color"
738 );
739 colorB.addEventListener("click", function() {
740 brick.classList.add("visible-colors");
741 });
742 var colors = [
743 ["Pink", "#ff62ce", "niles"],
744 ["Red", "#ff492f", "joey"],
745 ["Orange", "#ff8a00", "monica"],
746 ["Yellow", "#e8d73a", "phoebe"],
747 ["Green", "#00cf35", "ross"],
748 ["Cerulean", "#00b8ff", "rachel"],
749 ["Blue", "#7c5cff", "chandler"]
750 ];
751 var cb;
752 for (i = 0; i < colors.length; i++) {
753 cb = butt(colors[i][0]);
754 cb.classList.add(cb.id);
755 cb.removeAttribute("id");
756 cb.setAttribute(
757 "title",
758 colors[i][0] + " " +
759 colors[i][2].charAt(0).toUpperCase() + colors[i][2].slice(1)
760 );
761 cb.classList.add("colors_buttons");
762 cb.firstChild.innerHTML = "";
763 cb.style.backgroundColor = colors[i][1];
764 cb.setAttribute("data-node", "span");
765 cb.setAttribute("data-class", "npf_color_" + colors[i][2]);
766 cb.setAttribute("data-attr", "none");
767 cb.setAttribute("data-parent", "none");
768 cb.addEventListener("click", addTextFormatting);
769 pbe.appendChild(cb);
770 }
771 var fb = butt("Q");
772 fb.classList.add(fb.id);
773 fb.removeAttribute("id");
774 fb.setAttribute(
775 "title", "Quirky/Fancy"
776 );
777 fb.setAttribute("data-node", "p");
778 fb.setAttribute("data-class", "npf_quirky");
779 fb.setAttribute("data-attr", "none");
780 fb.setAttribute("data-parent", "none");
781 fb.addEventListener("click", addTextFormatting);
782 pbe.appendChild(xb);
783 pbe.appendChild(bb);
784 pbe.appendChild(ib);
785 pbe.appendChild(so);
786 pbe.appendChild(ab);
787 pbe.appendChild(hb);
788 pbe.appendChild(ol);
789 pbe.appendChild(ul);
790 pbe.appendChild(bq);
791 pbe.appendChild(colorB);
792 pbe.appendChild(fb);
793 pbe.appendChild(urlInput);
794 pbe.appendChild(ok);
795 };
796 var pluginBuildColumns = function() {
797 var data = document.getElementById(
798 "mass_post_features-plugin_data"
799 );
800 data.classList.add("rebuild_anyway");
801 // we'll dispatch a masonry event, with window resize
802 // because I don't want to appendChild script xMany
803 // times, to communicate to window wrapper/scope...
804 var masonry = new CustomEvent("resize");
805 window.dispatchEvent(masonry);
806 };
807 // here are some button making things
808 var butt = function (nam) { // buttons for widgets
809 var sel = document.createElement("button");
810 sel.id = nam.toLowerCase().replace(/\s+/, "_") + "_button";
811 sel.classList.add("chrome");
812 sel.classList.add("big_dark");
813 var div = document.createElement("div");
814 div.classList.add("chrome_button"); // numbers for same name buttons
815 div.appendChild(document.createTextNode(nam.replace(/\d+$/,"")));
816 sel.appendChild(div);
817 return sel;
818 };
819 var newChromeButton = function (id, text, withWidget) {
820 var container = document.createElement("span");
821 container.classList.add("header_button");
822 var button = document.createElement("button");
823 button.id = id + "_button";
824 button.classList.add("chrome");
825 button.classList.add("big_dark");
826 var label;
827 label = document.createElement("label");
828 label.classList.add("chrome_button");
829 if (typeof text === "string") {
830 label.innerHTML = text;
831 } else { // assumed element/fragment
832 label.appendChild(text);
833 var sv = label.getElementsByTagName("svg");
834 for (var i = 0; i < sv.length; i++) {
835 sv[i].setAttribute("fill", "#fff");
836 sv[i].setAttribute("width", "15");
837 sv[i].setAttribute("height", "15");
838 }
839 }
840 if (withWidget) {
841 var arrow = document.createElement("div");
842 arrow.classList.add("arrow");
843 label.appendChild(arrow);
844 var input = document.createElement("input");
845 input.type = "checkbox";
846 input.id = id;
847 label.setAttribute("for", id);
848 button.appendChild(label);
849 container.appendChild(button);
850 container.appendChild(input);
851 var widget = document.createElement("div");
852 widget.classList.add("widget");
853 widget.id = id + "_widget";
854 container.appendChild(widget);
855 } else {
856 button.appendChild(label);
857 }
858 container.appendChild(button);
859 return container;
860 };
861 // end buttons stuff
862 var lcontent = document.getElementsByClassName("l-content")[0];
863 if (typeof lcontent !== "undefined") {
864 lcontent.innerHTML = "";
865 }
866 var en = document.getElementsByClassName("editor_navigation");
867 var enable = en[0].getElementsByTagName("button");
868 for (i = 0; i < enable.length; i++) {
869 enable[i].classList.add("disable-when-none-selected");
870 }
871 // these functions & vars may be both plugin and window
872 var postCountMake = function () {
873 var hl = document.getElementsByClassName("highlighted");
874 var x = hl.length;
875 var i;
876 var privateButton = document.getElementById("private_button");
877 var privateCount = 0;
878 for (i = 0; i < x; i++) {
879 if (hl[i].classList.contains("private")) {
880 privateCount++;
881 }
882 }
883 // make public if mostly private selected
884 if (
885 privateButton !== null &&
886 typeof privateButton !== "undefined" &&
887 privateCount === hl.length && hl.length !== 0
888 ) {
889 privateButton.getElementsByTagName("span")[0].innerHTML = "(Public)";
890 privateButton.setAttribute(
891 "data-edit_action",'{"post[state]":"0"}'
892 ); // "0" is public usually
893 } else if (
894 privateButton !== null &&
895 typeof privateButton !== "undefined"
896 ) {
897 privateButton.getElementsByTagName("span")[0].innerHTML = "Private";
898 privateButton.setAttribute(
899 "data-edit_action",'{"post[state]":"private"}'
900 );
901 }
902 var unsel = document.getElementById("unselect");
903 var count = unsel.getElementsByClassName("chrome_button_right")[0];
904 var data = document.getElementById(
905 "mass_post_features-plugin_data"
906 );
907 var del = document.getElementById("delete_posts");
908 var count2 = del.getElementsByClassName("chrome_button_right")[0];
909 if (data.getAttribute("data-highlight-count") !== x.toString()) {
910 data.setAttribute("data-select-all_needle", "0");
911 data.setAttribute("data-select-by_needle", "0");
912 document.getElementById(
913 "select-all_button"
914 ).getElementsByTagName("span")[0].innerHTML = "Select 100";
915 data.setAttribute("data-highlight-count", x);
916 document.title = data.getAttribute("doc-title") + " (" + x + ")";
917 count.innerHTML = " (" + x + ")";
918 count2.innerHTML = " (" + x + ")";
919 var en = document.getElementsByClassName("editor_navigation");
920 var enable = en[0].getElementsByClassName(
921 "disable-when-none-selected"
922 );
923 // disable certain edit buttons, when 0 selected posts
924 if (x === 0) {
925 for (i = 0; i < enable.length; i++) {
926 if (enable[i].id === "select-by_button") {
927 continue;
928 }
929 enable[i].disabled = true;
930 }
931 count.innerHTML = "";
932 count2.innerHTML = "";
933 document.title = data.getAttribute("doc-title");
934 data.classList.add("disable-temp");
935 } else if (data.classList.contains("disable-temp")) {
936 for(var l = 0; l < enable.length; l++) {
937 enable[l].disabled = false;
938 }
939 data.classList.remove("disable-temp");
940 }
941 }
942 // populate remove_tags widget...
943 // sans ajax && sans%20escaped%20labels && sans jQuery
944 var idToTags = JSON.parse(
945 data.getAttribute("data-id_to_tags")
946 );
947 var createTagThing = function (i, tag) {
948 var div = document.createElement("div");
949 var input = document.createElement("input");
950 input.type = "checkbox";
951 input.id = "tag_checkbox_" + i;
952 input.setAttribute("alt", tag);
953 var label = document.createElement("label");
954 label.setAttribute("for", "tag_checkbox_" + i);
955 label.appendChild(
956 document.createTextNode(tag)
957 );
958 div.appendChild(input);
959 div.appendChild(label);
960 return div;
961 };
962 var id;
963 var tag;
964 var tags;
965 var tagsAdded = [];
966 var tagsWidget = document.getElementById("tags");
967 if (
968 window.getComputedStyle(
969 tagsWidget.parentNode
970 ).getPropertyValue("display") !== "block"
971 ) {
972 tagsWidget.innerHTML = "";
973 for (i = 0; i < hl.length; i++) {
974 id = hl[i].getAttribute("data-id");
975 tags = idToTags[id];
976 if( typeof tags !== "undefined") {
977 for (l = 0; l < tags.length; l++) {
978 tag = tags[l];
979 if (tagsAdded.indexOf(tag) === -1) {
980 tagsAdded.push(tag);
981 tagsWidget.appendChild(
982 createTagThing(tagsAdded.length, tag)
983 );
984 }
985 }
986 }
987 }
988 }
989 return x;
990 };
991 // end dual wrapper functions
992
993 // these are pluginScope, but all DOM, so regardless
994 var precountTheSelection = function () {
995 var pick = document.getElementsByClassName("picked");
996 while (pick.length > 0) {
997 pick[0].classList.remove("picked");
998 }
999 var data = document.getElementById(
1000 "mass_post_features-plugin_data"
1001 );
1002 var allToSelect = JSON.parse(
1003 data.getAttribute("data-all-to-select")
1004 );
1005 var typeToIds = JSON.parse(
1006 data.getAttribute("data-type_to_ids")
1007 );
1008 var tagToIds = JSON.parse(
1009 data.getAttribute("data-tag_to_ids")
1010 );
1011 var idToTags = JSON.parse(
1012 data.getAttribute("data-id_to_tags")
1013 );
1014 var idToTypes = JSON.parse(
1015 data.getAttribute("data-id_to_types")
1016 );
1017 var idToOrigin = JSON.parse(
1018 data.getAttribute("data-id_to_origin")
1019 );
1020 var idToState = JSON.parse(
1021 data.getAttribute("data-id_to_state")
1022 );
1023 var gt2select = JSON.parse(
1024 data.getAttribute("data-gt-to-select")
1025 );
1026 var lt2select = JSON.parse(
1027 data.getAttribute("data-lt-to-select")
1028 );
1029 // less than notes, the ID is the generated java shortcode thing
1030 var ltIs = data.classList.contains(// not more
1031 "istype-1902356151"
1032 );
1033 var gtIs = data.classList.contains( // more than notes
1034 "istype-454920947"// not less :)
1035 );
1036 var type;
1037 var id;
1038 var post;
1039 var tag;
1040 var ltgt;
1041 var toSelect = [];
1042 // contains tag
1043 for (var l = 0; l < allToSelect.istag.length; l++) {
1044 tag = allToSelect.istag[l];
1045 for (var i = 0; i < tagToIds[tag].length; i++) {
1046 id = tagToIds[tag][i];
1047 if(toSelect.indexOf(id) === -1) {
1048 toSelect.push(id);
1049 }
1050 }
1051 }
1052 var index;
1053 var spliceAfter;
1054 var originType;
1055 var origin = [
1056 "original",
1057 "reblog-self",
1058 "reblog-other"
1059 ];
1060 var stateType;
1061 if (toSelect.length === 0) {
1062 // contains type, go from 0, capture all
1063 for (l = 0; l < allToSelect.istype.length; l++) {
1064 type = allToSelect.istype[l];
1065 if (
1066 type === "notes-more-than" || type === "notes-less-than"
1067 ) {
1068 continue;
1069 }
1070 for (i = 0; i < typeToIds[type].length; i++) {
1071 id = typeToIds[type][i];
1072 if (
1073 allToSelect.istype.length > 1 && // capture some
1074 allToSelect.istype.indexOf(idToOrigin[id]) === -1 &&
1075 allToSelect.istype.indexOf(idToState[id]) === -1
1076 ) {
1077 continue; // has type1, but not type2
1078 } else {
1079 if(toSelect.indexOf(id) === -1) {
1080 toSelect.push(id);
1081 }
1082 }
1083 }
1084 }
1085 }
1086 if (toSelect.length !== 0) { // go twice, for 2 or 3 typeTypes
1087 // if doesn't contain type, remove from selection
1088 for (l = 0; l < allToSelect.istype.length; l++) {
1089 type = allToSelect.istype[l];
1090 if (
1091 type === "notes-more-than" || type === "notes-less-than"
1092 ) {
1093 continue;
1094 }
1095 originType = origin.indexOf(type) !== -1;
1096 stateType = type === "private";
1097 for (i = 0; i < toSelect.length; i++) {
1098 id = toSelect[i];
1099 if (
1100 idToTypes[id] !== type && !originType && !stateType ||
1101 idToOrigin[id] !== type && originType ||
1102 idToState[id] !== type && stateType
1103 ) {
1104 index = toSelect.indexOf(id);
1105 if (index !== -1) {
1106 toSelect.splice(i, 1);
1107 i--;
1108 }
1109 }
1110 }
1111 }
1112 }
1113 // intermission/break here, continued from @ var notesLtGt
1114 if (ltIs) { // no :not, so no opposite-day ui confusion :)
1115 if (toSelect.length !== 0) {
1116 // after thought types like note count for LT
1117 for (i = 0; i < toSelect.length; i++) {
1118 id = toSelect[i];
1119 if(lt2select.indexOf(id) === -1) {
1120 toSelect.splice(i, 1);
1121 i--;
1122 }
1123 }
1124 } else {
1125 for (i = 0; i < lt2select.length; i++) {
1126 id = lt2select[i];
1127 if(toSelect.indexOf(id) === -1) {
1128 toSelect.push(id);
1129 }
1130 }
1131 }
1132 }
1133 if (gtIs) { // this has no :not, less confusion
1134 if (toSelect.length !== 0) {
1135 // after thought types like note count for GT
1136 for (i = 0; i < toSelect.length; i++) {
1137 id = toSelect[i];
1138 if(gt2select.indexOf(id) === -1) {
1139 toSelect.splice(i, 1);
1140 i--;
1141 }
1142 }
1143 } else {
1144 for (i = 0; i < gt2select.length; i++) {
1145 id = gt2select[i];
1146 if(toSelect.indexOf(id) === -1) {
1147 toSelect.push(id);
1148 }
1149 }
1150 }
1151 }
1152 // back to the normal function
1153 if (toSelect.length !== 0) { // remove from selection
1154 // doesn't contain tag
1155 for (l = 0; l < allToSelect.nottag.length; l++) {
1156 tag = allToSelect.nottag[l];
1157 for (i = 0; i < toSelect.length; i++) {
1158 id = toSelect[i];
1159 if(tagToIds[tag].indexOf(id) !== -1) {
1160 toSelect.push(id);
1161 }
1162 }
1163 }
1164 } else { // or wild select from 0, so add to selection
1165 for (l = 0; l < allToSelect.nottag.length; l++) {
1166 tag = allToSelect.nottag[l];
1167 for (id in idToTags) {
1168 if (idToTags[id] !== tag) {
1169 if(toSelect.indexOf(id) === -1) {
1170 toSelect.push(id);
1171 }
1172 }
1173 }
1174 }
1175 }
1176 if (toSelect.length !== 0) {
1177 // doesn't contain type, exclusive or whatever
1178 for (l = 0; l < allToSelect.nottype.length; l++) {
1179 type = allToSelect.nottype[l];
1180 if (
1181 type === "notes-more-than" || type === "notes-less-than"
1182 ) {
1183 continue;
1184 }
1185 originType = origin.indexOf(type) !== -1;
1186 stateType = type === "private";
1187 for (i = 0; i < toSelect.length; i++) {
1188 id = toSelect[i];
1189 if (
1190 idToTypes[id] === type && !originType && !stateType ||
1191 idToOrigin[id] === type && originType ||
1192 idToState[id] === type && originType
1193 ) {
1194 index = toSelect.indexOf(id);
1195 if (index !== -1) {
1196 toSelect.splice(i, 1);
1197 i--;
1198 }
1199 }
1200 }
1201 }
1202 } else { // select from nothing
1203 for (l = 0; l < allToSelect.nottype.length; l++) {
1204 type = allToSelect.nottype[l];
1205 if (
1206 type === "notes-more-than" || type === "notes-less-than"
1207 ) {
1208 continue;
1209 }
1210 for (var type2 in typeToIds) {
1211 if (type === type2) {
1212 continue;
1213 }
1214 for (i = 0; i < typeToIds[type2].length; i++) {
1215 id = typeToIds[type2][i];
1216 if (
1217 typeToIds[type].indexOf(id) !== -1 ||
1218 allToSelect.nottype.length > 1 && // capture some
1219 allToSelect.nottype.indexOf(idToOrigin[id]) !== -1 &&
1220 allToSelect.nottype.indexOf(idToState[id]) === -1
1221 ) {
1222 continue; // has type1, but not type2
1223 } else {
1224 if(toSelect.indexOf(id) === -1) {
1225 toSelect.push(id);
1226 }
1227 }
1228 }
1229 }
1230 }
1231 }
1232 // proudly show the posts select count
1233 var titleD = document.getElementById("select-by-widget_title");
1234 var countEl = titleD.getElementsByClassName("preselect-count")[0];
1235 countEl.classList.add("noanim");
1236 setTimeout(function (){
1237 countEl.classList.remove("noanim");
1238 countEl.innerHTML = " (x" + toSelect.length + ")";
1239 }, 1);
1240 var sb = document.getElementById("select_button");
1241 if (toSelect.length === 0) {
1242 if (!data.classList.contains("show-only")) {
1243 sb.disabled = true;
1244 }
1245 } else {
1246 sb.disabled = false;
1247 var sel;
1248 for (i = 0; i < toSelect.length; i++) {
1249 id = toSelect[i];
1250 sel = document.getElementById("post_" + id);
1251 if (sel !== null) {
1252 sel.classList.add("picked");
1253 }
1254 }
1255 data.setAttribute(
1256 "data-to-select",
1257 JSON.stringify(toSelect)
1258 );
1259 }// to be continued @ var selecto
1260 };
1261 var highlightBrick = function (brick, sel) {
1262 var x = postCountMake();
1263 var visible = !brick.classList.contains("display-none");
1264 var hilite = brick.classList.contains("highlighted");
1265 if(!hilite && sel && x < 100 && visible){
1266 brick.classList.remove("prevent-anim");
1267 brick.classList.add("highlighted");
1268 }
1269 if(hilite && !sel){
1270 brick.classList.add("prevent-anim");
1271 brick.classList.remove("highlighted");
1272 brick.classList.remove("edit-reblog-queue");
1273 }
1274 postCountMake();
1275 };
1276 var SVG = function (width, height, fill, viewBox, d) {
1277 var svg = document.createElementNS(
1278 "http://www.w3.org/2000/svg", "svg"
1279 );
1280 var path = document.createElementNS(
1281 "http://www.w3.org/2000/svg", "path"
1282 );
1283 path.setAttribute("d", d);
1284 svg.setAttribute("viewBox", viewBox);
1285 svg.setAttribute("width", width);
1286 svg.setAttribute("height", height);
1287 svg.setAttribute("fill", fill);
1288 svg.appendChild(path);
1289 return svg;
1290 };
1291 // these SVG are stringed wierdly... TODO, clean decimals, maybe?
1292 var svgForType = {
1293 "home": SVG(
1294 20, 20, "#fff", "0 0 25 25",
1295 'M 21,13 V 23 H 15 V 15 H 9 v 8 H 3 V 13 H 0 L 12,1 24,13 Z'
1296 ),
1297 "clock": SVG(
1298 20, 20, "#fff", "0 0 25 25",
1299 'M 12 0 C 5.3 0 -7.9e-17 5.3 0 12 C 0 18.' +
1300 '6 5.3 24 12 24 C 18.6 24 24 18.6 24 12 C' +
1301 ' 24 5.3 18.6 -7.9e-17 12 0 z M 12 3.9 C ' +
1302 '16.5 3.9 20.2 7.5 20.2 12 C 20.2 15.0 18' +
1303 '.4 17.7 15.8 19.1 C 14.6 19.7 13.3 20.0 ' +
1304 '12 20.0 C 7.4 20.0 3.7 16.4 3.7 12 C 3.7' +
1305 ' 7.5 7.4 3.9 12 3.9 z M 9.7 7.8 L 9.7 15' +
1306 '.0 L 15.3 15.0 L 15.3 12.3 L 12.3 12.3 L' +
1307 ' 12.3 7.8 L 9.7 7.8 z '
1308 ),
1309 "symlink": SVG( // symbol link :D
1310 20, 20, "#FFF", "0 0 17 17",
1311 'M 10.8 3.2 C 10.0 3.2 9.3 3.5 8.8 4.0 C ' +
1312 '8.0 4.8 7.8 7.2 7.8 8.5 L 7.6 9.4 C 7.5 ' +
1313 '10.8 7.2 11.7 7.0 11.9 C 6.4 12.4 5.5 12' +
1314 '.4 5.0 11.9 C 4.4 11.3 4.4 10.5 5.0 9.9 ' +
1315 'C 5.1 9.9 5.4 9.7 6.6 9.4 L 6.6 7.9 C 5.' +
1316 '5 8.0 4.5 8.3 4.0 8.8 C 2.9 9.9 2.9 11.8' +
1317 ' 4.0 12.9 C 5.1 14.1 7.0 14.0 8.1 12.9 C' +
1318 ' 8.7 12.2 9.0 10.6 9.1 9.3 L 10.4 9.0 C ' +
1319 '11.4 8.9 12.4 8.6 12.9 8.1 C 14.1 6.9 14' +
1320 '.1 5.1 12.9 4.0 C 12.3 3.4 11.5 3.2 10.8' +
1321 ' 3.2 z M 10.9 4.7 C 11.2 4.7 11.6 4.8 11' +
1322 '.9 5.0 C 12.5 5.6 12.5 6.4 11.9 7.0 C 11' +
1323 '.7 7.2 11.1 7.4 10.4 7.5 L 9.3 7.6 C 9.4' +
1324 ' 6.4 9.7 5.3 9.9 5.0 C 10.2 4.8 10.5 4.7' +
1325 ' 10.9 4.7 z '
1326 ),
1327 "select": SVG(
1328 20, 20, "rgba(255,255,255,1)", "0 0 1800 1800",
1329 'M 1190.5,1425 H 981.9 v 300 h 208.6 z m -445.0,0 H 536.' +
1330 '8 v 300 H 745.4 Z M 300.4,5 H 5 V 285.6 H 300.4 Z M 5,5' +
1331 '22.1 V 730.7 H 300.4 V 522.1 Z M 5,967.1 V 1175.8 H 300' +
1332 '.4 V 967.1 Z M 5,1412.2 V 1725 H 300.4 V 1412.2 Z M 142' +
1333 '7.0,1725 H 1725 V 1412.2 H 1427.0 Z M 1725,1175.8 V 967' +
1334 '.1 h -300 v 208.6 z m 0,-445.0 V 522.1 h -300 v 208.6 z' +
1335 ' m 0,-445.0 V 5 h -297.9 l -0.0,280.6 z M 536.8,305 H 7' +
1336 '45.4 V 5 H 536.8 Z m 445.0,0 H 1190.5 V 5 H 981.9 v 300'
1337 ),
1338 "unselect": SVG(
1339 20, 20, "rgba(255,255,255,1)", "0 0 1800 1800",
1340 'M 1190.5,1425 H 981.9 v 300 h 208.6 z m -445.0,0 H 536.' +
1341 '8 v 300 H 745.4 Z M 300.4,5 H 5 V 285.6 H 300.4 Z M 5,5' +
1342 '22.1 V 730.7 H 300.4 V 522.1 Z M 5,967.1 V 1175.8 H 300' +
1343 '.4 V 967.1 Z M 5,1412.2 V 1725 H 300.4 V 1412.2 Z M 142' +
1344 '7.0,1725 H 1725 V 1412.2 H 1427.0 Z M 1725,1175.8 V 967' +
1345 '.1 h -300 v 208.6 z m 0,-445.0 V 522.1 h -300 v 208.6 z' +
1346 ' m 0,-445.0 V 5 h -297.9 l -0.0,280.6 z M 536.8,305 H 7' +
1347 '45.4 V 5 H 536.8 Z m 445.0,0 H 1190.5 V 5 H 981.9 Z M 5' +
1348 '26.1,1392.8 870.3,1048.6 1214.6,1392.8 1402.4,1204.9 10' +
1349 '58.2,860.7 1402.4,516.5 1214.6,328.7 870.3,672.9 526.1,' +
1350 '328.7 338.3,516.5 682.5,860.7 338.3,1204.9 526.1,1392.8'
1351 ),
1352 "private": SVG(
1353 20, 20, "rgba(0,0,0,0.65)", "0 0 25 25",
1354 'M 12 0 C 8.687 0 6 2.687 6 6 L 6 10 L 3 ' +
1355 '10 L 3 24 L 21 24 L 21 10 L 18 10 L 18 6' +
1356 ' C 18 2.687 15.313 0 12 0 z M 12 2 C 14.' +
1357 '205 2 16 3.794 16 6 L 16 10 L 8 10 L 8 6' +
1358 ' C 8 3.794 9.794 2 12 2 z '
1359 ),
1360 "view": SVG(
1361 20, 20, "#fff", "0 0 25 25",
1362 'M 5 2 C 3.9 2 3 2.9 3 4 L 3 19 C 3 20.1 3' +
1363 '.9 21 5 21 L 9.90625 21 C 9.40625 20.4 9.' +
1364 '1125 19.7 8.8125 19 L 5 19 L 5 4 L 17 4 L' +
1365 ' 17 10.8125 C 17.7 11.0125 18.4 11.40625 ' +
1366 '19 11.90625 L 19 4 C 19 2.9 18.1 2 17 2 L' +
1367 ' 5 2 z M 15 12 C 12.254545 12 10 14.25454' +
1368 '5 10 17 C 10 19.745455 12.254545 22 15 22' +
1369 ' C 16.014334 22 16.958627 21.71405 17.75 ' +
1370 '21.1875 L 20.59375 24 L 22 22.59375 L 19.' +
1371 '1875 19.75 C 19.71405 18.958627 20 18.014' +
1372 '334 20 17 C 20 14.254545 17.745455 12 15 ' +
1373 '12 z M 15 14 C 16.654545 14 18 15.345455 ' +
1374 '18 17 C 18 18.654545 16.654545 20 15 20 C' +
1375 ' 13.345455 20 12 18.654545 12 17 C 12 15.' +
1376 '345455 13.345455 14 15 14 z'
1377 ),
1378 "see": SVG(
1379 20, 20, "#fff", "0 0 25 25",
1380 'M12.0 7c4.7 0 8.0 3.0 9.5 4.6-1.4 1.8-4.7 ' +
1381 '5.3-9.5 5.3-4.4 0-7.9-3.5-9.4-5.4 1.4-1.6 ' +
1382 '4.8-4.5 9.4-4.5zm0-2c-7.5 0-12.0 6.5-12.0 ' +
1383 '6.5s4.8 7.4 12.0 7.4c7.7 0 11.9-7.4 11.9-7' +
1384 '.4s-4.2-6.5-11.9-6.5zm-.0 3c-2.2 0-4 1.7-4' +
1385 ' 4s1.7 4 4 4c2.2 0 4-1.7 4-4s-1.7-4-4-4zm-' +
1386 '.0 3.9c-.5.5-1.4.5-2.0 0s-.5-1.4 0-2.0c.5-' +
1387 '.5 1.4-.5 2.0 0s.5 1.4 0 2.0z'
1388 ),
1389 "edit": SVG(
1390 20, 20, "#fff", "0 0 17.6 17.6",
1391 'M5.3 13.8l-2.1.7.7-2.1L10.3 6l1.4 1.4-6.' +
1392 '4 6.4zm6.4-9.3l-1.4-1.4-1.4 1.4-6.7 6.7-' +
1393 '.2.5-2 5.9 3.8-1.3 2.1-.7.4-.1.3-.3 7.8-' +
1394 '7.8c.1 0-2.7-2.9-2.7-2.9zm5.6-1.4L14.5.3' +
1395 'c-.4-.4-1-.4-1.4 0l-1.4 1.4L15.9 6l1.4-1' +
1396 '.4c.4-.5.4-1.1 0-1.5'
1397 ),
1398 "tag": SVG(
1399 20, 20, "rgba(0,0,0,0.65)", "0 0 25 25",
1400 'M 22.548,9 C 23.206256,8.9700327 23.650255,7.910999 23,7 H 1' +
1401 '7.636 L 19,1 C 18.752094,0.59934281 17.927011,0.1886722 17,1' +
1402 ' l -1.364,6 h -5 L 12,1 C 11.549885,0.14080067 10.499307,0.2' +
1403 '4688203 10,1 L 8.636,7 H 2.452 C 1.4285746,7.5060381 1.19403' +
1404 '09,8.6369341 2,9 H 8.182 L 6.818,15 H 1.458 C 0.88718577,15.' +
1405 '077045 -0.12646423,15.930092 1,17 H 6.364 L 5,23 c 0.085861,' +
1406 '0.788259 1.3877329,1.432281 2,0 l 1.364,-6 h 5 L 12,23 c -0.' +
1407 '149456,1.256123 1.798475,1.024039 2,0 l 1.364,-6 h 6.185 C 2' +
1408 '2.966246,16.643398 22.272209,14.963206 22,15 h -6.182 l 1.36' +
1409 '4,-6 z m -8.73,6 h -5 l 1.364,-6 h 5 z'
1410 ),
1411 "ask": SVG(
1412 20, 20, "rgba(0,0,0,0.65)", "0 0 17 17",
1413 'M8.7 0C4.1 0 .4 3.7.4 8.3c0 1.2.2 2.3.7 3.4-.2.6-.4 1.5-.7 2' +
1414 '.5L0 15.8c-.2.7.5 1.4 1.2 1.2l1.6-.4 2.4-.7c1.1.5 2.2.7 3.4.' +
1415 '7 4.6 0 8.3-3.7 8.3-8.3C17 3.7 13.3 0 8.7 0zM15 8.3c0 3.5-2.' +
1416 '8 6.3-6.4 6.3-1.2 0-2.3-.3-3.2-.9l-3.2.9.9-3.2c-.5-.9-.9-2-.' +
1417 '9-3.2.1-3.4 3-6.2 6.5-6.2S15 4.8 15 8.3z'
1418 ),
1419 "reblog-self": SVG(
1420 20, 20, "rgba(0,0,0,0.65)", "0 0 17 18.1",
1421 'M12.8.2c-.4-.4-.8-.2-.8.4v2H' +
1422 '2c-2 0-2 2-2 2v5s0 1 1 1 1-1' +
1423 ' 1-1v-4c0-1 .5-1 1-1h9v2c0 .' +
1424 '6.3.7.8.4L17 3.6 12.8.2zM4.2' +
1425 ' 17.9c.5.4.8.2.8-.3v-2h10c2 ' +
1426 '0 2-2 2-2v-5s0-1-1-1-1 1-1 1' +
1427 'v4c0 1-.5 1-1 1H5v-2c0-.6-.3' +
1428 '-.7-.8-.4L0 14.6l4.2 3.3z'
1429 ),
1430 "original": SVG(
1431 20, 20, "rgba(0,0,0,0.65)", "0 0 27 27",
1432 'M 12.2,5.3 14.1,9.9 l 4.3,0.5 -2.9,4.1 0' +
1433 '.9,4.7 -4.8,-2.1 C 7.2,11.3 10.6,11.3 12' +
1434 '.2,5.3 Z M 12,0.5 8.3,8.1 0,9.3 6.0,15.1' +
1435 ' 4.5,23.4 12,19.4 19.4,23.4 17.9,15.1 24' +
1436 ',9.3 15.6,8.1 Z'
1437 ),
1438 "reblog-other": SVG(
1439 20, 20, "rgba(0,0,0,0.6)", "18 10 67 67",
1440 'M 64.7 10.1 C 63.9 10.2 63.3 11.0 63.3 12.' +
1441 '4 L 63.3 20.0 L 25.5 20.0 C 17.9 20.0 18 2' +
1442 '7.5 18 27.5 L 18 46.4 C 18 46.4 17.9 50.2 ' +
1443 '21.7 50.2 C 25.5 50.2 25.5 46.4 25.5 46.4 ' +
1444 'L 25.5 31.3 C 25.5 27.5 27.4 27.5 29.3 27.' +
1445 '5 L 63.3 27.5 L 63.3 35.1 C 63.3 37.4 64.4' +
1446 ' 37.7 66.3 36.6 L 82.2 23.7 L 66.3 10.9 C ' +
1447 '65.8 10.3 65.2 10.1 64.7 10.1 z M 50.5 30.' +
1448 '1 C 42.2 30.1 35.5 36.7 35.5 44.9 C 35.5 5' +
1449 '3.1 42.2 59.8 50.5 59.8 C 58.8 59.8 65.5 5' +
1450 '3.1 65.5 44.9 C 65.5 36.7 58.8 30.1 50.5 3' +
1451 '0.1 z M 50.5 32.6 C 55.1 32.6 59.2 35.1 61' +
1452 '.3 38.8 L 39.7 38.8 C 41.8 35.1 45.9 32.6 ' +
1453 '50.5 32.6 z M 78.4 38.9 C 74.6 38.9 74.6 4' +
1454 '2.6 74.6 42.6 L 74.6 57.8 C 74.6 61.5 72.8' +
1455 ' 61.5 70.9 61.5 L 36.8 61.5 L 36.8 54.0 C ' +
1456 '36.8 51.7 35.7 51.3 33.8 52.5 L 18 65.3 L ' +
1457 '33.8 78.2 C 34.4 78.7 35.0 79.0 35.4 79.0 ' +
1458 'C 36.3 78.9 36.8 78.1 36.8 76.7 L 36.8 69.' +
1459 '1 L 74.6 69.1 C 82.2 69.1 82.2 61.5 82.2 6' +
1460 '1.5 L 82.2 42.6 C 82.2 42.6 82.2 38.9 78.4' +
1461 ' 38.9 z M 38.5 41.2 L 40.9 41.2 C 41.6 43.' +
1462 '1 43.3 44.9 45.9 44.9 C 49.0 44.9 48.6 42.' +
1463 '1 50.5 42.1 C 52.4 42.1 52.0 44.9 55.1 44.' +
1464 '9 C 57.7 44.9 59.4 43.1 60.1 41.2 L 62.4 4' +
1465 '1.2 C 62.8 42.4 63.0 43.7 63.0 44.9 C 63.0' +
1466 ' 51.8 57.4 57.3 50.5 57.3 C 43.6 57.3 38.0' +
1467 ' 51.8 38.0 44.9 C 38.0 43.7 38.2 42.4 38.5' +
1468 ' 41.2 z M 43.6 47.3 L 43.0 48.0 C 44.4 50.' +
1469 '1 47.0 52.4 50.5 52.4 C 54.0 52.4 56.6 50.' +
1470 '1 58.0 48.0 L 57.4 47.3 C 55.5 48.8 53.4 4' +
1471 '9.7 50.5 49.7 C 47.6 49.7 45.5 48.8 43.6 4' +
1472 '7.3 z '
1473 ),
1474 "notes": SVG(
1475 20, 20, "rgba(0,0,0,0.65)", "0 0 20 18",
1476 'M14.658 0c-1.625 0-3.21.767-4.463 2.156-' +
1477 '.06.064-.127.138-.197.225-.074-.085-.137' +
1478 '-.159-.196-.225C8.547.766 6.966 0 5.35 0' +
1479 ' 4.215 0 3.114.387 2.162 1.117c-2.773 2.' +
1480 '13-2.611 5.89-1.017 8.5 2.158 3.535 6.55' +
1481 '6 7.18 7.416 7.875A2.3 2.3 0 0 0 9.998 1' +
1482 '8c.519 0 1.028-.18 1.436-.508.859-.695 5' +
1483 '.257-4.34 7.416-7.875 1.595-2.616 1.765-' +
1484 '6.376-1-8.5C16.895.387 15.792 0 14.657 0' +
1485 'h.001zm0 2.124c.645 0 1.298.208 1.916.68' +
1486 '3 1.903 1.461 1.457 4.099.484 5.695-1.97' +
1487 '3 3.23-6.16 6.7-6.94 7.331a.191.191 0 0 ' +
1488 '1-.241 0c-.779-.631-4.966-4.101-6.94-7.3' +
1489 '32-.972-1.595-1.4-4.233.5-5.694.619-.475' +
1490 ' 1.27-.683 1.911-.683 1.064 0 2.095.574 ' +
1491 '2.898 1.461.495.549 1.658 2.082 1.753 2.' +
1492 '203.095-.12 1.259-1.654 1.752-2.203.8-.8' +
1493 '87 1.842-1.461 2.908-1.461h-.001z'
1494 ),
1495 "liked": SVG(
1496 20, 20, "rgba(255,0,0,1)", "0 0 20 18",
1497 'M17.888 1.1C16.953.38 15.87 0 14.758 0c-1.' +
1498 '6 0-3.162.76-4.402 2.139-.098.109-.217.249' +
1499 '-.358.42a12.862 12.862 0 0 0-.36-.421C8.4.' +
1500 '758 6.84 0 5.248 0 4.14 0 3.06.381 2.125 1' +
1501 '.1-.608 3.201-.44 6.925 1.14 9.516c2.186 3' +
1502 '.59 6.653 7.301 7.526 8.009.38.307.851.474' +
1503 ' 1.333.474a2.12 2.12 0 0 0 1.332-.473c.873' +
1504 '-.71 5.34-4.42 7.526-8.01 1.581-2.597 1.75' +
1505 '5-6.321-.968-8.418'
1506 ),
1507 "text": SVG(
1508 20, 20, "#000", "0 0 20.8 13",
1509 'M.1 13h2.8l.9-3h4.7l.8 3h2.9L7.7 0h-3L.1' +
1510 ' 13zm6-10.1l2 5.1H4.2l1.9-5.1zM20 10V6c0' +
1511 '-1.1-.2-1.9-1-2.3-.7-.5-1.7-.7-2.7-.7-1.' +
1512 '6 0-2.7.4-3.4 1.2-.4.5-.6 1.2-.7 2h2.4c.' +
1513 '1-.4.2-.6.4-.8.2-.3.6-.4 1.2-.4.5 0 .9.1' +
1514 ' 1.2.2.3.1.4.4.4.8 0 .3-.2.5-.5.7-.2.1-.' +
1515 '5.2-1 .2l-.9.1c-1 .1-1.7.3-2.2.6-.9.5-1.' +
1516 '4 1.3-1.4 2.5 0 .9.3 1.6.8 2 .6.5 1.3.9 ' +
1517 '2.2.9.7 0 1.2-.3 1.7-.6.4-.2.8-.6 1.2-.9' +
1518 ' 0 .2 0 .4.1.6 0 .2.1.8.2 1h2.7v-.8c-.1-' +
1519 '.1-.3-.2-.4-.3.1-.3-.3-1.7-.3-2zm-2.2-1.' +
1520 '1c0 .8-.3 1.4-.7 1.7-.4.3-1 .5-1.5.5-.3 ' +
1521 '0-.6-.1-.9-.3-.2-.2-.4-.5-.4-.9 0-.5.2-.' +
1522 '8.6-1 .2-.1.6-.2 1.1-.3l.6-.1c.3-.1.5-.1' +
1523 '.7-.2.2-.1.3-.1.5-.2v.8z'
1524 ),
1525 "image": SVG(
1526 20, 20, "#ff492f", "0 0 17 15",
1527 'M14.6 1h-2.7l-.6-1h-6l-.6 1H2.4C1.1 1 0 ' +
1528 '2 0 3.3v9.3C0 13.9 1.1 15 2.4 15h12.2c1.' +
1529 '3 0 2.4-1.1 2.4-2.4V3.3C17 2 15.9 1 14.6' +
1530 ' 1zM8.3 13.1c-2.9 0-5.2-2.3-5.2-5.1s2.3-' +
1531 '5.1 5.2-5.1c2.9 0 5.2 2.3 5.2 5.1s-2.3 5' +
1532 '.1-5.2 5.1zm5.9-8.3c-.6 0-1.1-.5-1.1-1.1' +
1533 ' 0-.6.5-1.1 1.1-1.1s1.1.5 1.1 1.1c0 .6-.' +
1534 '5 1.1-1.1 1.1zm-10 3.1c0 1.2.5 2.2 1.3 3' +
1535 ' 0-.2 0-.4-.1-.6 0-2.2 1.8-4 4.1-4 1.1 0' +
1536 ' 2 .4 2.8 1.1-.3-2-2-3.4-4-3.4-2.2-.1-4.' +
1537 '1 1.7-4.1 3.9z'
1538 ),
1539 "link": SVG(
1540 20, 20, "#00cf35", "0 0 17 17",
1541 'M9.9 5.1c-.2.3-.5 1.4-.6 2.6l1.1-.1c.7-.' +
1542 '1 1.3-.3 1.5-.5.6-.6.6-1.4 0-2-.6-.5-1.4' +
1543 '-.5-2 0zM8.5 0C3.8 0 0 3.8 0 8.5S3.8 17 ' +
1544 '8.5 17 17 13.2 17 8.5 13.2 0 8.5 0zm4.4 ' +
1545 '8.2c-.5.5-1.5.8-2.5.9l-1.2.2c-.1 1.3-.4 ' +
1546 '2.9-1 3.6-1.1 1.1-3 1.2-4.1 0-1.1-1.1-1.' +
1547 '1-3 0-4.1.5-.5 1.5-.8 2.6-.9v1.5c-1.2.3-' +
1548 '1.5.5-1.6.5-.6.6-.6 1.4 0 2 .5.5 1.4.5 2' +
1549 ' 0 .2-.2.5-1.1.6-2.5l.1-.9c0-1.3.2-3.6 1' +
1550 '-4.4 1.1-1.1 3-1.2 4.1 0 1.2 1.1 1.2 2.9' +
1551 ' 0 4.1z'
1552 ),
1553 "quote": SVG(
1554 20, 20, "#ff8a00", "0 0 17 13",
1555 'M3.5 5.5C4 3.7 5.8 2.4 7.2 1.3L5.9 0C3 1' +
1556 '.8 0 5 0 8.5 0 11 1.3 13 4 13c2 0 3.7-1.' +
1557 '5 3.7-3.6C7.7 7 6 5.5 3.5 5.5zm9.3 0c.4-' +
1558 '1.8 2.2-3.1 3.7-4.2L15.2 0c-2.8 1.8-5.9 ' +
1559 '5-5.9 8.5 0 2.4 1.3 4.5 4 4.5 2 0 3.7-1.' +
1560 '5 3.7-3.6 0-2.4-1.7-3.9-4.2-3.9z'
1561 ),
1562 "chat": SVG(
1563 20, 20, "#00b8ff", "0 0 18.7 17",
1564 'M16 6.1V2.6C16 .8 15 0 13.1 0H2.9C1 0 0 ' +
1565 '1.1 0 3.3v10.4C0 15.9 1 17 2.9 17h10.2c1' +
1566 '.9 0 2.9-.8 2.9-2.6v-2.9l2.7-2.9c0-.1-2.' +
1567 '7-2.5-2.7-2.5zm-4.5-.7c0-.5.3-.8.7-.8s.8' +
1568 '.3.8.8v1.7l-.3 2.5c0 .3-.2.4-.4.4s-.4-.1' +
1569 '-.4-.4l-.3-2.5V5.4zm-3.8 6.4c0 .4-.1.8-.' +
1570 '7.8-.5 0-.7-.4-.7-.8V9.1C6.3 8.4 6 8 5.4' +
1571 ' 8c-.5 0-1 .4-1 1.2v2.6c0 .4-.1.8-.7.8s-' +
1572 '.7-.4-.7-.8V5.4c0-.5.3-.8.7-.8.4 0 .7.3.' +
1573 '7.8v2.1c.3-.4.7-.8 1.5-.8s1.7.5 1.7 2c.1' +
1574 '.1.1 3.1.1 3.1zm2.5 0c0 .4-.1.8-.7.8-.5 ' +
1575 '0-.7-.4-.7-.8V7.5c0-.4.1-.8.7-.8.5 0 .7.' +
1576 '4.7.8v4.3zm-.7-5.6c-.4 0-.7-.4-.7-.8s.3-' +
1577 '.8.7-.8c.4 0 .7.4.7.8s-.3.8-.7.8zm2.8 6.' +
1578 '3c-.4 0-.8-.4-.8-.9s.3-.9.8-.9.8.4.8.9-.' +
1579 '4.9-.8.9z'
1580 ),
1581 "audio": SVG(
1582 20, 20, "#7c5cff", "0 0 19 16",
1583 'M17.7 7.3c-.4-4.4-4-7.3-8.3-7.3-4.3 0-7.' +
1584 '9 2.9-8.3 7.4C.5 7.4 0 8 0 8.6v5c0 .8.6 ' +
1585 '1.4 1.3 1.4H4c.2.4.8 1 1.2 1 .6 0 .8-1 .' +
1586 '8-1.6V7.8c0-.5-.2-1.6-.8-1.6-.4 0-1 .8-1' +
1587 '.2 1.1H2.9c.4-3.5 3.2-5.6 6.5-5.6s6.2 2.' +
1588 '1 6.5 5.6H15c0-.3-.7-1.1-1.1-1.1-.6 0-.9' +
1589 ' 1-.9 1.6v6.6c0 .5.3 1.6.9 1.6.4 0 1.1-.' +
1590 '6 1.2-1h2.6c.7 0 1.3-.6 1.3-1.3v-5c0-.8-' +
1591 '.6-1.3-1.3-1.4zM3 8.5v1l-2 1.3V8.5h2zm15' +
1592 ' .9l-2 1.3V8.5h2v.9zm-6.4.3l-1.6.5V6.4c0' +
1593 '-.1-.1-.2-.2-.2s-.2 0-.2.1L7.2 12v.2c.1.' +
1594 '1.1.1.2.1L9 12v3.8c0 .1-.2.2-.1.2h.3c.1 ' +
1595 '0 .2 0 .2-.1l2.4-5.9v-.2c-.1-.1-.2-.1-.2' +
1596 '-.1z'
1597 ),
1598 "video": SVG(
1599 20, 20, "#ff62ce", "0 0 16 15",
1600 'M15.7 7.8c-.2-.1-.5 0-.6.1l-2.9 2.2c-.1.' +
1601 '1-.1.1-.2.1V8H0v3h2v3.2c0 .4.3.8.8.8h8.4' +
1602 'c.5 0 .8-.4.8-.8V12c0 .1.1.2.2.2l2.9 2.2' +
1603 'c.2.2.4.2.6.1.2-.1.3-.3.3-.5V8.4c0-.2-.1' +
1604 '-.5-.3-.6zM2.8 6.9c.3 0 .8.1 1.1.1h5.5c.' +
1605 '3 0 .8-.1 1-.1 1.6-.3 2.8-1.7 2.8-3.4 0-' +
1606 '1.9-1.6-3.5-3.5-3.5-1.2 0-2.4.6-3 1.7h-.' +
1607 '1C5.9.6 4.8 0 3.6 0 1.6 0 0 1.6 0 3.5c0 ' +
1608 '1.7 1.2 3 2.8 3.4zM9 4.2c1 0 1.8-.8 1.8-' +
1609 '1.8v-.3c.4.3.6.8.6 1.4 0 1-.8 1.8-1.8 1.' +
1610 '8-.9 0-1.6-.6-1.8-1.5.3.3.7.4 1.2.4zm-6.' +
1611 '2.1c1 0 1.8-.8 1.8-1.8v-.3c.4.2.6.7.6 1.' +
1612 '3 0 1-.8 1.8-1.8 1.8-.9 0-1.6-.6-1.8-1.5' +
1613 '.3.3.7.5 1.2.5z'
1614 ),
1615 };
1616 var shortCode = function (str) {
1617 var hash = 0;
1618 var chr;
1619 for (var i = 0; i < str.length; i++) {
1620 chr = str.charCodeAt(i);
1621 hash = ((hash << 5) - hash) + chr;
1622 hash |= 0; // Convert to 32bit integer
1623 }
1624 return hash;
1625 };
1626 var populateSelectByWidget = function () {
1627 if (!document.getElementById("select-by").checked) {
1628 return;
1629 }
1630 var data = document.getElementById(
1631 "mass_post_features-plugin_data"
1632 );
1633 // these are large JSON attributes DOM, but it should run ok
1634 // as long as no mutation events/observers on Tumblr's side
1635 var tagsAllArr = JSON.parse(
1636 data.getAttribute("data-tags_all_arr")
1637 );
1638 var typesAllArr = JSON.parse(
1639 data.getAttribute("data-types_all_arr")
1640 );
1641 var idsAllArr = JSON.parse(
1642 data.getAttribute("data-ids_all_arr")
1643 );
1644 var idToTags = JSON.parse(
1645 data.getAttribute("data-id_to_tags")
1646 );
1647 var idToTypes = JSON.parse(
1648 data.getAttribute("data-id_to_types")
1649 );
1650 var idToOrigin = JSON.parse(
1651 data.getAttribute("data-id_to_origin")
1652 );
1653 var idToState = JSON.parse(
1654 data.getAttribute("data-id_to_state")
1655 );
1656 var idToNotes = JSON.parse(
1657 data.getAttribute("data-id_to_notes")
1658 );
1659 var tagToIds = JSON.parse(
1660 data.getAttribute("data-tag_to_ids")
1661 );
1662 var typeToIds = JSON.parse(
1663 data.getAttribute("data-type_to_ids")
1664 );
1665 var widgetFirstFocus = data.getAttribute(
1666 "widget_first-focus"
1667 );
1668 var rowsLength = 0;
1669 var anti = function () { // is and not checkboxes
1670 var ante = document.getElementById(
1671 this.getAttribute("anti")
1672 );
1673 var data = document.getElementById(
1674 "mass_post_features-plugin_data"
1675 );
1676 var allToSelect = JSON.parse(
1677 data.getAttribute("data-all-to-select")
1678 );
1679 var tp = document.getElementsByClassName("type");
1680 var tg;
1681 var tg2;
1682 var tgi;
1683 if (this.checked && ante.checked) {
1684 ante.parentNode.classList.remove("ch");
1685 ante.classList.remove(this.id);
1686 ante.checked = false;
1687 tg = ante.getAttribute("data-is");
1688 tg2 = ante.getAttribute("data-tag");
1689 tgi = allToSelect[tg].indexOf(tg2);
1690 if (tgi !== -1) {
1691 allToSelect[tg].splice(tgi, 1);
1692 }
1693 }
1694 var tag = this.getAttribute("data-tag");
1695 var is = this.getAttribute("data-is");
1696 var i = allToSelect[is].indexOf(tag);
1697 var originSelected = false;
1698 if (this.checked) {
1699 this.parentNode.classList.add("ch");
1700 data.classList.add(this.id);
1701 var origin = ["original","reblog-self","reblog-other"];
1702 if(i === -1) {
1703 if (this.classList.contains("type")) {
1704 for (i = 0; i < tp.length; i++) {
1705 if (tp[i] !== this) {
1706 tg = tp[i].getAttribute("data-is");
1707 tg2 = tp[i].getAttribute("data-tag");
1708 if (tg2 === null) {
1709 continue;
1710 }
1711 if (
1712 (
1713 data.classList.contains(tp[i].id) &&
1714 tg2 !== "reblog-self" &&
1715 tg2 !== "reblog-other" &&
1716 tg2 !== "original" &&
1717 tg2 !== "notes-less-than" &&
1718 tg2 !== "notes-more-than" &&
1719 tg2 !== "private" &&
1720 tag !== "private"
1721 ) || (
1722 data.classList.contains(tp[i].id) &&
1723 origin.indexOf(tg2) !== -1 &&
1724 origin.indexOf(tag) !== -1
1725 )
1726 ) {
1727 // there can be only one...
1728 tgi = allToSelect[tg].indexOf(tg2);
1729 tp[i].parentNode.classList.remove("ch");
1730 tp[i].checked = false;
1731 data.classList.remove(tp[i].id);
1732 if (tgi !== -1) {
1733 allToSelect[tg].splice(tgi, 1);
1734 }
1735 // you can't select 1 post, with 2 basic types...
1736 // it doesn't exist
1737 }
1738 }
1739 }
1740 }
1741 allToSelect[is].push(tag);
1742 }
1743 } else {
1744 this.parentNode.classList.remove("ch");
1745 data.classList.remove(this.id);
1746 if(i !== -1) {
1747 allToSelect[is].splice(i, 1);
1748 }
1749 }
1750 data.setAttribute(
1751 "data-all-to-select",
1752 JSON.stringify(allToSelect)
1753 );
1754 //istag, nottag, istype, nottype
1755 // step 1 ^ gain the checkBoxes
1756 // step 2 v preCount the selection
1757 precountTheSelection();
1758 };
1759 var notesLtGt = function () {
1760 var row = this.parentNode;
1761 var recount = row.getElementsByClassName("input_is")[0];
1762 var data = document.getElementById(
1763 "mass_post_features-plugin_data"
1764 );
1765 var idToNotes = JSON.parse(
1766 data.getAttribute("data-id_to_notes")
1767 );
1768 var alreadyHidden = data.classList.contains(
1769 "some-posts-already-hidden"
1770 );
1771 var visibleIdsAllArr = JSON.parse(
1772 data.getAttribute("data-visible_ids_all_arr")
1773 );
1774 var op = this.getAttribute("data-operator")
1775 var ltb = op === "lt";
1776 var gtb = op === "gt";
1777 var count = 0;
1778 var ids = [];
1779 var nh; // not hidden
1780 var countEl = row.getElementsByClassName("count")[0];
1781 for (var id in idToNotes) {
1782 nh = ( // do not count for hidden posts
1783 alreadyHidden &&
1784 visibleIdsAllArr.indexOf(id) !== -1
1785 ) || !alreadyHidden;
1786 if(
1787 (idToNotes[id] < this.value && ltb && nh) ||
1788 (idToNotes[id] > this.value && gtb && nh)
1789 ) {
1790 ids.push(id);
1791 count++; // count the posts to select
1792 }
1793 }
1794 if (ltb) {
1795 data.setAttribute(
1796 "select-by-note_lt",
1797 this.value
1798 );
1799 data.setAttribute(
1800 "data-lt-to-select",
1801 JSON.stringify(ids)
1802 );
1803 }
1804 // to be continued @ var precountTheSelection
1805 if (gtb) {
1806 data.setAttribute(
1807 "select-by-note_gt",
1808 this.value
1809 );
1810 data.setAttribute(
1811 "data-gt-to-select",
1812 JSON.stringify(ids)
1813 );
1814 }
1815 countEl.innerHTML = count;
1816 if (recount.checked) {
1817 precountTheSelection();
1818 }
1819 };
1820 // make row function makeRow
1821 var widgetRow = function (tag, count, isType, tagIcon) {
1822 var row = document.createElement("div");
1823 var rowId = (isType? "type" : "tag") + shortCode(tag);
1824 row.id = rowId;
1825 row.setAttribute("data-row", rowsLength);
1826 row.classList.add("row");
1827 if (isType) {
1828 row.classList.add("type");
1829 row.classList.add(tag);
1830 } else {
1831 row.classList.add("tag");
1832 }
1833 var countColumn = document.createElement("div");
1834 countColumn.classList.add("count");
1835 countColumn.appendChild(
1836 document.createTextNode(
1837 count.toLocaleString(
1838 "en", {useGrouping:true}
1839 )
1840 )
1841 );
1842 var label1 = document.createElement("label");
1843 var label2 = document.createElement("label");
1844 var input1 = document.createElement("input");
1845 var input2 = document.createElement("input");
1846 input1.setAttribute("data-tag", tag);
1847 input2.setAttribute("data-tag", tag);
1848 var lb = (isType ? "type" : "tag");
1849 input1.setAttribute("data-is", "is" + lb);
1850 input2.setAttribute("data-is", "not" + lb);
1851 input1.classList.add(lb);
1852 input2.classList.add(lb);
1853 input1.classList.add("yes");
1854 input2.classList.add("no");
1855 input1.setAttribute("data-yn", "yes");
1856 input2.setAttribute("data-yn", "no");
1857 var id1 = "is" + rowId;
1858 var id2 = "not" + rowId;
1859 input1.setAttribute(
1860 "anti", "not" + rowId
1861 );
1862 input1.classList.add("input_is");
1863 input2.setAttribute(
1864 "anti", "is" + rowId
1865 );
1866 input2.classList.add("input_not");
1867 input1.id = id1;
1868 input2.id = id2;
1869 input1.addEventListener("change", anti);
1870 input2.addEventListener("change", anti);
1871 input1.type = "checkbox";
1872 input2.type = "checkbox";
1873 label1.setAttribute("for", id1);
1874 label2.setAttribute("for", id2);
1875 var div = document.createElement("div");
1876 div.classList.add("row-child");
1877 row.setAttribute("title", tag);
1878 label1.appendChild(countColumn);
1879 // we use html instead of textNode for emoji :(
1880 if (isType) {
1881 div.innerHTML = tag.replace(/-/g, " ").
1882 replace(/^.|\s./g, function (m){
1883 return m.toUpperCase();
1884 }).replace("Original","Original (op)");
1885 } else {
1886 div.innerHTML = tag;
1887 }
1888 tagIcon.classList.add("tag-icon");
1889 label1.appendChild(tagIcon);
1890 label1.appendChild(div);
1891 var is = document.createElement("span");
1892 is.appendChild(document.createTextNode("is: "))
1893 is.appendChild(input1);
1894 label2.appendChild(
1895 document.createTextNode("not: ")
1896 );
1897 label2.appendChild(input2);
1898 label1.classList.add("is");
1899 label2.classList.add("not");
1900 if (data.classList.contains("is" + rowId)) {
1901 input1.checked = true;
1902 is.classList.add("ch");
1903 } else if (data.classList.contains("not" + rowId)) {
1904 label2.classList.add("ch");
1905 input2.checked = true;
1906 }
1907 label1.appendChild(is);
1908 row.appendChild(label2);
1909 row.appendChild(label1);
1910 rowsLength++;
1911 return row;
1912 };
1913 var tag;
1914 var type;
1915 var widget = document.getElementById("select-by_widget");
1916 widget.innerHTML = "";
1917 var topPart = document.createElement("div");
1918 topPart.id = "widget-top-buttons";
1919 var abcSort = document.createElement("div");
1920 abcSort.classList.add("sort");
1921 abcSort.classList.add("abc");
1922 abcSort.appendChild(document.createTextNode("abc"));
1923 var numSort = document.createElement("div");
1924 numSort.classList.add("sort");
1925 numSort.classList.add("num");
1926 numSort.appendChild(document.createTextNode("123"));
1927 var dateSort = document.createElement("div");
1928 dateSort.classList.add("sort");
1929 dateSort.classList.add("date");
1930 dateSort.appendChild(document.createTextNode("date"));
1931 var redSort = document.createElement("div");
1932 redSort.classList.add("red");
1933 // the sorting method gets the arrow
1934 var arrow = document.createElement("div");
1935 arrow.classList.add("arrow");
1936 var widgetSortBy = data.getAttribute("widget_sort-by");
1937 dateSort.setAttribute("widget_sort-by", "date-down");
1938 abcSort.setAttribute("widget_sort-by", "abc-down");
1939 numSort.setAttribute("widget_sort-by", "num-down");
1940 if (widgetSortBy === "date-down") {
1941 dateSort.appendChild(arrow);
1942 // this is default sort method, do nothing
1943 dateSort.setAttribute("widget_sort-by", "date-up");
1944 }
1945 if (widgetSortBy === "date-up") {
1946 arrow.classList.add("reverse");
1947 dateSort.appendChild(arrow);
1948 // this is default sort method reversed
1949 typesAllArr.reverse();
1950 tagsAllArr.reverse();
1951 }
1952 if (widgetSortBy === "abc-down") {
1953 abcSort.appendChild(arrow);
1954 // sort by alphabetical
1955 typesAllArr.sort();
1956 tagsAllArr.sort();
1957 abcSort.setAttribute("widget_sort-by", "abc-up");
1958 }
1959 if (widgetSortBy === "abc-up") {
1960 arrow.classList.add("reverse");
1961 abcSort.appendChild(arrow);
1962 // sort by reverse alphabetical
1963 typesAllArr.sort();
1964 tagsAllArr.sort();
1965 typesAllArr.reverse();
1966 tagsAllArr.reverse();
1967 }
1968 var sortByCounts = function () {
1969 var typeArr = [];
1970 for(var type in typeToIds) {
1971 typeArr.push([typeToIds[type].length, type]);
1972 }
1973 typeArr.sort(function (a, b) {
1974 return parseFloat(b[0]) - parseFloat(a[0]);
1975 });
1976 for (var i = 0; i < typeArr.length; i++) {
1977 typesAllArr[i] = typeArr[i][1];
1978 }
1979 var tagArr = [];
1980 for(var tag in tagToIds) {
1981 tagArr.push([tagToIds[tag].length, tag]);
1982 }
1983 tagArr.sort(function (a, b) {
1984 return parseFloat(b[0]) - parseFloat(a[0]);
1985 });
1986 for (i = 0; i < tagArr.length; i++) {
1987 tagsAllArr[i] = tagArr[i][1];
1988 }
1989 };
1990 if (widgetSortBy === "num-down") {
1991 numSort.appendChild(arrow);
1992 // sort by counts
1993 sortByCounts();
1994 numSort.setAttribute("widget_sort-by", "num-up");
1995 }
1996 if (widgetSortBy === "num-up") {
1997 arrow.classList.add("reverse");
1998 numSort.appendChild(arrow);
1999 // sort by reverse counts
2000 sortByCounts();
2001 typesAllArr.reverse();
2002 tagsAllArr.reverse();
2003 }
2004 var sortBy = function () {
2005 var data = document.getElementById(
2006 "mass_post_features-plugin_data"
2007 );
2008 data.setAttribute(
2009 "widget_sort-by",
2010 this.getAttribute("widget_sort-by")
2011 );
2012 populateSelectByWidget();
2013 };
2014 var reSte = typesAllArr.indexOf("private");
2015 if(reSte !== -1) {
2016 typesAllArr.splice(reSte, 1);
2017 typesAllArr.unshift("private");
2018 }
2019 var reOthr = typesAllArr.indexOf("reblog-other");
2020 if(reOthr !== -1) {
2021 typesAllArr.splice(reOthr, 1);
2022 typesAllArr.unshift("reblog-other");
2023 }
2024 var reSelf = typesAllArr.indexOf("reblog-self");
2025 if(reSelf !== -1) {
2026 typesAllArr.splice(reSelf, 1);
2027 typesAllArr.unshift("reblog-self");
2028 }
2029 var reOrgi = typesAllArr.indexOf("original");
2030 if(reOrgi !== -1) {
2031 typesAllArr.splice(reOrgi, 1);
2032 typesAllArr.unshift("original");
2033 }
2034 // ^ the last shall be first
2035 var inputFocus = function () {
2036 var data = document.getElementById(
2037 "mass_post_features-plugin_data"
2038 );
2039 data.setAttribute(
2040 "widget_first-focus",
2041 this.id
2042 );
2043 };
2044 var memValue = function () {
2045 var data = document.getElementById(
2046 "mass_post_features-plugin_data"
2047 );
2048 var alreadyHidden = data.classList.contains(
2049 "some-posts-already-hidden"
2050 );
2051 var sb;
2052 var s;
2053 if (this.id === "uncheck") {
2054 s = document.getElementById(
2055 "select_button"
2056 );
2057 sb = s.firstChild;
2058 sb.innerHTML = this.checked ? "UnSelect" : "Select";
2059 }
2060 if (this.id === "show-only") {
2061 s = document.getElementById(
2062 "select_button"
2063 );
2064 sb = s.firstChild;
2065 sb.innerHTML = this.checked ?
2066 (alreadyHidden ? "ShowAll" : "Hide=!X") : "Select";
2067 }
2068 if (this.checked) {
2069 data.classList.add(this.id);
2070 } else {
2071 data.classList.remove(this.id);
2072 }
2073 };
2074 var memAndRePopulate = function () {
2075 var ante = document.getElementById(
2076 this.getAttribute("anti")
2077 );
2078 var data = document.getElementById(
2079 "mass_post_features-plugin_data"
2080 );
2081 if (this.checked && ante.checked) {
2082 ante.checked = false;
2083 }
2084 if (this.checked) {
2085 data.classList.add(this.id);
2086 data.classList.remove(ante.id);
2087 } else {
2088 data.classList.remove(this.id);
2089 if (ante.checked) {
2090 data.classList.add(ante.id);
2091 }
2092 }
2093 };
2094 dateSort.addEventListener("click", sortBy);
2095 abcSort.addEventListener("click", sortBy);
2096 numSort.addEventListener("click", sortBy);
2097 topPart.appendChild(numSort);
2098 topPart.appendChild(abcSort);
2099 topPart.appendChild(dateSort);
2100 topPart.appendChild(redSort);
2101 widget.appendChild(topPart);
2102 var scrollingPart = document.createElement("div");
2103 scrollingPart.classList.add("overflow-auto");
2104 scrollingPart.id = "widget_scrolling_part";
2105 widget.appendChild(scrollingPart);
2106 // the types / tags rows begin
2107 var div1 = document.createElement("div");
2108 div1.classList.add("tags_title");
2109 div1.appendChild(
2110 document.createTextNode("Posts By Type")
2111 );
2112 var wsp = document.getElementById("widget_scrolling_part");
2113 wsp.appendChild(div1);
2114 // firstly, add some integral buttons that need to go first
2115 var ltgtInput = document.createElement("input");
2116 ltgtInput.addEventListener("focus", inputFocus);
2117 ltgtInput.id = "hide-ltgt-than-tags";
2118 ltgtInput.type = "number";
2119 ltgtInput.addEventListener("change", function () {
2120 var data = document.getElementById(
2121 "mass_post_features-plugin_data"
2122 );
2123 data.setAttribute("hide-ltgt-than-tags", this.value);
2124 var gtl = document.getElementById("gt_input");
2125 var ltl = document.getElementById("lt_input");
2126 });
2127 ltgtInput.value = parseFloat(data.getAttribute("hide-ltgt-than-tags"));
2128 var lt = document.createElement("input");
2129 lt.type = "checkbox";
2130 lt.id = "lt_input";
2131 lt.setAttribute("anti", "gt_input");
2132 var ltlabel = document.createElement("label");
2133 ltlabel.setAttribute("for", "lt_input");
2134 ltlabel.appendChild(document.createTextNode("Less Than"));
2135 var gt = document.createElement("input");
2136 gt.type = "checkbox";
2137 gt.id = "gt_input";
2138 gt.setAttribute("anti", "lt_input");
2139 var gtlabel = document.createElement("label");
2140 gtlabel.setAttribute("for", "gt_input");
2141 gtlabel.appendChild(document.createTextNode("More Than"));
2142 lt.checked = data.classList.contains("lt_input");
2143 gt.checked = data.classList.contains("gt_input");
2144 var hider = butt("Hide");
2145 hider.setAttribute("title", "Hide/Show");
2146 hider.addEventListener("click", function () {
2147 populateSelectByWidget();
2148 });
2149 var acheck = butt("Clear");
2150 acheck.firstChild.innerHTML = "UnCheck";
2151 acheck.setAttribute("title", "Uncheck All");
2152 acheck.addEventListener("click", function () {
2153 var ch = new CustomEvent("change");
2154 var wgt = document.getElementById("select-by_widget");
2155 var check = wgt.getElementsByTagName("input");
2156 for (var i = 0; i < check.length; i++) {
2157 if (
2158 check[i].getAttribute("type") === "checkbox" &&
2159 check[i].checked
2160 ) {
2161 check[i].checked = false;
2162 check[i].dispatchEvent(ch);
2163 } //else {
2164 //TODO ??
2165 //}
2166 }
2167 populateSelectByWidget();
2168 });
2169 var ltgtContainer = document.createElement("div");
2170 ltgtContainer.setAttribute(
2171 "title",
2172 "Hide tags that occur less than: X#"
2173 );
2174 gt.addEventListener("change", memAndRePopulate);
2175 lt.addEventListener("change", memAndRePopulate);
2176 ltgtContainer.appendChild(lt);
2177 ltgtContainer.appendChild(ltlabel);
2178 ltgtContainer.appendChild(gt);
2179 ltgtContainer.appendChild(gtlabel);
2180 ltgtContainer.appendChild(ltgtInput);
2181 ltgtContainer.classList.add("select-by_ltgt");
2182 ltgtContainer.appendChild(ltgtInput);
2183 ltgtContainer.appendChild(hider);
2184 widget.appendChild(ltgtContainer);
2185 // append rows for types
2186 var count;
2187 var countOver = document.getElementById("hide-ltgt-than-tags").value;
2188 // this boolean says to check post counts, to hide
2189 var lti = document.getElementById("lt_input");
2190 var gti = document.getElementById("gt_input");
2191 var postTypeTagHiddenCount = 0;
2192 var alreadyHidden = data.classList.contains(
2193 "some-posts-already-hidden"
2194 );
2195 var visibleIdsAllArr = JSON.parse(
2196 data.getAttribute("data-visible_ids_all_arr")
2197 );
2198 // start the types with note count rows
2199 var ltrow = widgetRow(
2200 "notes-less-than", "0", 1, svgForType.notes.cloneNode(true)
2201 );
2202 ltrow.getElementsByClassName("input_not")[0].disabled = true;
2203 ltrow.getElementsByClassName("not")[0].classList.add("disabled");
2204 var gtrow = widgetRow(
2205 "notes-more-than", "0", 1, svgForType.notes.cloneNode(true)
2206 );
2207 gtrow.getElementsByClassName("input_not")[0].disabled = true;
2208 gtrow.getElementsByClassName("not")[0].classList.add("disabled");
2209 var ltnumber = document.createElement("input");
2210 ltnumber.type = "number";
2211 // input focus, remembers focus, for constant DOM rebuild
2212 ltnumber.addEventListener("focus", inputFocus);
2213 var gtnumber = document.createElement("input");
2214 gtnumber.addEventListener("focus", inputFocus);
2215 gtnumber.type = "number";
2216 ltnumber.classList.add("number-input");
2217 gtnumber.classList.add("number-input");
2218 ltnumber.setAttribute("data-operator", "lt");
2219 gtnumber.setAttribute("data-operator", "gt");
2220 ltnumber.value = parseFloat(
2221 data.getAttribute("select-by-note_lt")
2222 );
2223 gtnumber.value = parseFloat(
2224 data.getAttribute("select-by-note_gt")
2225 );
2226 ltnumber.addEventListener("input", notesLtGt);
2227 gtnumber.addEventListener("input", notesLtGt);
2228 var quickInput = new CustomEvent("input");
2229 ltnumber.id = "select-by-notes_less-than";
2230 gtnumber.id = "select-by-notes_more-than";
2231 ltrow.append(ltnumber);
2232 gtrow.append(gtnumber);
2233 wsp.appendChild(ltrow);
2234 wsp.appendChild(gtrow);
2235 // this func just counts the posts w/ note counts
2236 document.getElementById(
2237 "select-by-notes_less-than"
2238 ).dispatchEvent(quickInput);
2239 document.getElementById(
2240 "select-by-notes_more-than"
2241 ).dispatchEvent(quickInput);
2242 var div2 = document.createElement("div");
2243 div2.classList.add("tags_title");
2244 var newCount;
2245 var id;
2246 var l;
2247 for (var i = 0; i < typesAllArr.length; i++) {
2248 type = typesAllArr[i];
2249 if (type === "notes-more-than" || type === "notes-less-than") {
2250 continue;
2251 }
2252 count = typeToIds[type].length;
2253 if (alreadyHidden) {
2254 newCount = 0;
2255 // also do this for tags scroll below,
2256 // make sure id is visible
2257 for(l = 0; l < typeToIds[type].length; l++) {
2258 id = typeToIds[type][l];
2259 if (visibleIdsAllArr.indexOf(id) !== -1) {
2260 newCount++;
2261 }
2262 }
2263 // hide counts--; and rows that are invisible
2264 if(newCount === 0) {
2265 postTypeTagHiddenCount++;
2266 continue;
2267 } else {
2268 count = newCount;
2269 }
2270 }
2271 // skip if less than tags/type count :)
2272 if (
2273 // get both countOvers (type and tag, scroll down :)
2274 (
2275 type !== "reblog-self" &&
2276 type !== "reblog-other"
2277 ) && (
2278 (count < countOver && lti.checked) ||
2279 (count > countOver && gti.checked)
2280 )
2281 ) {
2282 postTypeTagHiddenCount++;
2283 continue;
2284 }
2285 wsp.appendChild(
2286 widgetRow(
2287 type, count, 1, svgForType[type].cloneNode(true)
2288 )
2289 );
2290 }
2291 // types / tags seperator
2292 div2.appendChild(
2293 document.createTextNode("Posts By Tag")
2294 );
2295 wsp.appendChild(div2);
2296 // append rows for tags
2297 for (i = 0; i < tagsAllArr.length; i++) {
2298 tag = tagsAllArr[i];
2299 count = tagToIds[tag].length;
2300 if (alreadyHidden) {
2301 newCount = 0;
2302 // also do this for types up above
2303 for(l = 0; l < tagToIds[tag].length; l++) {
2304 id = tagToIds[tag][l];
2305 if (visibleIdsAllArr.indexOf(id) !== -1) {
2306 newCount++;
2307 }
2308 }
2309 // hide counts--; and rows that are invisible (AGAIN)
2310 if(newCount === 0) {
2311 postTypeTagHiddenCount++;
2312 continue;
2313 } else {
2314 count = newCount;
2315 }
2316 }
2317 // skip if tags amount to lessThan / moreThan
2318 if (
2319 // get both countOvers (scroll up :)
2320 (count < countOver && lti.checked) ||
2321 (count > countOver && gti.checked)
2322 ) {
2323 postTypeTagHiddenCount++;
2324 continue;
2325 }
2326 wsp.appendChild(
2327 widgetRow(
2328 tag, count, 0, svgForType.tag.cloneNode(true)
2329 )
2330 );
2331 }
2332 // finish with the tags, show hidden count in top
2333 var wigTB = document.getElementById("widget-top-buttons");
2334 var redTB = wigTB.getElementsByClassName("red")[0];
2335 if (postTypeTagHiddenCount !== 0) {
2336 redTB.innerHTML = postTypeTagHiddenCount + " rows hidden";
2337 } else {
2338 wigTB.removeChild(redTB);
2339 }
2340 var re = butt("List");
2341 re.setAttribute("title", "Refresh Tags/Type List...");
2342 re.firstChild.innerHTML = "Refresh";
2343 re.addEventListener("click", function () {
2344 var data = document.getElementById(
2345 "mass_post_features-plugin_data"
2346 );
2347 var wsp = document.getElementById("widget_scrolling_part");
2348 data.setAttribute("widget_scroll-top", wsp.scrollTop);
2349 // refresh the tag select by widget
2350 document.getElementById("lt_input").checked = false;
2351 document.getElementById("gt_input").checked = false;
2352 data.classList.remove("lt_input");
2353 data.classList.remove("gt_input");
2354 populateSelectByWidget();
2355 });
2356 var cancel = butt("Cancel1");
2357 cancel.firstChild.innerHTML = "❌";
2358 cancel.setAttribute("title", "Cancel and Close Widget...");
2359 cancel.addEventListener("click", function () {
2360 var data = document.getElementById(
2361 "mass_post_features-plugin_data"
2362 );
2363 var pick = document.getElementsByClassName("picked");
2364 while (pick.length > 0) {
2365 pick[0].classList.remove("picked");
2366 }
2367 var wsp = document.getElementById("widget_scrolling_part");
2368 data.setAttribute("widget_scroll-top", wsp.scrollTop);
2369 document.getElementById("select-by").checked = false;
2370 });
2371 var needle = parseFloat(
2372 data.getAttribute("data-select-by_needle")
2373 );
2374 var selecto = butt("Select"); // this is the select-by/show-by button
2375 if (data.classList.contains("show-only")) {
2376 selecto.firstChild.innerHTML = (alreadyHidden ? "ShowAll" : "Hide=!X");
2377 } else if (
2378 needle > 0 &&
2379 !data.classList.contains("uncheck")
2380 ) {
2381 selecto.firstChild.innerHTML = "100more";
2382 }
2383 // "select by tag" "select by type"
2384 selecto.addEventListener("click", function () {
2385 var data = document.getElementById(
2386 "mass_post_features-plugin_data"
2387 );
2388 var limit = 100; // tumblr limit, for classic mass tag api
2389 var needle = parseFloat(
2390 data.getAttribute("data-select-by_needle")
2391 );
2392 var s = document.getElementById(
2393 "select_button"
2394 );
2395 var sb = s.firstChild;
2396 // Mass Post Features v3 by benign-mx (me) Jake Jilg
2397 // oh wait. I don't need this^ anymore... :) sorry...
2398 precountTheSelection();
2399 // continued from this^ function @ var precountTheSelection
2400 var toSelect = JSON.parse(
2401 data.getAttribute("data-to-select")
2402 );
2403 var idsAllArr = JSON.parse(
2404 data.getAttribute("data-ids_all_arr")
2405 );
2406 var alreadyHidden = data.classList.contains(
2407 "some-posts-already-hidden"
2408 );
2409 var visibleIdsAllArr = JSON.parse(
2410 data.getAttribute("data-visible_ids_all_arr")
2411 );
2412 var hl;
2413 var un = data.classList.contains("uncheck");
2414 var regularSelect = !data.classList.contains("show-only");
2415 // and finally select some posts
2416 var i = 0;
2417 var id;
2418 var hlBrick;
2419 hl = document.getElementsByClassName("highlighted");
2420 var needleBefore = needle;
2421 var selectedCount = 0;
2422 if (regularSelect) {
2423 while (hl.length > 0 && needle !== 0) {
2424 highlightBrick(hl[0], 0);
2425 }
2426 for (i = needle; i < toSelect.length; i++) {
2427 hlBrick = document.getElementById("post_" + toSelect[i]);
2428 if (hlBrick !== null) {
2429 // or deselect if uselect is checked
2430 if (!un) {
2431 needle++;
2432 if (needle > needleBefore + limit) { // stop at 100 select
2433 break;
2434 }
2435 }
2436 selectedCount++;
2437 highlightBrick(hlBrick, !un);
2438 }
2439 }
2440 if (selectedCount < limit) {
2441 needle = 0;
2442 }
2443 data.setAttribute("data-select-by_needle", needle);
2444 } else {
2445 // but this is the ShowOnly mode thing... :)
2446 var needRebuild = false;
2447 var brick;
2448 if (!alreadyHidden) {
2449 sb.innerHTML = "ShowAll";
2450 s.disabled = false;
2451 data.classList.add(
2452 "some-posts-already-hidden"
2453 );
2454 for (i = 0; i < idsAllArr.length; i++) {
2455 id = idsAllArr[i];
2456 brick = document.getElementById("post_" + id);
2457 if (toSelect.indexOf(id) !== -1){
2458 visibleIdsAllArr.push(id);
2459 }// a clone of toSelect,
2460 // but this staggers back for more after selections :)
2461 if (
2462 toSelect.indexOf(id) === -1 &&
2463 brick !== null
2464 ) {
2465 needRebuild = true;
2466 brick.classList.remove("brick");
2467 brick.classList.remove("laid");
2468 brick.classList.remove("highlighted");
2469 brick.classList.add("display-none");
2470 } else if (
2471 toSelect.indexOf(id) !== -1 &&
2472 brick !== null &&
2473 brick.classList.contains("display-none")
2474 ) {
2475 needRebuild = true;
2476 brick.classList.add("brick");
2477 brick.classList.add("laid");
2478 brick.classList.remove("display-nones");
2479 }
2480 }
2481 } else {
2482 sb.innerHTML = "Hide=!X";
2483 var dn = document.getElementsByClassName("display-none");
2484 data.classList.remove(
2485 "some-posts-already-hidden"
2486 );
2487 needRebuild = dn.length > 0;
2488 while (dn.length > 0) {
2489 dn[0].classList.add("brick");
2490 dn[0].classList.add("laid");
2491 // this goes lass, or else dn[0] becomes undefined :)
2492 dn[0].classList.remove("display-none");
2493 }
2494 }
2495 if (needRebuild) {
2496 pluginBuildColumns();
2497 }
2498 }
2499 data.setAttribute(
2500 "data-visible_ids_all_arr",
2501 JSON.stringify(visibleIdsAllArr)
2502 );
2503 postCountMake();
2504 populateSelectByWidget();
2505 });
2506 cancel.setAttribute("title", "Close Widget");
2507 selecto.setAttribute("title", "Select or Show");
2508 widget.appendChild(selecto);
2509 widget.appendChild(cancel);
2510 widget.appendChild(acheck);
2511 widget.appendChild(re);
2512 var unlabel = document.createElement("label");
2513 var uncheck = document.createElement("input");
2514 uncheck.type = "checkbox";
2515 uncheck.id = "uncheck";
2516 uncheck.addEventListener("change", memValue);
2517 if (data.classList.contains("uncheck")) {
2518 uncheck.checked = true;
2519 }
2520 unlabel.setAttribute("for", "uncheck");
2521 unlabel.appendChild(document.createTextNode("Un"));
2522 var h1 = document.createElement("div");
2523 var shoLabel = document.createElement("label");
2524 var shoInput = document.createElement("input");
2525 shoInput.id = "show-only";
2526 shoInput.addEventListener("change", memValue);
2527 if (data.classList.contains("show-only")) {
2528 shoInput.checked = true;
2529 }
2530 shoInput.type = "checkbox";
2531 shoLabel.setAttribute("for", "show-only");
2532 shoLabel.appendChild(document.createTextNode("Show Only"));
2533 h1.appendChild(shoInput);
2534 h1.appendChild(shoLabel);
2535 h1.appendChild(uncheck);
2536 h1.appendChild(unlabel);
2537 h1.id = "select-by-widget_title";
2538 var innerSpan = document.createElement("span");
2539 innerSpan.appendChild(document.createTextNode("Select"));
2540 var countSpan = document.createElement("span");
2541 countSpan.classList.add("preselect-count");
2542 countSpan.appendChild(document.createTextNode("(x0)"));
2543 countSpan.setAttribute("title", "Selecting X Many...")
2544 innerSpan.appendChild(countSpan);
2545 h1.appendChild(innerSpan);
2546 // refocus number inputs
2547 var ff = document.getElementById(widgetFirstFocus);
2548 ff.focus();
2549 // all elements added, go back down/up scrollTop
2550 wsp.scrollTo(
2551 0,
2552 parseFloat(
2553 data.getAttribute("widget_scroll-top")
2554 )
2555 );
2556 // lastly, the title element textNode
2557 widget.appendChild(h1);
2558 precountTheSelection();
2559 }; // end var populateSelectByWidget
2560
2561 // this had an alert(); yucky
2562 document.getElementById("unselect").
2563 parentNode.setAttribute(
2564 "onclick",
2565 (function () {
2566 var hl = document.getElementsByClassName("highlighted");
2567 while(hl.length > 0) {
2568 hl[0].classList.add("prevent-anim");
2569 hl[0].classList.remove("edit-reblog-queue");
2570 hl[0].classList.remove("highlighted");
2571 }
2572 window.postCountMake();
2573 return false;
2574 }).toString().slice(13,-1)
2575 );
2576 // end alert fix
2577
2578 // this had escaped%20spaces in the tags eww!
2579 document.getElementById(
2580 "tags_loading"
2581 ).parentNode.removeChild(
2582 document.getElementById(
2583 "tags_loading"
2584 )
2585 );
2586 document.getElementById("remove_tags").
2587 parentNode.setAttribute(
2588 "onclick",
2589 (function () {
2590 window.just_clicked_remove_tags = !0;
2591 var hl = document.getElementsByClassName("highlighted");
2592 if (hl.length === 0) {
2593 document.getElementById(
2594 "no_tags_message"
2595 ).style.display = "block";
2596 document.getElementById(
2597 "remove_tag_button"
2598 ).style.display = "none";
2599 } else {
2600 document.getElementById(
2601 "remove_tag_button"
2602 ).style.display = "block";
2603 document.getElementById(
2604 "no_tags_message"
2605 ).style.display = "none";
2606 }
2607 document.getElementById(
2608 "remove_tags_widget"
2609 ).style.display = "block";
2610 return false;
2611 }).toString().slice(13,-1)
2612 );
2613 // end escape fix up in
2614
2615 // these functions are only in plugin scope
2616 // API...? Where we are going, we won't need API :)
2617 var getResponseText = function (url, read, header) {
2618 var post = undefined;
2619 if (typeof url === "object") {
2620 post = url.post;
2621 url = url.url;
2622 }
2623 var get = "GET";
2624 if (// special URLs, make POST
2625 "/svc/secure_form_key" === url ||
2626 "/svc/post/update" === url.split(/\?/)[0] ||
2627 "/svc/post/upload_photo" === url.split(/\?/)[0]
2628 ) {
2629 get = "POST";
2630 }
2631 var xhttp = new XMLHttpRequest();
2632 xhttp.onreadystatechange = function () {
2633 if (this.readyState == 4 && this.status == 200) {
2634 read(
2635 "/svc/secure_form_key" === url ?
2636 { // we need the puppies, to make a new post
2637 puppies: this.getResponseHeader("x-tumblr-secure-form-key"),
2638 kittens: /* this.getAllResponseHeaders() */ 0
2639 } :// Idk what kittens is, but it happens after success
2640 this.responseText
2641 );
2642 }
2643 };
2644 xhttp.open(get, url, true);
2645 // headers only after open and only before send
2646 if(typeof header !== "undefined") {
2647 for(var i = 0; i < header.length; i++) {
2648 xhttp.setRequestHeader(header[i][0], header[i][1]);
2649 }
2650 }
2651 if (get === "GET") {
2652 xhttp.send();
2653 } else {
2654 xhttp.send(post);
2655 }
2656 };
2657 // add a bouncey reblog or heart
2658 var reblogAnimation = function(id) {
2659 var cb = document.getElementById("post_" + id);
2660 var bigReblog = svgForType["reblog-self"].cloneNode(true);
2661 bigReblog.setAttribute("fill", "#7EFF29");
2662 bigReblog.setAttribute("width", "125");
2663 bigReblog.setAttribute("height", "125");
2664 bigReblog.classList.add("big-reblog");
2665 bigReblog.addEventListener("mousedown", function(){
2666 this.parentNode.removeChild(this);
2667 });
2668 setTimeout(function(){
2669 bigReblog.parentNode.removeChild(bigReblog);
2670 }, 1700);
2671 cb.appendChild(bigReblog);
2672 }
2673 // fun :)
2674
2675 // we'll need our own masonry for batch photo bricks
2676 var rebuildPhotoColumn = function() {
2677 // this fires once for each image
2678 var data = document.getElementById(
2679 "mass_post_features-plugin_data"
2680 );
2681 var column = 150;
2682 var brk = document.getElementsByClassName("photo-brick");
2683 var rect;
2684 var iRct;
2685 var img;
2686 var mt; // margin Top
2687 var brkHeight = 0;
2688 var tallH;
2689 for (var i = 0; i < brk.length; i++) {
2690 img = brk[i].getElementsByClassName("photo-brick-img");
2691 if (
2692 img.length === 0 || img.length === 1 &&
2693 typeof img[0] !== "undefined" &&
2694 typeof img[0].children !== "undefined" &&
2695 img[0].children.length === 0
2696 ) {
2697 brk[i].parentNode.removeChild(brk[i]);
2698 i--;
2699 if (i > 0 && typeof brk[i] === "undefined") {
2700 break;
2701 }
2702 } else {
2703 brkHeight = 0;
2704 for (var l = 0; l < img.length; l++) {
2705 if(
2706 img[l].classList.contains("row-with-two-img") &&
2707 img[l].classList.contains("data-photoset-a") &&
2708 typeof img[l+1] !== "undefined" // nextSibling
2709 ){
2710 // neat row...? row same height #1
2711 tallH = Math.round(Math.min(
2712 img[l].children[0].clientHeight*
2713 (60/img[l].children[0].clientWidth),
2714 img[l+1].children[0].clientHeight*
2715 (60/img[l+1].children[0].clientWidth)
2716 )); //2
2717 img[l].style.height = tallH + "px";
2718 img[l+1].style.height = tallH + "px";
2719 }
2720 if(
2721 img[l].classList.contains("row-with-three-img") &&
2722 img[l].classList.contains("data-photoset-a") &&
2723 typeof img[l+1] !== "undefined" && // nextSibling
2724 typeof img[l+2] !== "undefined" // nextSibling&nextSibling
2725 ){
2726 // neat row...? row same height #1
2727 tallH = Math.round(Math.min(
2728 img[l].children[0].clientHeight*
2729 (38/img[l].children[0].clientWidth),
2730 img[l+1].children[0].clientHeight*
2731 (38/img[l+1].children[0].clientWidth),
2732 img[l+2].children[0].clientHeight*
2733 (38/img[l+2].children[0].clientWidth)
2734 )); //3
2735 img[l].style.height = tallH + "px";
2736 img[l+1].style.height = tallH + "px";
2737 img[l+2].style.height = tallH + "px";
2738 }
2739 if (
2740 typeof img[l] !== "undefined" &&
2741 typeof img[l].children[0] !== "undefined"
2742 ) {
2743 rect = img[l].getBoundingClientRect();
2744 iRct = img[l].children[0].getBoundingClientRect();
2745 mt = Math.round((rect.height - iRct.height) / 2);
2746 img[l].children[0].style.marginTop = mt + "px";
2747 if (
2748 img[l].classList.contains("row-with-one-img") ||
2749 img[l].classList.contains("data-photoset-a") &&
2750 !img[l].classList.contains("brick-dragging")
2751 ) {
2752 brkHeight += rect.height + 6;
2753 }
2754 }
2755 }
2756 if (brkHeight !== 0) {
2757 brk[i].style.height = Math.round(brkHeight) + "px";
2758 brk[i].getElementsByClassName("rich")[0].
2759 style.maxHeight = Math.round(brkHeight-42) > 100 ?
2760 Math.round(brkHeight-42) + "px" : "100px";
2761 }
2762 }
2763 }
2764 for (i = 0; i < brk.length; i++) {
2765 brk[i].style.top = column + "px";
2766 brk[i].style.left = "420px"; // :P
2767 column += brk[i].getBoundingClientRect().height + 6;
2768 }
2769 data.setAttribute("data-photos_height", column);
2770 lcontent.style.height = column + "px";
2771 };
2772 // end rebuildColumns for batch photos rebuildPhotoColumn
2773
2774 // alternative name: makePhotoBrickFromUpload
2775 var allResized = 0;
2776 var brickIndex = 0;
2777 var reading = [{
2778 read: rebuildPhotoColumn
2779 }];
2780 var unreadFile = {};
2781 var readers = [];
2782 var loadPhotoIntoDOM = function(reloadedImg){
2783 var data = document.getElementById(
2784 "mass_post_features-plugin_data"
2785 );
2786 // new photo-brick
2787 var bricks = document.getElementsByClassName("photo-brick");
2788 var brick = document.createElement("div");
2789 var brickInner = document.createElement("div");
2790 brickInner.classList.add("photo-inner");
2791 brick.classList.add("photo-brick");
2792 brick.style.top = "-150px";
2793 brick.style.left = "420px";
2794 brick.setAttribute("onclick", "window.just_clicked_add_tags = true;");
2795 brick.id = "photo-brick_" + brickIndex;
2796 var img = new Image();
2797 if (
2798 typeof reloadedImg !== "undefined" &&
2799 typeof reloadedImg.target !== "undefined" &&
2800 typeof reloadedImg.target.imgCode !== "undefined"
2801 ) {
2802 img.setAttribute("img-code", reloadedImg.target.imgCode);
2803 }
2804 img.style.visibility = "hidden";
2805 img.setAttribute("data-id", brick.id);
2806 var pbi = document.createElement("div");
2807 pbi.setAttribute("data-id", brick.id);
2808 pbi.classList.add("row-with-one-img");
2809 pbi.classList.add("photo-brick-img");
2810 var pbic = document.createElement("div");
2811 pbic.classList.add("photo-brick-img-cell");
2812 var observer = document.createElement("div");
2813 observer.classList.add("resize-observer");
2814 // rebuildColumn after single photo dragged / resized
2815 new ResizeObserver(rebuildPhotoColumn).observe(observer);
2816 // these ^ are cool :)
2817 // editor portion
2818 var pbe = document.createElement("div");
2819 pbe.classList.add("photo-brick-edit");
2820 var rich = document.createElement("div");
2821 rich.setAttribute("title", "caption");
2822 rich.id = "rich_text_" + brickIndex;
2823 rich.setAttribute("data-id", brickIndex);
2824 var tags = document.createElement("div");
2825 tags.setAttribute("data-id", brickIndex);
2826 tags.classList.add("photo-tags");
2827 tags.addEventListener("click", function() {
2828 if (!brick.classList.contains("focused-rich")) {
2829 rich.focus();
2830 }
2831 });
2832 tags.id = "photo_tags_" + brickIndex;
2833 rich.contentEditable = true;
2834 rich.designMode = "on";
2835 rich.classList.add("rich");
2836 rich.addEventListener("focus", function () {
2837 if (data.classList.contains("photo-upload-in-progress")) {
2838 return;
2839 }
2840 if (!brick.classList.contains("focused-rich")) {
2841 var fr = document.getElementsByClassName("focused-rich");
2842 while (fr.length > 0 ) {
2843 fr[0].classList.remove("focused-rich");
2844 }
2845 var addTagsWidget = document.getElementById("add_tags_widget");
2846 addTagsWidget.style.display = "block";
2847 brick.classList.add("focused-rich");
2848 }
2849 });
2850 pbe.appendChild(rich);
2851 pbe.appendChild(tags);
2852 var stripe = document.createElement("div");
2853 stripe.classList.add("stripe");
2854 var clone = butt("Clone ABC");
2855 clone.classList.add(clone.id);
2856 clone.removeAttribute("id");
2857 clone.addEventListener("click", function () {
2858 var otherRich = document.getElementsByClassName("rich");
2859 for (var i = 0; i < otherRich.length; i++){
2860 if (otherRich[i] === rich) {
2861 continue;
2862 }
2863 otherRich[i].innerHTML = rich.innerHTML;
2864 }
2865 });
2866 clone.setAttribute(
2867 "title", "Copy this caption, to all photo captions."
2868 );
2869 pbe.appendChild(clone);
2870 appendRichButtons(pbe, rich, brick);
2871 pbe.appendChild(stripe);
2872 // end editor portion
2873 img.addEventListener("load", function() {
2874 var brick = document.getElementById(
2875 this.getAttribute("data-id")
2876 );
2877 var column = parseInt(
2878 data.getAttribute("data-photos_height")
2879 );
2880 var minBrickHeight = 120;
2881 this.removeAttribute("style");
2882 column += (this.height > minBrickHeight ? this.height: minBrickHeight) + 6;
2883 data.setAttribute("data-photos_height", column);
2884 lcontent.style.height = column + "px";
2885 });
2886 img.src = typeof reloadedImg.nodeName === "undefined" ?
2887 this.result : reloadedImg.src;
2888 pbi.appendChild(img);
2889 observer.appendChild(pbi);
2890 pbic.appendChild(observer);
2891 brickInner.appendChild(pbic); // mayo?
2892 brickInner.appendChild(pbe); // lettuce?
2893 brick.appendChild(brickInner);
2894 if (typeof reading !== "undefined" && reading.length > 0) {
2895 reading.pop();
2896 }
2897 if (typeof reading !== "undefined" && reading.length > 0) {
2898 reading[reading.length - 1].read();
2899 }
2900 if (typeof reloadedImg.nodeName !== "undefined") {
2901 var hlb = document.getElementsByClassName("hl-bottom");
2902 var hlt = document.getElementsByClassName("hl-top");
2903 reloadedImg.parentNode.removeChild(reloadedImg);
2904 document.body.insertBefore(
2905 brick,
2906 hlb.length > 0 ? hlb[0].nextSibling : hlt.length > 0 ? hlt[0] :
2907 document.body.firstChild // < but not this usually
2908 );
2909 } else {
2910 document.body.appendChild(brick);
2911 }
2912 brickIndex++;
2913 };
2914 // end the batch photo brick maker thing
2915
2916 // tampermonkey say this needs to be defined first Catch22
2917 // our own DOM builder for the Dash/Archive/Tagged API; end at return brick
2918 var makeBrickFromApiPost = function (post, type, content) {
2919 if (type === "undefined") {
2920 return false;
2921 }
2922 var i;
2923 var tp = {
2924 "chat": "conversation",
2925 "ask": "note",
2926 "image": "photo",
2927 "text": "regular",
2928 "link": "link",
2929 "video": "video",
2930 "audio": "audio",
2931 "quote": "quote"
2932 }; // tumblr 2014 post type names (archive.js)
2933 var smallestMedia = function (media) {
2934 var url = media[0].url;
2935 var width = 100000;
2936 var height = 125;
2937 for (var i = 0; i < media.length; i++) {
2938 if (typeof media[i].width === "undefined") {
2939 continue;
2940 }
2941 if (media[i].width === media[i].height) {
2942 width = media[i].width;
2943 height = media[i].height;
2944 url = media[i].url;
2945 break;
2946 }
2947 if (media[i].width < width && media[i].width >= 125) {
2948 width = media[i].width;
2949 height = media[i].height;
2950 url = media[i].url;
2951 }
2952 }
2953 if (width === 100000) {
2954 width = 125;
2955 }
2956 var img = new Image();
2957 img.src = url;
2958 img.width = 125;
2959 img.height = ((125/width) * height);
2960 img.style.width = img.width + "px";
2961 img.style.height = img.height + "px";
2962 return img;
2963 };
2964 var formatText = function (text, f, q) {
2965 if (typeof f === "undefined") {
2966 f = [];
2967 }
2968 if (typeof q === "undefined") {
2969 q = "nothing";
2970 }
2971 if (typeof text === "undefined") {
2972 text = "";
2973 }
2974 var chars = text.split("");
2975 chars.push("");
2976 var open;
2977 var close = "</span>";
2978 for (var i = 0; i < f.length; i++) {
2979 open = {
2980 "mention":
2981 "<span style=\"text-decoration:underline;\">",
2982 "link":
2983 "<span style=\"text-decoration:underline;\">",
2984 "bold":
2985 "<span style=\"font-weight:bold;\">",
2986 "color":
2987 "<span style=\"color:" + f[i].hex + ";\">",
2988 "italic":
2989 "<span style=\"font-style:italic;\">"
2990 }[f[i].type];
2991 chars[f[i].start] = open + chars[f[i].start];
2992 chars[f[i].end] = chars[f[i].end] + close;
2993 }
2994 if(q === "quirky") {
2995 chars.unshift(
2996 "<p class=\"quirky\">"
2997 );
2998 chars.push("</p>");
2999 }
3000 if(q === "heading1") {
3001 chars.unshift(
3002 "<p class=\"h1\">"
3003 );
3004 chars.push("</p>");
3005 }
3006 if(q === "heading2") {
3007 chars.unshift(
3008 "<p class=\"h2\">"
3009 );
3010 chars.push("</p>");
3011 }
3012 if(q === "link") {
3013 chars.unshift(
3014 "<div class=\"rq\">→</div>" +
3015 "<p class=\"link\">"
3016 );
3017 chars.push("</p>");
3018 }
3019 if(q === "chat") {
3020 chars.unshift(
3021 "<p class=\"monospace\">"
3022 );
3023 chars.push("</p>");
3024 }
3025 if(q === "ordered-list-item") {
3026 chars.unshift(
3027 "<p class=\"ol\">"
3028 );
3029 chars.push("</p>");
3030 }
3031 if(q === "unordered-list-item") {
3032 chars.unshift(
3033 "<p class=\"ul\">"
3034 );
3035 chars.push("</p>");
3036 }
3037 if(q === "quote") {
3038 chars.unshift(
3039 "<div class=\"rq\">”</div>" +
3040 "<p class=\"quote\">"
3041 );
3042 chars.push("</p>");
3043 }
3044 if(q === "note") {
3045 chars.unshift(
3046 "<div class=\"rq\">?</div>" +
3047 "<p class=\"quote\">"
3048 );
3049 chars.push("</p>");
3050 }
3051 return chars.join("");
3052 }; // format text
3053 var brick = document.createElement("a");
3054 brick.classList.add("brick");
3055 brick.classList.add(tp[type]);
3056 brick.classList.add("timestamp_" + post.timestamp);
3057 brick.setAttribute("data-id", post.id);
3058 brick.setAttribute("data-timestamp", post.timestamp);
3059 brick.setAttribute("data-reblog_key", post.reblog_key);
3060 brick.id = "post_" + post.id;
3061 var firstChild = document.createElement("div");
3062 firstChild.classList.add("highlight");
3063 var cm = new Image();
3064 cm.src = "https://assets.tumblr.com/images/" +
3065 "small_white_checkmark.png";
3066 cm.classList.add("checkmark");
3067 firstChild.appendChild(cm);
3068 var tc = document.createElement("div");
3069 tc.classList.add("tag_count");
3070 tc.id = "tag_count_" + post.id;
3071 tc.appendChild(
3072 document.createTextNode(
3073 typeof post.tags === "undefined" ? "0 tags" :
3074 post.tags.length === 1 ? "1 tag" :
3075 post.tags.length + " tags"
3076 )
3077 );
3078 firstChild.appendChild(tc);
3079 var nc = document.createElement("div");
3080 nc.classList.add("note_count");
3081 nc.id = "note_count_" + post.id;
3082 nc.appendChild(
3083 document.createTextNode(
3084 typeof post.note_count === "undefined" ? "0 notes" :
3085 post.note_count === 1 ? "1 note" :
3086 post.note_count.toLocaleString("en", {useGrouping:true}) + " notes"
3087 )
3088 );
3089 firstChild.appendChild(nc);
3090 brick.appendChild(firstChild);
3091 // meat & tators middle child
3092 var middleChild = document.createElement("div");
3093 var middleChildT = document.createElement("div");
3094 var middleChildTR = document.createElement("div");
3095 var middleChildTD = document.createElement("div");
3096 var middleChildIB = document.createElement("div");
3097 var fade = document.createElement("div");
3098 fade.classList.add("fade");
3099 var childTitle;
3100 var imgs;
3101 var h;
3102 var url;
3103 var av;
3104 var nm;
3105 var orly;
3106 var line;
3107 var op;
3108 var l;
3109 middleChild.classList.add("overflow-hidden");
3110 middleChildT.classList.add("overflow-table");
3111 middleChildTR.classList.add("overflow-row");
3112 middleChildTD.classList.add("overflow-cell");
3113 middleChildIB.classList.add("overflow-inline");
3114 if (
3115 type === "text" ||
3116 type === "chat" ||
3117 type === "quote" ||
3118 type === "ask" ||
3119 type === "link"
3120 ) {
3121 childTitle = document.createElement("div");
3122 childTitle.classList.add("title");
3123 if (
3124 typeof content[0] !== "undefined" &&
3125 typeof content[0].text !== "undefined"
3126 ) {
3127 childTitle.innerHTML = formatText(
3128 content[0].text,
3129 content[0].formatting,
3130 content[0].subtype
3131 );
3132 }
3133 if (type === "ask") {
3134 nm = typeof post.trail[0].layout[0].attribution !== "undefined" ?
3135 post.trail[0].layout[0].attribution.blog.name :
3136 post.trail[0].blog.name;
3137 url = "https://api.tumblr.com/v2/blog/" + nm + "/avatar/24";
3138 av = new Image();
3139 av.width = 24;
3140 av.height = 24;
3141 av.style.width = av.width + "px";
3142 av.style.height = av.height + "px";
3143 av.src = url;
3144 av.classList.add("ask-av");
3145 childTitle.appendChild(av);
3146 if (
3147 typeof post.trail[0] !== "undefined" &&
3148 typeof post.trail[0].content[0] !== "undefined" &&
3149 typeof post.trail[0].content[0].text !== "undefined"
3150 ) {
3151 childTitle.innerHTML += "<div class=\"rq\">?</div>" +
3152 "<div class=\"asker\">" +
3153 formatText(
3154 post.trail[0].content[0].text,
3155 post.trail[0].content[0].formatting,
3156 post.trail[0].content[0].subtype
3157 ) + "</div>";
3158 }
3159 }
3160 if (
3161 type === "ask" &&
3162 typeof post.trail[0] !== "undefined" &&
3163 typeof post.trail[0].content[1] !== "undefined" &&
3164 (
3165 typeof post.trail[0].content[1].text !== "undefined" ||
3166 typeof post.trail[0].content[1].media !== "undefined"
3167 )
3168 ) {
3169 if (typeof post.trail[0].content[1].text !== "undefined") {
3170 childTitle.innerHTML += "<div class=\"answer\">" +
3171 formatText(
3172 post.trail[0].content[1].text,
3173 post.trail[0].content[1].formatting,
3174 post.trail[0].content[1].subtype
3175 ) + "</div>";
3176 } else {
3177 imgs = post.trail[0].content[1].media;
3178 brick.classList.add("has-img");
3179 line = smallestMedia(imgs);
3180 h = line.height;
3181 childTitle.innerHTML +=
3182 line.outerHTML;
3183 childTitle.appendChild(fade);
3184 }
3185 }
3186 middleChildIB.appendChild(childTitle);
3187 if (
3188 typeof content[1] !== "undefined" &&
3189 typeof content[1].text !== "undefined"
3190 ) {
3191 op = document.createElement("div");
3192 op.classList.add("overprint");
3193 var alt = true;
3194 if (type === "chat") {
3195 for (i = 1; i < content.length; i++) {
3196 if (typeof content[i].text === "undefined") {
3197 continue;
3198 }
3199 line = document.createElement("div");
3200 line.classList = "line";
3201 if (alt) {
3202 line.classList.add("alt");
3203 }
3204 alt = !alt;
3205 line.innerHTML = formatText(
3206 content[i].text,
3207 content[i].formatting,
3208 content[i].subtype
3209 );
3210 op.appendChild(
3211 line
3212 );
3213 }
3214 middleChildIB.appendChild(op);
3215 }
3216 if (
3217 type === "text" || type === "quote" ||
3218 type === "ask" || type === "link"
3219 ) {
3220 if (
3221 typeof content === "undefined" ||
3222 typeof content !== "undefined" &&
3223 content.length === 0
3224 ) {
3225 if (
3226 typeof post.trail !== "undefined" &&
3227 typeof post.trail[0] !== "undefined" &&
3228 typeof post.trail[0].content !== "undefined" &&
3229 post.trail[0].content.length > 0
3230 ) {
3231 content = post.trail[0].content;
3232 }
3233 }
3234 for (i = 1; i < content.length; i++) {
3235 if (typeof content[i].text !== "undefined") {
3236 line = document.createElement("div");
3237 line.innerHTML = formatText(
3238 content[i].text,
3239 content[i].formatting,
3240 content[i].subtype
3241 );
3242 op.appendChild(
3243 line
3244 );
3245 }
3246 if (
3247 typeof content[i].media !== "undefined" &&
3248 content[i].media.length > 0 ||
3249 typeof content[i].poster !== "undefined" &&
3250 content[i].poster.length > 0
3251 ) {
3252 imgs = typeof content[i].poster === "undefined" ?
3253 content[i].media : content[i].poster;
3254 brick.classList.add("has-img");
3255 line = smallestMedia(imgs);
3256 h = line.height;
3257 op.appendChild(
3258 line
3259 );
3260 op.appendChild(fade);
3261 }
3262 }
3263 middleChildIB.appendChild(op);
3264 }
3265 }
3266 } // photo images, audio, video
3267 if (
3268 !(
3269 typeof content !== "undefined" &&
3270 typeof content[0] !== "undefined" &&
3271 typeof content[0].media !== "undefined" &&
3272 content[0].media.length > 0 ||
3273 typeof content !== "undefined" &&
3274 typeof content[0] !== "undefined" &&
3275 typeof content[0].poster !== "undefined" &&
3276 content[0].poster.length > 0
3277 )
3278 ) {
3279 if(
3280 typeof content !== "undefined" &&
3281 typeof post.content !== "undefined"
3282 ) {
3283 content = post.content; // another backflip :)
3284 // I'm done with ^ NPF neue posts here :)
3285 }
3286 }
3287 if (
3288 type === "link" &&
3289 typeof content !== "undefined" &&
3290 typeof content[0] !== "undefined" &&
3291 typeof content[0].title !== "undefined"
3292 ) {
3293 line = document.createElement("div");
3294 line.innerHTML = formatText(
3295 content[0].title,
3296 content[0].formatting,
3297 "link"
3298 );
3299 if (typeof content[0].description !== "undefined") {
3300 line.innerHTML += formatText(
3301 content[0].description,
3302 content[0].formatting,
3303 "normal"
3304 );
3305 }
3306 middleChildIB.appendChild(
3307 line
3308 );
3309 }
3310 if (
3311 typeof content !== "undefined" &&
3312 typeof content[0] !== "undefined" &&
3313 typeof content[0].media !== "undefined" &&
3314 content[0].media.length > 0 ||
3315 typeof content !== "undefined" &&
3316 typeof content[0] !== "undefined" &&
3317 typeof content[0].poster !== "undefined" &&
3318 content[0].poster.length > 0
3319 ) {
3320 imgs = typeof content[0].poster === "undefined" ?
3321 content[0].media : content[0].poster;
3322 line = smallestMedia(imgs);
3323 brick.classList.add("has-img");
3324 h = line.height;
3325 middleChildIB.appendChild(line);
3326 if (type === "text") {
3327 middleChildIB.appendChild(fade);
3328 }
3329 } else if (
3330 typeof content[1] !== "undefined" &&
3331 typeof content[1].media !== "undefined" &&
3332 content[1].media.length > 0 ||
3333 typeof content[1] !== "undefined" &&
3334 typeof content[1].poster !== "undefined" &&
3335 content[1].poster.length > 0
3336 ) {
3337 imgs = typeof content[1].poster === "undefined" ?
3338 content[1].media : content[1].poster;
3339 line = smallestMedia(imgs);
3340 brick.classList.add("has-img");
3341 h = line.height;
3342 middleChildIB.appendChild(line);
3343 if (type === "text") {
3344 middleChildIB.appendChild(fade);
3345 }
3346 }
3347 if (
3348 type === "image" || h < 125 &&
3349 type !== "text" &&
3350 type !== "ask"
3351 ) {
3352 brick.style.height = Math.round(h) + "px";
3353 } else {
3354 brick.style.height = "125px";
3355 }
3356 if (
3357 type === "image" || type === "video" || type === "audio"
3358 ) {
3359 // I discovered this looks nice, so I'm doing some design
3360 var captionInlineBlock = document.createElement("div");
3361 captionInlineBlock.classList.add("caption-inline-block");
3362 var captionTR = document.createElement("div");
3363 captionTR.classList.add("caption-tr");
3364 var captionTD = document.createElement("div");
3365 captionTD.classList.add("caption-td");
3366 var caption = document.createElement("div");
3367 caption.classList.add("caption");
3368 var capContent;
3369 if (
3370 typeof post.trail !== "undefined" &&
3371 post.trail.length > 0
3372 ) {
3373 for (i = 0; i < post.trail.length; i++) {
3374 if (
3375 typeof post.trail[i].content !== "undefined" &&
3376 post.trail[i].content.length > 0
3377 ) {
3378 capContent = post.trail[i].content;
3379 for (l = 0; l < capContent.length; l++) {
3380 if (
3381 typeof capContent[l].text !== "undefined"
3382 ) {
3383 captionInlineBlock.innerHTML += "<div>" + formatText(
3384 capContent[l].text,
3385 capContent[l].formatting,
3386 capContent[l].subtype
3387 ) + "</div>";
3388 }
3389 }
3390 }
3391 }
3392 }
3393 if (captionInlineBlock.innerHTML.length === 0) {
3394 capContent = typeof post.content !== "undefined" &&
3395 post.content.length > 0 ?
3396 post.content : content;
3397 for (i = 0; i < capContent.length; i++) {
3398 if (typeof capContent[i].text !== "undefined") {
3399 captionInlineBlock.innerHTML += "<div>" + formatText(
3400 capContent[i].text,
3401 capContent[i].formatting,
3402 capContent[i].subtype
3403 ) + "</div>";
3404 }
3405 }
3406 }
3407 captionTD.appendChild(captionInlineBlock);
3408 captionTR.appendChild(captionTD);
3409 caption.appendChild(captionTR);
3410 brick.appendChild(caption);
3411 }
3412 if (type === "image") {
3413 var imgCount = -1;
3414 for (i = 1; i < content.length; i++) {
3415 if (typeof content[i].media !== "undefined") {
3416 ++imgCount;
3417 }
3418 }
3419 if (imgCount > 0) {
3420 var imgCountDiv = document.createElement("div");
3421 imgCountDiv.classList.add("img-count");
3422 imgCountDiv.appendChild(
3423 document.createTextNode("+" + imgCount + " more")
3424 );
3425 brick.appendChild(imgCountDiv);
3426 }
3427 }
3428 if (type === "video") {
3429 orly = document.createElement("div");
3430 orly.classList.add("play_overlay");
3431 brick.appendChild(orly);
3432 }
3433 if (type === "audio") {
3434 orly = document.createElement("div");
3435 orly.classList.add("listen_overlay");
3436 brick.appendChild(orly);
3437 }
3438 if (post.state === "private") {
3439 orly = document.createElement("div");
3440 orly.classList.add("private_overlay");
3441 brick.classList.add("private");
3442 brick.appendChild(orly);
3443 }
3444 // this is the tags and links thingy
3445 brick.href = post.post_url;
3446 brick.setAttribute("target", "_blank");
3447 var linksLayer = document.createElement("div");
3448 linksLayer.classList.add("links-layer");
3449 var linksTrow = document.createElement("div");
3450 linksTrow.classList.add("trow");
3451 var tagsLayer = document.createElement("div");
3452 tagsLayer.classList.add("tags-layer");
3453 if (typeof post.tags !== "undefined") {
3454 var tagsLayerContainer = document.createElement("div");
3455 tagsLayerContainer.classList.add("tag-container");
3456 post.tags.sort(function (a, b) {
3457 return a.length - b.length;
3458 });
3459 for (i = 0; i < post.tags.length; i++) {
3460 tagsLayerContainer.appendChild(
3461 document.createTextNode(
3462 "#" + post.tags[i] + " "
3463 )
3464 );
3465 }
3466 tagsLayer.appendChild(tagsLayerContainer);
3467 }
3468 var href = document.location.href.split(/[\/\?&#=]+/g);
3469 var noEdit = typeof href[5] !== "undefined" &&
3470 (
3471 href[5] === "dashboard" ||
3472 href[5] === "archive" ||
3473 href[5] === "tagged" ||
3474 href[5] === "likes" ||
3475 href[5] === "search"
3476 );
3477 // post bricks edit button
3478 var link1 = document.createElement("a");
3479 link1.setAttribute("target", "_blank");
3480 link1.classList.add("link-edit");
3481 link1.href = noEdit ?
3482 "/dashboard/blog/" + post.blog_name + "/" + post.id :
3483 "/edit/" + post.id;
3484 link1.setAttribute("title",
3485 (noEdit ? "Peepr" : "Edit")
3486 );
3487 link1.appendChild(
3488 (noEdit?
3489 svgForType.view.cloneNode(true):
3490 svgForType.edit.cloneNode(true)
3491 )
3492 );
3493 link1.setAttribute("data-id", post.id);
3494 // only add like/reblog buttons if posts are visible
3495 if (!noEdit) {
3496 link1.addEventListener("click", function(e) {
3497 e.preventDefault();
3498 e.stopPropagation();
3499 e.cancelBubble = true;
3500 var iframe = document.createElement("iframe");
3501 iframe.setAttribute("data-id", this.getAttribute("data-id"));
3502 document.getElementById(
3503 "post_" + this.getAttribute("data-id")
3504 ).classList.remove("prevent-anim");
3505 iframe.id = "neue_post_form-iframe";
3506 iframe.addEventListener("load", function () {
3507 var removeAfterEdit = this;
3508 var id = this.getAttribute("data-id");
3509 // this checks if done editing/closed
3510 var reminisce = setInterval(function () {
3511 var w = document.getElementById(
3512 "neue_post_form-iframe"
3513 ).contentWindow;
3514 var p = w.document.getElementsByClassName(
3515 "post-forms-modal"
3516 )[0];
3517 if (
3518 typeof p === "undefined" ||
3519 typeof p !== "undefined" &&
3520 p.length === 0 ||
3521 typeof p !== "undefined" &&
3522 (
3523 w.getComputedStyle(p).
3524 getPropertyValue("display") === "none" ||
3525 w.getComputedStyle(p).
3526 getPropertyValue("opacity").toString() === "0"
3527 )
3528 ) {
3529 clearInterval(reminisce);
3530 document.body.removeChild(
3531 document.getElementById("neue_post_form-iframe")
3532 );
3533 // this is defined below, so we will have to reset it each time
3534 // or viceVersa... one always has to go first tho... catch 22 :)
3535 var reloadBrick = typeof reloadBrick !== "undefined" ?
3536 reloadBrick : function(){};
3537 reloadBrick(removeAfterEdit);
3538 }
3539 }, 500);
3540 });
3541 iframe.src = "https://www.tumblr.com/neue_web/iframe/edit/" +
3542 post.id;
3543 iframe.setAttribute("scrolling", "no");
3544 iframe.setAttribute("frameborder", "0");
3545 iframe.setAttribute("title", "Post forms");
3546 document.body.appendChild(iframe);
3547 });
3548 } else {
3549 link1.addEventListener("click", function (e){
3550 e.cancelBubble = true;
3551 e.stopProgagation();
3552 });
3553 }
3554 // post bricks view post link
3555 var link2 = document.createElement("a");
3556 link2.setAttribute("target", "_blank");
3557 link2.addEventListener("click", function (e){
3558 e.cancelBubble = true;
3559 e.stopProgagation();
3560 });
3561 link2.classList.add("link-view");
3562 link2.href = post.post_url;
3563 link2.setAttribute("target", "_blank");
3564 link2.setAttribute("title", "View Post");
3565 link2.appendChild(
3566 svgForType.see.cloneNode(true)
3567 );
3568 // post bricks like button
3569 var isReblogable = href[3] !== "draft" && href[3] !== "queued";
3570 if (isReblogable) {
3571 var link3 = document.createElement("a");
3572 link3.setAttribute("target", "_blank");
3573 link3.classList.add("link-like");
3574 link3.setAttribute("data-id", post.id);
3575 link3.href = post.post_url + "#like" + post.reblog_key;
3576 link3.setAttribute(
3577 "data-like-info",
3578 JSON.stringify({"id":post.id,"reblog_key":post.reblog_key})
3579 );
3580 link3.setAttribute("target", "_blank");
3581 link3.setAttribute("title", "Like Post");
3582 var whiteHeart = post.liked ?
3583 svgForType.liked.cloneNode(true):
3584 svgForType.notes.cloneNode(true);
3585 whiteHeart.setAttribute("fill", post.liked ? "#f56": "#fff");
3586 link3.appendChild(
3587 whiteHeart
3588 );
3589 link3.classList.add(post.liked ? "liked" : "not-liked");
3590 link3.addEventListener("click", function (e) {
3591 e.cancelBubble = true;
3592 e.stopPropagation();
3593 e.preventDefault();
3594 if (this.classList.contains("clicked")) {
3595 return;
3596 }
3597 var data = document.getElementById(
3598 "mass_post_features-plugin_data"
3599 );
3600 this.classList.remove("new-liked");
3601 this.classList.add("clicked");
3602 var button = this;
3603 var liked = this.classList.contains("liked");
3604 var info = this.getAttribute("data-like-info");
3605 var v2url = liked ?
3606 "/api/v2/user/unlike" : "/api/v2/user/like";
3607 var token = data.getAttribute("data-api-token");
3608 var href = document.location.href.split(/[\/\?&#=]+/g);
3609 var name = href[4];
3610 var csrfToken = data.getAttribute("data-csrf-token");;
3611 if (csrfToken !== "0") {
3612 var xhttp = new XMLHttpRequest();
3613 xhttp.onreadystatechange = function () {
3614 if (this.readyState == 4 && this.status == 200) {
3615 button.innerHTML = "";
3616 var cb = document.getElementById(
3617 "post_" + button.getAttribute("data-id")
3618 );
3619 if (liked) {
3620 whiteHeart = svgForType.notes.cloneNode(true);
3621 whiteHeart.setAttribute("fill", "#fff");
3622 button.classList.remove("liked");
3623 button.classList.add("not-liked");
3624 cb.classList.remove("liked");
3625 } else {
3626 whiteHeart = svgForType.liked.cloneNode(true);
3627 whiteHeart.setAttribute("fill", "#f56");
3628 button.classList.add("liked");
3629 button.classList.remove("not-liked");
3630 cb.classList.add("liked");
3631 // graphical aftertaste for reblog
3632 var bigHeart = svgForType.liked.cloneNode(true);
3633 bigHeart.setAttribute("fill", "#f56");
3634 bigHeart.setAttribute("width", "125");
3635 bigHeart.setAttribute("height", "125");
3636 bigHeart.classList.add("big-heart");
3637 setTimeout(function(){
3638 bigHeart.parentNode.removeChild(bigHeart);
3639 }, 1700);
3640 cb.appendChild(bigHeart);
3641 button.classList.add("new-liked");
3642 }
3643 button.appendChild(whiteHeart);
3644 button.classList.remove("clicked");
3645 }
3646 };
3647 xhttp.open("POST", v2url, true);
3648 // headers only after open and only before send
3649 xhttp.setRequestHeader(
3650 "Accept", "application/json;format=camelcase"
3651 );
3652 xhttp.setRequestHeader(
3653 "Authorization", "Bearer " + token
3654 );
3655 xhttp.setRequestHeader(
3656 "X-CSRF", csrfToken
3657 );
3658 xhttp.setRequestHeader(
3659 "Content-Type", "application/json; charset=utf8"
3660 );
3661 xhttp.setRequestHeader(
3662 "X-Version", "redpop/3/0//redpop/"
3663 );
3664 xhttp.send(info);
3665 } // else {
3666 // TODO, (just in case) get a new CSRF token here?
3667 // this may not be needed...?
3668 // the token seems to stay ok, so far :)
3669 //}
3670 });
3671 // posts bricks reblog button
3672 var link4 = document.createElement("a");
3673 link4.setAttribute("target", "_blank");
3674 link4.classList.add("link-reblog");
3675 link4.href = post.post_url + "#like" + post.reblog_key;
3676 link4.setAttribute("data-id", post.id);
3677 link4.setAttribute("data-reblog_key", post.reblog_key);
3678 link4.setAttribute("target", "_blank");
3679 link4.setAttribute("title", "Reblog Post");
3680 var whiteReblog = svgForType["reblog-self"].cloneNode(true);
3681 whiteReblog.setAttribute("fill", "#fff");
3682 link4.appendChild(
3683 whiteReblog
3684 );
3685 link4.addEventListener("click", function (e) {
3686 e.cancelBubble = true;
3687 e.stopPropagation();
3688 e.preventDefault();
3689 if (
3690 this.classList.contains("clicked") ||
3691 this.classList.contains("reblogged")
3692 ) {
3693 return;
3694 }
3695 var id = this.getAttribute("data-id");
3696 var key = this.getAttribute("data-reblog_key");
3697 var button = this;
3698 this.classList.remove("new-liked");
3699 this.classList.add("clicked");
3700 data.setAttribute("data-single_edit_id", id);
3701 data.setAttribute("data-current_edit_index", "-1");
3702 data.setAttribute("data-current_edit_action", "reblog");
3703 // negative index for outside of queue single reblogs
3704 fetchEditSubmit(
3705 function(){
3706 var cb = document.getElementById(
3707 "post_" + button.getAttribute("data-id")
3708 );
3709 button.children[0].setAttribute("fill", "#7EFF29");
3710 button.classList.remove("clicked");
3711 button.classList.add("reblogged");
3712 cb.classList.add("reblogged");
3713 reblogAnimation(button.getAttribute("data-id"));
3714 });
3715 });
3716 }
3717 tagsLayer.addEventListener("click", function (e) {
3718 e.cancelBubble = true;
3719 e.stopPropagation();
3720 e.preventDefault();
3721 var clickParentBrick = new Event("click");
3722 this.parentNode.parentNode.
3723 parentNode.dispatchEvent(clickParentBrick);
3724 });
3725 tagsLayer.appendChild(link1);
3726 tagsLayer.appendChild(link2);
3727 if (isReblogable) {
3728 tagsLayer.appendChild(link3);
3729 tagsLayer.appendChild(link4);
3730 }
3731 linksTrow.appendChild(tagsLayer);
3732 linksLayer.appendChild(linksTrow);
3733 brick.appendChild(linksLayer);
3734 // sandwich, yum
3735 middleChildTD.appendChild(middleChildIB);
3736 middleChildTR.appendChild(middleChildTD);
3737 middleChildT.appendChild(middleChildTR);
3738 middleChild.appendChild(middleChildT);
3739 brick.appendChild(middleChild);
3740 // close off the brick and return below
3741 var lastChild = document.createElement("div");
3742 lastChild.classList.add("overlay");
3743 var jz = document.createElement("div");
3744 jz.classList.add("inner");
3745 var dt = document.createElement("div");
3746 var d = new Date(post.timestamp * 1000);
3747 var b = d.getDate();
3748 var px = ["th ", "st ", "nd ", "rd ", "th ", "th ",
3749 "th ", "th ", "th ", "th ", "th "][b % 10];
3750 if (b === 12 || b === 11) {
3751 px = "th ";
3752 }
3753 var date = [
3754 "Sun - ", "Mon - ", "Tue - ", "Wed - ",
3755 "Thu - ", "Fri - ", "Sat - "
3756 ][d.getDay()] + [
3757 "Jan ", "Feb ", "Mar ", "Apr ",
3758 "May ", "Jun ", "Jul ", "Aug ",
3759 "Sep ", "Oct ", "Nov ", "Dec "
3760 ][d.getMonth()] + b + px + d.getFullYear();
3761 dt.classList.add("date");
3762 dt.appendChild(document.createTextNode(date));
3763 jz.appendChild(dt);
3764 lastChild.appendChild(jz);
3765 brick.appendChild(lastChild);
3766 if (
3767 typeof content !== "undefined" &&
3768 typeof content[0] !== "undefined" &&
3769 typeof content[0].attribution !== "undefined" &&
3770 typeof content[0].attribution.url !== "undefined"
3771 ) {
3772 var sourceLabel2 = document.createElement("div");
3773 sourceLabel2.setAttribute(
3774 "title",
3775 "link: " + content[0].attribution.url
3776 );
3777 var symlink1 = svgForType.symlink.cloneNode(true); //:D
3778 symlink1.setAttribute("fill", "#0ef");
3779 sourceLabel2.appendChild(symlink1);
3780 sourceLabel2.classList.add("source-label2");
3781 brick.appendChild(sourceLabel2);
3782 }
3783 if (
3784 typeof post.source_url_raw !== "undefined" &&
3785 post.source_url_raw !== "" &&
3786 post.source_url_raw !== false
3787 ) {
3788 var sourceLabel1 = document.createElement("div");
3789 sourceLabel1.setAttribute(
3790 "title",
3791 "source: " + post.source_url_raw
3792 );
3793 var symlink2 = svgForType.symlink.cloneNode(true); //:D
3794 symlink2.setAttribute("fill", "#eee");
3795 sourceLabel1.appendChild(symlink2);
3796 sourceLabel1.classList.add("source-label1");
3797 brick.appendChild(sourceLabel1);
3798 }
3799 // lastly create the event to highlight single stuff
3800 brick.addEventListener("click", function (e) {
3801 e.stopPropagation();
3802 e.preventDefault();
3803 e.cancelBubble = true;
3804 highlightBrick(this, !this.classList.contains("highlighted"));
3805 });
3806 return brick; // end from var makeBrickFromAPIPost
3807 }
3808 // end giant makeBrick brick building function
3809
3810 // since tumblr put a somewhat api/v2 on the main domain,
3811 // instead of api.tumblr.com ect...
3812 // greasemonkey can use an api
3813 // without registering an oauth key (_-.-)shh
3814 var asyncRepeatApiRead = function (api) {
3815 if(typeof api === "string") {
3816 api = JSON.parse(api);
3817 }
3818 var lcontent = document.getElementsByClassName("l-content")[0];
3819 var href = document.location.href.split(/[\/\?&#=]+/g);
3820 var name = href[4];
3821 var endHeader;
3822 var data = document.getElementById(
3823 "mass_post_features-plugin_data"
3824 );
3825 data.classList.add("fetching-from-tumblr-api");
3826 if ( // this is the liked/by page if any JSON
3827 href[5] === "likes" &&
3828 typeof api.response.liked_posts !== "undefined" &&
3829 api.response.liked_posts.length > 0
3830 ) {
3831 api.response.posts = api.response.liked_posts;
3832 }
3833 if ( // this is the dashboards JSON
3834 typeof api.response.posts === "undefined" &&
3835 typeof api.response.timeline !== "undefined" &&
3836 typeof api.response.timeline.elements !== "undefined"
3837 ) {
3838 api.response.posts = api.response.timeline.elements;
3839 }
3840 if ( // tagged & search JSON
3841 typeof api.response.posts !== "undefined" &&
3842 typeof api.response.posts.data !== "undefined"
3843 ) {
3844 api.response.posts = api.response.posts.data;
3845 if (
3846 typeof api.response._links === "undefined" &&
3847 api.response.posts.length - 1 > 0
3848 ) {
3849 api.response._links = {
3850 "next": {
3851 "href": data.getAttribute("data-ajax-first-subpage") +
3852 "&post_offset=" + api.response.posts[
3853 api.response.posts.length - 1
3854 ].timestamp
3855 }
3856 }
3857 };
3858 // I know, these ^ are endless
3859 // idea: [pause button]
3860 }
3861 if (
3862 typeof api.response.posts !== "undefined"
3863 ) {
3864 if(api.response.posts.length === 0) {
3865 endHeader = document.createElement("div");
3866 endHeader.classList.add("heading");
3867 endHeader.id = "heading_solum"; // end latin
3868 endHeader.appendChild(
3869 document.createTextNode("END") // idky... :)
3870 );
3871 lcontent.appendChild(endHeader);
3872 // done here too, should be
3873 data.classList.add("next_page_false");
3874 return;
3875 }
3876 var tagsAllArr = JSON.parse(
3877 data.getAttribute("data-tags_all_arr")
3878 );
3879 var idsAllArr = JSON.parse(
3880 data.getAttribute("data-ids_all_arr")
3881 );
3882 var typesAllArr = JSON.parse(
3883 data.getAttribute("data-types_all_arr")
3884 );
3885 var typeToIds = JSON.parse(
3886 data.getAttribute("data-type_to_ids")
3887 );
3888 var idToTags = JSON.parse(
3889 data.getAttribute("data-id_to_tags")
3890 );
3891 var idToTypes = JSON.parse(
3892 data.getAttribute("data-id_to_types")
3893 );
3894 var lastMonthTimestamp = parseFloat(
3895 data.getAttribute("data-last_month_timestamp")
3896 );
3897 var lastYearTimestamp = parseFloat(
3898 data.getAttribute("data-last_year_timestamp")
3899 );
3900 var idToOrigin = JSON.parse(
3901 data.getAttribute("data-id_to_origin")
3902 );
3903 var idToState = JSON.parse(
3904 data.getAttribute("data-id_to_state")
3905 );
3906 var idToTimestamp = JSON.parse(
3907 data.getAttribute("data-id_to_timestamp")
3908 );
3909 var idToNotes = JSON.parse(
3910 data.getAttribute("data-id_to_notes")
3911 );
3912 var tagToIds = JSON.parse(
3913 data.getAttribute("data-tag_to_ids")
3914 );
3915 var post = api.response.posts;
3916 var tag;
3917 var id;
3918 var type;
3919 var url;
3920 var reblog;
3921 var me;
3922 var media;
3923 var j;
3924 var newBrick;
3925 var monthHeader;
3926 var lastTimestamp;
3927 var lastYearstamp;
3928 if (!lcontent.classList.contains("albino")) {
3929 lcontent.classList.add("albino");
3930 }
3931 var t = [
3932 "text", "image", "chat", "ask", "video", "audio", "link", "quote"
3933 ];
3934 for (var i = 0; i < post.length; i++) {
3935 id = post[i].id;
3936 type = post[i].type;
3937 me = post[i];
3938 media = me.media;
3939 if (t.indexOf(type) === -1) { // neue type blocks???
3940 if (
3941 typeof post[i].trail != "undefined" &&
3942 typeof post[i].trail[0] !== "undefined" &&
3943 typeof post[i].trail[0].layout !== "undefined" &&
3944 typeof post[i].trail[0].layout[0] !== "undefined"
3945 ) {
3946 me = post[i].trail[0].layout;
3947 type = me[0].type;
3948 }
3949 if (
3950 t.indexOf(type) === -1 &&
3951 typeof post[i].trail != "undefined" &&
3952 typeof post[i].trail[0] !== "undefined" &&
3953 typeof post[i].trail[0].content !== "undefined" &&
3954 typeof post[i].trail[0].content[0] !== "undefined"
3955 ) {
3956 me = post[i].trail[0].content;
3957 type = me[0].type;
3958 }
3959 if (
3960 t.indexOf(type) === -1 &&
3961 typeof post[i].content !== "undefined" &&
3962 typeof post[i].content[0] === "undefined" &&
3963 typeof post[i].trail !== "undefined" &&
3964 typeof post[i].trail[0] !== "undefined" &&
3965 typeof post[i].trail[0].content !== "undefined"
3966 ) {
3967 me = post[i].trail[0].content;
3968 type = me[0].type;
3969 }
3970 if (
3971 t.indexOf(type) === -1 &&
3972 typeof post[i].content !== "undefined" &&
3973 typeof post[i].content[1] !== "undefined" &&
3974 typeof post[i].content[1].subtype !== "undefined"
3975 ) {
3976 me = post[i].content;
3977 type = me[1].subtype; // chat, maybe
3978 }
3979 if (
3980 t.indexOf(type) === -1 &&
3981 typeof post[i].content !== "undefined" &&
3982 typeof post[i].content[0] !== "undefined"
3983 ) {
3984 me = post[i].content;
3985 type = me[0].type;
3986 }
3987 if (
3988 typeof me !== "undefined" &&
3989 typeof me[0] !== "undefined" &&
3990 typeof me[0].subtype !== "undefined" &&
3991 type !== me[0].subtype &&
3992 t.indexOf(me[0].subtype) !== -1
3993 ) {
3994 type = me[0].subtype;
3995 }
3996 }
3997 if(typeof post[i].timestamp === "undefined") {
3998 continue;
3999 }
4000 lastTimestamp = (new Date(
4001 post[i].timestamp * 1000)
4002 ).getMonth();
4003 lastYearstamp = (new Date(
4004 post[i].timestamp * 1000)
4005 ).getFullYear();
4006 if(
4007 lastTimestamp !== lastMonthTimestamp ||
4008 lastYearstamp !== lastYearTimestamp
4009 ) {
4010 lastMonthTimestamp = lastTimestamp;
4011 lastYearTimestamp = lastYearstamp;
4012 data.setAttribute(
4013 "data-last_month_timestamp", lastMonthTimestamp
4014 );
4015 data.setAttribute(
4016 "data-last_year_timestamp", lastYearTimestamp
4017 );
4018 monthHeader = document.createElement("div");
4019 monthHeader.classList.add("heading");
4020 monthHeader.id = "heading_" + post[i].timestamp;
4021 monthHeader.appendChild(
4022 document.createTextNode([
4023 "Jan ", "Feb ", "Mar ", "Apr ",
4024 "May ", "Jun ", "Jul ", "Aug ",
4025 "Sep ", "Oct ", "Nov ", "Dec "
4026 ][lastTimestamp] + lastYearstamp)
4027 );
4028 lcontent.appendChild(monthHeader);
4029 }
4030 // this replaces everything Tumblr wrote inside the bricks
4031 // with our own flavor, of brick
4032 newBrick = makeBrickFromApiPost(post[i], type, me);
4033 if (newBrick !== false) {
4034 lcontent.appendChild(newBrick);
4035 }
4036 idsAllArr.push(id);
4037 if (typesAllArr.indexOf(type) === -1) {
4038 typesAllArr.push(type);
4039 typeToIds[type] = [];
4040 }
4041 typeToIds[type].push(id);
4042 if (
4043 typeof post[i].reblogged_from_name !== "undefined"
4044 ) {
4045 reblog = post[i].reblogged_from_name;
4046 if (reblog === name) {
4047 if (
4048 typesAllArr.indexOf("reblog-self") === -1
4049 ) {
4050 typesAllArr.push("reblog-self");
4051 typeToIds["reblog-self"] = [];
4052 }
4053 typeToIds["reblog-self"].push(id);
4054 idToOrigin[id] = "reblog-self";
4055 } else {
4056 if (
4057 typesAllArr.indexOf("reblog-other") === -1
4058 ) {
4059 typesAllArr.push("reblog-other");
4060 typeToIds["reblog-other"] = [];
4061 }
4062 typeToIds["reblog-other"].push(id);
4063 idToOrigin[id] = "reblog-other";
4064 }
4065 } else {
4066 if (
4067 typesAllArr.indexOf("original") === -1
4068 ) {
4069 typesAllArr.push("original");
4070 typeToIds.original = [];
4071 }
4072 typeToIds.original.push(id);
4073 idToOrigin[id] = "original";
4074 }
4075 if (post[i].state === "private") {
4076 if (
4077 typesAllArr.indexOf("private") === -1
4078 ) {
4079 typesAllArr.push("private");
4080 typeToIds.private = [];
4081
4082 }
4083 idToState[id] = "private";
4084 typeToIds.private.push(id);
4085 } else {
4086 idToState[id] = "public";
4087 }
4088 idToNotes[id] = post[i].note_count;
4089 idToTimestamp[id] = post[i].timestamp;
4090 idToTypes[id] = type;
4091 if (typeof post[i].tags !== "undefined") {
4092 for (var l = 0; l < post[i].tags.length; l++) {
4093 tag = post[i].tags[l];
4094 if (tagsAllArr.indexOf(tag) === -1) {
4095 tagsAllArr.push(tag);
4096 tagToIds[tag] = [];
4097 }
4098 tagToIds[tag].push(id);
4099 if (typeof idToTags[id] === "undefined") {
4100 idToTags[id] = [];
4101 }
4102 if (idToTags[id].indexOf(tag) === -1) {
4103 idToTags[id].push(tag)
4104 }
4105 }
4106 }
4107 }
4108 pluginBuildColumns();
4109 // the later onclick event to select-by runs outside of plugin scope
4110 // so we use the DOM for var memory
4111 data.setAttribute(
4112 "data-tags_all_arr", JSON.stringify(tagsAllArr)
4113 );
4114 data.setAttribute(
4115 "data-ids_all_arr", JSON.stringify(idsAllArr)
4116 );
4117 data.setAttribute(
4118 "data-types_all_arr", JSON.stringify(typesAllArr)
4119 );
4120 data.setAttribute(
4121 "data-id_to_tags", JSON.stringify(idToTags)
4122 );
4123 data.setAttribute(
4124 "data-id_to_types", JSON.stringify(idToTypes)
4125 );
4126 data.setAttribute(
4127 "data-id_to_origin", JSON.stringify(idToOrigin)
4128 );
4129 data.setAttribute(
4130 "data-id_to_state", JSON.stringify(idToState)
4131 );
4132 data.setAttribute(
4133 "data-id_to_timestamp", JSON.stringify(idToTimestamp)
4134 );
4135 data.setAttribute(
4136 "data-id_to_notes", JSON.stringify(idToNotes)
4137 );
4138 data.setAttribute(
4139 "data-tag_to_ids", JSON.stringify(tagToIds)
4140 );
4141 data.setAttribute(
4142 "data-type_to_ids", JSON.stringify(typeToIds)
4143 );
4144 }
4145 var token = data.getAttribute("data-api-token");
4146 var nextPage = false;
4147 if (
4148 typeof api.response !== "undefined" &&
4149 typeof api.response._links !== "undefined" &&
4150 typeof api.response._links.next !== "undefined" &&
4151 typeof api.response._links.next.href !== "undefined"
4152 ) {
4153 nextPage = api.response._links.next.href;
4154 } else if (
4155 typeof api.response !== "undefined" &&
4156 typeof api.response.timeline !== "undefined" &&
4157 typeof api.response.timeline._links.next !== "undefined" &&
4158 typeof api.response.timeline._links.next.href !== "undefined"
4159 ) {
4160 nextPage = api.response.timeline._links.next.href;
4161 }
4162 if (nextPage !== false && nextPage !== data.getAttribute("data-page-repeat")) {
4163 data.setAttribute("data-page-repeat", nextPage); // loop much?
4164 // walk, don't run :)
4165 data.classList.add("fetching-from-tumblr-api");
4166 var repeatedTimeOut = setInterval(function() {
4167 // this delays pagination slightly, but it may be better...
4168 // it's steadier, non-bot-ish, and is easier to process :)
4169 var tagAlongDiff = document.getElementsByClassName("brick").length -
4170 document.getElementsByClassName("laid").length;
4171 if(
4172 document.getElementById(
4173 "pause_button"
4174 ).classList.contains("paused") ||
4175 tagAlongDiff > 10 // < this :)
4176 ) {// the CSS3 animation thing is also crash prevention :)
4177 return;
4178 }
4179 clearInterval(repeatedTimeOut);
4180 getResponseText(
4181 "/api" + nextPage,
4182 asyncRepeatApiRead,
4183 [
4184 ["Authorization", "Bearer " + token]
4185 ]
4186 );
4187 }, 500);
4188 } else {
4189 endHeader = document.createElement("div");
4190 endHeader.classList.add("heading");
4191 endHeader.id = "heading_solum"; // end latin
4192 endHeader.appendChild(
4193 document.createTextNode("END")
4194 );
4195 lcontent.appendChild(endHeader);
4196 // this is where it usually ends, mostly
4197 data.classList.add("next_page_false");
4198 }
4199 };
4200 // end var asyncRepeatApiRead
4201
4202 // re the brick building for edits
4203 var reloadBrick = function (removeAfterEdit) {
4204 var highlightAfterReload = removeAfterEdit.classList.contains("highlighted");
4205 var preloadContainer = document.createElement("div");
4206 preloadContainer.classList.add("edited-gif");
4207 var preloadTrow = document.createElement("div");
4208 preloadTrow.classList.add("trow");
4209 var preloadInner = document.createElement("div");
4210 preloadInner.classList.add("edited-center");
4211 // show spinner until post re-caches/updates
4212 var preLoad = new Image();
4213 preLoad.src = loderGifSrc;
4214 preLoad.style.width = "32px;"
4215 preLoad.style.height = "32px";
4216 preLoad.classList.add("bm_load_img");
4217 preloadInner.appendChild(preLoad);
4218 preloadTrow.appendChild(preloadInner);
4219 preloadContainer.appendChild(preloadTrow);
4220 removeAfterEdit.appendChild(preloadContainer);
4221 setTimeout(function () {
4222 // this reloads the brick DOM after edit/close
4223 var id = removeAfterEdit.getAttribute("data-id");
4224 getResponseText(
4225 "/api/v2/blog/" + name +
4226 "/posts?limit=1&reblog_info=1&npf=1&id=" + id,
4227 function (api) {// post to replace
4228 if(typeof api === "string") {
4229 api = JSON.parse(api);
4230 }
4231 var t = ["text", "image", "chat", "ask",
4232 "video", "audio", "link", "quote"];
4233 var p2r = document.getElementById("post_" + id);
4234 var me;
4235 var type;
4236 // TODO, delete the superflous content/me argument
4237 // and put this inside the makeBrick function...
4238 // but only if it breaks...
4239 // not broken; don't fix it X)
4240 if (
4241 typeof api.response !== "undefined" &&
4242 typeof api.response.posts !== "undefined"
4243 ) {
4244 var post = api.response.posts;
4245 if (
4246 typeof post[0].trail != "undefined" &&
4247 typeof post[0].trail[0] !== "undefined" &&
4248 typeof post[0].trail[0].layout !== "undefined" &&
4249 typeof post[0].trail[0].layout[0] !== "undefined"
4250 ) {
4251 me = post[0].trail[0].layout;
4252 type = me[0].type;
4253 }
4254 if (
4255 t.indexOf(type) === -1 &&
4256 typeof post[0].trail != "undefined" &&
4257 typeof post[0].trail[0] !== "undefined" &&
4258 typeof post[0].trail[0].content !== "undefined" &&
4259 typeof post[0].trail[0].content[0] !== "undefined"
4260 ) {
4261 me = post[0].trail[0].content;
4262 type = me[0].type;
4263 }
4264 if (
4265 t.indexOf(type) === -1 &&
4266 typeof post[0].content !== "undefined" &&
4267 typeof post[0].content[0] === "undefined" &&
4268 typeof post[0].trail !== "undefined" &&
4269 typeof post[0].trail[0] !== "undefined" &&
4270 typeof post[0].trail[0].content !== "undefined"
4271 ) {
4272 me = post[0].trail[0].content;
4273 type = me[0].type;
4274 }
4275 if (
4276 t.indexOf(type) === -1 &&
4277 typeof post[0].content !== "undefined" &&
4278 typeof post[0].content[1] !== "undefined" &&
4279 typeof post[0].content[1].subtype !== "undefined"
4280 ) {
4281 me = post[0].content;
4282 type = me[1].subtype; // chat, maybe
4283 }
4284 if (
4285 t.indexOf(type) === -1 &&
4286 typeof post[0].content !== "undefined" &&
4287 typeof post[0].content[0] !== "undefined"
4288 ) {
4289 me = post[0].content;
4290 type = me[0].type;
4291 }
4292 if (
4293 typeof me !== "undefined" &&
4294 typeof me[0] !== "undefined" &&
4295 typeof me[0].subtype !== "undefined" &&
4296 type !== me[0].subtype &&
4297 t.indexOf(me[0].subtype) !== -1
4298 ) {
4299 type = me[0].subtype;
4300 }
4301 var newBrick = makeBrickFromApiPost(
4302 post[0], type, me
4303 ); // this third ^ me argument could be expunged
4304 newBrick.classList.add("laid");
4305 var lcontent = document.getElementsByClassName(
4306 "l-content"
4307 )[0];
4308 lcontent.replaceChild(newBrick, p2r);
4309 if (highlightAfterReload) {
4310 highlightBrick(
4311 document.getElementById("post_" + id), true
4312 );
4313 }
4314 pluginBuildColumns();
4315 }
4316 },
4317 [
4318 [
4319 "Authorization",
4320 "Bearer " + data.getAttribute("data-api-token")
4321 ]
4322 ]
4323 );
4324 }, 1000); // delay 1 secode for cache update, perhaps?
4325 };
4326 // end the brick reload function
4327
4328 // this is how we upload photos/images
4329 var photoUploadAndSubmit = function () { // and repeat asynchronously
4330 var data = document.getElementById(
4331 "mass_post_features-plugin_data"
4332 );
4333 var asDraftCheck = document.getElementById("photos_as_draft");
4334 var papb = document.getElementById("post_all_photos_button");
4335 if (!data.classList.contains("photo-upload-in-progress")) {
4336 data.classList.add("photo-upload-in-progress");
4337 asDraftCheck.disabled = true;
4338 papb.disabled = true;
4339 }
4340 var asDraft = asDraftCheck.checked;
4341 var apiKey = data.getAttribute("data-x-tumblr-form-key");
4342 var brk = document.getElementsByClassName("photo-brick");
4343 var brick = brk[brk.length - 1];
4344 brick.classList.add("upload-working");
4345 brick.scrollIntoView({behavior: "smooth"});
4346 var i;
4347 var rich = brick.getElementsByClassName("rich")[0];
4348 var img = brick.getElementsByClassName("photo-brick-img");
4349 var uploaded = brick.getElementsByClassName("uploaded");
4350 var squeakyToy = {};
4351 var code;
4352 var formData;
4353 var upImg;
4354 var api;
4355 // upload first or return or repeat
4356 if (uploaded.length !== img.length) {
4357 code = img[uploaded.length].firstChild.getAttribute("img-code");
4358 formData = new FormData();
4359 formData.append("photo", unreadFile[code]);
4360 getResponseText(
4361 {url: "/svc/post/upload_photo?source=post_type_form", post: formData},
4362 function(re){
4363 api = JSON.parse(re);
4364 if (
4365 typeof api !== "undefined" &&
4366 typeof api.response !== "undefined" &&
4367 typeof api.response[0] !== "undefined" &&
4368 typeof api.response[0].url !== "undefined"
4369 ) {
4370 img[uploaded.length].firstChild.src = api.response[0].url;
4371 }// whether we get the URL or not, the show must go on
4372 img[uploaded.length].classList.add("uploaded");
4373 photoUploadAndSubmit();
4374 // the fallback is to post a straight data url and let
4375 // Tumblr backend convert it to image/png etc on post
4376 // but that shouldn't have to happen
4377 },
4378 [
4379 ["X-tumblr-form-key", apiKey],
4380 ["X-Requested-With", "XMLHttpRequest"]
4381 ]
4382 );
4383 return;
4384 }
4385 // AFTER THE UPLOAD, SUMMER HAS GONE...
4386 brick.style.top = (0 - brick.clientHeight) + "px";
4387 // this v runs after that ^ runs for each photo to upload
4388 squeakyToy["post[two]"] = rich.innerHTML;
4389 squeakyToy["post[three]"] = "";
4390 // this post is an edit
4391 squeakyToy.channel_id = name;
4392 squeakyToy["post[type]"] = "photo";
4393 squeakyToy["post[state]"] = asDraft ? "1" : "0";
4394 squeakyToy["post[slug]"] = "";
4395 squeakyToy["post[date]"] = "";
4396 squeakyToy["post[publish_on]"] = "";
4397 if (img.length > 0) {
4398 var order = [];
4399 var oneone = "";
4400 var one = 0;
4401 for (i = 0; i < img.length; i++) {
4402 order.push("o" + (i+1));
4403 if (img[i].classList.contains("row-with-one-img")) {
4404 oneone += "1"; // new photoset order
4405 one = 0;
4406 }
4407 if (img[i].classList.contains("row-with-two-img")) {
4408 if (one === 0) {
4409 oneone += "2"; // new photoset order
4410 }
4411 ++one;
4412 if (one >= 2) {
4413 one = 0;
4414 }
4415 }
4416 if (img[i].classList.contains("row-with-three-img")) {
4417 if (one === 0) {
4418 oneone += "3"; // new photoset order
4419 }
4420 ++one;
4421 if (one >= 3) {
4422 one = 0;
4423 }
4424 }
4425 squeakyToy["images[o" + (i+1) + "]"] = img[i].firstChild.src;
4426 squeakyToy["caption[o" + (i+1) + "]"] = "";
4427 }
4428 squeakyToy["post[photoset_order]"] = order.join(",");
4429 squeakyToy["post[photoset_layout]"] = oneone;
4430 }
4431 squeakyToy["post[tags]"] = "";
4432 var tag = brick.getElementsByClassName("tag");
4433 var tags = [];
4434 if (tag.length > 0) {
4435 for (i = 0; i < tag.length; i++) {
4436 tags.push(tag[i].innerHTML);
4437 }
4438 squeakyToy["post[tags]"] = tags.join(",");
4439 }
4440 getResponseText( // this is step #2
4441 "/svc/secure_form_key",
4442 function(re2) {
4443 getResponseText(
4444 { // this is step #3
4445 url: "/svc/post/update",
4446 post: JSON.stringify(squeakyToy)
4447 },
4448 function(re3) {
4449 if (!JSON.parse(re3).errors) { // success image posted!
4450 if (brk.length > 0) {
4451 brick.parentNode.removeChild(brick);
4452 }
4453 if (brk.length > 0) {
4454 photoUploadAndSubmit();
4455 } else {
4456 var blogLink = document.createElement("a");
4457 var bigHome = svgForType.home.cloneNode(true);
4458 bigHome.setAttribute("width", "40");
4459 bigHome.setAttribute("height", "40");
4460 bigHome.setAttribute("fill", "#555");
4461 blogLink.appendChild(bigHome);
4462 blogLink.appendChild(
4463 document.createTextNode(
4464 "Visit your new posts..."
4465 )
4466 );
4467 blogLink.id = "return_to_dash_link";
4468 blogLink.href = "/blog/" + name + (asDraft ? "/drafts" : "");
4469 data.classList.remove("photo-upload-in-progress");
4470 asDraftCheck.disabled = false;
4471 papb.disabled = false;
4472 document.body.appendChild(blogLink);
4473 }
4474 }
4475 },
4476 [ // the prev request brought us some puppies :)
4477 ["X-tumblr-puppies", re2.puppies],
4478 ["X-tumblr-form-key", apiKey],
4479 ["X-Requested-With", "XMLHttpRequest"],
4480 ["Content-Type", "application/json"],
4481 ["Accept", "application/json, text/javascript, */*; q=0.01"]
4482 ]
4483 );
4484 },
4485 [
4486 ["Accept", "application/json, text/javascript, */*; q=0.01"],
4487 ["X-tumblr-form-key", apiKey],
4488 ["X-Requested-With", "XMLHttpRequest"]
4489 ]
4490 );
4491 };
4492 // end photoUploadAndSubmit
4493
4494 // this edits posts and reblogs posts,
4495 // and it can even clone posts accidentally :P
4496 var fetchEditSubmit = function (success) {
4497 var data = document.getElementById(
4498 "mass_post_features-plugin_data"
4499 );
4500 var isDraft = document.getElementById("re-as-draft").checked;
4501 var action = data.getAttribute("data-current_edit_action");
4502 var isReblog = action === "reblog";
4503 var href = document.location.href.split(/[\/\?&#=]+/g);
4504 var name = href[4];
4505 var reblogger = data.getAttribute("data-reblog-to-here"); // if any
4506 var apiKey = data.getAttribute("data-x-tumblr-form-key");
4507 var id;
4508 var key;
4509 var changes;
4510 var change;
4511 var brick;
4512 var editQueue = document.getElementsByClassName("edit-reblog-queue");
4513 // editReblog queue index
4514 var qIndex = parseInt(data.getAttribute("data-current_edit_index"));
4515 if (qIndex === -1) {
4516 id = data.getAttribute("data-single_edit_id");
4517 brick = document.getElementById("post_" + id);
4518 brick.classList.add("edit-reblog-queue");
4519 if (id === "0") {
4520 return; // just in case
4521 }
4522 } else { // batch reblogEdit v / ^ single reblogEdit
4523 id = editQueue[qIndex].getAttribute("data-id");
4524 brick = document.getElementById("post_" + id);
4525 }
4526 var postInEdit = document.getElementById("post_" + id);
4527 key = postInEdit.getAttribute("data-reblog_key");
4528 if (apiKey !== "0") {
4529 getResponseText(// A Reblog/Edit Takes 4 AJAX Steps
4530
4531 "/svc/post/fetch?" + (
4532 isReblog ?
4533 "reblog_id=" + id + "&reblog_key=" + key :
4534 "post_id=" + id
4535 ),
4536 // this is step #1
4537 function(re1) {
4538 var fetch = JSON.parse(re1).post;
4539 var bone = {}; // puppies / fetch / bone :)
4540 var reblog_post_id = typeof fetch.parent_id !== "undefined" ?
4541 fetch.parent_id :
4542 typeof fetch.root_id !== "undefined" ?
4543 fetch.root_id : id; // this is step #2// this is step #2
4544 // text chat quote
4545 if (typeof fetch.one !== "undefined") {
4546 bone["post[one]"] = fetch.one;
4547 }
4548 if (typeof fetch.two !== "undefined") {
4549 bone["post[two]"] = fetch.two;
4550 }
4551 if (typeof fetch.three !== "undefined") {
4552 bone["post[three]"] = fetch.three;
4553 }
4554 if (typeof fetch.source_url !== "undefined") {
4555 bone["post[source_url]"] = fetch.source_url;
4556 }
4557 if (typeof fetch["post[state]"] !== "undefined") {
4558 bone["post[state]"] = fetch["post[state]"];
4559 }
4560 bone["post[type]"] = fetch.type;
4561 if (isReblog) {
4562 // this post is a reblog
4563 bone.channel_id = reblogger;
4564 bone.reblog = true;
4565 bone.reblog_key = key;
4566 bone.reblog_post_id = reblog_post_id;
4567 bone.context_id = reblogger;
4568 bone["post[state]"] = isDraft ? "1" : "0";
4569 bone["post[slug]"] = ""; // bone, slug, and harmony :);
4570 bone["post[tags]"] = "";
4571 bone["post[date]"] = "";
4572 bone["post[publish_on]"] = "";
4573 } else {
4574 // this post is an edit
4575 bone.channel_id = name;
4576 bone.post_id = id;
4577 bone.edit_post_id = id;
4578 bone.reblog = false;
4579 bone["post[state]"] = fetch.state.toString();
4580 bone["post[slug]"] = fetch.slug; // lol what? :);
4581 bone["post[tags]"] = fetch.tags;
4582 bone["post[date]"] = fetch.date;
4583 bone["post[publish_on]"] = "";
4584 if (
4585 action !== "caption" &&
4586 action !== "backdate"
4587 ) {
4588 // simple edits, less dynamic and easy
4589 changes = JSON.parse(action);
4590 if(Array.isArray(changes)) {
4591 change = changes[qIndex];
4592 } else {
4593 change = changes;// turn and face the strange :)
4594 }
4595 for (var ch in change) {
4596 bone[ch] = change[ch];
4597 }
4598 var removeWhenDone =
4599 typeof changes["post[state]"] !== "undefined" &&
4600 changes["post[state]"] === "1" ||
4601 changes["post[state]"] === "0" &&
4602 href["3"] === "queued" ||
4603 changes["post[state]"] === "0" &&
4604 href["3"] === "draft" ||
4605 changes["post[state]"] === "on.2" ||
4606 changes["post[state]"] === "2"
4607 } else if (action === "caption") {
4608 var rich2 = document.getElementById(
4609 "rich_text_caption"
4610 );
4611 var b4 = document.getElementById(
4612 "prepend-caption-option"
4613 ).checked;
4614 var ow = document.getElementById(
4615 "overwrite-caption-option"
4616 ).checked;
4617 var af = document.getElementById(
4618 "append-caption-option"
4619 ).checked;
4620 bone["post[two]"] = af ? bone["post[two]"] + rich2.innerHTML:
4621 ow ? rich2.innerHTML:
4622 b4 ? rich2.innerHTML + bone["post[two]"] :
4623 bone["post[two]"] + rich2.innerHTML; // ""?
4624 } else if (action === "backdate") {
4625 var isOneDay = document.getElementById(
4626 "bd-one-day"
4627 ).checked;
4628 var isTwoDay = document.getElementById(
4629 "bd-two-day"
4630 ).checked;
4631 var isNoDay = document.getElementById(
4632 "bd-no-day"
4633 ).checked;
4634 var isOneTime = document.getElementById(
4635 "bt-one-time"
4636 ).checked;
4637 var isTwoTime = document.getElementById(
4638 "bt-two-time"
4639 ).checked;
4640 var isNoTime = document.getElementById(
4641 "bt-no-time"
4642 ).checked;
4643 var mo1 = document.getElementById("moleft").value - 1;
4644 var mo2 = document.getElementById("moright").value - 1;
4645 var dt1 = document.getElementById("dtleft").value;
4646 var dt2 = document.getElementById("dtright").value;
4647 var yr1 = document.getElementById("yrleft").value;
4648 var yr2 = document.getElementById("yrright").value;
4649 var ho1 = document.getElementById("holeft").value;
4650 var ho2 = document.getElementById("horight").value;
4651 var mt1 = document.getElementById("mtleft").value;
4652 var mt2 = document.getElementById("mtright").value;
4653 var pm1 = document.getElementById("pmleft").checked;
4654 var pm2 = document.getElementById("pmright").checked;
4655 // 1000 because seconds to miliseconds...
4656 var ts = parseInt(editQueue[qIndex].getAttribute("data-timestamp"));
4657 var d1 = new Date();
4658 var d2 = new Date();
4659 if (isOneDay || isTwoDay) {
4660 d1.setMonth(mo1);
4661 d1.setDate(dt1);
4662 d1.setYear(yr1);
4663 }
4664 if (isOneTime || isTwoTime) {
4665 d1.setMinutes(mt1);
4666 d1.setHours(ho1 + pm1 ? 12 : 0);
4667 }
4668 if (isTwoDay) {
4669 d2.setMonth(mo2);
4670 d2.setDate(dt2);
4671 d2.setYear(yr2);
4672 }
4673 if (isTwoTime) {
4674 d2.setMinutes(mt2);
4675 d2.setHours(ho2 + pm2 ? 12 : 0);
4676 }
4677 var df = (d1.getTime() - d2.getTime()) / (editQueue.length+1);
4678 var b = new Date();
4679 b.setTime(d1.getTime() - df * qIndex);
4680 var dt = [
4681 "Jan ", "Feb ", "Mar ", "Apr ",
4682 "May ", "Jun ", "Jul ", "Aug ",
4683 "Sep ", "Oct ", "Nov ", "Dec "
4684 ][b.getMonth()] + b.getDate() + ", " + b.getFullYear();
4685 var h = (b.getHours() < 12 ? b.getHours() : b.getHours()-12);
4686 if (h === 0) {
4687 h = 12;
4688 }
4689 var time = " " + h + ":" +
4690 (b.getMinutes()/100).toFixed(2).split(".")[1] + ":" +
4691 (b.getSeconds()/100).toFixed(2).split(".")[1] +
4692 (b.getHours() < 12 ? "am" : "pm");
4693 if (href[3] === "draft") {
4694 bone["post[publish_on]"] = dt + time;
4695 bone["post[state]"] = "on.2";
4696 } else {
4697 bone["post[date]"] = dt + time;
4698 }
4699 }
4700 }
4701 // photo posts
4702 if (typeof fetch.photos !== "undefined") {
4703 var order = [];
4704 var oneone = "";
4705 var photo;
4706 for (var i = 0; i < fetch.photos.length; i++) {
4707 photo = fetch.photos[i];
4708 order.push(photo.id);
4709 oneone += "1"; // backup photoset order
4710 bone["images[" + photo.id + "]"] = "";
4711 bone["caption[" + photo.id + "]"] = "";
4712 }
4713 bone["post[photoset_order]"] = order.join(",");
4714 bone["post[photoset_layout]"] = (
4715 typeof fetch.photoset_layout !== "undefined"
4716 ) ?
4717 fetch.photoset_layout : oneone;
4718 }
4719 getResponseText( // this is step #3
4720 "/svc/secure_form_key",
4721 function(re2) {
4722 getResponseText(
4723 { // this is step #4
4724 url: "/svc/post/update",
4725 post: JSON.stringify(bone)
4726 },
4727 function(re3) {
4728 if (!JSON.parse(re3).errors) { // success reblogged!
4729 brick.classList.remove("edit-reblog-queue");
4730 if (!isReblog) {// assume edited appearance
4731 if (
4732 removeWhenDone
4733 ) {
4734 brick.parentNode.removeChild(brick);
4735 pluginBuildColumns();
4736 }
4737 reloadBrick(brick);
4738 } else {
4739 reblogAnimation(id);
4740 }
4741 success(success);
4742 } else {
4743 brick.classList.remove("edit-reblog-queue");
4744 success(success);// repeat for next
4745 }
4746 },
4747 [ // the prev request brought us some puppies :)
4748 ["X-tumblr-puppies", re2.puppies],
4749 ["X-tumblr-form-key", apiKey],
4750 ["X-Requested-With", "XMLHttpRequest"],
4751 ["Content-Type", "application/json"],
4752 ["Accept", "application/json, text/javascript, */*; q=0.01"]
4753 ]
4754 );
4755 },
4756 [
4757 ["Accept", "application/json, text/javascript, */*; q=0.01"],
4758 ["X-tumblr-form-key", apiKey],
4759 ["X-Requested-With", "XMLHttpRequest"]
4760 ]
4761 );
4762 },
4763 [
4764 ["Accept", "application/json, text/javascript, */*; q=0.01"],
4765 ["X-tumblr-form-key", apiKey],
4766 ["X-Requested-With", "XMLHttpRequest"]
4767 ]
4768 );
4769 }
4770 };
4771 // end the single fetchEdit reblog/edit
4772
4773 // this function runs once v ^ then this goes repeatedly
4774 var fetchEditSubmitMulti = function () {
4775 var data = document.getElementById(
4776 "mass_post_features-plugin_data"
4777 );
4778 var highlighted = document.getElementsByClassName("highlighted");
4779 var qIndex = -1;
4780 for (var i = 0; i < highlighted.length; i++) {
4781 if (
4782 this.getAttribute("data-edit_action") === "reblog" &&
4783 highlighted[i].classList.contains("private")
4784 ) {
4785 continue;
4786 }
4787 qIndex++;
4788 highlighted[i].classList.add("edit-reblog-queue");
4789 }
4790 data.setAttribute("data-current_edit_index", qIndex);
4791 data.setAttribute(
4792 "data-current_edit_action",
4793 this.getAttribute("data-edit_action")
4794 );
4795 fetchEditSubmit(function(success){
4796 var data = document.getElementById(
4797 "mass_post_features-plugin_data"
4798 );
4799 var qIndex = parseInt(data.getAttribute("data-current_edit_index"));
4800 qIndex--;
4801 if (qIndex >= 0) {
4802 data.setAttribute("data-current_edit_index", qIndex);
4803 fetchEditSubmit(success);
4804 // repeat
4805 }
4806 });
4807 };
4808 // end edit/reblogging stuff
4809
4810 // extra chrome buttons and widgets, and nav-links
4811 var mpe = document.createElement("div");
4812 var mpeIcon = new Image();
4813 mpeIcon.width = 18;
4814 mpeIcon.height = 16;
4815 mpeIcon.src = // PNG is the monkey emoji from windows 8.1
4816 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC' +
4817 'AAAAAcCAYAAAAAwr0iAAAABmJLR0QA/wD/AP+gvaeTAAAACX' +
4818 'BIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AUIEy8cVCgtoA' +
4819 'AAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTV' +
4820 'BkLmUHAAAGt0lEQVRIx62Xa2wU1xXHf/fO7MO7awMOdkyIU1' +
4821 'roIynhUbWGEh4BVB4NKDWvuGkaCkHQVHGkkGLvAkXFIpm1oa' +
4822 'QNBaXIxRAItagbmkARKCpQIkxJoUrSDy2VEESkYIgxNvauvb' +
4823 'Mzc/rBNjH4RSTOt7mPc/73f849/zuKPqzWmhe28RelVPBlD/' +
4824 '2QgbPHw3xjVnTHh9wj071N/Dn+s3CbCpZk0FI5UK4/nC2fhQ' +
4825 'dIw4qINFbVxF/8Tue6E9aiewfgT/HiLhPekDSBdVqpW2MKEP' +
4826 'SYCDefA/ib9ZQxObbv3gA4Fi9ifnQLAFs3rFXipEK+rBzyCn' +
4827 '6A63oACAo/KbKlfkWtVSjAi/csBVOj1VyMj+VQfGnOg8a1X2' +
4828 'aFfbu/PGYC949bSOQrBYhj39okdLCiZNAXCbaz/BfdvlXXgW' +
4829 'PxokEaryFDkngChHMZPGIM/ztzhAy/RrqsdTFOtapI8fTonr' +
4830 'P9BT5tzWVc7AAAr1f8ytB46oWSVU5nWrssnJMN6vrnRxVEXJ' +
4831 'Q27/RZB/LSuNjB6qPxp5kW3dvv6c9as7SJGzmnR84AFcj1Lr' +
4832 '8HXoPu81Io1S24oPAw3h0XO1hdVb7WnBbdS61V2GvgyooyAN' +
4833 'L4JyUJ3/iSd756mPffbRr3qofxxG0RUwRsm8BhUCkPLT05VA' +
4834 'gad8pR6+lNg+XaDNng0xNi+zlhLegRwLKSdQA4+GpctL6ihv' +
4835 '6wIHZwQFKFd6eVP3YLwPvWAibH/tgyKVYzu0Vlrb+psk8p5B' +
4836 'LwiaDq7/D79TA3X86Ruv21xtxigMmxGo5ZRT2C+G3Fpu8bOK' +
4837 'GkimwOqtTbALOiO58VjJG3AEyK1XA83u5genSPNTNa9VhB7O' +
4838 'BD42IHhtWrvFKFdONCIX6FV37CWrAYYGqsukcAGZIYrEA3M9' +
4839 'B/jSG+zvFMaVxzWwoej3Z38E78+SEZJGb3lmMDN2DgFh62fp' +
4840 'Lf3r6718M549EjHjr5gHwyNFOaMjrH3whEd+j+qjdEImziDO' +
4841 '9tXiEI+skgbc8BTIjtvw3E9ooNVPx83tWkCp8FVQgy/7Xy1z' +
4842 'TA7pUFzf0CsAnm2gTGgvRYlJ3dMUhyVa1VuEKWtYMAOBBfzv' +
4843 'KSte1APe/HIOdy5fLakfLPnN9VvNq3GHUxr4sU0BsIhYQ03u' +
4844 'aTw+cXv1P+fB7A3Oh2AE5ahUxfvffqVZW/UuMNVVCyhG19O+' +
4845 '20v8SXj/fTdmqgXMfrB69CsFUAm8AxQb2ukI+mRfdeADhq/Y' +
4846 'hpsbf4a/yZ4z7sKQkiI9L4z5v9EyCdrbcVVFLh3dcXEz5JiZ' +
4847 '/UVFsFpnro0yeshb9JqKxj06K/rwNIkLkxTy5NbFUZq/2klv' +
4848 'XLwKH4svEG7imT9Acm9p6gJNeAur+/faq9ZpSHxiZQ7eArTR' +
4849 'K6NCdWKSetefUe+sZEu+Zr+m6VzMCpmxLdtwXUprtZLyjVUR' +
4850 'sSoLUoSHLRABr9AAkVed9PasSrocqA7t+RxsAhU5pMgFbCV9' +
4851 'L46d6YeidDAR7GIx7aBzBI6o8D5EjdhNsAVJaX9VQBKQ9Nig' +
4852 'AALWpAwlYB94u8A1xMmtWAs3Uq326/VoYfREKSmGUesRYzM7' +
4853 'arXThK24VjS/mmoeO9o1kJssw20tMVQpPK1gAZJC74JfUPYH' +
4854 'znw6QvNhRCSgXrw7T8YXZ0h93BqqdxlY3/72Zn8APW8pyQSn' +
4855 'w3JIlhzfLxY4LO85PKVOKN9ZGmUWWfAwhJS1rjtTqYOJhnTJ' +
4856 'xWA3dSXwy0EVy/zb+2EfZ1KKNZYABLS9e/bbY/LhfOhRvzXX' +
4857 'wPGzj5A6WhzUN7HloE9ZGHrs3zPt3aUYxtCkm3EaRJZVc+4F' +
4858 '1811H+3QqZ3uvVxPG/YJeNKo4/kw5LIlfhLrLxf3rhlW8p83' +
4859 'B8yUxTGnfYBK5pvBhws7OCr+tc75wa3VBS8tN/hX8t5uH40l' +
4860 'GuNIxWyFdBofEGfXv14SsfWHNWuhhrBDXfwDXuTElEbq52MA' +
4861 'pBpTTuGA+DpIpE/22MxTRwy3zYg8/rRxY+W/rK8a4byza+mT' +
4862 'XZPTT5pDXvCaf1qeEG7miF5AH5HW00CFAQO/jxkfIlL2V4za' +
4863 'cdfGMc5RsuqJBPbFchuSbpfBNnIigczIaEytw6O1r1FoCpca' +
4864 'ua1H037gx+IL4ikuG+V2xKeh3gBmm9qBBXUA3AdZAmkDMAx+' +
4865 'NF6vHSqsvAZqrE2PrZplEGTmSwXHMypPnBgdLwqMYLeGidVJ' +
4866 'EPZ2TtrIZdn2tB2cZd31i3avF/rI3bia1a3vFbVhjSuE8q5J' +
4867 'spgmdNnMsGju64RoaNP2mr4PnvRd9s6iq9nep3N2Zt3M7/Ad' +
4868 'nvxY2Pj+AwAAAAAElFTkSuQmCC';
4869 mpe.id = "mpe_title";
4870 mpe.appendChild(mpeIcon);
4871 mpe.setAttribute("title", "Mass Post Editor Features 4");
4872 en = document.getElementsByClassName("editor_navigation")[0];
4873 var selectAllFrag = document.createDocumentFragment();
4874 selectAllFrag.appendChild(svgForType.select.cloneNode(true));
4875 var selectAllSpan = document.createElement("span");
4876 selectAllSpan.appendChild(document.createTextNode("Select 100"));
4877 selectAllFrag.appendChild(selectAllSpan);
4878 var selectAll_chrome = newChromeButton("select-all", selectAllFrag, false);
4879 var selectByFrag = document.createDocumentFragment();
4880 selectByFrag.appendChild(svgForType.select.cloneNode(true));
4881 selectByFrag.appendChild(document.createTextNode("Select By"));
4882 var selectBy_chrome = newChromeButton("select-by", selectByFrag, true);
4883 // this shows the select-by widget and populates it with tags/types
4884 selectBy_chrome.getElementsByTagName("input")[0].
4885 addEventListener("change", populateSelectByWidget);
4886 var pauseFrag1 = document.createDocumentFragment();
4887 var playSpan = document.createElement("span");
4888 playSpan.classList.add("play");
4889 playSpan.innerHTML = "▶";
4890 var pauseSpan = document.createElement("span");
4891 pauseSpan.classList.add("pause");
4892 pauseSpan.innerHTML = "▐▐";
4893 pauseFrag1.appendChild(playSpan);
4894 pauseFrag1.appendChild(pauseSpan);
4895 var pause_chrome = newChromeButton(
4896 "pause", pauseFrag1, false
4897 );
4898 var pauseFrag2 = document.createDocumentFragment();
4899 var canvas = document.createElement("canvas");
4900 canvas.id = "status";
4901 canvas.width = 72;
4902 canvas.height = 15;
4903 var pLoaded = document.createElement("span");
4904 pLoaded.id = "p_loaded";
4905 pLoaded.appendChild(
4906 document.createTextNode("x0")
4907 );
4908 pauseFrag2.appendChild(canvas);
4909 pauseFrag2.appendChild(pLoaded);
4910 var ajaxInfo_chrome = newChromeButton(
4911 "ajax-info", pauseFrag2, false
4912 );
4913 // gutter control (easy)
4914 var gutterFrag = document.createDocumentFragment();
4915 var gutterInputCheck = document.createElement("input");
4916 gutterInputCheck.type = "checkbox";
4917 gutterInputCheck.checked = false;
4918 var gutterInputNumber = document.createElement("input");
4919 gutterInputNumber.type = "number";
4920 gutterInputNumber.value = 6;
4921 var gutterLabel = document.createElement("label");
4922 gutterLabel.setAttribute("for", "gutter-checkbox");
4923 gutterInputCheck.id = "gutter-checkbox";
4924 gutterLabel.appendChild(
4925 document.createTextNode("Gutter")
4926 );
4927 var newGutterChange = function () {
4928 var button = this.parentNode;
4929 var data = document.getElementById(
4930 "mass_post_features-plugin_data"
4931 );
4932 var newGutter = button.children[2].value;
4933 if (button.children[0].checked) {
4934 data.setAttribute("data-column_gutter", newGutter);
4935 } else {
4936 data.setAttribute("data-column_gutter", "6");
4937 }
4938 pluginBuildColumns();
4939 };
4940 gutterInputCheck.addEventListener("change", newGutterChange);
4941 gutterInputNumber.addEventListener("change", newGutterChange);
4942 gutterFrag.appendChild(gutterInputCheck);
4943 gutterFrag.appendChild(gutterLabel);
4944 gutterFrag.appendChild(gutterInputNumber);
4945 var gutter_chrome = newChromeButton(
4946 "gutter", gutterFrag, false
4947 );
4948 // view captions
4949 var captionsFrag = document.createDocumentFragment();
4950 captionsFrag.appendChild(svgForType.see.cloneNode(true));
4951 captionsFrag.appendChild(
4952 document.createTextNode("View Captions")
4953 );
4954 var captions_chrome = newChromeButton(
4955 "view-captions", captionsFrag, false
4956 );
4957 captions_chrome.getElementsByTagName(
4958 "button"
4959 )[0].addEventListener("click", function () {
4960 var lcontent = document.getElementsByClassName("l-content")[0];
4961 if (lcontent.classList.contains("with-captions")) {
4962 lcontent.classList.remove("with-captions");
4963 this.children[0].setAttribute("fill", "#fff");
4964 this.removeAttribute("style");
4965 } else {
4966 lcontent.classList.add("with-captions");
4967 this.style.color = "rgba(0,65,100,1)";
4968 this.children[0].setAttribute("fill", "rgba(0,65,100,1");
4969 this.style.boxShadow = "inset 0 3px 2px 2px rgba(0,0,0,0.4)";
4970 }
4971 });
4972 // editlinksReblogLikeButton
4973 var linksFrag = document.createDocumentFragment();
4974 linksFrag.appendChild(svgForType.see.cloneNode(true));
4975 linksFrag.appendChild(svgForType.notes.cloneNode(true));
4976 linksFrag.appendChild(svgForType["reblog-self"].cloneNode(true));
4977 linksFrag.appendChild(svgForType.edit.cloneNode(true));
4978 var links_chrome = newChromeButton(
4979 "view-links", linksFrag, false
4980 );
4981 links_chrome.getElementsByTagName(
4982 "button"
4983 )[0].addEventListener("click", function () {
4984 var i;
4985 var lcontent = document.getElementsByClassName("l-content")[0];
4986 if (lcontent.classList.contains("with-links")) {
4987 for (i = 0; i < 4; i++) {
4988 this.getElementsByTagName("svg")[i].setAttribute("fill", "#fff");
4989 }
4990 this.removeAttribute("style");
4991 lcontent.classList.remove("with-links");
4992 } else {
4993 for (i = 0; i < 4; i++) {
4994 this.getElementsByTagName("svg")[i].setAttribute("fill", "rgba(0,65,100,1)");
4995 }
4996 this.style.boxShadow = "inset 0 3px 2px 2px rgba(0,0,0,0.4)";
4997 lcontent.classList.add("with-links");
4998 }
4999 });
5000 // pause buttons
5001 pause_chrome.getElementsByTagName(
5002 "button"
5003 )[0].classList.add("playing");
5004 pause_chrome.getElementsByTagName(
5005 "button"
5006 )[0].addEventListener("click", function () {
5007 if (this.classList.contains("done")) {
5008 return;
5009 }
5010 var b = this.classList.contains("playing");
5011 this.classList.add(b?"paused":"playing");
5012 this.classList.remove(!b?"paused":"playing");
5013 });
5014 ajaxInfo_chrome.getElementsByTagName(
5015 "button"
5016 )[0].addEventListener("click", function () {
5017 var pause = document.getElementById(
5018 "pause_button"
5019 );
5020 if (pause.classList.contains("done")) {
5021 return;
5022 }
5023 var b = pause.classList.contains("playing");
5024 pause.classList.add(b?"paused":"playing");
5025 pause.classList.remove(!b?"paused":"playing");
5026 });
5027 ajaxInfo_chrome.setAttribute(
5028 "title", "Time Till Next Page - Posts Loaded"
5029 );
5030 pause_chrome.setAttribute("title", "Pause Page Loading");
5031 selectAll_chrome.getElementsByTagName("button")[0].
5032 addEventListener(
5033 "click",
5034 function () {
5035 var data = document.getElementById(
5036 "mass_post_features-plugin_data"
5037 );
5038 var idsAllArr = JSON.parse(
5039 data.getAttribute("data-ids_all_arr")
5040 );
5041 var alreadyHidden = data.classList.contains(
5042 "some-posts-already-hidden"
5043 );
5044 var visibleIdsAllArr = JSON.parse(
5045 data.getAttribute("data-visible_ids_all_arr")
5046 );
5047 var needle = parseFloat(
5048 data.getAttribute("data-select-all_needle")
5049 );
5050 var id;
5051 var hlBrick;
5052 var unSelctBrick;
5053 var firstNeedle = needle;
5054 var i;
5055 var limit = 100; // tumblr limit; not mine
5056 var selectedCount = 0;
5057 unSelctBrick = document.getElementsByClassName("highlighted");
5058 while (unSelctBrick.length > 0 ) {
5059 highlightBrick(unSelctBrick[0], 0);
5060 }
5061 if (alreadyHidden) { // select from visible
5062 while(
5063 needle < visibleIdsAllArr.length &&
5064 needle < firstNeedle + limit
5065 ) {
5066 id = visibleIdsAllArr[needle];
5067 hlBrick = document.getElementById("post_" + id);
5068 if (hlBrick !== null) {
5069 highlightBrick(hlBrick, 1);
5070 selectedCount++;
5071 }
5072 needle++;
5073 }
5074 } else { // select from all
5075 while(
5076 needle < idsAllArr.length &&
5077 needle < firstNeedle + limit
5078 ) {
5079 id = idsAllArr[needle];
5080 hlBrick = document.getElementById("post_" + id);
5081 if (hlBrick !== null) {
5082 highlightBrick(hlBrick, 1);
5083 selectedCount++;
5084 }
5085 needle++;
5086 }
5087 }
5088 this.getElementsByTagName("span")[0].innerHTML = "100 More";
5089 if (selectedCount < limit) {
5090 needle = 0;
5091 this.getElementsByTagName("span")[0].innerHTML = "Select 100";
5092 }
5093 data.setAttribute("data-select-all_needle", needle);
5094 }
5095 );
5096 document.getElementById(
5097 "delete_posts"
5098 ).parentNode.classList.add("remove-in-third-party-mode");
5099 document.getElementById(
5100 "delete_posts"
5101 );
5102 document.getElementById(
5103 "remove_tags"
5104 ).parentNode.classList.add("remove-in-third-party-mode");
5105 document.getElementById(
5106 "add_tags"
5107 ).parentNode.classList.add("remove-in-third-party-mode");
5108 var href = document.location.href.split(/[\/\?&#=]+/g);
5109 name = href[4];
5110 links_chrome.setAttribute("title", "Links: See tags. View Posts. Edit posts.");
5111 captions_chrome.setAttribute("title", "See photo captions.");
5112 selectBy_chrome.setAttribute("title", "Select posts by tag.");
5113 ajaxInfo_chrome.setAttribute("title", "Pause posts loading.");
5114 selectBy_chrome.setAttribute("title", "Pause posts loading.");
5115 selectAll_chrome.setAttribute("title", "Select all posts.");
5116 gutter_chrome.setAttribute("title", "Create bigger gutters.");
5117 // this is the make private button
5118 var privateFrag = document.createDocumentFragment();
5119 privateFrag.appendChild(svgForType.private.cloneNode(true));
5120 var privateSpan = document.createElement("span");
5121 privateSpan.appendChild(document.createTextNode("Private"));
5122 privateFrag.appendChild(privateSpan);
5123 var private_chrome = newChromeButton("private", privateFrag, false);
5124 private_chrome.getElementsByTagName(
5125 "button"
5126 )[0].addEventListener("click", fetchEditSubmitMulti);
5127 private_chrome.children[0].disabled = true;
5128 private_chrome.children[0].classList.add("disable-when-none-selected");
5129 private_chrome.children[0].classList.add("remove-in-third-party-mode");
5130 private_chrome.children[0].classList.add("remove-in-drafts-queue-mode");
5131 private_chrome.setAttribute("title", "Make selected private/unprivate.");
5132 // append chromeButtons
5133 var unselectFrag = document.createDocumentFragment();
5134 var unselectIcon = svgForType.unselect.cloneNode(true);
5135 unselectIcon.setAttribute("width", "15");
5136 unselectIcon.setAttribute("height", "15");
5137 unselectFrag.appendChild(unselectIcon);
5138 unselectFrag.appendChild(document.createTextNode("UnSelect"));
5139 var cbr = document.createElement("span");
5140 cbr.classList.add("chrome_button_right");
5141 unselectFrag.appendChild(cbr);
5142 var unslect = document.getElementById("unselect")
5143 unslect.innerHTML = "";
5144 unslect.appendChild(unselectFrag);
5145 var unPnt = unslect.parentNode;
5146 var rtPnt = document.getElementById("remove_tags").parentNode;
5147 var dlPnt = document.getElementById("delete_posts").parentNode;
5148 // editor navigation
5149 document.getElementById("delete_posts").parentNode.style.float = "right";
5150 var remTag = document.getElementById("remove_tags").children[0];
5151 remTag.innerHTML = "";
5152 var remFrag = document.createDocumentFragment();
5153 var remSymbol = document.createElement("h2");
5154 remSymbol.appendChild(document.createTextNode("-"));
5155 var addTag = document.getElementById("add_tags").children[0];
5156 addTag.innerHTML = "";
5157 remFrag.appendChild(remSymbol);
5158 remFrag.appendChild(document.createTextNode("Tags"));
5159 var addSymbol = document.createElement("h2");
5160 var addFrag = document.createDocumentFragment();
5161 addSymbol.appendChild(document.createTextNode("+"));
5162 addFrag.appendChild(addSymbol);
5163 var captionFrag = document.createDocumentFragment();
5164 captionFrag.appendChild(addSymbol.cloneNode(true));
5165 captionFrag.appendChild(document.createTextNode("Caption"));
5166 var caption_chrome = newChromeButton("add-caption", captionFrag, true);
5167 caption_chrome.classList.add("remove-in-third-party-mode");
5168 var caption_widget = caption_chrome.getElementsByClassName("widget")[0];
5169 var caption_check = caption_chrome.getElementsByTagName("input")[0];
5170 caption_check.classList.add("disable-when-none-selected");
5171 caption_check.disabled = true;
5172 caption_chrome.setAttribute("title", "Caption selected posts.");
5173 // this part is all add caption widget
5174 var rich2 = document.createElement("div");
5175 rich2.setAttribute("title", "caption");
5176 rich2.id = "rich_text_caption";
5177 rich2.contentEditable = true;
5178 rich2.designMode = "on";
5179 rich2.classList.add("rich");
5180 appendRichButtons(caption_widget, rich2, caption_widget);
5181 var captionTitle = document.createElement("h2");
5182 captionTitle.appendChild(
5183 document.createTextNode("Caption Posts")
5184 );
5185 var captionSubtitle = document.createElement("div");
5186 captionSubtitle.appendChild(
5187 document.createTextNode("Image,Video,Audio,Quote,Link,Chat, and Text")
5188 );
5189 caption_widget.appendChild(captionTitle);
5190 caption_widget.appendChild(captionSubtitle);
5191 caption_widget.appendChild(rich2);
5192 var pendContainer = document.createElement("div");
5193 pendContainer.classList.add("pend-container");
5194 var pend1 = document.createElement("div");
5195 var pend2 = document.createElement("div");
5196 var pend3 = document.createElement("div");
5197 var b4Radio = document.createElement("input");
5198 b4Radio.id = "prepend-caption-option";
5199 var b4Label = document.createElement("label");
5200 b4Label.setAttribute("for", "prepend-caption-option");
5201 b4Label.appendChild(document.createTextNode("Prepend"));
5202 var owRadio = document.createElement("input");
5203 owRadio.id = "overwrite-caption-option";
5204 var owLabel = document.createElement("label");
5205 owLabel.setAttribute("for", "overwrite-caption-option");
5206 owLabel.appendChild(document.createTextNode("Overwrite"));
5207 var owWarn = document.createElement("span");
5208 owWarn.classList.add("robot-warning");
5209 owWarn.appendChild(
5210 document.createTextNode(
5211 "This will erase and replace the whole text body of any post."
5212 )
5213 );
5214 var afRadio = document.createElement("input");
5215 afRadio.id = "append-caption-option";
5216 var afLabel = document.createElement("label");
5217 afLabel.setAttribute("for", "append-caption-option");
5218 afLabel.appendChild(document.createTextNode("Append"));
5219 b4Radio.type = "radio";
5220 b4Radio.name = "pend";
5221 b4Radio.classList.add("pend");
5222 pend1.appendChild(b4Radio);
5223 pend1.appendChild(b4Label);
5224 owRadio.type = "radio";
5225 owRadio.name = "pend";
5226 owRadio.classList.add("pend");
5227 pend2.appendChild(owRadio);
5228 pend2.appendChild(owLabel);
5229 pend2.appendChild(owWarn);
5230 afRadio.type = "radio";
5231 afRadio.name = "pend";
5232 afRadio.classList.add("pend");
5233 afRadio.checked = true;
5234 pend3.appendChild(afRadio);
5235 pend3.appendChild(afLabel);
5236 pendContainer.appendChild(pend1);
5237 pendContainer.appendChild(pend2);
5238 pendContainer.appendChild(pend3);
5239 caption_widget.appendChild(pendContainer);
5240 var capButt = butt("Add Caption");
5241 capButt.id = "add-caption_button2";
5242 capButt.setAttribute("data-edit_action", "caption");
5243 capButt.style.top = "268px";
5244 capButt.style.right = "9px";
5245 capButt.style.padding = "0 7px";
5246 capButt.addEventListener("click", fetchEditSubmitMulti);
5247 caption_widget.appendChild(capButt);
5248 var cancelCaption = butt("Cancel3");
5249 cancelCaption.addEventListener("click", function () {
5250 document.getElementById("add-caption").checked = false;
5251 });
5252 cancelCaption.style.top = "238px";
5253 cancelCaption.style.right = "9px";
5254 cancelCaption.style.padding = "0 7px";
5255 cancelCaption.setAttribute("title", "Close widget");
5256 caption_widget.appendChild(cancelCaption);
5257 // this part is backdate widget
5258 var scheduleInstead = href[3] === "draft";
5259 var backdateFrag = document.createDocumentFragment();
5260 backdateFrag.appendChild(
5261 svgForType.clock.cloneNode(true)
5262 );
5263 backdateFrag.appendChild(
5264 document.createTextNode(scheduleInstead ? "Schedule" : "BackDate")
5265 );
5266 var backdate_chrome = newChromeButton(
5267 "backdate", backdateFrag, true
5268 );
5269 backdate_chrome.classList.add("remove-in-third-party-mode");
5270 var backdate_widget = backdate_chrome.getElementsByClassName("widget")[0];
5271 var backdate_check = backdate_chrome.getElementsByTagName("input")[0];
5272 backdate_check.addEventListener("change", function () {
5273 if (!this.checked) {
5274 return;
5275 }
5276 var hl = document.getElementsByClassName("highlighted");
5277 var d1 = new Date(
5278 parseInt(
5279 hl[0].getAttribute("data-timestamp")
5280 ) * 1000
5281 );
5282 var d2 = new Date(
5283 parseInt(
5284 hl[hl.length-1].getAttribute("data-timestamp")
5285 ) * 1000
5286 );
5287 var inp = new Event("input");
5288 document.getElementById("moleft").value = d1.getMonth() + 1;
5289 document.getElementById("moright").value = d2.getMonth() + 1;
5290 document.getElementById("dtleft").value = d1.getDate();
5291 document.getElementById("dtright").value = d2.getDate();
5292 document.getElementById("yrleft").value = d1.getFullYear();
5293 document.getElementById("yrright").value = d2.getFullYear();
5294 document.getElementById("holeft").value = d1.getHours() >= 12 ?
5295 d1.getHours() - 12 : d1.getHours();
5296 document.getElementById("horight").value = d2.getHours()>= 12 ?
5297 d2.getHours() - 12 : d2.getHours();
5298 document.getElementById("mtleft").value = d1.getMinutes();
5299 document.getElementById("mtright").value = d2.getMinutes();
5300 document.getElementById("pmleft").checked = d1.getHours() >= 12;
5301 document.getElementById("pmright").checked = d2.getHours() >= 12;
5302 document.getElementById("moleft").dispatchEvent(inp);
5303 document.getElementById("moright").dispatchEvent(inp);
5304 document.getElementById("mtleft").dispatchEvent(inp);
5305 document.getElementById("mtright").dispatchEvent(inp);
5306 });
5307 backdate_check.classList.add("disable-when-none-selected");
5308 backdate_check.disabled = true;
5309 backdate_chrome.setAttribute(
5310 "title", scheduleInstead ?
5311 "Schedule up to 200 posts." :
5312 "Backdate selected posts."
5313 );
5314 var bdBody = document.createElement("div");
5315 bdBody.id = "backdate-body";
5316 var backdateTitle = document.createElement("h2");
5317 var backdateRules = document.createElement("div");
5318 backdateTitle.appendChild(
5319 document.createTextNode(
5320 scheduleInstead ?
5321 "Schedule Month/Date/Year":
5322 "BackDate Month/Date/Year"
5323 )
5324 );
5325 backdateRules.appendChild(
5326 document.createTextNode(" ")
5327 );
5328 bdBody.appendChild(backdateTitle);
5329 bdBody.appendChild(backdateRules);
5330 // I don't like new-fangled type="date" inputs that throw NaN sometimes
5331 var dateByNumbers = function(id){ // I'm old fashioned like Safari
5332 var d = new Date();
5333 var container = document.createElement("div");
5334 container.classList.add("date-input-bunch");
5335 var day = document.createElement("label");
5336 var thday = [
5337 "Sun ", "Mon ", "Tue ", "Wed ",
5338 "Thu ", "Fri ", "Sat "
5339 ];
5340 day.innerText = thday[d.getDay()];
5341 var mo = document.createElement("input");
5342 mo.type = "number";
5343 mo.value = d.getMonth() + 1;
5344 mo.id = "mo" + id;
5345 mo.classList.add("linput");
5346 var moLabel = document.createElement("label");
5347 moLabel.classList.add("rlabel");
5348 moLabel.setAttribute("for", "mo" + id);
5349 var month = [0,
5350 "Jan", "Feb", "Mar", "Apr",
5351 "May", "Jun", "Jul", "Aug",
5352 "Sep", "Oct", "Nov", "Dec"
5353 ];
5354 moLabel.innerText = month[d.getMonth()+1];
5355 var dt = document.createElement("input");
5356 dt.type = "number";
5357 dt.value = d.getDate();
5358 dt.id = "dt" + id;
5359 var dtLabel = document.createElement("label");
5360 dtLabel.setAttribute("for", "dt" + id);
5361 dtLabel.classList.add("narrow");
5362 dt.classList.add("linput");
5363 dtLabel.classList.add("rlabel");
5364 var px = function (b) {
5365 var px = ["th", "st", "nd", "rd", "th", "th",
5366 "th", "th", "th", "th", "th"][b % 10];
5367 if (b === 12 || b === 11) {
5368 px = "th ";
5369 }
5370 return px;
5371 };
5372 var yr = document.createElement("input");
5373 yr.type = "number";
5374 yr.id = "yr" + id;
5375 yr.value = d.getFullYear();
5376 dtLabel.innerText = px(d.getDate());
5377 var inputs = function () {
5378 if (this === mo && mo.value < 1) {
5379 mo.value = 12;
5380 }
5381 if (this === mo && mo.value > 12) {
5382 mo.value = 1;
5383 }
5384 var s = mo.value.toString();
5385 if (
5386 this === mo &&
5387 (
5388 s.length >= 2 && s.charAt(0) === "1" ||
5389 s.length >= 1 && s.charAt(0) !== "1"
5390 )
5391 ) {
5392 dt.focus();
5393 }
5394 s = dt.value.toString();
5395 if (
5396 this === dt &&
5397 (
5398 s.length >= 2 && s.charAt(0) === "1" ||
5399 s.length >= 1 && s.charAt(0) !== "1" &&
5400 s.charAt(0) !== "2" && s.charAt(0) !== "3"
5401 )
5402 ) {
5403 yr.focus();
5404 }
5405 var newD = new Date(yr.value, mo.value, 0);
5406 if (this === dt && dt.value <= 0) {
5407 dt.value = newD.getDate();
5408 }
5409 if (this === dt && dt.value > newD.getDate()) {
5410 dt.value = 1;
5411 }
5412 if (this === yr && dt.value < 0) {
5413 dt.value = 1;
5414 }
5415 if (this === yr && dt.value > newD.getDate()) {
5416 dt.value = newD.getDate();
5417 }
5418 newD = new Date(yr.value, mo.value-1, dt.value);
5419 day.innerText = thday[newD.getDay()];
5420 moLabel.innerText = month[mo.value];
5421 dtLabel.innerText = px(dt.value);
5422 };
5423 mo.addEventListener("input", inputs);
5424 dt.addEventListener("input", inputs);
5425 yr.addEventListener("input", inputs);
5426 var thisSelect = function () {
5427 this.select();
5428 };
5429 mo.addEventListener("focus", thisSelect);
5430 dt.addEventListener("focus", thisSelect);
5431 yr.addEventListener("focus", thisSelect);
5432 container.appendChild(mo);
5433 container.appendChild(moLabel);
5434 container.appendChild(dt);
5435 container.appendChild(dtLabel);
5436 container.appendChild(yr);
5437 container.appendChild(day);
5438 return container;
5439 };
5440 var bddate1 = dateByNumbers("left");
5441 var bddate2 = dateByNumbers("right");
5442 var bdrowDate = document.createElement("div");
5443 var bdinput1 = document.createElement("input");
5444 var bdinput2 = document.createElement("input");
5445 var bdinput3 = document.createElement("input");
5446 var bdlabel1 = document.createElement("label");
5447 var bdlabel2 = document.createElement("label");
5448 var bdlabel3 = document.createElement("label");
5449 bdinput1.id = "bd-no-day";
5450 bdinput2.id = "bd-one-day";
5451 bdinput3.id = "bd-two-day";
5452 bdinput2.checked = true;
5453 bdinput1.name = "bd-date-option";
5454 bdinput2.name = "bd-date-option";
5455 bdinput3.name = "bd-date-option";
5456 bdlabel1.setAttribute("for", "bd-no-day");
5457 bdlabel2.setAttribute("for", "bd-one-day");
5458 bdlabel3.setAttribute("for", "bd-two-day");
5459 bdlabel1.appendChild(
5460 document.createTextNode("Keep Same Date")
5461 );
5462 bdlabel2.appendChild(
5463 document.createTextNode("All Same Date")
5464 );
5465 bdlabel3.appendChild(
5466 document.createTextNode("Between Dates")
5467 );
5468 bdinput1.type = "radio";
5469 bdinput2.type = "radio";
5470 bdinput3.type = "radio";
5471 bdrowDate.appendChild(bdinput2);
5472 bdrowDate.appendChild(bdlabel2);
5473 bdrowDate.appendChild(bdinput3);
5474 bdrowDate.appendChild(bdlabel3);
5475 bdrowDate.appendChild(bdinput1);
5476 bdrowDate.appendChild(bdlabel1);
5477 bdrowDate.appendChild(bddate1);
5478 bdrowDate.appendChild(bddate2);
5479 bdBody.appendChild(bdrowDate);
5480 backdateTitle = document.createElement("h2");
5481 backdateRules = document.createElement("div");
5482 backdateTitle.appendChild(
5483 document.createTextNode(
5484 scheduleInstead ?
5485 "Schedule Hour:Minute":
5486 "BackDate Hour:Minute"
5487 )
5488 );
5489 backdateRules.appendChild(
5490 document.createTextNode(" ")
5491 );
5492 bdBody.appendChild(backdateTitle);
5493 bdBody.appendChild(backdateRules);
5494 var btrowTime = document.createElement("div");
5495 var btinput1 = document.createElement("input");
5496 var btinput2 = document.createElement("input");
5497 var btinput3 = document.createElement("input");
5498 var btlabel1 = document.createElement("label");
5499 var btlabel2 = document.createElement("label");
5500 var btlabel3 = document.createElement("label");
5501 btinput1.id = "bt-no-time";
5502 btinput2.id = "bt-one-time";
5503 btinput3.id = "bt-two-time";
5504 btinput1.checked = true;
5505 btinput1.name = "bt-time-option";
5506 btinput2.name = "bt-time-option";
5507 btinput3.name = "bt-time-option";
5508 btlabel1.setAttribute("for", "bt-no-time");
5509 btlabel2.setAttribute("for", "bt-one-time");
5510 btlabel3.setAttribute("for", "bt-two-time");
5511 btlabel1.appendChild(
5512 document.createTextNode("Keep Same Time")
5513 );
5514 btlabel2.appendChild(
5515 document.createTextNode("All Same Time")
5516 );
5517 btlabel3.appendChild(
5518 document.createTextNode("Between Times")
5519 );
5520 btinput1.type = "radio";
5521 btinput2.type = "radio";
5522 btinput3.type = "radio";
5523 btrowTime.appendChild(btinput2);
5524 btrowTime.appendChild(btlabel2);
5525 btrowTime.appendChild(btinput3);
5526 btrowTime.appendChild(btlabel3);
5527 btrowTime.appendChild(btinput1);
5528 btrowTime.appendChild(btlabel1);
5529 var timeByNumbers = function(id){
5530 var d = new Date();
5531 var container = document.createElement("div");
5532 container.classList.add("date-input-bunch");
5533 var ho = document.createElement("input");
5534 ho.type = "number";
5535 ho.value = d.getHours();
5536 ho.id = "ho" + id;
5537 ho.classList.add("linput");
5538 var hoLabel = document.createElement("label");
5539 hoLabel.classList.add("rlabel");
5540 hoLabel.setAttribute("for", "ho" + id);
5541 hoLabel.innerText = ":"
5542 hoLabel.classList.add("narrow");
5543 var mt = document.createElement("input");
5544 mt.type = "number";
5545 mt.value = d.getMinutes();
5546 mt.id = "mt" + id;
5547 mt.classList.add("linput");
5548 var pm = document.createElement("input");
5549 pm.type = "checkbox";
5550 pm.id = "pm" + id;
5551 var pmLabel = document.createElement("label");
5552 pmLabel.checked = d.getHours() >= 12;
5553 pmLabel.setAttribute("for", "pm" + id);
5554 pmLabel.classList.add("rlabel");
5555 var inputs = function () {
5556 if (ho.value >= 12) {
5557 ho.value = 1;
5558 }
5559 if (ho.value <= 0) {
5560 ho.value = 12;
5561 }
5562 if (mt.value > 60) {
5563 mt.value = 1;
5564 }
5565 if (mt.value < 0) {
5566 mt.value = 60;
5567 }
5568 var s = ho.value.toString();
5569 if (
5570 this === ho &&
5571 (
5572 s.length >= 2 && s.charAt(0) === "1" ||
5573 s.length >= 1 && s.charAt(0) !== "1"
5574 )
5575 ) {
5576 mt.focus();
5577 }
5578 if (mt.value <= 9) {
5579 mt.value = "0" + mt.value;
5580 }
5581 };
5582 inputs();
5583 ho.addEventListener("input", inputs);
5584 mt.addEventListener("input", inputs);
5585 var thisSelect = function () {
5586 this.select();
5587 };
5588 ho.addEventListener("focus", thisSelect);
5589 mt.addEventListener("focus", thisSelect);
5590 container.appendChild(ho);
5591 container.appendChild(hoLabel);
5592 container.appendChild(mt);
5593 container.appendChild(pm);
5594 container.appendChild(pmLabel);
5595 return container;
5596 };
5597 var btTime1 = timeByNumbers("left");
5598 var btTime2 = timeByNumbers("right");
5599 btrowTime.appendChild(btTime1);
5600 btrowTime.appendChild(btTime2);
5601 bdBody.appendChild(btrowTime);
5602 backdateRules = document.createElement("i");
5603 backdateRules.appendChild(
5604 document.createTextNode(
5605 "Visual Post-Brick-Re-Order Happens After Reload"
5606 )
5607 );
5608 var backdate2 = butt("Backdate2");
5609 if (scheduleInstead) {
5610 backdate2.children[0].innerHTML = "Schedule";
5611 }
5612 backdate2.setAttribute("data-edit_action", "backdate");
5613 var cancelBackdate = butt("Cancel4");
5614 cancelBackdate.addEventListener("click", function () {
5615 document.getElementById("backdate").checked = false;
5616 });
5617 backdate2.addEventListener("click", fetchEditSubmitMulti);
5618 bdBody.appendChild(backdateRules);
5619 bdBody.appendChild(backdate2);
5620 bdBody.appendChild(cancelBackdate);
5621 backdate_widget.appendChild(bdBody);
5622 // this is the other stuff that squeezes into a widget/button
5623 var urlFrag = document.createDocumentFragment();
5624 var urlSVG = svgForType.symlink.cloneNode(true);
5625 urlSVG.setAttribute("viewBox", "2 2 13 13");
5626 urlFrag.appendChild(urlSVG); // :D
5627 urlFrag.appendChild(
5628 document.createTextNode("URLs")
5629 );
5630 var url_chrome = newChromeButton(
5631 "urlstuff", urlFrag, true
5632 );
5633 var url_widget = url_chrome.getElementsByClassName("widget")[0];
5634 var url_check = url_chrome.getElementsByTagName("input")[0];
5635 url_check.disabled = true;
5636 url_check.classList.add("disable-when-none-selected");
5637 var urlRow1 = document.createElement("div");
5638 var urlTitle1 = document.createElement("h2");
5639 urlTitle1.appendChild(
5640 document.createTextNode("Source URL")
5641 );
5642 urlRow1.appendChild(urlTitle1);
5643 var urlInput1 = document.createElement("input"); // source URL
5644 urlInput1.type = "text";
5645 urlInput1.id = "source_url";
5646 var urlRow2 = document.createElement("div");
5647 var urlTitle2 = document.createElement("h2");
5648 urlTitle2.appendChild(
5649 document.createTextNode("ClickThrough Link")
5650 );
5651 var urlInput2 = document.createElement("input"); // clickthrough
5652 urlInput2.type = "text";
5653 urlInput2.id = "clickthrough";
5654 var urlRow3 = document.createElement("div");
5655 var urlTitle3 = document.createElement("h2");
5656 urlTitle3.innerHTML = ".../URL/<b>slug</b>";
5657 var urlInput3 = document.createElement("input"); // slug
5658 urlInput3.type = "text";
5659 urlInput3.id = "slug";
5660 var urlThing = document.createElement("div");
5661 urlThing.id = "urlstuff_body";
5662 var addURL = butt("Add URLs");
5663 addURL.addEventListener("click", fetchEditSubmitMulti);
5664 var setURLValues = function () {
5665 var changes = {
5666 "enable_redirect_urls": true,
5667 "post[three]": urlInput2.value,
5668 "post[source_url]": urlInput1.value,
5669 "post[slug]": urlInput3.value
5670 };
5671 addURL.setAttribute("data-edit_action", JSON.stringify(changes));
5672 };
5673 setURLValues();
5674 urlInput1.addEventListener("input", setURLValues);
5675 urlInput2.addEventListener("input", setURLValues);
5676 urlInput3.addEventListener("input", setURLValues);
5677 var urlRules1 = document.createElement("div");
5678 urlRules1.appendChild(
5679 document.createTextNode("(Original Posts Only)")
5680 );
5681 var urlRules2 = document.createElement("div");
5682 urlRules2.appendChild(
5683 document.createTextNode("Leave Blank to Remove")
5684 );
5685 var urlRules3 = document.createElement("div");
5686 urlRules3.appendChild(
5687 document.createTextNode("Media/Image Posts Only")
5688 );
5689 urlRow1.appendChild(urlTitle1);
5690 urlRow1.appendChild(urlInput1);
5691 urlRow2.appendChild(urlTitle2);
5692 urlRow2.appendChild(urlInput2);
5693 urlRow3.appendChild(urlTitle3);
5694 urlRow3.appendChild(urlInput3);
5695 urlThing.appendChild(urlRules2);
5696 urlThing.appendChild(urlRow3);
5697 urlThing.appendChild(urlRow1);
5698 urlThing.appendChild(urlRules1);
5699 urlThing.appendChild(urlRow2);
5700 urlThing.appendChild(urlRules3);
5701 var cancelURL = butt("Cancel5");
5702 cancelURL.addEventListener("click", function () {
5703 document.getElementById("urlstuff").checked = false;
5704 });
5705 urlThing.appendChild(cancelURL);
5706 urlThing.appendChild(addURL);
5707 url_widget.appendChild(urlThing);
5708 // this part is mixing the editor nav panel a bit
5709 addFrag.appendChild(document.createTextNode("Tags"));
5710 addTag.appendChild(addFrag);
5711 addTag.setAttribute("title", "Add tags, from selected posts...");
5712 remTag.appendChild(remFrag);
5713 remTag.setAttribute("title", "Remove tags, from selected posts...");
5714 // get rid of oddly inline style attributes
5715 document.getElementById("tags").removeAttribute("style");
5716 // append all our new buttons "buttoned"
5717 en.insertBefore(pause_chrome, rtPnt);
5718 en.insertBefore(ajaxInfo_chrome, rtPnt);
5719 en.insertBefore(gutter_chrome, rtPnt);
5720 en.insertBefore(links_chrome, rtPnt);
5721 en.insertBefore(captions_chrome, rtPnt);
5722 en.insertBefore(caption_chrome, rtPnt);
5723 en.insertBefore(backdate_chrome, rtPnt);
5724 en.insertBefore(url_chrome, rtPnt);
5725 en.insertBefore(private_chrome, rtPnt);
5726 if (href[3] === "draft" || href[3] === "queued") {
5727 var publish_chrome = newChromeButton("publish", "Publish", false);
5728 publish_chrome.getElementsByTagName("button")[0].
5729 setAttribute(
5730 "data-edit_action", '{"post[state]":"0"}'
5731 );
5732 publish_chrome.getElementsByTagName("button")[0].
5733 addEventListener("click", fetchEditSubmitMulti);
5734 en.insertBefore(publish_chrome, rtPnt);
5735 }
5736 if (href[3] === "draft") {
5737 var queue_chrome = newChromeButton(
5738 "queue", "Queue Drafts", false
5739 );
5740 queue_chrome.getElementsByTagName("button")[0].
5741 setAttribute(
5742 "data-edit_action", '{"post[state]":"2"}'
5743 );
5744 queue_chrome.getElementsByTagName("button")[0].
5745 addEventListener("click", fetchEditSubmitMulti);
5746 en.insertBefore(queue_chrome, rtPnt);
5747 }
5748 if (href[3] === "queued") {
5749 var makeDraft_chrome = newChromeButton(
5750 "make-draft", "ReDraft", false
5751 );
5752 makeDraft_chrome.getElementsByTagName("button")[0].
5753 setAttribute(
5754 "data-edit_action", '{"post[state]":"1"}'
5755 );
5756 makeDraft_chrome.getElementsByTagName("button")[0].
5757 addEventListener("click", fetchEditSubmitMulti);
5758 en.insertBefore(makeDraft_chrome, rtPnt);
5759 }
5760 en.insertBefore(selectBy_chrome, unPnt);
5761 en.insertBefore(selectAll_chrome, dlPnt);
5762 var navLinks = document.getElementsByClassName("post-state-nav-item");
5763 var navDash = document.createElement("a");
5764 var navInputContainer = document.createElement("div");
5765 navInputContainer.classList.add("widget");
5766 navInputContainer.id = "reblog_widget";
5767 var navWidgetTrow = document.createElement("div");
5768 navWidgetTrow.classList.add("trow");
5769 var navWidgetInner = document.createElement("div");
5770 navWidgetInner.classList.add("inner");
5771 var navWidgetH2 = document.createElement("h2");
5772 navWidgetH2.appendChild(
5773 document.createTextNode("Load From Page for ReBlog")
5774 );
5775 navWidgetH2.id = "reblog-widget_h2";
5776 navWidgetInner.appendChild(navWidgetH2);
5777 var reblogDescription = document.createElement("div");
5778 reblogDescription.innerHTML = "Reblogging from the \"dashboard\"...";
5779 reblogDescription.id = "reblog-widget_description";
5780 var reblogInputText = document.createElement("input");
5781 reblogInputText.type = "text";
5782 reblogInputText.addEventListener("focus", function () {
5783 this.select();
5784 });
5785 reblogInputText.disabled = true;
5786 reblogInputText.id = "reblog-widget_input";
5787 reblogInputText.value = "dashboard";
5788 var loadp = butt("Load Page");
5789 var loadpSubmit = function () {
5790 var wGinput = document.getElementById(
5791 "reblog-widget_input"
5792 );
5793 var url = wGinput.getAttribute("data-url") + wGinput.value;
5794 document.location.href = url.replace(/\s+/g, "+");
5795 };
5796 reblogInputText.addEventListener("keyup", function (e) {
5797 if (e.keyCode === 13) {
5798 loadpSubmit();
5799 }
5800 });
5801 loadp.addEventListener("click", loadpSubmit);
5802 var cancelp = butt("Cancel2");
5803 cancelp.setAttribute( // so these aren't "undefined"
5804 "data-default-input", "null"
5805 );
5806 cancelp.setAttribute(
5807 "data-default-disabled", "null"
5808 );
5809 cancelp.setAttribute(
5810 "data-default-description", "null"
5811 );
5812 cancelp.setAttribute(
5813 "data-default-url", "null"
5814 );
5815 var openReblogsWidget = function (e) {
5816 e.preventDefault();
5817 e.cancelBubble = true;
5818 e.stopPropagation();
5819 var navLinks = document.getElementsByClassName(
5820 "post-state-nav-item"
5821 );
5822 var nav = navLinks[0].parentNode;
5823 if (nav.classList.contains("open")) {
5824 nav.classList.remove("open");
5825 } else {
5826 var data = document.getElementById(
5827 "mass_post_features-plugin_data"
5828 );
5829 data.classList.add("open-blog_menu");
5830 var wGinput = document.getElementById(
5831 "reblog-widget_input"
5832 );
5833 wGinput.value = this.getAttribute("data-default-input");
5834 wGinput.disabled = this.getAttribute("data-default-disabled") === "1";
5835 wGinput.setAttribute("data-url", this.getAttribute("data-default-url"));
5836 document.getElementById(
5837 "reblog-widget_description"
5838 ).innerHTML = "Reblogging from the \"" +
5839 this.getAttribute("data-default-description") +
5840 "\"...";
5841 nav.classList.add("open");
5842 }
5843 };
5844 cancelp.addEventListener("click", openReblogsWidget);
5845 navWidgetInner.appendChild(reblogInputText);
5846 navWidgetInner.appendChild(loadp);
5847 navWidgetInner.appendChild(cancelp);
5848 var robotWarningReblogs = document.createElement("div");
5849 var robotTitleReblogs = document.createElement("strong");
5850 robotTitleReblogs.appendChild(
5851 document.createTextNode(
5852 "Friendly Robot Warning"
5853 )
5854 );
5855 robotWarningReblogs.classList.add("robot-warning");
5856 robotWarningReblogs.appendChild(robotTitleReblogs);
5857 robotWarningReblogs.appendChild(
5858 document.createTextNode(
5859 "Please: utilize \"Pause Button\" for extra long feeds. " +
5860 "Please: Reblog responsibly!"
5861 )
5862 );
5863 navWidgetInner.appendChild(reblogDescription);
5864 navWidgetInner.appendChild(robotWarningReblogs);
5865 navWidgetTrow.appendChild(navWidgetInner);
5866 navInputContainer.appendChild(navWidgetTrow);
5867 navLinks[0].parentNode.appendChild(navInputContainer);
5868 navDash.appendChild(
5869 svgForType["reblog-self"].cloneNode(true)
5870 );
5871 navDash.appendChild(
5872 document.createTextNode("Dashboard")
5873 );
5874 navDash.getElementsByTagName("svg")[0].setAttribute("width", 15);
5875 navDash.getElementsByTagName("svg")[0].setAttribute("height", 15);
5876 navDash.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5877 var navChive = document.createElement("a");
5878 navChive.appendChild(
5879 svgForType["reblog-self"].cloneNode(true)
5880 );
5881 navChive.appendChild(
5882 document.createTextNode("Archive")
5883 );
5884 navChive.getElementsByTagName("svg")[0].setAttribute("width", 15);
5885 navChive.getElementsByTagName("svg")[0].setAttribute("height", 15);
5886 navChive.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5887 var navTagged = document.createElement("a");
5888 navTagged.appendChild(
5889 svgForType["reblog-self"].cloneNode(true)
5890 );
5891 navTagged.appendChild(
5892 document.createTextNode("Tagged")
5893 );
5894 navTagged.id = "nav-tagged";
5895 navTagged.getElementsByTagName("svg")[0].setAttribute("width", 15);
5896 navTagged.getElementsByTagName("svg")[0].setAttribute("height", 15);
5897 navTagged.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5898 var navSearch = document.createElement("a");
5899 navSearch.appendChild(
5900 svgForType["reblog-self"].cloneNode(true)
5901 );
5902 navSearch.appendChild(
5903 document.createTextNode("Search")
5904 );
5905 navSearch.getElementsByTagName("svg")[0].setAttribute("width", 15);
5906 navSearch.getElementsByTagName("svg")[0].setAttribute("height", 15);
5907 navSearch.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5908 var navLikes = document.createElement("a");
5909 navLikes.id = "nav-likes";
5910 navLikes.appendChild(
5911 svgForType["reblog-self"].cloneNode(true)
5912 );
5913 navLikes.appendChild(
5914 document.createTextNode("Likes")
5915 );
5916 navLikes.getElementsByTagName("svg")[0].setAttribute("width", 15);
5917 navLikes.getElementsByTagName("svg")[0].setAttribute("height", 15);
5918 navLikes.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5919 var navPhoto = document.createElement("a");
5920 navPhoto.appendChild(
5921 svgForType.image.cloneNode(true)
5922 );
5923 navPhoto.appendChild(
5924 document.createTextNode("Batch")
5925 );
5926 navPhoto.id = "nav-photo";
5927 navPhoto.getElementsByTagName("svg")[0].setAttribute("width", 15);
5928 navPhoto.getElementsByTagName("svg")[0].setAttribute("height", 15);
5929 navPhoto.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5930 navPhoto.classList.add("post-state-nav-item");
5931 navPhoto.setAttribute(
5932 "href", "/mega-editor/published/" + name + "?photos"
5933 );
5934 navLinks[0].parentNode.appendChild(mpe);
5935 var navFollowed = document.createElement("a");
5936 navFollowed.appendChild(
5937 svgForType.image.cloneNode(true)
5938 );
5939 navFollowed.appendChild(
5940 document.createTextNode("Followed")
5941 );
5942 navFollowed.id = "nav-photo";
5943 navFollowed.getElementsByTagName("svg")[0].setAttribute("width", 15);
5944 navFollowed.getElementsByTagName("svg")[0].setAttribute("height", 15);
5945 navFollowed.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5946 navFollowed.classList.add("post-state-nav-item");
5947 navFollowed.setAttribute(
5948 "href", "/mega-editor/published/" + name + "?followed"
5949 );
5950 var navFollowers = document.createElement("a");
5951 navFollowers.appendChild(
5952 svgForType.image.cloneNode(true)
5953 );
5954 navFollowers.appendChild(
5955 document.createTextNode("Followers")
5956 );
5957 navFollowers.id = "nav-photo";
5958 navFollowers.getElementsByTagName("svg")[0].setAttribute("width", 15);
5959 navFollowers.getElementsByTagName("svg")[0].setAttribute("height", 15);
5960 navFollowers.getElementsByTagName("svg")[0].setAttribute("fill", "#fff");
5961 navFollowers.classList.add("post-state-nav-item");
5962 navFollowers.setAttribute(
5963 "href", "/mega-editor/published/" + name + "?followed"
5964 );
5965 var four = [
5966 "dashboard", "archive", "tagged", "search", "likes", // reblogging pages
5967 "photos", "followed", "followers" //special features
5968 ];
5969 if (typeof href[5] !== "undefined" && four.indexOf(href[5]) !== -1) {
5970 document.getElementsByClassName("active")[0].classList.remove("active");
5971 if (href[5] === "dashboard") {
5972 navDash.classList.add("active");
5973 }
5974 if (href[5] === "archive") {
5975 navChive.classList.add("active");
5976 }
5977 if (href[5] === "tagged") {
5978 navTagged.classList.add("active");
5979 }
5980 if (href[5] === "search") {
5981 navSearch.classList.add("active");
5982 }
5983 if (href[5] === "likes") {
5984 navLikes.classList.add("active");
5985 }
5986 if (href[5] === "photos") {
5987 navPhoto.classList.add("active");
5988 }
5989 if (href[5] === "followed") {
5990 navPhoto.classList.add("active");
5991 }
5992 if (href[5] === "followers") {
5993 navPhoto.classList.add("active");
5994 }
5995 }
5996 navTagged.setAttribute(
5997 "data-default-input", "cats"
5998 );
5999 navTagged.setAttribute(
6000 "data-default-description", "Tagged Page"
6001 );
6002 navTagged.setAttribute(
6003 "data-default-url", "/mega-editor/published/" + name + "?tagged&"
6004 );
6005 navTagged.addEventListener("click", openReblogsWidget);
6006 navTagged.href = "/mega-editor/published/" + name + "?tagged&cats";
6007 navTagged.classList.add("post-state-nav-item");
6008 navLinks[0].parentNode.appendChild(navTagged);
6009 navLikes.setAttribute(
6010 "data-default-input", name
6011 );
6012 navLikes.setAttribute(
6013 "data-default-description", "Liked/By Page"
6014 );
6015 navLikes.setAttribute(
6016 "data-default-url", "/mega-editor/published/" + name + "?likes&"
6017 );
6018 navLikes.addEventListener("click", openReblogsWidget);
6019 navLikes.href = "/mega-editor/published/" + name + "?likes&" + name;
6020 navLikes.classList.add("post-state-nav-item");
6021 navLinks[0].parentNode.appendChild(navLikes);
6022 navSearch.setAttribute(
6023 "data-default-input", "cats"
6024 );
6025 navSearch.setAttribute(
6026 "data-default-disabled", "0"
6027 );
6028 navSearch.setAttribute(
6029 "data-default-description", "Search Page"
6030 );
6031 navSearch.setAttribute(
6032 "data-default-url", "/mega-editor/published/" + name + "?search&"
6033 );
6034 navSearch.addEventListener("click", openReblogsWidget);
6035 navSearch.href = "/mega-editor/published/" + name + "?search&cats";
6036 navSearch.classList.add("post-state-nav-item");
6037 navLinks[0].parentNode.appendChild(navSearch);
6038 navChive.setAttribute(
6039 "data-default-input", "david"
6040 );
6041 navChive.setAttribute(
6042 "data-default-disabled", "0"
6043 );
6044 navChive.setAttribute(
6045 "data-default-description", "Archive Page"
6046 );
6047 navChive.setAttribute(
6048 "data-default-url", "/mega-editor/published/" + name + "?archive&"
6049 );
6050 navChive.addEventListener("click", openReblogsWidget);
6051 navChive.href = "/mega-editor/published/" + name + "?archive&david";
6052 navChive.classList.add("post-state-nav-item");
6053 navLinks[0].parentNode.appendChild(navChive);
6054 navDash.setAttribute(
6055 "data-default-input", "dashboard"
6056 );
6057 navDash.setAttribute(
6058 "data-default-disabled", "1"
6059 );
6060 navDash.setAttribute(
6061 "data-default-description", "Dashboard"
6062 );
6063 navDash.setAttribute(
6064 "data-default-url", "/mega-editor/published/" + name + "?dashboard&"
6065 );
6066 navDash.addEventListener("click", openReblogsWidget);
6067 navDash.href = "/mega-editor/published/" + name + "?dashboard";
6068 navDash.classList.add("post-state-nav-item");
6069 navLinks[0].parentNode.appendChild(navDash);
6070 navLinks[0].parentNode.appendChild(navPhoto);
6071 navLinks[0].insertBefore(
6072 svgForType.edit.cloneNode(true), navLinks[0].firstChild
6073 );
6074 navLinks[1].insertBefore(
6075 svgForType.edit.cloneNode(true), navLinks[1].firstChild
6076 );
6077 navLinks[2].insertBefore(
6078 svgForType.edit.cloneNode(true), navLinks[2].firstChild
6079 );
6080 navLinks[0].getElementsByTagName("svg")[0].setAttribute("width", 15);
6081 navLinks[0].getElementsByTagName("svg")[0].setAttribute("height", 15);
6082 navLinks[1].getElementsByTagName("svg")[0].setAttribute("width", 15);
6083 navLinks[1].getElementsByTagName("svg")[0].setAttribute("height", 15);
6084 navLinks[2].getElementsByTagName("svg")[0].setAttribute("width", 15);
6085 navLinks[2].getElementsByTagName("svg")[0].setAttribute("height", 15);
6086 // end extra chrome buttons and widgets, and nav-links
6087
6088 // the replace/alias some of the default functions
6089 var rewriterScript = document.createElement("script");
6090 rewriterScript.type = "text/javascript";
6091 rewriterScript.id = "mass_post_features-plugin_functions";
6092 rewriterScript.appendChild(
6093 document.createTextNode(
6094 rewrite1.toString().slice(13, -1)
6095 )
6096 );
6097 rewriterScript.appendChild(
6098 document.createTextNode(
6099 "// The doc_title (#) is superfluous; use a visible (#)\n" +
6100 "window.postCountMake = " +
6101 postCountMake.toString() + ";\n"
6102 )
6103 );
6104 rewriterScript.appendChild(
6105 document.createTextNode(
6106 rewrite2.toString().slice(13, -1)
6107 )
6108 );
6109 document.head.appendChild(rewriterScript);
6110 // end the default script replacements/aliases
6111
6112 // begin the plugin css below
6113 // (I tweaked this CSS for hours upon days to be utmost pretty)
6114 var pluginStyle = document.createElement("style");
6115 pluginStyle.id = "mass_post_features-plugin_style";
6116 pluginStyle.type = "text/css";
6117 pluginStyle.appendChild(
6118 document.createTextNode(
6119 (function () {/*
6120
6121h2 {
6122 display: block;
6123 font-weight: 600;
6124}
6125
6126a {
6127 text-decoration: underline;
6128}
6129
6130b, strong {
6131 font-weight: 700;
6132}
6133
6134h2 b, h2 strong {
6135 font-weight: 900;
6136}
6137
6138em, i {
6139 font-style: italic;
6140}
6141
6142ol, ul {
6143 list-style: none;
6144}
6145
6146blockquote, q {
6147 quotes: none;
6148}
6149
6150blockquote {
6151 border-left: 3px solid #000;
6152 padding-left: 4px;
6153}
6154
6155blockquote:after,
6156blockquote:before,
6157q:after,
6158q:before {
6159 content: none;
6160}
6161
6162ol, ul {
6163 margin-bottom: .75em;
6164 padding-left: 2.8em;
6165}
6166
6167ol ol,
6168ol ul,
6169ul ol,
6170ul ul {
6171 margin: 0;
6172 padding-left: 1.1em;
6173}
6174
6175ul li {
6176 list-style-type: disc;
6177}
6178
6179ul li li {
6180 list-style-type: circle;
6181}
6182
6183ol li {
6184 list-style-type: decimal;
6185 font-feature-settings: "tnum";
6186}
6187
6188blockquote, p,
6189pre {
6190 margin-bottom: .75em;
6191}
6192
6193p.npf_quirky {
6194 font-family: Fairwater, serif;
6195 font-size: 24px;
6196 line-height: 1.3em;
6197}
6198
6199p.npf_chat {
6200 font-family: Source Code Pro, monospace;
6201}
6202
6203p.npf_color_joey,
6204span.npf_color_joey {
6205 color: #ff492f;
6206}
6207
6208p.npf_color_monica,
6209span.npf_color_monica {
6210 color: #ff8a00;
6211}
6212
6213p.npf_color_phoebe,
6214span.npf_color_phoebe {
6215 color: #e8d73a;
6216}
6217
6218p.npf_color_ross,
6219span.npf_color_ross {
6220 color: #00cf35;
6221}
6222
6223p.npf_color_rachel,
6224span.npf_color_rachel {
6225 color: #00b8ff;
6226}
6227
6228p.npf_color_chandler,
6229span.npf_color_chandler {
6230 color: #7c5cff;
6231}
6232
6233p.npf_color_niles,
6234span.npf_color_niles {
6235 color: #ff62ce;
6236}
6237
6238p.npf_color_frasier,
6239span.npf_color_frasier {
6240 color: #001935;
6241}
6242
6243p.npf_color_mr_big,
6244span.npf_color_mr_big {
6245 color: #000c1a;
6246}
6247
6248@keyframes happy-bounce {
6249 0% {
6250 opacity: 0;
6251 transform: rotate(40deg) translateY(0);
6252 }
6253
6254 10% {
6255 transform: rotate(0deg) translateY(-50px);
6256 opacity: 1;
6257 }
6258
6259 20% {
6260 transform: rotate(-40deg) translateY(0);
6261 }
6262
6263 30% {
6264 transform: rotate(0deg) translateY(-40px);
6265 }
6266
6267 40% {
6268 transform: rotate(40deg) translateY(0);
6269 }
6270
6271 50% {
6272 transform: rotate(0deg) translateY(-30px);
6273 }
6274
6275 60% {
6276 transform: rotate(-40deg) translateY(0);
6277 }
6278
6279 70% {
6280 transform: rotate(0deg) translateY(-20px);
6281 }
6282
6283 80% {
6284 transform: rotate(40deg) translateY(0);
6285 }
6286
6287 90% {
6288 opacity: 1;
6289 transform: rotate(0deg) translateY(-10px);
6290 }
6291
6292 100% {
6293 opacity: 0;
6294 transform: rotate(-40deg) translateY(0);
6295 }
6296}
6297
6298@keyframes blinking {
6299 0% {
6300 opacity: 0;
6301 }
6302 50% {
6303 opacity: 1;
6304 }
6305 100% {
6306 opacity: 0;
6307 }
6308}
6309
6310@keyframes updown {
6311 100% {
6312 margin-top: 0;
6313 }
6314
6315 50% {
6316 margin-top: -15px;
6317 }
6318
6319 0% {
6320 margin-top: 0;
6321 }
6322}
6323
6324@keyframes flip {
6325 100% {
6326 transform: rotateX(0);
6327 opacity: 1;
6328 }
6329
6330 0% {
6331 transform: rotateX(-180deg);
6332 opacity: 0;
6333 }
6334}
6335
6336.l-content {
6337 min-height: calc(100vh - 177px);
6338}
6339
6340.l-content>* {
6341 opacity: 0;
6342 transition: all 0.4s ease-out;
6343}
6344
6345.l-content>*.display-none {
6346 display: none;
6347}
6348
6349#select-by-widget_title .preselect-count,
6350#select-by_widget .row,
6351.l-content>*.laid {
6352 opacity: 1;
6353 animation: flip 0.25s ease-in-out both;
6354}
6355
6356#select-by-widget_title .preselect-count.noanim,
6357#select-by_widget .row:active {
6358 animation: none;
6359 opacity: 1;
6360}
6361
6362#mass_post_features-plugin_data {
6363 display: none;
6364}
6365
6366#mass_post_features-plugin_selection_box {
6367 position: absolute;
6368 background-color: rgba(50, 90, 250, 0.4);
6369 box-shadow: inset 0 0 0 1px rgba(50, 90, 250, 1);
6370 z-index: 100;
6371 cursor: pointer;
6372}
6373
6374a.blog_title {
6375 cursor: pointer;
6376}
6377
6378#delete_posts {
6379 background-color: #c00;
6380}
6381
6382#unselect .chrome_button_right {
6383 display: inline-block;
6384}
6385
6386.blue_bar .editor_navigation {
6387 text-align: center;
6388 float: none;
6389 display: block;
6390}
6391
6392.blue_bar .editor_navigation .header_button {
6393 display: inline-block;
6394 vertical-align: top;
6395}
6396
6397#status {
6398 margin: 0px 0px -3px 0px;
6399}
6400
6401#pause_button .play,
6402#pause_button .pause {
6403 color: #fff;
6404 font-size: 10px;
6405 padding: 0 2px;
6406}
6407
6408#pause_button.playing .play,
6409#pause_button.paused .pause,
6410#pause_button.done .play,
6411#pause_button.done .pause {
6412 color: rgba(255, 255, 255, 0.3);
6413}
6414
6415.chrome h2 {
6416 display: inline-block;
6417 font-size: 25px;
6418 vertical-align: top;
6419 color: inherit;
6420 font-weight: bold;
6421}
6422
6423#remove_tags h2 {
6424 line-height: 20px;
6425}
6426
6427.chrome h2 {
6428 line-height: 23px;
6429}
6430
6431#remove_tags h2 {
6432 line-height: 20px;
6433}
6434
6435#add_tag_button,
6436#cancel_add_tag_button,
6437#cancel_remove_tag_button,
6438#remove_tag_button {
6439 margin-bottom: -30px;
6440}
6441
6442#tag_editor,
6443#tags {
6444 font: normal 11px 'Lucida Grande', Verdana, sans-serif;
6445 width: 326px;
6446 position: absolute;
6447 left: 20px;
6448 top: 19px;
6449 text-align: left;
6450 height: 170px;
6451 overflow: auto;
6452 color: #555;
6453 background-color: rgba(255, 255, 255, 0.7);
6454}
6455
6456#unselect.chrome,
6457#select-all_button.chrome,
6458#select-by_button.chrome,
6459#view-links_button.chrome,
6460#view-captions_button.chrome {
6461 background: #7D99FF none;
6462}
6463
6464.blue_bar .editor_navigation .header_button button.chrome {
6465 margin: 0 3px 0 0;
6466 padding: 0 3px;
6467 box-sizing: border-box;
6468}
6469#gutter_button input[type="number"] {
6470 width: 40px;
6471 height: 19px;
6472 padding: 0 3px;
6473 background-color: #ccc;
6474 border: 0 none;
6475 box-shadow: inset 0 2px 2px 0px #000;
6476 top: -1px;
6477 position: relative;
6478}
6479
6480#cancel5_button,
6481#add_urls_button,
6482#post_all_photos_button,
6483#cancel2_button,
6484#cancel1_button,
6485#select_button,
6486#clear_button,
6487#hide_button,
6488#list_button {
6489 border: 0 none;
6490 padding: 0 5px;
6491}
6492
6493#select_button {
6494 position: absolute;
6495 bottom: 13px;
6496 left: 10px;
6497 width: 68px;
6498}
6499
6500#reblog_widget .robot-warning {
6501 width: 190px;
6502 margin: 10px 10px 11px 10px;
6503}
6504
6505#cancel2_button {
6506 position: absolute;
6507 bottom: 10px;
6508 right: 10px;
6509}
6510
6511#cancel1_button {
6512 position: absolute;
6513 top: 10px;
6514 right: 10px;
6515}
6516
6517#clear_button {
6518 position: absolute;
6519 bottom: 13px;
6520 right: 10px;
6521}
6522
6523#hide_button {
6524 position: absolute;
6525 bottom: 7px;
6526 right: 6px;
6527 height: 24px;
6528}
6529
6530#list_button {
6531 position: absolute;
6532 bottom: 13px;
6533 right: 307px;
6534 height: 24px;
6535}
6536
6537#photos-drop-zone *,
6538#photos-drop-zone,
6539.blog_title,
6540#jump_to_month,
6541#mpe_title,
6542.post-state-nav-item,
6543.l-content>*,
6544button,
6545label {
6546 user-drag: none;
6547 user-select: none;
6548 -moz-user-select: none;
6549 -webkit-user-drag: none;
6550 -webkit-user-select: none;
6551 -ms-user-select: none;
6552}
6553
6554.l-content .brick.photo {
6555 min-height: 50px;
6556 vertical-align: ;
6557}
6558
6559.l-content .heading {
6560 padding-top: 20px;
6561}
6562
6563.l-content .brick .overprint {
6564 width: 120px;
6565 top: 0px;
6566 left: 5px;
6567}
6568
6569.l-content .brick.video .play_overlay,
6570.l-content .brick.audio .listen_overlay {
6571 z-index: 9;
6572}
6573
6574.l-content .brick {
6575 overflow: visible;
6576 background: linear-gradient(135deg,
6577 rgba(242, 242, 242, 1) 0%,
6578 rgba(209, 209, 209, 1) 44%,
6579 rgba(209, 209, 209, 1) 100%,
6580 rgba(226, 226, 226, 1) 100%);
6581}
6582
6583.l-content .brick .overflow-hidden {
6584 position: absolute;
6585 height: 100%;
6586 overflow: hidden;
6587 width: 125px0;
6588 bottom: 0;
6589 right: 0;
6590 left: 0;
6591 top: 0;
6592}
6593
6594.l-content .brick .monospace *,
6595.l-content .brick .monospace {
6596 font-family: "Courier", monospace;
6597}
6598
6599.l-content .brick .ol {
6600 display: list-item;
6601 list-style: decimal inside;
6602}
6603
6604.l-content .brick .ul {
6605 display: list-item;
6606 list-style: disc inside;
6607}
6608
6609.l-content .brick .h1 {
6610 font-size: 115%;
6611 text-align: center;
6612}
6613
6614.l-content .brick .quote {
6615 font-size: 125%;
6616 font-family: "Times", "Times New Roman", serif;
6617}
6618
6619.l-content .brick .rq {
6620 font-size: 140px;
6621 font-weight: bold;
6622 font-family: "Times", "Times New Roman", "Times", serif;
6623 color: rgba(0, 0, 0, 0.15);
6624 position: absolute;
6625 top: 0px;
6626 right: 0;
6627 line-height: 110px;
6628}
6629
6630.l-content .brick.link .rq {
6631 bottom: -20px;
6632}
6633
6634.l-content .brick.note .ask-av {
6635 display: inline-block;
6636 vertical-align: middle;
6637 border-radius: 20px;
6638}
6639
6640.l-content .brick.has-img .fade {
6641 width: 125px;
6642 height: 90px;
6643 position: absolute;
6644 left: 0;
6645 bottom: 0;
6646 background: linear-gradient(to bottom,
6647 rgba(206, 206, 206, 0) 0%,
6648 rgba(208, 208, 208, 0) 73%,
6649 rgba(209, 209, 209, 1) 100%);
6650}
6651
6652.l-content .brick .asker {
6653 display: inline-block;
6654 vertical-align: middle;
6655}
6656
6657.l-content .brick .answer {
6658 font-weight: normal;
6659 padding-top: 30px;
6660}
6661
6662.l-content .brick .h2 {
6663 font-size: 105%;
6664}
6665
6666.l-content .brick .link {
6667 text-decoration: underline;
6668}
6669
6670.l-content .brick .quirky {
6671 font-family: Fairwater, serif;
6672 font-size: 112%;
6673}
6674
6675.l-content .brick.highlighted .overlay {
6676 background: none;
6677 border: 0 none;
6678 position: absolute;
6679 top: 0;
6680 left: 0;
6681 right: 0;
6682 bottom: 0;
6683 text-align: center;
6684 color: #fff;
6685 opacity: 1;
6686 filter: none;
6687 z-index: 999;
6688 display: block;
6689}
6690
6691.l-content .brick.highlighted .overlay .inner {
6692 position: absolute;
6693 top: 0;
6694 left: 0;
6695 right: 0;
6696 margin-top: 0;
6697 height: 100%;
6698}
6699
6700.l-content .brick.highlighted .overlay .inner .date {
6701 color: #fff;
6702 position: absolute;
6703 left: 0px;
6704 right: 0px;
6705 padding: 2px 6px 0px 2px;
6706 background-color: #73bae7;
6707 height: 13px;
6708 font-size: 10px;
6709 line-height: 11px;
6710}
6711
6712.l-content .brick.highlighted .highlight .tag_count {
6713 display: block !important;
6714}
6715
6716.tag_count[style]:after {
6717 content: " tags";
6718}
6719
6720.l-content .brick.highlighted .highlight .note_count {
6721 color: #fff;
6722 position: absolute;
6723 right: 0px;
6724 bottom: 0px;
6725 padding: 2px 6px 0px 2px;
6726 background-color: #73bae7;
6727 background-color: rgba(115,186,231,0.8);
6728 height: 11px;
6729 font-size: 10px;
6730 line-height: 11px;
6731 border-top-left-radius: 5px;
6732 display: block !important;
6733}
6734
6735.l-content .brick.highlighted .overlay .inner .notes {
6736 margin-top: 5px;
6737 position: absolute;
6738 bottom: 0px;
6739 right: 0px;
6740 padding: 3px 6px 0px 5px;
6741 background-color: #73bae7;
6742 height: 13px;
6743 font-size: 10px;
6744 line-height: 10px;
6745 border-top-left-radius: 5px;
6746 display: block !important;
6747}
6748
6749#widget-top-buttons .red {
6750 border: 1px rgba(255, 0, 0, 0.4) solid;
6751 background-color: rgba(255, 0, 0, 0.1);
6752 color: rgba(255, 0, 0, 0.6);
6753 position: absolute;
6754 right: 7px;
6755 top: 30px;
6756 font-size: 10px;
6757 padding: 1px 6px;
6758 font-weight: bold;
6759}
6760
6761#widget-top-buttons .arrow,
6762.blue_bar .arrow {
6763 display: inline-block;
6764 position: relative;
6765 top: -1px;
6766 width: 0;
6767 height: 0;
6768 margin-left: 4px;
6769 border-top: 6px solid;
6770 border-right: 6px solid transparent;
6771 border-left: 6px solid transparent;
6772}
6773#widget-top-buttons .arrow {
6774 border-top-color: #555;
6775}
6776#widget-top-buttons .arrow.reverse {
6777 border-bottom: 6px solid;
6778 border-bottom-color: #99a3ae;
6779 border-top: 0;
6780}
6781
6782.blue_bar .chrome {
6783 cursor: pointer;
6784}
6785
6786.blue_bar .chrome label .arrow {
6787 border-top-color: #fff;
6788}
6789
6790.blue_bar .small_text {
6791 max-width: 210px;
6792 position: relative;
6793 margin: 0;
6794 padding: 0;
6795 color: #fff;
6796 font-size: 14px;
6797 font-weight: bold;
6798 letter-spacing: 0;
6799 line-height: 15px;
6800 text-overflow: ellipsis;
6801 white-space: nowrap;
6802 overflow: hidden;
6803 display: block;
6804 left: 10px;
6805 text-align: center;
6806}
6807
6808.blue_bar .title .blog_title {
6809 color: #99a3ae;
6810 text-decoration: none;
6811}
6812
6813#blog_menu {
6814 display: none;
6815}
6816
6817#blog_menu .avatar_img,
6818#blog_menu .avatar {
6819 display: inline-block;
6820 float: left;
6821 width: 36px;
6822 height: 36px;
6823 margin: 3px 0px 0px 3px;
6824 vertical-align: bottom;
6825}
6826
6827#blog_menu .avatar_img {
6828 border: 1px solid #000;
6829 border-radius: 4px;
6830 background-color: rgba(255, 255, 255, 0.9);
6831}
6832
6833#blog_menu .avatar {
6834 position: relative;
6835 top: 0;
6836 left: 0;
6837}
6838
6839#blog_menu .avatar svg {
6840 display: none;
6841}
6842
6843#blog_menu .avatar.reblog-to-here svg {
6844 display: block;
6845 position: absolute;
6846 background-color: rgba(0, 0, 0, 0.8);
6847 box-shadow: 0 0 0 2px #7D99FF;
6848 border-radius: 2px;
6849 top: 4px;
6850 left: 4px;
6851 width: 26px;
6852 height: 26px;
6853 padding: 5px;
6854}
6855
6856.blog_menu_child {
6857 box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.13);
6858 padding: 2px 0px 4px 0px;
6859}
6860
6861.subt {
6862 text-align: center;
6863 max-height: 40px;
6864}
6865
6866.subt a {
6867 padding: 2px;
6868 color: #7D99FF;
6869 margin: 2px;
6870}
6871
6872.subt button,
6873.subt a {
6874 cursor: pointer;
6875}
6876
6877.subt .blank-space,
6878.subt button,
6879.subt a {
6880 height: 24px;
6881 font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
6882 font-size: 10px;
6883 line-height: 14px;
6884 font-weight: bold;
6885 text-decoration: none;
6886}
6887
6888.subt .blank-space,
6889.subt button {
6890 display: inline-block;
6891 min-height: 52px;
6892 position: relative;
6893 margin: 0;
6894}
6895
6896.subt button {
6897 width: 82px;
6898 min-height: 52px;
6899 white-space: normal;
6900 top: -17px;
6901 padding: 3px 8px 3px 8px;
6902 border-color: #000;
6903 border-radius: 2px;
6904 background-color: #444;
6905 border-width: 1px;
6906 border-style: solid;
6907 color: #fff;
6908}
6909
6910.subt .blank-space {
6911 width: 60px;
6912 height: 30px;
6913 top: -19px;
6914 vertical-align: middle;
6915}
6916
6917.subt a:active {
6918 text-decoration: underline;
6919}
6920
6921.subt button:active {
6922 background-color: #969696;
6923 border-color: #8a8f96;
6924 border-color: rgba(0, 0, 0, 0.2);
6925 box-shadow: none
6926}
6927
6928.open #blog_menu {
6929 display: block;
6930 position: fixed;
6931 text-align: center;
6932 left: 0;
6933 width: 365px;
6934 height: auto;
6935 max-height: calc(100vh - 50px);
6936 padding: 0;
6937 overflow-y: auto;
6938 overflow-x: hidden;
6939 background-color: #001935;
6940 box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.13);
6941 z-index: 100;
6942 top: 0;
6943}
6944
6945a.open {
6946 cursor: normal;
6947}
6948
6949#widget_scrolling_part::-webkit-scrollbar {
6950 width: 8px;
6951 height: 10px;
6952}
6953
6954#widget_scrolling_part::-webkit-scrollbar-thumb {
6955 border-radius: 8px;
6956 background: #c2c9d2;
6957}
6958
6959.editor_navigation span input+.widget {
6960 display: none;
6961}
6962
6963.editor_navigation span input:checked+.widget {
6964 display: block;
6965}
6966
6967#urlstuff,
6968#backdate,
6969#add-caption,
6970#select-by {
6971 width: 0;
6972 height: 0;
6973 opacity: 0;
6974}
6975
6976#urlstuff_widget {
6977 padding: 30px;
6978}
6979
6980#urlstuff_widget .chrome {
6981 margin: 14px;
6982}
6983
6984.row label.not.disabled {
6985 background-color: rgba(0, 0, 0, 0.1);
6986 opacity: 0.3;
6987}
6988
6989.row label.not.ch {
6990 background-color: rgba(250, 170, 100, 0.2);
6991}
6992
6993#backdate_widget,
6994#urlstuff_widget,
6995#add-caption_widget,
6996#reblog_widget,
6997#remove_tags_widget,
6998#add_tags_widget,
6999#select-by_widget {
7000 cursor: grab !important;
7001}
7002
7003#urlstuff_body,
7004#backdate-body,
7005#reblog_widget button,
7006#reblog_widget input,
7007#tags {
7008 cursor: auto;
7009}
7010
7011.brick-dragging *,
7012.brick-dragging,
7013#backdate_widget.widget-dragging *,
7014#backdate_widget.widget-dragging,
7015#urlstuff_widget.widget-dragging *,
7016#urlstuff_widget.widget-dragging,
7017#add-caption_widget.widget-dragging *,
7018#add-caption_widget.widget-dragging,
7019#reblog_widget.widget-dragging *,
7020#reblog_widget.widget-dragging,
7021#remove_tags_widget.widget-dragging *,
7022#remove_tags_widget.widget-dragging,
7023#add_tags_widget.widget-dragging *,
7024#add_tags_widget.widget-dragging,
7025#select-by_widget.widget-dragging *,
7026#select-by_widget.widget-dragging {
7027 cursor: grabbing !important;
7028}
7029
7030#reblog_widget h2,
7031#reblog_widget div,
7032#reblog_widget span,
7033#remove_tags_widget div,
7034#add-caption_widget div,
7035#add-caption_widget h2,
7036#backdate_widget h2,
7037#backdate_widget span,
7038#backdate_widget div,
7039#urlstuff_widget h2,
7040#urlstuff_widget span,
7041#urlstuff_widget div,
7042#add-caption_widget span,
7043#select-by_widget span,
7044#select-by_widget div {
7045 user-drag: none;
7046 user-select: none;
7047 -moz-user-select: none;
7048 -webkit-user-drag: none;
7049 -webkit-user-select: none;
7050 -ms-user-select: none;
7051}
7052
7053#backdate-body {
7054 top: 20px;
7055 position: relative;
7056}
7057
7058#select-by_widget .row span.ch {
7059 background-color: rgba(100, 170, 250, 0.2);
7060}
7061
7062#select-by_widget .row label.is {
7063 position: absolute;
7064 left: 0;
7065 top: 0;
7066 right: 50px;
7067 height: 20px;
7068}
7069
7070#select-by_widget .row svg {
7071 position: absolute;
7072 left: 78px;
7073 top: 0;
7074 width: 20px;
7075 height: 20px;
7076}
7077
7078#select-by_widget .row label.is .row-child {
7079 overflow: hidden;
7080 text-overflow: ellipsis;
7081 white-space: nowrap;
7082 display: inline-block;
7083 width: 255px;
7084 font-size: 11px;
7085 line-height: 19px;
7086 left: 102px;
7087 top: 0;
7088 position: absolute;
7089 height: 20px;
7090}
7091
7092#select-by_widget .row .is span {
7093 height: 20px;
7094 line-height: 25px;
7095 font-size: 10px;
7096 position: absolute;
7097 width: 40px;
7098 right: 0px;
7099 text-align: center;
7100 top: 0;
7101}
7102
7103#select-by_widget .row .not {
7104 height: 20px;
7105 line-height: 25px;
7106 font-size: 10px;
7107 position: absolute;
7108 width: 44px;
7109 right: 0;
7110 top: 0;
7111 text-align: center;
7112}
7113
7114#select-by_widget .row label {
7115 cursor: pointer;
7116}
7117
7118#select-by_widget .row div.count {
7119 width: 72px;
7120 background-color: rgba(50, 50, 50, 0.1);
7121 height: 20px;
7122 text-align: right;
7123 text-overflow: unset;
7124 padding-right: 4px;
7125 position: absolute;
7126 overflow: hidden;
7127 left: 0;
7128 top: 0;
7129}
7130
7131#select-by_widget .row {
7132 height: 20px;
7133 position: relative;
7134 top: 0;
7135 left: 0;
7136 background-color: rgba(255, 255, 255, 0.6);
7137}
7138
7139#select-by_widget .row,
7140#select-by_widget .tags_title {
7141 border-bottom: 1px solid #ccc;
7142}
7143
7144#select-by_widget .tags_title {
7145 color: #555;
7146 height: 15px;
7147 font-size: 10px;
7148 font-weight: bold;
7149 text-align: center;
7150 background-color: rgba(50, 50, 50, 0.1);
7151}
7152
7153#select-by_widget {
7154 height: 480px;
7155}
7156
7157.widget,
7158#remove_tags_widget,
7159#add_tags_widget,
7160#reblog_widget,
7161#backdate_widget,
7162#urlstuff_widget,
7163#add-caption_widget,
7164#select-by_widget {
7165 background: rgba(235, 235, 235, 0.9) none !important;
7166 box-shadow: inset 0 0 4px 5px #fff,
7167 inset 0 0 5px 2px #000,
7168 0 0 8px 1px #000;
7169 border-radius: 9px;
7170 position: fixed;
7171}
7172
7173#select-by_widget {
7174 font: normal 12px 'Lucida Grande', Verdana, sans-serif;
7175 padding: 9px;
7176 width: 440px;
7177 text-align: left;
7178 z-index: 9;
7179}
7180
7181#tag_editor * {
7182 font: normal 14px/1.4 "Helvetica Neue",
7183 "HelveticaNeue", Helvetica, Arial, sans-serif;
7184}
7185
7186#tags,
7187#tag_editor,
7188#widget_scrolling_part {
7189 box-shadow: inset 0 0 0 1px #ccc,
7190 inset 0px 3px 6px 0px #ccc;
7191}
7192
7193#tag_editor {
7194 background: none rgba(255, 255, 255, 0.7);
7195}
7196
7197#widget_scrolling_part {
7198 overflow-x: hidden;
7199 overflow-y: auto;
7200 position: absolute;
7201 top: 48px;
7202 left: 4px;
7203 right: 4px;
7204 bottom: 48px;
7205 cursor: default;
7206}
7207
7208#widget-top-buttons,
7209#widget-top-buttons .sort {
7210 position: absolute;
7211}
7212
7213#widget-top-buttons {
7214 top: 0;
7215 left: 0;
7216 right: 0;
7217}
7218
7219#widget-top-buttons .sort {
7220 top: 30px;
7221 font-size: 12px;
7222 font-weight: bold;
7223 color: #555;
7224 cursor: pointer;
7225}
7226
7227#widget-top-buttons .sort.num {
7228 left: 15px;
7229}
7230
7231#widget-top-buttons .sort.abc {
7232 left: 90px;
7233}
7234
7235#widget-top-buttons .sort.date {
7236 left: 185px;
7237}
7238
7239.row .tag-icon {
7240 display: inline-block;
7241 width: 20px;
7242 height: 20px;
7243 margin-right: 5px;
7244 margin-left: 1px;
7245 opacity: 0.6;
7246}
7247
7248.row.type.notes-more-than .number-input,
7249.row.type.notes-less-than .number-input {
7250 border: 1px solid #555;
7251 width: 90px;
7252 position: absolute;
7253 right: 88px;
7254 height: 18px;
7255 top: 0;
7256 border: 1px solid #555;
7257 box-shadow: inset 0 1px 2px 0px #ccc;
7258}
7259
7260#urlstuff_widget input {
7261 width: 180px;
7262 height: 22px;
7263 border: 1px solid #999;
7264 padding: 2px;
7265 box-shadow: inset 0 1px 2px 0px #555;
7266}
7267
7268#select-by-widget_title {
7269 font-size: 17px;
7270 font-weight: bold;
7271 color: #555;
7272}
7273
7274#select-by-widget_title .preselect-count {
7275 color: rgba(0, 130, 0, 0.6);
7276 font-size: 12px;
7277 background-color: #fff;
7278 height: 21px;
7279 min-width: 60px;
7280 border-radius: 12px;
7281 box-shadow: inset 0 1px 2px 0px #555;
7282 margin-left: 12px;
7283 position: absolute;
7284 top: 8px;
7285 left: 160px;
7286 text-align: center;
7287 line-height: 21px;
7288 transform: translateX(-505%);
7289}
7290
7291#uncheck+label {
7292 color: #999;
7293}
7294
7295#show-only:checked+label+#uncheck+label+span,
7296#show-only+label {
7297 color: #999;
7298}
7299
7300#show-only:checked+label,
7301#uncheck:checked+label {
7302 color: #555;
7303}
7304
7305#show-only:checked+label+#uncheck+label,
7306#show-only:checked+label+#uncheck {
7307 visibility: hidden;
7308}
7309
7310#show-only {
7311 margin-top: 5px;
7312 margin-right: 60px;
7313}
7314
7315#show-only,
7316#show-only+label {
7317 float: right;
7318}
7319
7320#select-by_widget .select-by_ltgt {
7321 position: absolute;
7322 bottom: 5px;
7323 right: 90px;
7324 border: 1px solid #888;
7325 width: 203px;
7326 height: 39px;
7327}
7328
7329#gt_input,
7330#lt_input {
7331 position: absolute;
7332 left: 78px;
7333}
7334
7335#lt_input,
7336#lt_input+label {
7337 top: 4px;
7338}
7339
7340#gt_input,
7341#gt_input+label {
7342 top: 22px;
7343}
7344
7345#gt_input+label,
7346#lt_input+label {
7347 left: 0px;
7348 width: 72px;
7349 position: absolute;
7350 color: #999;
7351 text-align: right;
7352 cursor: pointer;
7353}
7354
7355#gt_input:checked+label,
7356#lt_input:checked+label {
7357 color: #555;
7358}
7359
7360#lt_input+label+#gt_input+label+#hide-ltgt-than-tags {
7361 opacity: 0.5;
7362 width: 55px;
7363 position: absolute;
7364 top: 8px;
7365 left: 97px;
7366 border: 1px solid #555;
7367 box-shadow: inset 0 1px 2px 0px #ccc;
7368 height: 23px;
7369}
7370
7371#lt_input+label+#gt_input:checked+label+#hide-ltgt-than-tags,
7372#lt_input:checked+label+#gt_input+label+#hide-ltgt-than-tags {
7373 opacity: 1;
7374}
7375
7376.l-content .brick .title {
7377 margin: 0;
7378 padding: 0;
7379 background-color: rgba(255, 255, 255, 0.1);
7380 overflow: hidden;
7381 width: 110px;
7382}
7383
7384.l-content .brick>* {
7385 max-width: 125px;
7386}
7387
7388.l-content .brick.picked {
7389 overflow: visible;
7390 box-shadow: 0 0 12px 2px rgba(14, 19, 84, 0.5);
7391 z-index: 60;
7392}
7393
7394.l-content .brick.highlighted {
7395 animation: updown 0.1s ease-in both;
7396}
7397
7398.l-content .brick.highlighted.picked {
7399 overflow: visible;
7400 box-shadow: 0 0 12px 2px rgba(0, 0, 0, 0.5);
7401 z-index: 60;
7402}
7403
7404.l-content .brick.prevent-anim,
7405.l-content .brick.highlighted.picked {
7406 animation: none;
7407}
7408
7409.l-content .brick.edit-reblog-queue .highlight {
7410 background: url(https://assets.tumblr.com/images/loading_ddd.gif) 50% 20px no-repeat rgba(225,185,35,0.9);
7411 display: block;
7412 border-color: rgba(225,95,35,1);
7413}
7414.l-content .brick.edit-reblog-queue .highlight .note_count,
7415.l-content .brick.edit-reblog-queue .highlight .tag_count,
7416.l-content .brick.edit-reblog-queue .highlight .tag_count:after,
7417.l-content .brick.edit-reblog-queue .overlay .inner .date {
7418 background-color: rgba(225,95,35,1);
7419}
7420*/}).toString().slice(15,-3) + // this is a pointing hand graphic
7421'.l-content .brick.picked:before { content: ""; top: -35px;\n'+
7422'width: 50px; height: 50px; position: absolute;left: 25px;\n' +
7423'animation: updown 0.5s infinite ease-out both;\n' + // bounces up&down :)
7424'background: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iM' +
7425'S4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM' +
7426'6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0ia' +
7427'HR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly9' +
7428'3d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0ia' +
7429'HR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9' +
7430'yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY' +
7431'2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR' +
7432'0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgd2lkdGg9I' +
7433'jI0IgogICBoZWlnaHQ9IjI0IgogICB2aWV3Qm94PSIwIDAgMjQgMjQiCiAgIHZlcnNpb24' +
7434'9IjEuMSIKICAgaWQ9InN2ZzQiCiAgIHNvZGlwb2RpOmRvY25hbWU9ImI2NC5zdmciCiAgI' +
7435'Glua3NjYXBlOnZlcnNpb249IjAuOS41ICgyMDYwZWMxZjlmLCAyMDIwLTA0LTA4KSI+CiA' +
7436'gPG1ldGFkYXRhCiAgICAgaWQ9Im1ldGFkYXRhMTAiPgogICAgPHJkZjpSREY+CiAgICAgI' +
7437'DxjYzpXb3JrCiAgICAgICAgIHJkZjphYm91dD0iIj4KICAgICAgICA8ZGM6Zm9ybWF0Pml' +
7438'tYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4KICAgICAgICA8ZGM6dHlwZQogICAgICAgICAgI' +
7439'HJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2U' +
7440'iIC8+CiAgICAgICAgPGRjOnRpdGxlPjwvZGM6dGl0bGU+CiAgICAgIDwvY2M6V29yaz4KI' +
7441'CAgIDwvcmRmOlJERj4KICA8L21ldGFkYXRhPgogIDxkZWZzCiAgICAgaWQ9ImRlZnM4IiA' +
7442'vPgogIDxzb2RpcG9kaTpuYW1lZHZpZXcKICAgICBwYWdlY29sb3I9IiNmZmZmZmYiCiAgI' +
7443'CAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgYm9yZGVyb3BhY2l0eT0iMSIKICAgICB' +
7444'vYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGdyaWR0b2xlcmFuY2U9IjEwIgogICAgIGd1a' +
7445'WRldG9sZXJhbmNlPSIxMCIKICAgICBpbmtzY2FwZTpwYWdlb3BhY2l0eT0iMCIKICAgICB' +
7446'pbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iN' +
7447'zMyIgogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9IjQ4MCIKICAgICBpZD0ibmFtZWR' +
7448'2aWV3NiIKICAgICBzaG93Z3JpZD0iZmFsc2UiCiAgICAgaW5rc2NhcGU6em9vbT0iOS44I' +
7449'gogICAgIGlua3NjYXBlOmN4PSIxMiIKICAgICBpbmtzY2FwZTpjeT0iMTIiCiAgICAgaW5' +
7450'rc2NhcGU6d2luZG93LXg9IjAiCiAgICAgaW5rc2NhcGU6d2luZG93LXk9IjAiCiAgICAga' +
7451'W5rc2NhcGU6d2luZG93LW1heGltaXplZD0iMCIKICAgICBpbmtzY2FwZTpjdXJyZW50LWx' +
7452'heWVyPSJzdmc0IiAvPgogIDxwYXRoCiAgICAgZD0ibSA1LjQsMTYuNCBjIDEuMSwwLjIgN' +
7453'C42LDAuOSA1LjUsMS4wIHYgMy41IGMgMCwxLjYgMS4zLDIuOSAzLDIuOSAxLjYsMCAzLC0' +
7454'xLjMgMywtMi45IHYgLTcuNCBjIDAuNSwwLjMgMS4xLDAuNiAxLjgsMC43IEMgMjAuNiwxN' +
7455'C41IDIyLDEzLjMgMjIsMTEuOCAyMiwxMSAyMS42LDEwLjEgMjAuOSw5LjUgMTcuMCw1LjU' +
7456'gMTUuMiw0LjQgMTQuOSwwIEggNSB2IDEuNyBjIDAsNS4xIC0zLDYuMCAtMywxMC4wIDAsM' +
7457'i40IDEuMCw0LjEgMy40LDQuNiB6IgogICAgIGlkPSJwYXRoMTQiIC8+CiAgPHBhdGgKICA' +
7458'gICBkPSJNIDUuMSw4LjQgQyA1LjksNi45IDYuOSw1LjEgNi45LDIgaCA2LjEgYyAwLjcsM' +
7459'y44IDMuOCw2LjMgNi40LDguOSAwLjYsMC42IDAuMywxLjMgLTAuNCwxLjMgQyAxNy44LDE' +
7460'yLjMgMTYuMCwxMC40IDE1LDkuMSBWIDIxLjAgQyAxNSwyMS41IDE0LjUsMjIgMTQsMjIgM' +
7461'TMuNCwyMiAxMywyMS41IDEzLDIxLjAgdiAtNi45IGMgMCwtMC4zIC0wLjIsLTAuNSAtMC4' +
7462'1LC0wLjUgLTAuMywwIC0wLjUsMC4yIC0wLjUsMC41IHYgMC41IGMgMCwwLjUgLTAuNCwwL' +
7463'jkgLTEuMCwwLjggLTAuMywtMC4wIC0wLjYsLTAuNCAtMC42LC0wLjggdiAtMS4yIGMgMCw' +
7464'tMC4zIC0wLjIsLTAuNSAtMC41LC0wLjUgLTAuMywwIC0wLjUsMC4yIC0wLjUsMC41IHYgM' +
7465'C44IGMgMCwwLjUgLTAuNCwwLjkgLTEuMCwwLjggQyA3LjYsMTQuOSA3LjMsMTQuNiA3LjM' +
7466'sMTQuMiB2IC0xLjUgYyAwLC0wLjMgLTAuMiwtMC41IC0wLjUsLTAuNSAtMC4zLDAgLTAuN' +
7467'SwwLjIgLTAuNSwwLjUgdiAwLjkgYyAwLDAuNSAtMC41LDAuOCAtMS4wLDAuNiBDIDQuNSw' +
7468'xMy45IDQsMTMuMyA0LDExLjcgNCwxMC40IDQuNCw5LjUgNS4xLDguNCBaIgogICAgIGlkP' +
7469'SJwYXRoMiIKICAgICBzdHlsZT0iZmlsbDojZmZmZmZmIiAvPgo8L3N2Zz4K") 0 0 ' +
7470'no-repeat transparent;\nbackground-size: 50px 50px; z-index: 1001;}' +
7471// this ^ is a hand pointing pointer graphic
7472// this v is a tiny robot head icon
7473'.robot-warning { padding: 8px 9px 8px 21px;' + // :) tampermonkey tells
7474'background: 4px 2px no-repeat url("' + // me it's superfluous to combine
7475'data:image/png;base64,iVBORw0KGgoAAAANSU' + // string literals with the
7476'hEUgAAABAAAAAYBAMAAAABjmA/AAAAElBMVEUAAA' + // + operator! but it's
7477'ABBABHSEajnp28trX8//tPIl81AAAAAXRSTlMAQO' + // also not lint to
7478'bYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAALiMAAC' + // go above 80 characters
7479'4jAXilP3YAAAAHdElNRQfkBQgSLgK2/ku1AAAAa0' + // in width...
7480'lEQVQI123O2w3AIAgFUNygoAxANzBxAasL+OH+qx' + // dear StackExchange...
7481'R8tGnS+3USLgEAAIQZ148J7m0jr9G1Rk8Z3Be4An' +
7482'SOCIQ6khWp1mKIkgp5BfeQe/tFxFTQOsW2k4KIRM' + // kumate!
7483'Q6zK1ZxxuiQuwk5ffWfuMG6yMYLhjK67sAAAAASU' +
7484'VORK5CYII=") rgba(255,190,170,1);' +
7485'box-shadow: 0 0 0 1px red;font-size: 12px;font-weight: normal;'+
7486'color: red; width: 172px;overflow-wrap: normal;'+
7487'white-space: normal;margin: 9px;display:block;}' +
7488(function () {/*
7489.l-content .brick .private_overlay {
7490 z-index: 9;
7491}
7492
7493.robot-warning strong {
7494 font-size: 13px;
7495 font-weight: bold;
7496 display: block;
7497}
7498
7499.blue_bar .editor_navigation .notice {
7500 color: rgba(150, 150, 150, 1);
7501 margin: 0;
7502 padding: 5px 0px 0px 5px;
7503 float: right;
7504}
7505
7506.l-content .brick .caption {
7507 display: none;
7508}
7509
7510.l-content.with-captions .brick .caption {
7511 display: table;
7512 background: rgba(40, 50, 60, 0.6);
7513 box-shadow: inset 0 0 0 4px rgba(40, 50, 60, 0.6);
7514 color: #fff;
7515 position: absolute;
7516 top: 0;
7517 left: 0;
7518 right: 0;
7519 bottom: 0;
7520 z-index: 99;
7521 text-align: left;
7522 width: 125px;
7523 height: 100%;
7524 animation: fadein 0.5s ease-in-out both;
7525}
7526
7527.overflow-table {
7528 display: table;
7529 position: absolute;
7530 top: 0;
7531 left: 0;
7532 right: 0;
7533 bottom: 0;
7534 width: 125px;
7535 height: 100%;
7536}
7537
7538.overflow-row,
7539.caption-tr {
7540 display: table-row;
7541}
7542
7543.overflow-cell,
7544.caption-td {
7545 display: table-cell;
7546 text-align: center;
7547 vertical-align: middle;
7548}
7549
7550.overflow-inline {
7551 display: inline-block;
7552 text-align: left;
7553}
7554
7555.caption-inline-block {
7556 display: inline-block;
7557 text-align: left;
7558 max-width: 115px;
7559 max-height: 115px;
7560 overflow: hidden;
7561}
7562
7563.header_button > input[disabled]+.widget+.chrome svg,
7564.header_button > input[disabled]+.widget+.chrome .arrow,
7565.chrome.big_dark[disabled] svg {
7566 opacity: 0.5;
7567}
7568
7569.chrome.big_dark svg,
7570.chrome_button svg {
7571 opacity: 1;
7572 margin-right: 1px;
7573 vertical-align: middle;
7574 vertical-align: text-top;
7575}
7576
7577#neue_post_form-iframe {
7578 position: fixed;
7579 top: 0;
7580 left: 0;
7581 right: 0;
7582 bottom: 0;
7583 width: 100%;
7584 height: 100%;
7585 z-index: 999;
7586 background-color: rgba(0, 10, 30, 0.9);
7587 animation: fadein 0.5s ease-in-out both;
7588}
7589
7590.l-content .links-layer {
7591 display: none;
7592}
7593
7594.l-content .brick .edited-gif,
7595.l-content.with-links .brick .links-layer {
7596 background-color: rgba(40, 50, 60, 0.6);
7597 box-shadow: inset 0 0 0 4px rgba(40, 50, 60, 0.6);
7598 position: absolute;
7599 top: 0;
7600 left: 0;
7601 right: 0;
7602 bottom: 0;
7603 color: #fff;
7604 z-index: 100;
7605 display: table;
7606 width: 125px;
7607 height: 100%;
7608 animation: fadein 0.5s ease-in-out both;
7609}
7610
7611.l-content.with-links .brick .tags-layer,
7612.l-content.with-links .brick .links-layer {
7613 transition: all 0.2s ease-out;
7614}
7615
7616.l-content.with-links .brick:hover .links-layer,
7617.l-content.with-links .brick:hover .tags-layer {
7618 color: rgba(255, 255, 255, 0);
7619 background-color: rgba(0, 0, 0, 0);
7620}
7621
7622.l-content.with-links .brick.highlighted .links-layer {
7623 z-index: 1000;
7624 background-color: rgba(0, 80, 255, 0.5);
7625 box-shadow: inset 0 0 0 4px rgba(115, 186, 231, 1);
7626}
7627
7628.l-content.with-links .brick.highlighted:hover .links-layer {
7629 background-color: rgba(0, 80, 255, 0.05);
7630}
7631
7632.brick.highlighted a.link-reblog,
7633.brick.highlighted a.link-like,
7634.brick.highlighted a.link-edit,
7635.brick.highlighted a.link-view {
7636 background: rgba(115, 186, 231, 1);
7637}
7638
7639.l-content .brick .edited-gif .trow,
7640.l-content.with-links .links-layer .trow {
7641 display: table-row;
7642 vertical-align: middle;
7643 text-align: center;
7644}
7645
7646.l-content .brick .tags-layer,
7647.l-content .brick .edited-center {
7648 display: table-cell;
7649 vertical-align: middle;
7650 text-align: center;
7651 padding: 0px 18px 0 18px;
7652}
7653
7654.links-layer a.link-view {
7655 position: absolute;
7656 right: 4px;
7657 top: 4px;
7658 border-bottom-left-radius: 5px
7659}
7660
7661.links-layer a.link-edit {
7662 position: absolute;
7663 left: 4px;
7664 bottom: 4px;
7665 border-top-right-radius: 5px;
7666}
7667
7668.links-layer a.link-like {
7669 right: 4px;
7670 bottom: 4px;
7671 border-top-left-radius: 5px;
7672}
7673
7674.links-layer a.link-reblog {
7675 left: 4px;
7676 top: 4px;
7677 border-bottom-right-radius: 5px;
7678}
7679
7680.links-layer a.link-reblog,
7681.links-layer a.link-like,
7682.links-layer a.link-edit,
7683.links-layer a.link-view {
7684 background-color: rgba(40, 50, 60, 0.6);
7685 padding: 3px;
7686 width: 20px;
7687 height: 20px;
7688 text-align: center;
7689 position: absolute;
7690}
7691
7692svg.big-heart,
7693svg.big-reblog {
7694 position: absolute;
7695 left:0;
7696 bottom:0;
7697 width: 125px;
7698 height: 125px;
7699 z-index: 999;
7700 animation: happy-bounce 1.7s ease-out both;
7701}
7702
7703.links-layer a.link-reblog.clicked svg,
7704.links-layer a.link-like.clicked svg {
7705 animation: flip 0.75s infinite ease-out both;
7706 position: relative;
7707}
7708
7709.links-layer a.link-reblog.clicked svg,
7710.links-layer a.link-like.new-liked svg {
7711 animation: updown 0.75s ease-out both;
7712 position: relative;
7713}
7714
7715.links-layer a.link-reblog.reblogged {
7716 cursor: default;
7717}
7718
7719#view-links_button svg {
7720 margin: 0;
7721}
7722
7723#mpe_title {
7724 position: relative;
7725 display: inline-block;
7726}
7727
7728.post-state-nav-item {
7729 display: inline-block;
7730 text-decoration: none;
7731}
7732
7733.post-state-nav-item svg {
7734 opacity: 0.5;
7735 display: inline-block;
7736 vertical-align: text-top;
7737}
7738
7739.post-state-nav-item.active svg {
7740 opacity: 1;
7741}
7742
7743.blue_bar .post-state-nav .post-state-nav-item {
7744 color: #99a3ae;
7745 font-weight: bold;
7746 padding: 3px 6px;
7747 top: 0;
7748 left: 0;
7749 z-index: 9;
7750 position: relative;
7751 background: #001935 none;
7752}
7753
7754#re-as-draft:checked+label+.robot-warning {
7755 display: none;
7756}
7757
7758#re-as-draft+label {
7759 color: #7D99FF;
7760 padding-left: 5px;
7761 font-size: 20px;
7762}
7763
7764#reblog_widget {
7765 display: none;
7766}
7767
7768.open #reblog_widget {
7769 width: 300px;
7770 height: 200px;
7771 z-index: 999;
7772 left: 340px;
7773 display: table;
7774}
7775
7776#urlstuff_widget,
7777#backdate_widget,
7778#add-caption_widget {
7779 z-index: 9;
7780}
7781
7782#reblog_widget .trow {
7783 display: table-row;
7784}
7785
7786#reblog_widget .inner {
7787 display: table-cell;
7788 vertical-align: middle;
7789 text-align: center;
7790}
7791
7792#reblog_widget h2 {
7793 color: #555;
7794 font-size: 17px;
7795}
7796
7797#reblog-widget_input {
7798 width: 190px;
7799 padding: 6px;
7800 box-shadow: inset 0 2px 3px 0px rgba(0, 0, 0, 0.5);
7801 margin: 0;
7802 border: 0 none;
7803}
7804
7805.header_button > input[disabled]+.widget+.chrome,
7806#reblog-widget_input[disabled] {
7807 color: #ccc;
7808}
7809
7810#browse_months {
7811 position: relative;
7812 top: -3px;
7813 left: 0;
7814}
7815
7816iframe#browse_months_widget {
7817 height: 423px;
7818 width: 226px;
7819 border-radius: 5px;
7820 box-shadow: 0 0 4px 2px rgba(0, 0, 0, 0.2);
7821}
7822
7823div#browse_months_widget {
7824 height: 422px;
7825 width: 225px;
7826 padding: 0px;
7827 top: 0px;
7828 left: 0px;
7829}
7830
7831.post-state-nav,
7832#mpe_title,
7833#nav-photo {
7834 border-left: 1px solid #122943;
7835 padding-left: 20px;
7836}
7837.chrome_button_right, .chrome_button_left {
7838 display: inline;
7839}
7840
7841#tags {
7842 padding: 5px;
7843}
7844
7845#tags div {
7846 margin: 0px 5px 5px 0px;
7847 overflow: hidden;
7848 display: inline-block;
7849 border: solid 1px rgba(255,75,35,1);
7850 background-color: rgba(255,75,35,0.4);
7851 padding: 5px;
7852 border-radius: 2px;
7853 color: #111;
7854 max-width: 200px;
7855 text-overflow: ellipsis;
7856 white-space: nowrap;
7857}
7858
7859#photos-drop-zone.full {
7860 cursor: copy;
7861 top: 0;
7862 left: 0;
7863 right: 0;
7864 bottom: 0;
7865 height: 100%;
7866 width: 100%;
7867 background-color: rgba(200,255,200,0.5);
7868 z-index: 1000;
7869}
7870
7871#photos-drop-zone {
7872 top: 90px;
7873 left: 20px;
7874 width: 300px;
7875 height: 190px;
7876 transition: all 0.4s ease-out;
7877 background-color: rgb(220, 220, 220);
7878 position: fixed;
7879 display: block;
7880 text-align: center;
7881 border-radius: 14px;
7882 box-shadow: inset 0 0 0 5px #f4f4f4, 0 0 0 4px rgb(220, 220, 220);
7883 z-index: 9;
7884}
7885
7886#photos-drop-zone h2 {
7887 color: #f4f4f4;
7888 display: inline;
7889 font-size: 25px;
7890 font-weight: bold;
7891 top: 20px;
7892 position: relative;
7893 text-align: center;
7894 display: block;
7895}
7896
7897#photos-drop-zone input {
7898 position: relative;
7899 top: 210px;
7900}
7901
7902#drop_images_here {
7903 position: fixed;
7904 top: 168px;
7905 left: 70px;
7906 z-index: 12;
7907 font-size: 23px;
7908}
7909
7910#photo_file_input {
7911 position: fixed;
7912 bottom: 40px;
7913 left: 40px;
7914}
7915
7916#post_all_photos_button {
7917 position:fixed;
7918 top: 300px;
7919 cursor: pointer;
7920 color: #fff;
7921 font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
7922 font-size: 14px;
7923 line-height: 14px;
7924 left: 40px;
7925}
7926
7927#post_all_photos_button[disabled] {
7928 color: #ccc;
7929}
7930
7931.photo-brick.upload-working {
7932 animation: updown 0.3s infinite linear;
7933}
7934
7935.photo-brick-img,
7936.photo-brick {
7937 transition: all 0.4s ease-out;
7938}
7939.photo-brick {
7940 position: absolute;
7941 width: 500px;
7942 background-color: rgb(220, 220, 220);
7943 cursor: grab;
7944 display: table;
7945 min-height: 150px;
7946}
7947
7948.img-count {
7949 position: absolute;
7950 bottom: 0;
7951 right: 0;
7952 font-size: 21px;
7953 color: rgba(255,255,255,0.9);
7954 z-index: 9;
7955 font-weight: bold;
7956 background-color: rgba(0,0,0,0.65);
7957 padding: 6px 9px;
7958 border-top-left-radius: 9px;
7959}
7960
7961.photo-inner {
7962 display: table-row;
7963 height: 100%;
7964 width: 100%;
7965}
7966
7967.photo-brick-img.brick-dragging,
7968.photo-brick.brick-dragging {
7969 z-index: 1000;
7970 opacity: 0.3;
7971 box-shadow: 0 0 5px 2px #000;
7972 transition: none;
7973 postion: absolute;
7974}
7975
7976.photo-brick.hl-top {
7977 border-top: 3px dashed #0cf;
7978 margin-top: 5px;
7979}
7980
7981.photo-brick.hl-bottom {
7982 margin-top: -5px;
7983 border-bottom: 3px dashed #0cf;
7984}
7985
7986.hl-up {
7987 border-top: 3px dashed #0cf;
7988 margin-top: 5px;
7989}
7990
7991.hl-down {
7992 border-bottom: 3px dashed #0cf;
7993 margin-bottom: 5px;
7994}
7995
7996.hl-left {
7997 border-left: 3px dashed #0cf;
7998 margin-left: 5px;
7999}
8000
8001.hl-right {
8002 border-right: 3px dashed #0cf;
8003 margin-right: 5px;
8004}
8005
8006.photo-brick-edit {
8007 display: table-cell;
8008}
8009
8010.photo-brick-img-cell {
8011 position: relative;
8012 display: table-cell;
8013 vertical-align: middle;
8014 text-align: center;
8015 top: 0;
8016 left: 0;
8017 width: 137px;
8018 background-color: #001935;
8019}
8020
8021.pre-photoset .photo-brick-img-cell {
8022 background-color: #405975;
8023 box-shadow: inset 0 0 8px 1px #fff;
8024}
8025
8026.photo-brick-img:first-child {
8027 margin-top: 5px;
8028}
8029
8030.photo-brick-img {
8031 display: inline-block;
8032 position: relative;
8033 top: 0;
8034 left: 0;
8035 margin-bottom: 5px;
8036}
8037
8038.photo-brick-img.brick-dragging,
8039.photo-brick-img.brick-dragging img,
8040.row-with-one-img,
8041.row-with-one-img img {
8042 width: 125px;
8043}
8044
8045.row-with-two-img,
8046.row-with-two-img img {
8047 width: 60px;
8048}
8049
8050.row-with-three-img,
8051.row-with-two-img {
8052 overflow: hidden;
8053}
8054
8055.row-with-three-img img,
8056.row-with-two-img img {
8057 width: 100%;
8058 height: auto;
8059 max-width: 125px;
8060}
8061
8062.row-with-two-img.data-photoset-a {
8063 margin-right: 5px;
8064}
8065
8066.row-with-three-img,
8067.row-with-three-img img {
8068 width: 38px;
8069}
8070
8071.row-with-three-img.data-photoset-a,
8072.row-with-three-img.data-photoset-b {
8073 margin-right: 5px;
8074}
8075
8076.photo-brick img {
8077 user-drag: none;
8078 user-select: none;
8079 -moz-user-select: none;
8080 -webkit-user-drag: none;
8081 -webkit-user-select: none;
8082 -ms-user-select: none;
8083}
8084
8085.photo-brick-edit .rich {
8086 background-color: rgba(255,255,255,0.8);
8087 margin: 34px 6px 0px 6px;
8088 box-shadow: inset 0 2px 3px 0 #999;
8089 padding: 5px;
8090 cursor: auto;
8091 overflow-y: scroll;
8092 overflow-x: hidden;
8093 text-align: left;
8094 display: block;
8095 width: 340px;
8096 height: calc(100% - 42px);
8097}
8098
8099#add-caption_widget .rich {
8100 background-color: rgba(255,255,255,0.8);
8101 margin: 30px 7px 0px 7px;
8102 box-shadow: inset 0 2px 3px 0 #999;
8103 padding: 5px;
8104 cursor: auto;
8105 overflow-y: scroll;
8106 overflow-x: hidden;
8107 display: block;
8108 width: 340px;
8109 height: 150px;
8110 text-align: left;
8111}
8112
8113#add-caption_widget.visible-url .chrome,
8114#add-caption_widget .chrome,
8115.focused-rich.visible-url .photo-brick-edit .chrome,
8116.photo-brick-edit .chrome {
8117 font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
8118 font-size: 14px;
8119 display: none;
8120 position: absolute;
8121 cursor: pointer;
8122 min-width: 30px;
8123}
8124
8125#add-caption_widget {
8126 height: 300px;
8127 width: 365px;
8128}
8129
8130#backdate_widget {
8131 height: 260px;
8132 width: 540px;
8133 font-family: "Helvetica Neue", Arial, Helvetica, sans-serif;
8134 font-size: 14px;
8135}
8136
8137#backdate_widget .chrome{
8138 margin: 5px;
8139 float: right;
8140 padding: 0 8px;
8141}
8142
8143#backdate_widget .chrome,
8144#add-caption_widget .chrome {
8145 border: 0 none;
8146}
8147
8148.focused-rich.visible-url .photo-brick-edit .chrome,
8149.photo-brick-edit .chrome {
8150 top: 3px;
8151}
8152
8153#add-caption_widget .chrome {
8154 top: 45px;
8155}
8156
8157.photo-brick.focused-rich {
8158 z-index: 100;
8159 box-shadow: 0 0 5px 1px #03f;
8160 margin: -2px 0px 0px 5px;
8161}
8162
8163.photo-brick-edit .photo-tags {
8164 max-height: 135px;
8165 display: inline-block;
8166 position: absolute;
8167 right: 0;
8168 max-width: 300px;
8169 overflow: hidden;
8170 text-overflow: ellipsis;
8171 top: 0;
8172 transform: translateX(100%);
8173}
8174
8175.focused-rich .photo-tags {
8176 overflow: auto;
8177 background-color: rgba(0, 33, 255, 0.5);
8178 padding: 4px 0px 0px 6px;
8179}
8180
8181#add-caption_widget.visible-url .chrome,
8182#add-caption_widget .chrome,
8183.focused-rich .photo-brick-edit .chrome {
8184 display: block;
8185}
8186
8187.stripe {
8188 position: absolute;
8189 top: 7px;
8190 left: 143px;
8191 border-top: 5px solid #BBB;
8192 height: 10px;
8193 width: calc(100% - 150px);
8194 display: block;
8195 border-bottom: 5px solid #BBB;
8196}
8197
8198.focused-rich .photo-brick-edit .stripe {
8199 display: none;
8200}
8201
8202.focused-rich .photo-brick-edit .photo-tags .token {
8203 float: left;
8204 padding: 3px 5px;
8205 border: solid 1px #b7c963;
8206 background-color: #C7DA76;
8207 color: #111;
8208 margin: 0px 5px 5px 0px;
8209 border-radius: 2px;
8210 font: normal 14px/1.4 "Helvetica Neue",
8211 "HelveticaNeue", Helvetica, Arial, sans-serif;
8212 text-decoration: none;
8213 cursor: auto;
8214}
8215
8216.photo-brick-edit .photo-tags .token .tag:before {
8217 content: "#";
8218 display: inline-block;
8219}
8220
8221.focused-rich .photo-brick-edit .photo-tags .token .tag:before {
8222 content: "";
8223 display: none;
8224}
8225
8226.photo-brick-edit .token a {
8227 display: none;
8228}
8229
8230#add-caption_widget a,
8231.focused-rich .photo-brick-edit .token a {
8232 font-weight: bold;
8233 margin-left: 7px;
8234 text-decoration: none;
8235 color: #749440;
8236 display: inline-block;
8237}
8238
8239.photo-brick-edit .photo-tags .token {
8240 float: left;
8241 padding: 3px 5px;
8242 color: #999;
8243 font-weight: bold;
8244 margin: 0px 5px 5px 0px;
8245 font: normal 14px/1.4 "Helvetica Neue",
8246 "HelveticaNeue", Helvetica, Arial, sans-serif;
8247 text-decoration: underline;
8248 display: inline-block;
8249 cursor: auto;
8250}
8251
8252.photo-brick-edit .clone_abc_button {
8253 right: 265px;
8254 width: 94px;
8255 line-height: 11px;
8256 top: -31px;
8257 box-shadow: 0 1px 0 3px rgb(220, 220, 220),
8258 0 0 5px 3px #03f;
8259}
8260
8261#add-caption_widget .pink_button,
8262#add-caption_widget .x_button,
8263.photo-brick-edit .pink_button,
8264.photo-brick-edit .x_button {
8265 right: 327px;
8266 font-weight: 900;
8267 color: #f00;
8268}
8269
8270#add-caption_widget .red_button,
8271#add-caption_widget .b_button,
8272.photo-brick-edit .red_button,
8273.photo-brick-edit .b_button {
8274 right: 295px;
8275 font-weight: 900;
8276}
8277
8278#add-caption_widget .orange_button,
8279#add-caption_widget .i_button,
8280.photo-brick-edit .orange_button,
8281.photo-brick-edit .i_button {
8282 right: 263px;
8283 font-style: italic;
8284}
8285
8286#add-caption_widget .yellow_button,
8287#add-caption_widget .s_button,
8288.photo-brick-edit .yellow_button,
8289.photo-brick-edit .s_button {
8290 right: 231px;
8291 font-style: italic;
8292 text-decoration-line: line-through;
8293}
8294
8295#add-caption_widget .green_button,
8296#add-caption_widget .a_button,
8297.photo-brick-edit .green_button,
8298.photo-brick-edit .a_button {
8299 right: 199px;
8300 color: #009;
8301 text-decoration-line: underline;
8302}
8303
8304#add-caption_widget .ok_button,
8305.focused-rich .photo-brick-edit .ok_button {
8306 right: 7px;
8307 display: none;
8308}
8309
8310#add-caption_widget.visible-url .chrome,
8311#add-caption_widget.visible-colors .chrome,
8312#add-caption_widget .colors_buttons,
8313.focused-rich.visible-colors .photo-brick-edit .chrome,
8314.photo-brick-edit .colors_buttons,
8315.focused-rich .photo-brick-edit .colors_buttons {
8316 display: none;
8317}
8318
8319#add-caption_widget .a_button_input,
8320.photo-brick-edit .a_button_input,
8321.focused-rich .photo-brick-edit .a_button_input {
8322 display: none;
8323 right: 199px;
8324 color: #009;
8325 text-decoration-line: underline;
8326 position: absolute;
8327 top: 3px;
8328 height: 30px;
8329 width: 318px;
8330 padding: 0 3px;
8331 left: 143px;
8332 background-color: #fff;
8333 box-shadow: 0 0 0 1px #eee, inset 0 2px 2px 0 #000;
8334}
8335
8336#add-caption_widget.visible-url .a_button_input,
8337#add-caption_widget.visible-url .ok_button,
8338.focused-rich.visible-url .photo-brick-edit .a_button_input,
8339.focused-rich.visible-url .photo-brick-edit .ok_button {
8340 display: block;
8341}
8342
8343#add-caption_widget.visible-colors .colors_buttons,
8344.focused-rich.visible-colors .photo-brick-edit .colors_buttons {
8345 display: block;
8346}
8347
8348#add-caption_widget .cerulean_button,
8349#add-caption_widget .h_button,
8350.photo-brick-edit .cerulean_button,
8351.photo-brick-edit .h_button {
8352 right: 167px;
8353 font-weight: 900;
8354}
8355
8356#add-caption_widget .blue_button,
8357#add-caption_widget .ol_button,
8358.photo-brick-edit .blue_button,
8359.photo-brick-edit .ol_button {
8360 right: 135px;
8361}
8362
8363#add-caption_widget .ul_button,
8364.photo-brick-edit .ul_button {
8365 right: 103px;
8366}
8367
8368#add-caption_widget .bq_button,
8369.photo-brick-edit .bq_button {
8370 right: 71px;
8371}
8372
8373#add-caption_widget .colors_button,
8374.photo-brick-edit .colors_button {
8375 right: 39px;
8376}
8377
8378#add-caption_widget .q_button,
8379.photo-brick-edit .q_button {
8380 right: 7px;
8381 font-family: Fairwater, serif;
8382 font-size: 17px;
8383 line-height: 26px;
8384}
8385
8386#add-caption_widget .colors_button .color,
8387.photo-brick-edit .colors_button .color {
8388 width: 14px;
8389 height: 17px;
8390 border-radius: 6px;
8391 box-shadow: inset 0 0 0 1px #fff;
8392 background: linear-gradient(
8393 to bottom,
8394 rgba(255,0,0,1) 0%,
8395 rgba(255,85,0,1) 20%,
8396 rgba(255,255,0,1) 40%,
8397 rgba(0,255,0,1) 60%,
8398 rgba(0,0,255,1) 80%,
8399 rgba(255,0,255,1) 100%
8400 );
8401}
8402
8403#photos_as_draft_container {
8404 position: fixed;
8405 top: 340px;
8406 left: 50px;
8407}
8408
8409#photos_as_draft + label + .robot-warning {
8410 display: block;
8411}
8412
8413#photos_as_draft:checked + label + .robot-warning {
8414 display: none;
8415}
8416
8417#return_to_dash_link {
8418 position: fixed;
8419 top: 50%;
8420 left: 50%;
8421 transform: translate(-50%, -50%);
8422 color: #555;
8423 font-size: 45px;
8424}
8425
8426#add-caption_widget .robot-warning {
8427 display: inline-block;
8428}
8429
8430.pend-container {
8431 text-align: left;
8432}
8433
8434.pend-container div {
8435 height: 20px;
8436}
8437
8438.pend-container label {
8439 cursor: pointer;
8440}
8441
8442#overwrite-caption-option + label +.robot-warning {
8443 position: absolute;
8444 left: 70px;
8445 bottom: -11px;
8446 width: 136px;
8447 display: none;
8448 height: 50px;
8449}
8450
8451#overwrite-caption-option:checked + label +.robot-warning {
8452 display: block;
8453}
8454
8455.pend-container {
8456 position: relative;
8457 left: 6px;
8458 bottom: -6px;
8459}
8460
8461#bt-no-time + label,
8462#bt-one-time + label,
8463#bt-two-time + label,
8464#bd-no-day + label,
8465#bd-one-day + label,
8466#bd-two-day + label {
8467 width: 130px;
8468 text-align: left;
8469 height: 19px;
8470 background-color: rgba(14,20,25,0.5);
8471 border-radius: 10px;
8472 color: #fff;
8473 padding: 5px 20px;
8474}
8475
8476#bt-no-time:checked + label,
8477#bt-one-time:checked + label,
8478#bt-two-time:checked + label,
8479#bd-no-day:checked + label,
8480#bd-one-day:checked + label,
8481#bd-two-day:checked + label {
8482 background-color: #0ae;
8483}
8484
8485#bt-no-time,
8486#bt-one-time,
8487#bt-two-time,
8488#bd-no-day,
8489#bd-one-day,
8490#bd-two-day {
8491 position: relative;
8492 left: 18px;
8493}
8494
8495.date-input-bunch * {
8496 float: left;
8497 line-height: 17px;
8498}
8499
8500.date-input-bunch {
8501 display: inline-block;
8502 background-color: rgba(30,85,125,1);
8503 color: #fff;
8504 margin: 0px 3px;
8505 width: 245px;
8506 height: 22px;
8507 top: 9px;
8508 position: relative;
8509 padding: 3px 0px 3px 5px;
8510}
8511
8512.date-input-bunch input[type="number"] {
8513 margin-left: 3px;
8514 max-width: 50px;
8515 box-shadow: inset 0px 1px 3px 0px #000;
8516}
8517
8518.date-input-bunch label {
8519 text-align: center;
8520 color: #0ae;
8521 width: 40px;
8522 font-size: 14px;
8523 font-weight: bold;
8524 line-height: 22px;
8525}
8526
8527.date-input-bunch label.rlabel {
8528 background-color: #3bc;
8529 color: #fff;
8530 border-bottom-right-radius: 9px;
8531 border-top-right-radius: 9px;
8532 height: 21px;
8533}
8534
8535.date-input-bunch label.rlabel.narrow {
8536 width: 20px;
8537}
8538
8539.date-input-bunch .linput {
8540 width: 40px;
8541}
8542
8543#bt-no-time:checked+label+.date-input-bunch+.date-input-bunch,
8544#bt-no-time:checked+label+.date-input-bunch,
8545#bd-no-day:checked+label+.date-input-bunch+.date-input-bunch,
8546#bd-no-day:checked+label+.date-input-bunch {
8547 opacity: 0.3;
8548}
8549
8550#bt-one-time:checked+label+input+label+input+label+
8551.date-input-bunch+.date-input-bunch,
8552#bd-one-day:checked+label+input+label+input+label+
8553.date-input-bunch+.date-input-bunch {
8554 opacity: 0.3;
8555}
8556
8557#backdate_widget div {
8558 margin-bottom: 7px;
8559}
8560
8561#pmright+label:before,
8562#pmleft+label:before {
8563 position: relative;
8564 content: "am";
8565 display: inline-block;
8566}
8567
8568#pmright:checked+label:before,
8569#pmleft:checked+label:before {
8570 content: "pm";
8571}
8572
8573.source-label1 {
8574 position: absolute;
8575 bottom: 0;
8576 left: 0;
8577 z-index: 9;
8578 background-color: rgba(0,0,0,0.5);
8579 border-radius: 30px;
8580}
8581.source-label2 {
8582 position: absolute;
8583 bottom: 0;
8584 right: 0;
8585 z-index: 9;
8586 background-color: rgba(0,0,255,255.5);
8587 border-radius: 30px;
8588}
8589
8590*/}).toString().slice(15,-3)
8591 )
8592 );
8593 // all of my extra css are in this ^ inline style
8594 document.head.appendChild(pluginStyle);
8595 // end extra CSS
8596
8597 // my plugin will not use unSafeWindow, so instead
8598 // this v, is how I shall use fake window scope wrapper variables
8599 // for asynchronous window functions, the plugin data must be in the DOM
8600 // the DOM can be accessed by both wrapper scopes
8601 // it's like a 4 dimensional being :)
8602 var pluginData = document.createElement("div");
8603 pluginData.id = "mass_post_features-plugin_data";
8604 pluginData.classList.add("blog-menu-preload");
8605 pluginData.classList.add("month-menu-preload");
8606 pluginData.setAttribute("widget_sort-by", "date-down");
8607 pluginData.setAttribute("data-select-all_needle", "0");
8608 pluginData.setAttribute("data-select-by_needle", "0");
8609 pluginData.setAttribute("data-last_month_timestamp", "0")
8610 pluginData.setAttribute("data-last_year_timestamp", "0");
8611 pluginData.setAttribute("widget_scroll-top", "0");
8612 pluginData.setAttribute("widget_first-focus", "hide-ltgt-than-tags");
8613 pluginData.setAttribute("select-by-note_lt", "10");
8614 pluginData.setAttribute("select-by-note_gt", "5");
8615 pluginData.setAttribute("hide-ltgt-than-tags", "5");
8616 pluginData.setAttribute("data-to-seconds", "0");
8617 pluginData.setAttribute("data-lt-to-select", "[]");
8618 pluginData.setAttribute("data-gt-to-select", "[]");
8619 pluginData.setAttribute(
8620 "data-all-to-select",
8621 "{\"istag\":[],\"nottag\":[],\"istype\":[],\"nottype\":[]}"
8622 );// this ^ has the 4 dimensions of the select-by widget
8623 pluginData.setAttribute("data-to-select", "[]");
8624 pluginData.setAttribute("data-tags_all_arr", "[]");
8625 pluginData.setAttribute("data-ids_all_arr", "[]");
8626 pluginData.setAttribute("data-visible_ids_all_arr", "[]");
8627 pluginData.setAttribute("data-types_all_arr", "[]");
8628 pluginData.setAttribute("data-id_to_tags", "{}");
8629 pluginData.setAttribute("data-id_to_types", "{}")
8630 pluginData.setAttribute("data-id_to_image", "{}");
8631 pluginData.setAttribute("data-id_to_origin", "{}");
8632 pluginData.setAttribute("data-id_to_state", "{}");
8633 pluginData.setAttribute("data-id_to_timestamp", "{}");
8634 pluginData.setAttribute("data-id_to_notes", "{}");
8635 pluginData.setAttribute("data-tag_to_ids", "{}");
8636 pluginData.setAttribute("data-type_to_ids", "{}");
8637 pluginData.setAttribute("data-csrf-token", "0");
8638 pluginData.setAttribute("data-reblog-to-here", name);
8639 pluginData.setAttribute("data-primary-blog", name); // correct guess later
8640 pluginData.setAttribute("data-x-tumblr-form-key", "0");
8641 pluginData.setAttribute("data-column_gutter", "6");
8642 pluginData.setAttribute("data-current_edit_index", "-1");
8643 pluginData.setAttribute("data-single_edit_id", "0");
8644 pluginData.setAttribute("data-current_edit_action", "reblog");
8645 pluginData.setAttribute("data-photos_height", "150");
8646 var pluginDataShell = document.createElement("div");
8647 pluginDataShell.appendChild(pluginData);
8648 document.body.insertBefore(pluginDataShell, document.body.firstChild);
8649 // this ^, per classList booleans and data-attributes, etc.
8650 // one giant DOM element attribute tree,
8651 // like every post on the Tumblr dashboard 2016
8652
8653 // this v, is how I shall draw a selection box
8654 var data = document.getElementById(
8655 "mass_post_features-plugin_data"
8656 );
8657 data.setAttribute("doc-title", document.title);
8658
8659 // the mousedown contains a variety of things for other functions
8660 window.addEventListener("mousedown", function (e) {
8661 if (e.which !== 1) {
8662 return true;
8663 }
8664 var data = document.getElementById(
8665 "mass_post_features-plugin_data"
8666 );
8667 var selectionBox = document.getElementById(
8668 "mass_post_features-plugin_selection_box"
8669 );
8670 var targ = e.target;
8671 var cont = targ; // container(parent)
8672 // this only runs on the photos page
8673 if (data.classList.contains("is-uploading-photos")) {
8674 // batch photos dragging
8675 while (
8676 cont.parentNode !== null &&
8677 typeof cont.parentNode !== "undefined" &&
8678 cont.nodeName !== "BODY" &&
8679 cont.id !== "add_tags_widget" &&
8680 cont.nodeName !== "A" &&
8681 cont.nodeName !== "BUTTON" &&
8682 !cont.classList.contains("photo-tags") &&
8683 !cont.classList.contains("photo-brick") &&
8684 !cont.classList.contains("photo-brick-img") &&
8685 !cont.classList.contains("rich") // edit
8686 ) {
8687 cont = cont.parentNode;
8688 }
8689 if (
8690 !data.classList.contains("photo-upload-in-progress") &&
8691 typeof cont !== "undefined" &&
8692 typeof cont.nodeName !== "undefined" &&
8693 (
8694 cont.nodeName === "A" ||
8695 cont.nodeName === "BUTTON"
8696 )
8697 ) {
8698 if (cont.parentNode.classList.contains("token")) {
8699 cont.parentNode.parentNode.removeChild(
8700 cont.parentNode
8701 );
8702 }
8703 e.preventDefault();
8704 e.stopPropagation();
8705 e.cancelBubble = true;
8706 return true;
8707 }
8708 if (
8709 !data.classList.contains("photo-upload-in-progress") &&
8710 typeof cont !== "undefined" &&
8711 typeof cont.classList !== "undefined" &&
8712 (
8713 cont.classList.contains("photo-brick") ||
8714 cont.classList.contains("photo-brick-img")
8715 )
8716 ) {
8717 if (cont.classList.contains("focused-rich")) {
8718 var addTagsWidget = document.getElementById(
8719 "add_tags_widget"
8720 );
8721 addTagsWidget.style.display = "block";
8722 }
8723 var bcr = cont.getBoundingClientRect();
8724 cont.setAttribute("original-x", bcr.left);
8725 cont.setAttribute("original-y", bcr.top);
8726 var bmx = bcr.left - e.clientX;
8727 var bmy = bcr.top - e.clientY;
8728 if (cont.classList.contains("photo-brick-img")) {
8729 bmx -= 360;
8730 bmy -= cont.parentNode.getBoundingClientRect().top +
8731 document.documentElement.scrollTop;
8732 }
8733 cont.setAttribute("mouse-x-from-left", bmx);
8734 cont.setAttribute("mouse-y-from-top", bmy - cont.clientHeight);
8735 cont.classList.add("brick-dragging");
8736 cont.style.marginBottom = "-" + cont.clientHeight + "px";
8737 } else if (
8738 typeof cont !== "undefined" &&
8739 typeof cont.classList !== "undefined" &&
8740 !cont.classList.contains("rich") &&
8741 cont.id !== "add_tags_widget"
8742 ) {
8743 var fr = document.getElementsByClassName("focused-rich");
8744 while (fr.length > 0 ) {
8745 fr[0].classList.remove("focused-rich");
8746 }
8747 }
8748 }
8749 targ = e.target;
8750 cont = targ;
8751 var initialMouseX = e.pageX;
8752 var initialMouseY = e.pageY;
8753 while (
8754 cont.parentNode !== null &&
8755 typeof cont.parentNode !== "undefined" &&
8756 cont.nodeName !== "BODY" &&
8757 cont.id !== "nav_archive" &&
8758 cont.id !== "blog_menu" &&
8759 cont.id !== "select-by_widget" &&
8760 cont.id !== "add-caption_widget" &&
8761 cont.id !== "backdate_widget" &&
8762 cont.id !== "urlstuff_widget" &&
8763 cont.id !== "urlstuff_body" &&
8764 cont.id !== "backdate-body" &&
8765 cont.id !== "reblog_widget" &&
8766 cont.id !== "select-by-widget_title" &&
8767 cont.id !== "remove_tags_widget" &&
8768 cont.id !== "add_tags_widget" &&
8769 cont.id !== "tags" &&
8770 cont.id !== "tags_to_add" &&
8771 cont.id !== "tag_editor" &&
8772 cont.id !== "widget_scrolling_part" &&
8773 cont.id !== "reblog-widget_input" &&
8774 cont.id !== "rich_text_caption"
8775 ) {
8776 cont = cont.parentNode;
8777 }
8778 if (
8779 cont.id === "select-by_widget" ||
8780 cont.id === "select-by-widget_title" ||
8781 cont.id === "remove_tags_widget" ||
8782 cont.id === "add_tags_widget" ||
8783 cont.id === "reblog_widget" ||
8784 cont.id === "add-caption_widget" ||
8785 cont.id === "backdate_widget" ||
8786 cont.id === "urlstuff_widget"
8787 ) {
8788 var sbw = document.getElementById(
8789 cont.id === "select-by-widget_title" ? "select-by_widget": cont.id
8790 );
8791 // grabbing and dragging step #1
8792 var mx = sbw.getBoundingClientRect().left - e.clientX;
8793 var my = sbw.getBoundingClientRect().top - e.clientY;
8794 sbw.setAttribute("mouse-x-from-left", mx);
8795 sbw.setAttribute("mouse-y-from-top", my);
8796 sbw.classList.add("widget-dragging");
8797 }
8798 // close urlstuff_widget
8799 var urlstuff = document.getElementById("urlstuff");
8800 if (
8801 cont.id !== "urlstuff_widget" &&
8802 cont.id !== "urlstuff_body" &&
8803 urlstuff !== null && urlstuff.checked
8804 ) {
8805 urlstuff.checked = false;
8806 }
8807 // close backdate_widget
8808 var backdate = document.getElementById("backdate");
8809 if (
8810 cont.id !== "backdate_widget" &&
8811 cont.id !== "backdate-body" &&
8812 backdate !== null && backdate.checked
8813 ) {
8814 backdate.checked = false;
8815 }
8816 // close add-caption_widget
8817 var addCaption = document.getElementById("add-caption");
8818 if (
8819 cont.id !== "add-caption_widget" &&
8820 cont.id !== "rich_text_caption" &&
8821 addCaption !== null && addCaption.checked
8822 ) {
8823 addCaption.checked = false;
8824 }
8825 // close select-by_widget
8826 var selectBy = document.getElementById("select-by");
8827 if (
8828 cont.id !== "select-by_widget" &&
8829 cont.id !== "select-by-widget_title" &&
8830 cont.id !== "widget_scrolling_part" &&
8831 selectBy !== null && selectBy.checked
8832 ) {
8833 var wsp = document.getElementById("widget_scrolling_part");
8834 data.setAttribute("widget_scroll-top", wsp.scrollTop);
8835 var pick = document.getElementsByClassName("picked");
8836 while (pick.length > 0) {
8837 pick[0].classList.remove("picked");
8838 }
8839 selectBy.checked = false;
8840 }
8841 // close blog menu, close reblog widget
8842 if (
8843 cont.id !== "blog_menu" &&
8844 cont.id !== "reblog_widget" &&
8845 cont.id !== "reblog-widget_input" &&
8846 data.classList.contains("open-blog_menu") &&
8847 !data.classList.contains("closing-blog_menu")
8848 ) {
8849 var o = document.getElementsByClassName("open");
8850 while (o.length > 0) {
8851 o[0].classList.remove("open");
8852 }
8853 data.classList.remove("open-blog_menu");
8854 e.cancelBubble = true;
8855 e.stopPropagation();
8856 data.classList.add("closing-blog_menu");
8857 data.classList.remove("open-blog_menu");
8858 return false;
8859 }
8860 if (data.classList.contains("closing-blog_menu")) {
8861 data.classList.remove("closing-blog_menu");
8862 }
8863 if (data.classList.contains("is-uploading-photos")) {
8864 return true;
8865 // we return here, because all this other thing
8866 // stuff is for other editor modes...
8867 }
8868 // draw selection box
8869 if (
8870 e.shiftKey &&
8871 !data.classList.contains("shift_key")
8872 ) {
8873 data.classList.add("shift_key");
8874 }
8875 if (
8876 !data.classList.contains("mousedown") &&
8877 cont !== null &&
8878 typeof cont === "object" &&
8879 cont.nodeName === "BODY" &&
8880 cont.id !== "nav_archive"
8881 ) {
8882 data.classList.add("mousedown");
8883 data.setAttribute("data-initial_mouse_x", initialMouseX);
8884 data.setAttribute("data-initial_mouse_y", initialMouseY);
8885 }
8886 });
8887 window.addEventListener("mouseup", function (e) {
8888 var drg = document.getElementsByClassName("widget-dragging");
8889 while (drg.length > 0) {
8890 drg[0].classList.remove("widget-dragging");
8891 }
8892 var pre = document.getElementsByClassName("pre-photoset");
8893 var hu;
8894 var hd;
8895 var hl;
8896 var hr;
8897 var hlb = document.getElementsByClassName("hl-bottom");
8898 var hlt = document.getElementsByClassName("hl-top");
8899 var bd = document.getElementsByClassName("brick-dragging");
8900 if (bd.length > 0 && bd[0].classList.contains("photo-brick")) {
8901 // drop row inbetween rows
8902 if (hlb.length + hlt.length === 0) {
8903 bd[0].style.left = bd[0].getAttribute("original-x") + "px";
8904 bd[0].style.top = bd[0].getAttribute("original-y") + "px";
8905 } else if (hlt.length > 0) {
8906 document.body.insertBefore(bd[0], hlt[0]);
8907 } else if (hlb.length > 0) {
8908 document.body.insertBefore(bd[0], hlb[0].nextSibling);
8909 }
8910 while (hlb.length > 0) {
8911 hlb[0].classList.remove("hl-bottom");
8912 }
8913 while (hlt.length > 0) {
8914 hlt[0].classList.remove("hl-top");
8915 }
8916 while (bd.length > 0) {
8917 bd[0].style.removeProperty("margin-bottom");
8918 bd[0].classList.remove("brick-dragging");
8919 }
8920 // rebuildColumn after row dragged
8921 rebuildPhotoColumn();
8922 } else if (
8923 bd.length > 0 && bd[0].classList.contains("photo-brick-img")
8924 ) {
8925 // drop into photoset instead...
8926 hu = document.getElementsByClassName("hl-up");
8927 hd = document.getElementsByClassName("hl-down");
8928 hl = document.getElementsByClassName("hl-left");
8929 hr = document.getElementsByClassName("hl-right");
8930 if (
8931 hlb.length + hlt.length > 0 &&
8932 hu.length + hd.length + hl.length + hr.length === 0
8933 ) {
8934 // drop into new Editor row thing, instead...
8935 bd[0].style.left = "0px";
8936 bd[0].style.top = "0px";
8937 loadPhotoIntoDOM(bd[0].children[0]);
8938 } else if (hu.length + hd.length + hl.length + hr.length > 0) {
8939 if (hu.length > 0) {
8940 // insert photo above, above (clap, clap, clap)
8941 if (
8942 hu[0].classList.contains("row-with-one-img") ||
8943 (
8944 (
8945 hu[0].classList.contains("row-with-two-img") &&
8946 hu[0].classList.contains("data-photoset-a")
8947 ) || (
8948 hu[0].classList.contains("row-with-three-img") &&
8949 hu[0].classList.contains("data-photoset-a")
8950 )
8951 )
8952 ) {
8953 // insertBefore... :P
8954 hu[0].parentNode.insertBefore(bd[0], hu[0]);
8955 } else if (
8956 (
8957 hu[0].classList.contains("row-with-two-img") &&
8958 hu[0].classList.contains("data-photoset-b")
8959 ) || (
8960 hu[0].classList.contains("row-with-three-img") &&
8961 hu[0].classList.contains("data-photoset-b")
8962 )
8963 ) {
8964 // insertBefore&Before
8965 hu[0].parentNode.insertBefore(
8966 bd[0], hu[0].previousSibling
8967 );
8968 } else if (
8969 hu[0].classList.contains("row-with-three-img") &&
8970 hu[0].classList.contains("data-photoset-c")
8971 ) {
8972 // insertAfter&Before&Before
8973 hu[0].parentNode.insertBefore(
8974 bd[0], // weird: siblings ARE always there and !== undefined
8975 hu[0].previousSibling.previousSibling
8976 ); // because everything is correct :P
8977 } else {
8978 hu[0].parentNode.insertBefore(bd[0], hu[0]);
8979 }
8980 bd[0].classList.add("row-with-one-img");
8981 bd[0].classList.remove("data-photoset-a");
8982 bd[0].classList.remove("data-photoset-b");
8983 bd[0].classList.remove("data-photoset-c"); // abc...
8984 bd[0].classList.remove("row-with-two-img");
8985 bd[0].classList.remove("row-with-three-img");
8986 } else if (hd.length > 0) {
8987 // insert photo below, below photo (clap, clap, clap)
8988 if (
8989 hd[0].classList.contains("row-with-one-img") ||
8990 (
8991 (
8992 hd[0].classList.contains("row-with-two-img") &&
8993 hd[0].classList.contains("data-photoset-b")
8994 ) || (
8995 hd[0].classList.contains("row-with-three-img") &&
8996 hd[0].classList.contains("data-photoset-c")
8997 )
8998 )
8999 ) {
9000 // insertAfter... :P
9001 hd[0].parentNode.insertBefore(bd[0], hd[0].nextSibling);
9002 } else if (
9003 (
9004 hd[0].classList.contains("row-with-two-img") &&
9005 hd[0].classList.contains("data-photoset-a")
9006 ) || (
9007 hd[0].classList.contains("row-with-three-img") &&
9008 hd[0].classList.contains("data-photoset-b")
9009 )
9010 ) {
9011 // insertAfter&After
9012 hd[0].parentNode.insertBefore(
9013 bd[0], hd[0].nextSibling.nextSibling
9014 );
9015 } else if (
9016 hd[0].classList.contains("row-with-three-img") &&
9017 hd[0].classList.contains("data-photoset-a")
9018 ) {
9019 // insertAfter&After&After
9020 hd[0].parentNode.insertBefore(
9021 bd[0], // assumed: my siblings ARE there and !== undefined
9022 hd[0].nextSibling.nextSibling.nextSibling
9023 ); // because everything is correct :P
9024 }
9025 bd[0].classList.add("row-with-one-img");
9026 bd[0].classList.remove("row-with-two-img");
9027 bd[0].classList.remove("row-with-three-img");
9028 // insert to the left, to the left... (clap, clap, clap)
9029 } else if (hl.length > 0) {
9030 // START: these next few chucks are: long and similar; don't get lost
9031 if (hl[0].classList.contains("row-with-one-img")) {
9032 bd[0].classList.add("data-photoset-a");
9033 hl[0].classList.add("data-photoset-b");
9034 // 123...
9035 bd[0].classList.remove("data-photoset-c");
9036 bd[0].classList.remove("data-photoset-b");
9037 hl[0].classList.remove("data-photoset-a");
9038 hl[0].classList.remove("data-photoset-c");
9039 // abc...
9040 hl[0].classList.remove("row-with-one-img");
9041 hl[0].classList.add("row-with-two-img");
9042 bd[0].classList.remove("row-with-one-img");
9043 bd[0].classList.add("row-with-two-img");
9044 bd[0].classList.remove("row-with-three-img");
9045 } else if (hl[0].classList.contains("row-with-two-img")) {
9046 // left of an "a" goes to the left
9047 if (hl[0].classList.contains("data-photoset-a")) {
9048 bd[0].classList.add("data-photoset-a");
9049 hl[0].classList.add("data-photoset-b");
9050 hl[0].nextSibling.classList.add("data-photoset-c");
9051 // 123...
9052 hl[0].nextSibling.classList.remove("data-photoset-b");
9053 hl[0].nextSibling.classList.remove("data-photoset-a");
9054 bd[0].classList.remove("data-photoset-c");
9055 bd[0].classList.remove("data-photoset-b");
9056 hl[0].classList.remove("data-photoset-a");
9057 hl[0].classList.remove("data-photoset-c");
9058 // abc...
9059 hl[0].classList.remove("row-with-two-img");
9060 hl[0].classList.add("row-with-three-img");
9061 hl[0].nextSibling.classList.remove("row-with-two-img");
9062 hl[0].nextSibling.classList.add("row-with-three-img");
9063 // left of a "b" goes in-between
9064 } else if (hl[0].classList.contains("data-photoset-b")) {
9065 hl[0].classList.add("data-photoset-c");
9066 bd[0].classList.add("data-photoset-b");
9067 hl[0].previousSibling.classList.add("data-photoset-a");
9068 // 123...
9069 hl[0].previousSibling.classList.remove("data-photoset-b");
9070 hl[0].previousSibling.classList.remove("data-photoset-c");
9071 bd[0].classList.remove("data-photoset-c");
9072 bd[0].classList.remove("data-photoset-a");
9073 hl[0].classList.remove("data-photoset-b");
9074 hl[0].classList.remove("data-photoset-a");
9075 // abc...
9076 hl[0].classList.remove("row-with-two-img");
9077 hl[0].classList.add("row-with-three-img");
9078 hl[0].previousSibling.classList.remove("row-with-two-img");
9079 hl[0].previousSibling.classList.add("row-with-three-img");
9080 }
9081 bd[0].classList.remove("row-with-one-img");
9082 bd[0].classList.remove("row-with-two-img");
9083 bd[0].classList.add("row-with-three-img");
9084 }
9085 // regardless, it's to the left...
9086 hl[0].parentNode.insertBefore(bd[0], hl[0]);
9087 } else if (hr.length > 0) {
9088 // insert to the right, to the right... (clap, clap, clap)
9089 if (hr[0].classList.contains("row-with-one-img")) {
9090 hr[0].classList.add("data-photoset-a");
9091 bd[0].classList.add("data-photoset-b");
9092 // 123...
9093 bd[0].classList.remove("data-photoset-c");
9094 bd[0].classList.remove("data-photoset-a");
9095 hr[0].classList.remove("data-photoset-b");
9096 hr[0].classList.remove("data-photoset-c");
9097 // abc...
9098 hr[0].classList.remove("row-with-one-img");
9099 hr[0].classList.add("row-with-two-img");
9100 bd[0].classList.remove("row-with-one-img");
9101 bd[0].classList.add("row-with-two-img");
9102 bd[0].classList.remove("row-with-three-img");
9103 } else if (hr[0].classList.contains("row-with-two-img")) {
9104 // right of an "a" goes to the in-between
9105 if (hr[0].classList.contains("data-photoset-a")) {
9106 hr[0].classList.add("data-photoset-a");
9107 bd[0].classList.add("data-photoset-b");
9108 hr[0].nextSibling.classList.add("data-photoset-c");
9109 // 123...
9110 hr[0].nextSibling.classList.remove("data-photoset-b");
9111 hr[0].nextSibling.classList.remove("data-photoset-a");
9112 bd[0].classList.remove("data-photoset-c");
9113 bd[0].classList.remove("data-photoset-a");
9114 hr[0].classList.remove("data-photoset-b");
9115 hr[0].classList.remove("data-photoset-c");
9116 // abc...
9117 hr[0].classList.remove("row-with-two-img");
9118 hr[0].classList.add("row-with-three-img");
9119 hr[0].nextSibling.classList.remove("row-with-two-img");
9120 hr[0].nextSibling.classList.add("row-with-three-img");
9121 // right of a "b" goes to the right
9122 } else if (hr[0].classList.contains("data-photoset-b")) {
9123 hr[0].previousSibling.classList.add("data-photoset-a");
9124 hr[0].classList.add("data-photoset-b");
9125 bd[0].classList.add("data-photoset-c");
9126 // 123...
9127 hr[0].previousSibling.classList.remove("data-photoset-b");
9128 hr[0].previousSibling.classList.remove("data-photoset-c");
9129 bd[0].classList.remove("data-photoset-a");
9130 bd[0].classList.remove("data-photoset-b");
9131 hr[0].classList.remove("data-photoset-a");
9132 hr[0].classList.remove("data-photoset-c");
9133 // abc...
9134 hr[0].classList.remove("row-with-two-img");
9135 hr[0].classList.add("row-with-three-img");
9136 hr[0].previousSibling.classList.remove("row-with-two-img");
9137 hr[0].previousSibling.classList.add("row-with-three-img");
9138 }
9139 bd[0].classList.remove("row-with-one-img");
9140 bd[0].classList.remove("row-with-two-img");
9141 bd[0].classList.add("row-with-three-img");
9142 }
9143 // regardless, it's to the right...
9144 hr[0].parentNode.insertBefore(bd[0], hr[0].nextSibling);
9145 }
9146 }
9147 if (
9148 !bd[0].classList.contains("row-with-one-img") &&
9149 !bd[0].classList.contains("row-with-two-img") &&
9150 !bd[0].classList.contains("row-with-three-img")
9151 ){
9152 bd[0].classList.add("row-with-one-img")
9153 }
9154 // END: thanks for bearing with me.
9155 pre = document.getElementsByClassName("pre-photoset");
9156 hu = document.getElementsByClassName("hl-up");
9157 hd = document.getElementsByClassName("hl-down");
9158 hl = document.getElementsByClassName("hl-left");
9159 hr = document.getElementsByClassName("hl-right");
9160 hlb = document.getElementsByClassName("hl-bottom");
9161 hlt = document.getElementsByClassName("hl-top");
9162 while (hlt.length > 0) {
9163 hlt[0].classList.remove("hl-top");
9164 }
9165 while (hlb.length > 0) {
9166 hlb[0].classList.remove("hl-bottom");
9167 }
9168 while (pre.length > 0) {
9169 pre[0].classList.remove("pre-photoset");
9170 }
9171 while (bd.length > 0) {
9172 bd[0].style.left = "0px";
9173 bd[0].style.top = "0px";
9174 bd[0].style.removeProperty("margin-bottom");
9175 bd[0].classList.remove("brick-dragging");
9176 }
9177 while (hu.length > 0) {
9178 hu[0].classList.remove("hl-up");
9179 }
9180 while (hd.length > 0) {
9181 hd[0].classList.remove("hl-down");
9182 }
9183 while (hl.length > 0) {
9184 hl[0].classList.remove("hl-left");
9185 }
9186 while (hr.length > 0) {
9187 hr[0].classList.remove("hl-right");
9188 }
9189 // observers should rebuildPhotoColumn
9190 setTimeout(rebuildPhotoColumn, 800);
9191 // but here goes one more time just in case :P
9192 // I thinks my pretty transition is delaying
9193 // the top/left/height... or something IDK...
9194 }
9195 var data = document.getElementById(
9196 "mass_post_features-plugin_data"
9197 );
9198 var selectionBox = document.getElementById(
9199 "mass_post_features-plugin_selection_box"
9200 );
9201 if (data.classList.contains("mousedown")) {
9202 data.classList.remove("mousedown");
9203 }
9204 if (data.classList.contains("shift_key")) {
9205 data.classList.remove("shift_key");
9206 }
9207 if (selectionBox !== null) {
9208 selectionBox.parentNode.removeChild(selectionBox);
9209 }
9210 var ts = document.getElementsByClassName("temp-select");
9211 while (ts.length > 0) {
9212 ts[0].classList.remove("temp-select");
9213 }
9214 });
9215 var blueUp = 0;
9216 // resize the selection box and stuff :)
9217 window.addEventListener("mousemove", function (e) {
9218 var data = document.getElementById(
9219 "mass_post_features-plugin_data"
9220 );
9221 var i;
9222 if (
9223 document.getElementsByClassName(
9224 "brick-dragging"
9225 ).length === 1
9226 ) {
9227 var bdrg = document.getElementsByClassName(
9228 "brick-dragging"
9229 )[0]; // being dragged
9230 var brk = document.getElementsByClassName(
9231 "photo-brick"
9232 );
9233 var img = document.getElementsByClassName(
9234 "photo-brick-img-cell"
9235 );
9236 var bmx = parseFloat(bdrg.getAttribute("mouse-x-from-left"));
9237 var bmy = parseFloat(bdrg.getAttribute("mouse-y-from-top"));
9238 var pre = document.getElementsByClassName("pre-photoset");
9239 var st = document.documentElement.scrollTop;
9240 var bx = e.clientX + bmx;
9241 var by = e.clientY + bmy + st;
9242 bdrg.style.left = bx + "px";
9243 bdrg.style.top = by + "px";
9244 var t;
9245 var b;
9246 var l;
9247 var pbi;
9248 var pr;
9249 var hlb = document.getElementsByClassName("hl-bottom");
9250 var hlt = document.getElementsByClassName("hl-top");
9251 if (
9252 !data.classList.contains("blueup-drag-scroll") &&
9253 e.clientY < 90 &&
9254 typeof bdrg !== "undefined"
9255 ) {
9256 data.classList.add("blueup-drag-scroll");
9257 clearInterval(blueUp);
9258 blueUp = setInterval(function () {
9259 var doc = document.documentElement;
9260 window.scrollTo(doc.scrollLeft, doc.scrollTop - 10);
9261 }, 10);
9262 } else if (
9263 !data.classList.contains("blueup-drag-scroll") &&
9264 e.clientY > window.innerHeight - 90 &&
9265 typeof bdrg !== "undefined"
9266 ) {
9267 data.classList.add("blueup-drag-scroll");
9268 clearInterval(blueUp);
9269 blueUp = setInterval(function () {
9270 var doc = document.documentElement;
9271 window.scrollTo(doc.scrollLeft, doc.scrollTop + 10);
9272 }, 10);
9273 } else {
9274 data.classList.remove("blueup-drag-scroll");
9275 clearInterval(blueUp);
9276 }
9277 if (bdrg.classList.contains("photo-brick")) {
9278 for (i = 0; i < brk.length; i++) {
9279 b = brk[i].getBoundingClientRect();
9280 t = b.top + st; // dragging photo-brick over <this
9281 if (
9282 (by > t && by < t + b.height) ||
9283 (i === 0 && by < t) ||
9284 (i === brk.length -1 && by > t)
9285 ) {
9286 if (
9287 (by + b.height / 2 > t) ||
9288 (i === brk.length -1 && by > t)
9289 ) { // highlight bottom
9290 brk[i].classList.add("hl-bottom");
9291 brk[i].classList.remove("hl-top");
9292 } else if (
9293 (by - b.height / 2 < t) ||
9294 (i === 0 && by < t)
9295 ) { // highlight top
9296 brk[i].classList.add("hl-top");
9297 brk[i].classList.remove("hl-bottom");
9298 }
9299 } else {
9300 brk[i].classList.remove("hl-bottom");
9301 brk[i].classList.remove("hl-top");
9302 }
9303 }
9304 }else if (bdrg.classList.contains("photo-brick-img")) {
9305 while (hlb.length > 0) {
9306 hlb[0].classList.remove("hl-bottom");
9307 }
9308 while (hlt.length > 0) {
9309 hlt[0].classList.remove("hl-top");
9310 }
9311 // this part withdraws the dragged image bdrg from current row
9312 if (// this may seem repetative...
9313 bdrg.classList.contains("row-with-two-img") &&
9314 bdrg.classList.contains("data-photoset-a") &&
9315 bdrg.nextSibling.classList.contains("data-photoset-b")
9316 ) {
9317 bdrg.style.removeProperty("height");
9318 bdrg.nextSibling.style.removeProperty("height");
9319 // 2
9320 bdrg.classList.remove("row-with-two-img");
9321 bdrg.nextSibling.classList.remove("row-with-two-img");
9322 // 1
9323 bdrg.nextSibling.classList.add("row-with-one-img");
9324 // and shift pop around
9325 bdrg.nextSibling.classList.remove("data-photoset-b");
9326 // remove remnant
9327 bdrg.classList.remove("data-photoset-a");
9328 } else if (
9329 bdrg.classList.contains("row-with-two-img") &&
9330 bdrg.classList.contains("data-photoset-b") &&
9331 bdrg.previousSibling.classList.contains("data-photoset-a")
9332 ) {
9333 bdrg.style.removeProperty("height");
9334 bdrg.previousSibling.style.removeProperty("height");
9335 // 2
9336 bdrg.classList.remove("row-with-two-img");
9337 bdrg.previousSibling.classList.remove("row-with-two-img");
9338 // 1
9339 bdrg.previousSibling.classList.add("row-with-one-img");
9340 // and shift pop around
9341 bdrg.previousSibling.classList.remove("data-photoset-a");
9342 // remove remnant
9343 bdrg.classList.remove("data-photoset-b");
9344 } else if (
9345 bdrg.classList.contains("row-with-three-img") &&
9346 bdrg.classList.contains("data-photoset-a") &&
9347 bdrg.nextSibling.classList.contains("data-photoset-b")
9348 ) {
9349 bdrg.style.removeProperty("height");
9350 bdrg.nextSibling.style.removeProperty("height");
9351 bdrg.nextSibling.nextSibling.
9352 style.removeProperty("height");
9353 // 3
9354 bdrg.classList.remove("row-with-three-img");
9355 bdrg.nextSibling.classList.remove("row-with-three-img");
9356 bdrg.nextSibling.nextSibling.
9357 classList.remove("row-with-three-img");
9358 // 2
9359 bdrg.nextSibling.classList.add("row-with-two-img");
9360 bdrg.nextSibling.nextSibling.
9361 classList.add("row-with-two-img");
9362 // and shift pop around
9363 bdrg.nextSibling.classList.add("data-photoset-a");
9364 bdrg.nextSibling.classList.remove("data-photoset-b");
9365 bdrg.nextSibling.nextSibling.
9366 classList.add("data-photoset-b");
9367 bdrg.nextSibling.nextSibling.
9368 classList.remove("data-photoset-c");
9369 // remove remnant
9370 bdrg.classList.remove("data-photoset-a");
9371 } else if (
9372 bdrg.classList.contains("row-with-three-img") &&
9373 bdrg.classList.contains("data-photoset-b") &&
9374 bdrg.nextSibling.classList.contains("data-photoset-c")
9375 ) {
9376 bdrg.style.removeProperty("height");
9377 bdrg.nextSibling.style.removeProperty("height");
9378 bdrg.previousSibling.style.removeProperty("height");
9379 // 3
9380 bdrg.classList.remove("row-with-three-img");
9381 bdrg.nextSibling.classList.remove("row-with-three-img");
9382 bdrg.previousSibling.classList.remove("row-with-three-img");
9383 // 2
9384 bdrg.nextSibling.classList.add("row-with-two-img");
9385 bdrg.previousSibling.classList.add("row-with-two-img");
9386 // and shift pop around
9387 bdrg.nextSibling.classList.add("data-photoset-b");
9388 bdrg.nextSibling.classList.remove("data-photoset-c");
9389 // this is a rare chance flip around
9390 bdrg.parentNode.insertBefore(bdrg.nextSibling, bdrg);
9391 // remove remnant
9392 bdrg.classList.remove("data-photoset-b");
9393 } else if (
9394 bdrg.classList.contains("row-with-three-img") &&
9395 bdrg.classList.contains("data-photoset-c") &&
9396 bdrg.previousSibling.classList.contains("row-with-three-img")
9397 ) {
9398 bdrg.style.removeProperty("height");
9399 bdrg.previousSibling.style.removeProperty("height");
9400 bdrg.previousSibling.previousSibling
9401 .style.removeProperty("height");
9402 // 3
9403 bdrg.classList.remove("row-with-three-img");
9404 bdrg.previousSibling.classList.remove("row-with-three-img");
9405 bdrg.previousSibling.previousSibling.
9406 classList.remove("row-with-three-img");
9407 // 2
9408 bdrg.previousSibling.classList.add("row-with-two-img");
9409 bdrg.previousSibling.previousSibling.
9410 classList.add("row-with-two-img");
9411 // and shift pop around
9412 // b stays b, a stays a
9413 // remove remnant
9414 bdrg.classList.remove("data-photoset-c");
9415 } // last one ^
9416 bdrg.classList.remove("hl-up");
9417 bdrg.classList.remove("hl-down");
9418 bdrg.classList.remove("hl-left");
9419 bdrg.classList.remove("hl-right");
9420 rebuildPhotoColumn();
9421 for (i = 0; i < brk.length; i++) { // dragging image
9422 b = brk[i].getBoundingClientRect();
9423 if (
9424 e.clientX > b.left &&
9425 e.clientX < b.left + 137 &&
9426 e.clientY > b.top &&
9427 e.clientY < b.bottom
9428 ) {
9429 brk[i].classList.add("pre-photoset");
9430 pbi = brk[i].getElementsByClassName("photo-brick-img");
9431 for (l = 0; l < pbi.length; l++) {
9432 if (typeof pbi[l] === "undefined" || pbi[l] === bdrg) {
9433 continue;
9434 }
9435 if (
9436 pbi.length >= 10 &&
9437 brk[i].getElementsByClassName(
9438 "brick-dragging"
9439 ).length === 0
9440 ) {
9441 break;
9442 }
9443 pr = pbi[l].getBoundingClientRect();
9444 if (
9445 e.clientX > pr.left &&
9446 e.clientX < pr.right &&
9447 e.clientY > pr.top &&
9448 e.clientY < pr.bottom &&
9449 brk[i].classList.contains("pre-photoset")
9450 ) { // I should use dragover, but this is (sophisticated :p)
9451 if (e.clientY < pr.top + pr.height / 3) {
9452 pbi[l].classList.add("hl-up");
9453 // sliding to the above
9454 pbi[l].classList.remove("hl-down");
9455 pbi[l].classList.remove("hl-left");
9456 pbi[l].classList.remove("hl-right");
9457 // sliding to the under
9458 } else if (e.clientY > pr.top + pr.height * 0.75) {
9459 pbi[l].classList.add("hl-down");
9460 pbi[l].classList.remove("hl-up");
9461 pbi[l].classList.remove("hl-left");
9462 pbi[l].classList.remove("hl-right");
9463 // sliding to the right
9464 } else if (e.clientX > pr.left + pr.width / 2) {
9465 if (!pbi[l].classList.contains("row-with-three-img")) {
9466 pbi[l].classList.remove("hl-up");
9467 pbi[l].classList.remove("hl-down");
9468 pbi[l].classList.remove("hl-left");
9469 pbi[l].classList.add("hl-right");
9470 }
9471 // sliding to the left
9472 } else if (e.clientX < pr.left + pr.width / 2) {
9473 if (!pbi[l].classList.contains("row-with-three-img")) {
9474 pbi[l].classList.remove("hl-up");
9475 pbi[l].classList.remove("hl-down");
9476 pbi[l].classList.add("hl-left");
9477 pbi[l].classList.remove("hl-right");
9478 }
9479 }
9480 } else {
9481 pbi[l].classList.remove("hl-up");
9482 pbi[l].classList.remove("hl-down");
9483 pbi[l].classList.remove("hl-left");
9484 pbi[l].classList.remove("hl-right");
9485 }
9486 }
9487 } else { // dragging out of a photoset into new row
9488 brk[i].classList.remove("pre-photoset");
9489 if (
9490 e.clientX > b.left + 177 &&
9491 e.clientX < b.left + b.width &&
9492 e.clientY > b.top &&
9493 e.clientY < b.bottom
9494 ) {
9495 if (
9496 (e.clientY + b.height / 2 > b.top) ||
9497 (i === brk.length -1 && e.clientY > b.bottom)
9498 ) { // highlight bottom
9499 brk[i].classList.add("hl-bottom");
9500 brk[i].classList.remove("hl-top");
9501 } else if (
9502 (e.clientY - b.height / 2 < b.top) ||
9503 (i === 0 && e.clientY < b.top)
9504 ) { // highlight top
9505 brk[i].classList.add("hl-top");
9506 brk[i].classList.remove("hl-bottom");
9507 }
9508 } else {
9509 brk[i].classList.remove("hl-bottom");
9510 brk[i].classList.remove("hl-top");
9511 }
9512 }
9513 }
9514 }
9515 }
9516 if (
9517 document.getElementsByClassName(
9518 "widget-dragging"
9519 ).length === 1
9520 ) {
9521 var drg = document.getElementsByClassName(
9522 "widget-dragging"
9523 )[0];
9524 // grabbing and dragging step #2
9525 var mx = parseFloat(drg.getAttribute("mouse-x-from-left"));
9526 var my = parseFloat(drg.getAttribute("mouse-y-from-top"));
9527 if (document.getElementById("reblog_widget") !== null) {
9528 document.getElementById(
9529 "reblog_widget"
9530 ).style.left = (e.clientX + mx) + "px";
9531 document.getElementById(
9532 "reblog_widget"
9533 ).style.top = (e.clientY + my) + "px";
9534 }
9535 if (document.getElementById("select-by_widget") !== null) {
9536 document.getElementById(
9537 "select-by_widget"
9538 ).style.left = (e.clientX + mx) + "px";
9539 document.getElementById(
9540 "select-by_widget"
9541 ).style.top = (e.clientY + my) + "px";
9542 }
9543 if (document.getElementById("remove_tags_widget") !== null) {
9544 document.getElementById(
9545 "remove_tags_widget"
9546 ).style.left = (e.clientX + mx) + "px";
9547 document.getElementById(
9548 "remove_tags_widget"
9549 ).style.top = (e.clientY + my) + "px";
9550 }
9551 if (document.getElementById("add_tags_widget") !== null) {
9552 document.getElementById(
9553 "add_tags_widget"
9554 ).style.left = (e.clientX + mx) + "px";
9555 document.getElementById(
9556 "add_tags_widget"
9557 ).style.top = (e.clientY + my) + "px";
9558 }
9559 if (document.getElementById("add-caption_widget") !== null) {
9560 document.getElementById(
9561 "add-caption_widget"
9562 ).style.left = (e.clientX + mx) + "px";
9563 document.getElementById(
9564 "add-caption_widget"
9565 ).style.top = (e.clientY + my) + "px";
9566 }
9567 if (document.getElementById("backdate_widget") !== null) {
9568 document.getElementById(
9569 "backdate_widget"
9570 ).style.left = (e.clientX + mx) + "px";
9571 document.getElementById(
9572 "backdate_widget"
9573 ).style.top = (e.clientY + my) + "px";
9574 }
9575 if (document.getElementById("urlstuff_widget") !== null) {
9576 document.getElementById(
9577 "urlstuff_widget"
9578 ).style.left = (e.clientX + mx) + "px";
9579 document.getElementById(
9580 "urlstuff_widget"
9581 ).style.top = (e.clientY + my) + "px";
9582 }
9583 }
9584 var targ = e.target;
9585 var cont = targ;
9586 var initialMouseX = parseFloat(
9587 data.getAttribute("data-initial_mouse_x")
9588 );
9589 var initialMouseY = parseFloat(
9590 data.getAttribute("data-initial_mouse_y")
9591 );
9592 var newMouseX = e.pageX;
9593 var newMouseY = e.pageY;
9594 var mouseWidth = Math.abs(initialMouseX - newMouseX);
9595 var mouseHeight = Math.abs(initialMouseY - newMouseY);
9596 var mouseDiff = Math.hypot(mouseWidth, mouseHeight);
9597 var selectionBox = document.getElementById(
9598 "mass_post_features-plugin_selection_box"
9599 );
9600 if (
9601 mouseDiff > 6 &&
9602 data.classList.contains("mousedown") &&
9603 selectionBox === null
9604 ) {
9605 var pluginSelectionBox = document.createElement("div");
9606 pluginSelectionBox.id = "mass_post_features-" +
9607 "plugin_selection_box";
9608 document.body.appendChild(pluginSelectionBox);
9609 selectionBox = document.getElementById(
9610 "mass_post_features-plugin_selection_box"
9611 );
9612 if (!data.classList.contains("shift_key")) {
9613 var hl = document.getElementsByClassName("highlighted");
9614 while (hl.length > 0) {
9615 highlightBrick(hl[0], 0);
9616 }
9617 }
9618 }
9619 if (
9620 mouseDiff > 6 &&
9621 data.classList.contains("mousedown") &&
9622 selectionBox !== null
9623 ) {
9624 var selLeft;
9625 var selTop;
9626 if (initialMouseX < newMouseX) {
9627 selectionBox.style.left = initialMouseX + "px";
9628 selLeft = initialMouseX;
9629 }
9630 if (initialMouseY < newMouseY) {
9631 selectionBox.style.top = initialMouseY + "px";
9632 selTop = initialMouseY;
9633 }
9634 if (initialMouseX > newMouseX) {
9635 selectionBox.style.left = (initialMouseX - mouseWidth) + "px";
9636 selLeft = initialMouseX - mouseWidth;
9637 }
9638 if (initialMouseY > newMouseY) {
9639 selectionBox.style.top = (initialMouseY - mouseHeight) + "px";
9640 selTop = initialMouseY - mouseHeight;
9641 }
9642 selectionBox.style.width = mouseWidth + "px";
9643 selectionBox.style.height = mouseHeight + "px";
9644 var brick = document.getElementsByClassName("brick");
9645 var rec;
9646 var sT = document.documentElement.scrollTop;
9647 var sL = document.documentElement.scrollLeft; // 0
9648 for (i = 0; i < brick.length; i++) {
9649 rec = brick[i].getBoundingClientRect();
9650 if (
9651 !brick[i].classList.contains("highlighted") &&
9652 !brick[i].classList.contains("temp-select") &&
9653 rec.right + sL > selLeft &&
9654 rec.left + sL < selLeft + mouseWidth &&
9655 rec.bottom + sT > selTop &&
9656 rec.top + sT < selTop + mouseHeight
9657 ) {
9658 brick[i].classList.add("temp-select");
9659 highlightBrick(brick[i], 1);
9660 } else if (
9661 brick[i].classList.contains("temp-select") &&
9662 brick[i].classList.contains("highlighted") &&
9663 (
9664 (
9665 rec.right + sL < selLeft ||
9666 rec.left + sL > selLeft + mouseWidth
9667 ) || (
9668 rec.bottom + sT < selTop ||
9669 rec.top + sT > selTop + mouseHeight
9670 )
9671 )
9672 ) {
9673 brick[i].classList.remove("temp-select");
9674 highlightBrick(brick[i], 0);
9675 }
9676 }
9677 }
9678 });
9679 // end of selection box feature
9680
9681 // begin blogs menu / blog menu dropdown
9682 var loderGifSrc =
9683 'data:image/gif;base64,R0lGODlhIAAgAPUZAA' +
9684 'QEBDo6OhYWFg4ODi4uLoCAgAgICBgYGAICAmxsbH' +
9685 'h4eBwcHF5eXsDAwLS0tJKSkvLy8v///xISEhAQEE' +
9686 'ZGRqioqGRkZFBQUCIiIiYmJjY2Np6enk5OTuDg4D' +
9687 'AwMNLS0lZWVoKCgqCgoLKysgAAAAAAAAAAAAAAAA' +
9688 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
9689 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
9690 'AAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAA' +
9691 'Ah/hlPcHRpbWl6ZWQgdXNpbmcgZXpnaWYuY29tAC' +
9692 'H5BAUKABkALAAAAAAgACAAAAbkwIxwSCQOIJBFcc' +
9693 'k0GoiBSCRQBDSZl8YGKqUOB4fnFdpoUIbR6Tc8GB' +
9694 'crZXHamwEf3EVCOSGcCwFseEUhcRl+dWFuBARVZQ' +
9695 '+GXYiJTl8FlkpDDGUYAwEBdpN/EoF1FpYFDG2ljF' +
9696 'UTCKJsqmgKp5+CoKNMABSnIHi4bgMMBZhjCKS/gn' +
9697 'VNgLhgyojNzZ7U1ALK07EH1dV3t9rgztjS0szY0A' +
9698 'ahV82/o+rMsfDa7fNO8aJL7JLI+/bkx+rSBUznrx' +
9699 '+oVsEClZMEDZaYhQKtoAu1kOE4isgqJpxQcI3Ehh' +
9700 '4/glz37koQACH5BAkKABIALAAAAAAZABgAAAaVQI' +
9701 'lwSCQaHA5BcWkEEAmNBqEYYEo0BcszOh2KIg8moV' +
9702 'DoXrnDQARsTZCdZ+nwsx5YF2SKECqXMNYFVkIgb3' +
9703 'FTAxARHU1FA3mGEgVrVUIGAZd2aW+WBAYLaw1GHp' +
9704 'eYlSALS1CojaQBCwiCsQgYrbG2AASutrsGu00AwM' +
9705 'GwvpUHxsfGxMXIx8oSCMLCztPU1dbX2NfDgkEAIf' +
9706 'kECQoAFgAsAAAAAB8AGAAABr9Ai3BIJAIUikFxyR' +
9707 'waEMZCYVEkNJeHgCc6JSoaiatRK3BKqUJCAywmas' +
9708 'jp83CzNrSdcMtCbqGsGXducHtdBg5rYgAARQBaVo' +
9709 'RUDGtWXmEWCAeZi3gBTwufAmsPbh0REZQTmgNQlx' +
9710 'lKVRtleg2mEQ1GqnZ3AyK1HYBYqncjtV1NmJl3BB' +
9711 'EiaG2sykyYitSKgUKbuKqa19aM29yB3rjV1N3Zz9' +
9712 '3n6MfJiRLh7wdXyMLPq+32rcGs7Hju2HI9qXclCA' +
9713 'Ah+QQJCgAZACwAAAAAIAAYAAAGvcCMcEgkIgIBQH' +
9714 'HJNBYHyMGzyTQcJsYokVOgUJ9XpRCaHC4K3S/4YN' +
9715 'YKLWixehweuwnowHyNyJClAApoagBydFd+WgFxRR' +
9716 'cXQwhhhlaSA5FoDFsVDQ0YZpWQhmMWUn4PnA0PfI' +
9717 'hzBgqoFV5VknMhqAwGX5GsXxgNCgJ7fsKes4XHhc' +
9718 'RIy1FhzrxqARHT1NPPtHvS1dSRyMfKzG5LfXvk5d' +
9719 'BN34QSdevt45bYuvHvh+8Ton749tDy+pW7+rULAg' +
9720 'Ah+QQJCgAUACwAAAAAIAAZAAAGwECKcEgsHo7FpJ' +
9721 'KIMB4BxqXSgBwCnsRMACN1VinX72Cb6XqtWKGHbG' +
9722 'amw1Awu+1GwuVb89U7AGMXc0MaGmhpQlR2UACBFB' +
9723 'kJBQUChYYDcUwecQIMkAUMfF9di5wJBEuIoEsgnA' +
9724 'GWU5Wtpp19dE20ple4uHR4BL2+T8CoUgQNxcbFwc' +
9725 'C7xMfGCLm5y7+/psu7frBKARGRehKGUh8R456uwW' +
9726 '0LDeMRHwGflhPZuo0d6w91BvjPVM+gBRDjru0a0E' +
9727 'lIEAAh+QQJCgAWACwAAAAAIAAeAAAG2ECLcEgsHo' +
9728 '7FpJKIMB4BxqXSgBwCnsyq1IoVXrXfwdZ54IK1Y2' +
9729 '83rEanLQMsG+5OXsliNtV97rabdwh+cBoBAQZmfn' +
9730 'F2E02EhoZ4dVMZkBoCS3uTRpALjplxUGMGhqJpn6' +
9731 'OgV6t3b2ELsLFPs6ajBbe4t7O7b3C5uYKsq71xsr' +
9732 'GZxL10tUsEDQyIW69pGw3WFKqzpw/WDRsEkqaNSQ' +
9733 'EfC0LO3QlZaJrBghERIkQMDtZZqO/LUCLxAUwMLi' +
9734 'izAyHCh4FvCsRjgDBNh3hiGkoJsFDilgYROCgJAg' +
9735 'Ah+QQJCgAYACwAAAAAIAAgAAAF4CAmjmR5nGWqko' +
9736 'h5AuaqGugIvGwt27h467/BznXgAXVDXy+oRCYxAx' +
9737 'wT6kzdiEImzUkzSmBeKhUZbDV7YpcZEUWfq6u2Oz' +
9738 'efvQxDNhz7hPbNVjeCgn9ybUEvdXEBjI2MiZB/jo' +
9739 '56g1dPZYdxf31jSQsFAWAyiEkWBagEcYaApAyoBR' +
9740 'YLWF88KQQbAj4JsBR0eF6gBQsCDQ0KJAEKqDmtlR' +
9741 'gBEREBGArGqjaMeTjR01AODRudZyLd1BgM1+NfRe' +
9742 'XS5xgVxsCfaOYjBMYXhRPJ7yQPGsAb584bwR0DIE' +
9743 'CY9SQEACH5BAkKABQALAAAAAAgACAAAAXmICWOZH' +
9744 'mcZaqSiHkC5qoa6Ai8bC3buHjrv8HOdeABdUNfL6' +
9745 'hEJikDHBPqTN2IQibNSTNKYF4qFRlsNXtilxkRRZ' +
9746 '+rq7Y7N5+9DEM2HPuE9s1WN4KCfVSDZS91cYmMjX' +
9747 'uBjnqHgHmTVzN/hVtJAwELlHaKJgGkAouMnASkpV' +
9748 'hfPh8BVhZCUBqrGHR4Iw8REQQCDAwCAwUFHCQLqz' +
9749 'mUC70NFAQNDQQUHMULdEMNvdjR01AKxoUiAb0F5N' +
9750 'LU0NfjHdzo3yIJxWBJDL0MI97q6+JPHBE+IEtHgk' +
9751 'GBDONMEEy4w4ADB6aehAAAIfkECQoAFgAsAAAAAC' +
9752 'AAIAAABeCgJY5keZxlqpKIeQLmqhroCLxsLdu4eO' +
9753 'u/wc514AF1Q18vqEQmLQMcE+pM3YhCJs1JM0pgXi' +
9754 'oVGWw1e2KXGRFFn6urtjs3n70MQzYc+4T2zVY3go' +
9755 'J9VINlL3VxiYyNe4GOeoeAeZNXM39/BRABSYRDDB' +
9756 '0RER2eiSsEDaMRDQSmjCUPqx0cPhuuRG94I6sFQi' +
9757 'IJDa0DAQFtxXRFIwkPCyzCD1AFvlDFvzxDD8IC0t' +
9758 'QIxR6FIqkNDLbU1cbiFdvnzuPWfRTCFDbT7+nKSQ' +
9759 'ENGyQL9/6pE/cvIMEdABQouDYkBAAh+QQJCgAaAC' +
9760 'wAAAAAIAAgAAAF2aAmjmR5nGWqkoh5AuaqGugIvG' +
9761 'wt27h467/BznXgAXVDXy+oRCY1AxwT6kzdiEImzU' +
9762 'kzSmBeKhUZbDV7YpcZEUWfq6u2OzefvQxDNhz7hP' +
9763 'bNVgGCgwELfVQ3iRoQEY2OEQx/L5MHjI+NkU9BlA' +
9764 'uEg4aaiaKAMZp/DA4ESYpDFBUNsKuTcQ+wDQ8Ysp' +
9765 'QlCbYVAT4WoHRveCO2DMYaFAUFAmVuW0UjFwkCLM' +
9766 '2RA4JZc107DM1Z3E2HPs3AUORjYH0J4j7rY4cE6D' +
9767 'byU0kZBRYs8vPm/BUKmOffjhAAIfkECQoAFQAsAA' +
9768 'AAACAAIAAABujAinBILB6OxaSSiDAeAcal0oAcAp' +
9769 '7MqtSKFV6138HWeeCCtWNvN6xGpysDLBvuTjIYZD' +
9770 'Gb6qYOCRERHQFZSFd0aGFNcB+BESMLXEkIE4uUT2' +
9771 'JEDBCOBZljcZhTD44jaaF1Rg0RhKBdaQRvcEsCBL' +
9772 'a3trJ0V7wVDg3AwQ0UsmGYB7/CwMRvxse4uMW804' +
9773 'uTxcUBCpGuBrAJBeCnolMM4AUMAuLHRRTmCRltk5' +
9774 'VtrxXmAVBCGAH4l/6fiMr8oQAQAL9Ye+rRGRNtjs' +
9775 'JTB+lJ1KWBn6VXElLRijgxIDYPhfLF05WHZDONSY' +
9776 'IAACH5BAUKABYALAAAAAAgACAAAAbuQItwSCwejs' +
9777 'WkkkgYEAFHgHGpTEQ+z2jWQC0yIhHGEIoUkp1dYg' +
9778 'eMPo/L6WEA/DBrLe44scHG3+9UFBRGYA1+SAaAdn' +
9779 'INjQREBWCPUIdodn8bjQ0hAmYjAUkIEwiXihYUDp' +
9780 'oMXHEDURJSoQmaIa2vaQIPDY+4plQYenhLrgvFxp' +
9781 'a2UMoWCgXOzwW8ya9HzdDO0r3U28fIXaLK4cPBpH' +
9782 'qiAd5Ky7gaAe7TsaEE7u6s38SmGPQaE2+ho6XgnK' +
9783 'pXrhI4cAITJcQQr5JDfEbsDdOSx5c2VhUt/oKT51' +
9784 'Awh6XeCLzXT2RDYh//jUw5sWCaIAA7';
9785 var navArchive = document.getElementById("nav_archive");
9786 var blogMenu = document.createElement("div");
9787 blogMenu.id = "blog_menu";
9788 var blogMenuLink = navArchive.
9789 getElementsByClassName("title")[0].
9790 getElementsByTagName("a")[0];
9791 blogMenuLink.innerHTML = "Blogs";
9792 blogMenuLink.insertBefore(blogMenu, blogMenuLink.firstChild);
9793 var arrow = document.createElement("div");
9794 arrow.classList.add("arrow");
9795 blogMenuLink.removeAttribute("href");
9796 blogMenuLink.insertBefore(arrow, blogMenuLink.firstChild);
9797 // this makes a batch reblog button
9798 var reblogMenuButton = function (name) {
9799 var button = document.createElement("button");
9800 button.setAttribute(
9801 "title", "Batch reblog selected posts to \"" + name + "\""
9802 );
9803 var svg = svgForType["reblog-self"].cloneNode(true);
9804 svg.setAttribute("width","11");
9805 svg.setAttribute("height","11");
9806 svg.setAttribute("fill","#fff");
9807 button.appendChild(svg);
9808 button.appendChild(
9809 document.createTextNode(
9810 " BATCH REBLOG SELECTED"
9811 )
9812 );
9813 button.setAttribute("data-edit_action", "reblog");
9814 button.setAttribute("data-name", name);
9815 button.addEventListener(
9816 "click",
9817 function() {
9818 var data = document.getElementById(
9819 "mass_post_features-plugin_data"
9820 );
9821 data.setAttribute(
9822 "data-reblog-to-here", this.getAttribute("data-name")
9823 );
9824 var rb = document.getElementsByClassName("reblog-to-here");
9825 while (rb.length > 0) {
9826 rb[0].classList.remove("reblog-to-here");
9827 }
9828 document.getElementById(
9829 "reblog-to_" + this.getAttribute("data-name")
9830 ).classList.add("reblog-to-here");
9831 data.setAttribute(
9832 "data-reblog-to-here", this.getAttribute("data-name")
9833 );
9834 fetchEditSubmitMulti.apply(this, arguments);
9835 }
9836 );
9837 return button;
9838 }
9839 // this loads the secondaries for menu and data
9840 if (
9841 document.getElementById("bm_load_img") === null &&
9842 data.classList.contains("blog-menu-preload")
9843 ) {
9844 data.classList.remove("blog-menu-preload");
9845 // first time open, fetch the blogs, if any
9846 var xhttp = new XMLHttpRequest();
9847 var preLoad = new Image();
9848 preLoad.src = loderGifSrc;
9849 preLoad.style.width = "32px;"
9850 preLoad.style.height = "32px";
9851 preLoad.id = "bm_load_img";
9852 document.getElementById("blog_menu").appendChild(preLoad);
9853 xhttp.onreadystatechange = function () {
9854 if (this.readyState == 4 && this.status == 200) {
9855 var data = document.getElementById(
9856 "mass_post_features-plugin_data"
9857 );
9858 var div = document.createElement("div");
9859 div.innerHTML = this.responseText. // parse the dom
9860 replace(/<(\/?)script[^>]*>/g, "<$1flurb>"). // no eval
9861 replace(/<img/g,"<space"); // do not onload img tags
9862 var apiKey = div.querySelectorAll(
9863 "meta[name=tumblr-form-key]"
9864 )[0].getAttribute("content");
9865 data.setAttribute("data-x-tumblr-form-key", apiKey);
9866 var l = div.getElementsByClassName("l-container")[0];
9867 var li = l.getElementsByClassName("is_tumblelog");
9868 var tumblelogs = [];
9869 var st;
9870 var a;
9871 var av;
9872 var ho;
9873 var tray;
9874 var subt;
9875 var name1;
9876 var link1;
9877 var link2;
9878 var link3;
9879 var link4;
9880 var edIcon;
9881 var visIcon;
9882 var reIcon;
9883 var primIcon;
9884 var href = document.location.href.split(/[\/\?&#=]+/g);
9885 var name = href[4];
9886 var reAsDraftContainer = document.createElement("div");
9887 reAsDraftContainer.classList.add("blog_menu_child");
9888 var reAsDraft = document.createElement("input");
9889 reAsDraft.type = "checkbox";
9890 reAsDraft.id = "re-as-draft";
9891 reAsDraft.checked = true;
9892 reAsDraftContainer.appendChild(reAsDraft);
9893 var reAsDraftLabel = document.createElement("label");
9894 reAsDraftLabel.setAttribute("for", "re-as-draft");
9895 reAsDraftLabel.appendChild(
9896 document.createTextNode("Reblog Posts as Draft")
9897 );
9898 var robotWarning = document.createElement("div");
9899 var robotTitle = document.createElement("strong");
9900 robotTitle.appendChild(
9901 document.createTextNode(
9902 "Friendly Robot Warning"
9903 )
9904 );
9905 robotWarning.classList.add("robot-warning");
9906 robotWarning.appendChild(robotTitle);
9907 robotWarning.appendChild(
9908 document.createTextNode(
9909 "Dash flooding might make you lose followers!"
9910 )
9911 );
9912 reAsDraftContainer.appendChild(reAsDraftLabel);
9913 reAsDraftContainer.appendChild(robotWarning);
9914 document.getElementById("blog_menu").appendChild(reAsDraftContainer);
9915 for (var i = 0; i < li.length; i++) {
9916 a = li[i].getElementsByTagName("a")[0];
9917 av = a.getElementsByClassName("avatar")[0];
9918 av.removeAttribute("style");
9919 av.innerHTML = av.innerHTML.replace(/<space/g,"<img");
9920 st = a.getElementsByClassName("small_text")[0];
9921 ho = a.getElementsByClassName("hide_overflow")[0];
9922 tray = document.createElement("div");
9923 tray.classList.add("blog_menu_child");
9924 name1 = ho.innerHTML.replace(/\s+/g, "");
9925 tray.setAttribute("data-name", name1);
9926 if (i === 0) { // assuming primary is first blog :)
9927 data.setAttribute("data-primary-blog", name1);
9928 var navLikes = document.getElementById("nav-likes");
9929 navLikes.setAttribute(
9930 "data-default-input", name1
9931 );
9932 primIcon = svgForType.original.cloneNode(true);
9933 primIcon.setAttribute("width", 20);
9934 primIcon.setAttribute("height", 20);
9935 primIcon.setAttribute("title", "Primary Blog");
9936 primIcon.setAttribute("fill", "rgba(0,65,100,1)");
9937 st.insertBefore(primIcon, st.firstChild);
9938 }
9939 reIcon = svgForType["reblog-self"].cloneNode(true);
9940 reIcon.setAttribute("width", "26");
9941 reIcon.setAttribute("height", "26");
9942 reIcon.setAttribute("fill", "#7D99FF");
9943 av.appendChild(reIcon);
9944 av.setAttribute("title", "Select Avatar for Quick-Reblogs");
9945 av.setAttribute("data-name", name1);
9946 av.id = "reblog-to_" + name1;
9947 av.addEventListener("click", function() {
9948 var data = document.getElementById(
9949 "mass_post_features-plugin_data"
9950 );
9951 var rb = document.getElementsByClassName("reblog-to-here");
9952 while (rb.length > 0) {
9953 rb[0].classList.remove("reblog-to-here");
9954 }
9955 this.classList.add("reblog-to-here");
9956 data.setAttribute(
9957 "data-reblog-to-here", this.getAttribute("data-name")
9958 );
9959 });
9960 if (name.toLowerCase() === name1.toLowerCase()) {
9961 av.classList.add("reblog-to-here");
9962 data.setAttribute("data-reblog-to-here", name);
9963 }
9964 tray.appendChild(av);
9965 tray.appendChild(st);
9966 link1 = document.createElement("a");
9967 link2 = document.createElement("a");
9968 link3 = document.createElement("a");
9969 link4 = document.createElement("a");
9970 subt = document.createElement("div");
9971 link1.setAttribute(
9972 "title", "visit \"" + name1 + "\""
9973 );
9974 link1.setAttribute(
9975 "href", "https://www.tumblr.com/blog/" + name1
9976 );
9977 link1.setAttribute(
9978 "target", "_blank"
9979 );
9980 link3.setAttribute(
9981 "title", "edit \"" + name1 + "\" queue"
9982 );
9983 link4.setAttribute(
9984 "title", "edit \"" + name1 + "\" drafts"
9985 );
9986 link2.setAttribute(
9987 "href",
9988 "https://www.tumblr.com/mega-editor/published/" + name1
9989 );
9990 link3.setAttribute(
9991 "href",
9992 "https://www.tumblr.com/mega-editor/queued/" + name1
9993 );
9994 link4.setAttribute(
9995 "href",
9996 "https://www.tumblr.com/mega-editor/draft/" + name1
9997 );
9998 link1.appendChild(
9999 document.createTextNode(
10000 "Visit"
10001 )
10002 );
10003 link2.appendChild(
10004 document.createTextNode(
10005 "Published"
10006 )
10007 );
10008 link3.appendChild(
10009 document.createTextNode(
10010 "Queued"
10011 )
10012 );
10013 link4.appendChild(
10014 document.createTextNode(
10015 "Drafts"
10016 )
10017 );
10018 edIcon = svgForType.edit.cloneNode(true);
10019 edIcon.setAttribute("width", 12);
10020 edIcon.setAttribute("height", 12);
10021 edIcon.setAttribute("fill", "#7D99FF");
10022 visIcon = svgForType.home.cloneNode(true);
10023 visIcon.setAttribute("width", 12);
10024 visIcon.setAttribute("height", 12);
10025 visIcon.setAttribute("fill", "#7D99FF");
10026 link1.appendChild(visIcon);
10027 link2.appendChild(edIcon.cloneNode(true));
10028 link3.appendChild(edIcon.cloneNode(true));
10029 link4.appendChild(edIcon.cloneNode(true));
10030 subt.appendChild(link4);
10031 subt.appendChild(link3);
10032 subt.appendChild(link2);
10033 subt.appendChild(link1);
10034 if (!data.classList.contains("is-uploading-photos")) {
10035 subt.appendChild(reblogMenuButton(name1));
10036 } else {
10037 var blankSpace = document.createElement("div");
10038 blankSpace.classList.add("blank-space");
10039 subt.appendChild(blankSpace);
10040 }
10041 subt.classList.add("subt");
10042 tray.appendChild(subt);
10043 document.getElementById("blog_menu").appendChild(tray);
10044 }
10045 document.getElementById("blog_menu").removeChild(
10046 document.getElementById("bm_load_img")
10047 );
10048 }
10049 };
10050 xhttp.open("GET", "/settings", true);
10051 xhttp.send();
10052 } // this loads the blog menu
10053
10054 // this opens the blog menu
10055 blogMenuLink.addEventListener("click", function (e) {
10056 var data = document.getElementById(
10057 "mass_post_features-plugin_data"
10058 );
10059 // any other time, just open menu
10060 if (
10061 !this.classList.contains("open") &&
10062 !data.classList.contains("open-blog_menu") &&
10063 !data.classList.contains("closing-blog_menu")
10064 ) {
10065 data.classList.add("open-blog_menu");
10066 this.classList.add("open");
10067 e.cancelBubble = true;
10068 e.preventDefault();
10069 e.stopPropagation();
10070 }
10071 e.cancelBubble = true;
10072 e.stopPropagation();
10073 });
10074 // end of blogs menu blog dropdown...
10075
10076 // tumblr now has its own default queue/drafts pages
10077 // so we'll fake a query with userscript booleans
10078 if(
10079 href[3] === "published" || href[3] === "draft" || href[3] === "queued"
10080 ) {
10081 getResponseText("/blog/" + name, function (re){
10082 var div = document.createElement("div");
10083 div.innerHTML = re. // parse the dom
10084 replace(/<(\/?)script[^>]*>/g, "<$1flurb>"). // no eval
10085 replace(/<img/g,"<space"); // do not onload img tags
10086 var flurb = div.getElementsByTagName("flurb");
10087 var keyReg = /"API_TOKEN"[^:]*:[^"]*"([^"]+)"/i;
10088 var csrfReg = /"CSRFTOKEN"[^:]*:[^"]*"([^"]+)"/i;
10089 // find the flurb :) not joking
10090 var apiToken = 0;
10091 var csrfToken = 0;
10092 var primary = name;
10093 for (var i = 0; i < flurb.length; i++) {
10094 if (flurb[i].innerText.match(keyReg) !== null) {
10095 apiToken = flurb[i].innerText.match(keyReg)[1];
10096 break;
10097 }
10098 }
10099 for (i = 0; i < flurb.length; i++) {
10100 if (flurb[i].innerText.match(csrfReg) !== null) {
10101 csrfToken = flurb[i].innerText.match(csrfReg)[1];
10102 break;
10103 }
10104 }
10105 if (apiToken !== 0) {
10106 // this is Tumblr's own API key! (0_0)
10107 data.setAttribute("data-api-token", apiToken);
10108 data.setAttribute("data-csrf-token", csrfToken);
10109 // please use this ^ responsibly! (O.O)
10110 if (
10111 href[3] === "published" &&
10112 (
10113 href[5] === "dashboard" ||
10114 href[5] === "archive" ||
10115 href[5] === "tagged" ||
10116 href[5] === "likes" ||
10117 href[5] === "search"
10118 )
10119 ) {
10120 // hide editor functions for archive view / reblog mode
10121 var ritpm = document.getElementsByClassName(
10122 "remove-in-third-party-mode"
10123 ); // edit buttons don't work in reblog mode... I tried :)
10124 while (ritpm.length > 0) {
10125 ritpm[0].parentNode.removeChild(ritpm[0]);
10126 }
10127 var notice = document.createElement("div");
10128 notice.classList.add("notice");
10129 notice.appendChild(
10130 document.createTextNode(
10131 "Page may be endless; Utilize pause button."
10132 )
10133 );
10134 document.getElementsByClassName(
10135 "editor_navigation"
10136 )[0].appendChild(notice);
10137 if (href[5] === "dashboard") {
10138 i = "dash";
10139 }
10140 if (href[5] === "archive") {
10141 i = "archive";
10142 }
10143 if (href[5] === "tagged") {
10144 i = "tagged";
10145 }
10146 if (href[5] === "likes") {
10147 i = "likes";
10148 }
10149 if (href[5] === "search") {
10150 i = "search";
10151 }
10152 } else {
10153 i = href[3];
10154 }
10155 if (
10156 href[3] === "published" && href[5] !== "archive" ||
10157 href[3] === "published" && href[5] !== "likes" ||
10158 href[3] === "published" && href[5] !== "dashboard" ||
10159 href[3] === "published" && href[5] !== "tagged" ||
10160 href[3] === "published" && href[5] !== "search" ||
10161 i === "published" && href[5] !== "photos" ||
10162 i === "queued" ||
10163 i === "draft"
10164 ) {
10165 var q = typeof href[6] !== "undefined" ? href[6] : "cats";
10166 var o = typeof href[7] !== "undefined" && !isNaN(href[7]) ?
10167 "&before=" + href[7] : "";
10168 if (q === name) {
10169 q = data.getAttribute("data-primary-blog");
10170 // all secondaries goto the blog that likes, for likes :)
10171 }
10172 var subpage = {
10173 "published" :
10174 "/v2/blog/" + name + "/posts?limit=50&reblog_info=1&npf=1&page=1" + o,
10175 "likes":
10176 "/v2/blog/" + q + "/likes?limit=50&reblog_info=1&npf=1&page=1" + o,
10177 "draft":
10178 "/v2/blog/" + name + "/posts/draft?limit=50&reblog_info=1&npf=1&page=1" + o,
10179 "queued":
10180 "/v2/blog/" + name + "/posts/queue?limit=50&reblog_info=1&npf=1&page=1" + o,
10181 "archive":
10182 "/v2/blog/" + q + "/posts?limit=50&reblog_info=1&npf=1&page=1" + o,
10183 "dash" :
10184 "/v2/timeline/dashboard",
10185 "search" :
10186 "/v2/mobile/search/posts?blog_limit=0&post_limit=50&query=" + q +
10187 "&mode=top" + o,
10188 "tagged" : // why is these mobile? I'm not quite sure...
10189 "/v2/mobile/search/posts?blog_limit=0&post_limit=50m&query=" + q +
10190 "&mode=top&mode=recent" + o
10191 }[i];
10192 data.setAttribute("data-ajax-first-subpage", subpage);
10193 asyncRepeatApiRead({
10194 "response": { // we wil use all neue npf format, because
10195 "_links": { // some posts are neue npf, no matter what
10196 "next": { // (if you can't beat 'em, join 'em)
10197 "href": subpage
10198 }
10199 }
10200 }
10201 });// this thing paginates itself
10202 }
10203 }
10204 });
10205 };
10206 // end of my new API-less sin... :(
10207
10208 // the month widget must be modified to accomidate Archives
10209 var broMo = document.createElement("div");
10210 broMo.id = "browse_months";
10211 broMo.setAttribute("onclick", "just_clicked_browse_months = true;");
10212 var jum2mo = document.createElement("div");
10213 jum2mo.id = "jump_to_month";
10214 var aro2 = document.createElement("span");
10215 aro2.classList.add("arrow");
10216 jum2mo.appendChild(aro2);
10217 broMo.addEventListener("click", function () {
10218 var bmw = document.getElementById(
10219 "browse_months_widget"
10220 );
10221 if (
10222 window.getComputedStyle(bmw).
10223 getPropertyValue("display") === "none"
10224 ) {
10225 bmw.style.display = "block";
10226 } else {
10227 bmw.style.display = "none";
10228 }
10229 });
10230 var mo2;
10231 var jum = typeof href[5] !== "undefined" ? href[5] : "jump";
10232 var jumto = typeof href[6] !== "undefined" ? href[6] : name;
10233 var year = typeof href[7] !== "undefined" && !isNaN(href[7]) ?
10234 (new Date(parseInt(href[7]) * 1000)).getFullYear() :
10235 (new Date()).getFullYear();
10236 if (href[3] === "queued" || href[3] === "draft") {
10237 var ridqm = document.getElementsByClassName(
10238 "remove-in-drafts-queue-mode"
10239 );
10240 while (ridqm.length > 0) {
10241 ridqm[0].parentNode.removeChild(ridqm[0]);
10242 }
10243 }
10244 if (href[3] === "published" &&
10245 (
10246 typeof href[5] === "undefined" ||
10247 href[5] === "jump" ||
10248 href[5] === "archive"
10249 )
10250 ) {
10251 mo2 = document.createElement("span");
10252 mo2.classList.add("month");
10253 mo2.appendChild(document.createTextNode("Month"));
10254 jum2mo.appendChild(mo2);
10255 // this is a sneaky trick to get that elusive "firstPostTimeStamp"
10256 var monthIframe = document.createElement("iframe");
10257 monthIframe.style.display = "none";
10258 monthIframe.id = "browse_months_widget";
10259 monthIframe.setAttribute("scrolling", "no");
10260 monthIframe.setAttribute("frameborder", "0");
10261 monthIframe.setAttribute("title", "Post forms");
10262 monthIframe.src = "https://" + jumto + ".tumblr.com/" +
10263 "archive?fetch=first_post_timestamp" +
10264 "&jump=" + jum + "&name=" + name + "&to=" +
10265 jumto + "&year=" + year;
10266 // these ^ url parameters need to be in alphabetical order
10267 jum2mo.appendChild(monthIframe);
10268 broMo.appendChild(jum2mo);
10269 document.getElementById(
10270 "browse_months"
10271 ).parentNode.replaceChild(
10272 broMo,
10273 document.getElementById(
10274 "browse_months"
10275 )
10276 );
10277 } else {
10278 mo2 = document.createElement("span");
10279 mo2.classList.add("month");
10280 mo2.appendChild(document.createTextNode("Month"));
10281 jum2mo.appendChild(mo2);
10282 // this is for getting before timestamps for other feeds
10283 jum = typeof href[5] !== "undefined" ? href[5] : "jump";
10284 jumto = typeof href[6] !== "undefined" ? href[6] : name;
10285 year = typeof href[7] !== "undefined" && !isNaN(href[7]) ?
10286 (new Date(parseInt(href[7]) * 1000)).getFullYear() :
10287 (new Date()).getFullYear();
10288 lTs = (new Date()).getTime();
10289 fTs = (new Date(1970, 0, 1)).getTime();
10290 var monthDiv = makeBrowseMonthsWidget(year, lTs, fTs, jum, jumto);
10291 monthDiv.style.display = "none";
10292 jum2mo.appendChild(monthDiv);
10293 broMo.appendChild(jum2mo);
10294 document.getElementById(
10295 "browse_months"
10296 ).parentNode.replaceChild(
10297 broMo,
10298 document.getElementById(
10299 "browse_months"
10300 )
10301 );
10302 doubleCheckDisabledMonths(year, lTs, fTs, jum, jumto);
10303 }
10304
10305 // this is the new batch photos page! BATCH PHOTOS PAGE
10306 if (href[3] === "published" && href[5] === "photos") {
10307 navArchive = document.getElementById("nav_archive");
10308 navArchive.style.zIndex = "1000";
10309 var addTagsWidget = document.getElementById("add_tags_widget");
10310 navArchive.appendChild(addTagsWidget);
10311 var addTagButton = document.getElementById("add_tag_button");
10312 addTagButton.removeAttribute("onclick");
10313 var addTagButton2 = addTagButton.cloneNode(true);
10314 addTagButton.firstChild.innerHTML = "Add Tags (single)";
10315 addTagButton2.firstChild.innerHTML = "Add Tags to All";
10316 addTagButton2.id += "2";
10317 addTagButton2.style.position = "absolute";
10318 addTagButton2.style.bottom = "8px";
10319 addTagButton2.style.left = "161px";
10320 addTagButton2.addEventListener("click", function () {
10321 var token = document.getElementById("tokens").children;
10322 var pb = document.getElementsByClassName("photo-brick");
10323 var phTags;
10324 var aToken;
10325 var child;
10326 var a;
10327 var addToken = true;
10328 for (var j = 0; j < pb.length; j++) {//pb & j :)
10329 phTags = pb[j].getElementsByClassName("photo-tags")[0];
10330 aToken = phTags.children;
10331 for (var i = 0; i < token.length; i++) {
10332 addToken = true;
10333 for (var l = 0; l < aToken.length; l++) {
10334 if (token[i].innerHTML === aToken[l].innerHTML) {
10335 addToken = false;
10336 break;
10337 }
10338 }
10339 if (addToken) {
10340 child = token[i].cloneNode(true);
10341 a = child.getElementsByTagName("a");
10342 a[0].removeAttribute("onclick");
10343 phTags.appendChild(child);
10344 }
10345 }
10346 }
10347 });
10348 addTagButton.addEventListener("click", function () {
10349 var fr = document.getElementsByClassName("focused-rich");
10350 if (fr.length === 0) {
10351 return;
10352 }
10353 var token = document.getElementById("tokens").children;
10354 var phTags = fr[0].getElementsByClassName("photo-tags")[0];
10355 var aToken = phTags.children;
10356 var addToken = true;
10357 for (var i = 0; i < token.length; i++) {
10358 addToken = true;
10359 for (var l = 0; l < aToken.length; l++) {
10360 if (token[i].innerHTML === aToken[l].innerHTML) {
10361 addToken = false;
10362 break;
10363 }
10364 }
10365 if (addToken) {
10366 phTags.appendChild(token[i].cloneNode(true));
10367 }
10368 }
10369 });
10370 addTagButton.parentNode.parentNode.appendChild(addTagButton2);
10371 addTagsWidget.style.top = "83px";
10372 addTagsWidget.style.left = "15px";
10373 addTagsWidget.style.removeProperty("right");
10374 lcontent.classList.add("albino");
10375 lcontent.classList.add("photo-page");
10376 data.classList.add("is-uploading-photos");
10377 var dragEnter = function(e){
10378 e.preventDefault();
10379 if (
10380 document.getElementsByClassName(
10381 "brick-dragging"
10382 ).length > 0
10383 ) {
10384 return;
10385 }
10386 var pdz = document.getElementById("photos-drop-zone");
10387 pdz.classList.add("full");
10388 };
10389 var dragLeave = function(e) {
10390 e.preventDefault();
10391 var pdz = document.getElementById("photos-drop-zone");
10392 pdz.classList.remove("full");
10393 };
10394 var drop = function(e) {
10395 e.preventDefault();
10396 var papb = document.getElementById("post_all_photos_button");
10397 if (papb.getAttribute("disabled") !== null) {
10398 papb.removeAttribute("disabled");
10399 }
10400 var pdz = document.getElementById("photos-drop-zone");
10401 pdz.classList.remove("full");
10402 var files;
10403 if (typeof e.dataTransfer !== "undefined") {
10404 files = e.dataTransfer.files;
10405 } else if (typeof this.files !== "undefined") {
10406 files = this.files;
10407 }
10408 var r;
10409 for (var i = 0; i < files.length; i++) {
10410 if(files[i].type.toString().split(/\//)[0] !== "image") {
10411 continue;
10412 }
10413 r = new FileReader();
10414 r.imgCode = "img"+shortCode(files[i].name);
10415 r.addEventListener("load", loadPhotoIntoDOM);
10416 reading.push(
10417 {
10418 read: function(){
10419 reading[reading.length - 1].reader.readAsDataURL(
10420 reading[reading.length - 1].file
10421 );
10422 },
10423 file: files[i],
10424 reader: r
10425 }
10426 );
10427 unreadFile["img"+shortCode(files[i].name)] = files[i];
10428 }
10429 reading[reading.length - 1].read();
10430 };
10431 en = document.getElementsByClassName("editor_navigation");
10432 // remove all navigation buttons, editor widgets, and start anew
10433 en[0].parentNode.removeChild(en[0]);
10434 var dropZone = document.createElement("div");
10435 dropZone.id = "photos-drop-zone";
10436 var dropTitle = document.createElement("h2");
10437 dropTitle.appendChild(
10438 document.createTextNode("Drop Photos Here")
10439 );
10440 dropTitle.id = "drop_images_here";
10441 var inputBackup = document.createElement("input");
10442 inputBackup.type = "file";
10443 inputBackup.accept = "image/x-png,image/gif,image/jpeg,image/png";
10444 inputBackup.multiple = true;
10445 inputBackup.addEventListener("change", drop);
10446 inputBackup.id = "photo_file_input";
10447 var postPhotos = butt("Post Photos");
10448 postPhotos.disabled = true;
10449 postPhotos.id = "post_all_photos_button";
10450 postPhotos.setAttribute("title", "Post All Photos");
10451 postPhotos.addEventListener("click", photoUploadAndSubmit);
10452 var photosAsDraft = document.createElement("input");
10453 photosAsDraft.id = "photos_as_draft";
10454 photosAsDraft.type = "checkbox";
10455 photosAsDraft.checked = true;
10456 var photosAsDraftLabel = document.createElement("label");
10457 photosAsDraftLabel.setAttribute("for", "photos_as_draft");
10458 photosAsDraftLabel.appendChild(
10459 document.createTextNode(
10460 "New Photo/Photoset Posts"
10461 )
10462 );
10463 var asB = document.createElement("strong");
10464 asB.appendChild(
10465 document.createTextNode(" as Draft")
10466 );
10467 photosAsDraftLabel.appendChild(asB);
10468 var photosAsDraftContainer = document.createElement("div");
10469 photosAsDraftContainer.id = "photos_as_draft_container";
10470 photosAsDraftContainer.appendChild(photosAsDraft);
10471 photosAsDraftContainer.appendChild(photosAsDraftLabel);
10472 var photosRobotWarning = document.createElement("div");
10473 photosRobotWarning.classList.add("robot-warning");
10474 var robotTitlePhotos = document.createElement("strong");
10475 robotTitlePhotos.appendChild(
10476 document.createTextNode(
10477 "Friendly Robot Warning"
10478 )
10479 );
10480 photosRobotWarning.appendChild(robotTitlePhotos);
10481 photosRobotWarning.appendChild(
10482 document.createTextNode(
10483 "Dash flooding might make you lose followers. " +
10484 "Perhaps \"check\" post \"as draft\" instead?"
10485 )
10486 );
10487 photosAsDraftContainer.appendChild(photosRobotWarning);
10488 document.body.appendChild(photosAsDraftContainer);
10489 document.body.appendChild(inputBackup);
10490 document.body.appendChild(postPhotos);
10491 document.body.appendChild(dropTitle);
10492 document.body.appendChild(dropZone);
10493 document.documentElement.addEventListener("dragenter", dragEnter, false);
10494 document.documentElement.addEventListener("dragover", dragEnter, false);
10495 document.documentElement.addEventListener("dragleave", dragLeave, false);
10496 document.documentElement.addEventListener("drop", drop, false);
10497 }
10498};
10499// May 2020, Mass Post Editor Features 4 (from scratch) by Jake Jilg (benign-mx)
10500document.onreadystatechange = function () {
10501 // Hello :)
10502 if (document.readyState === "interactive") {
10503 MassPostEditorFeatures4();
10504 }
10505}; // Hello world!