Permalink
Browse files

Sample plugin to copy meta values to a new page, using a private api.…

… BAD GUS NO COOKIE.
  • Loading branch information...
1 parent 1e1c60a commit b7d3bb659793a4e42e41178c0752dd96c637ab03 @ccgus committed Feb 13, 2013
Showing with 21 additions and 0 deletions.
  1. +21 −0 plugins-script/Copy Meta Attributes To Current Page.jstalk
@@ -0,0 +1,21 @@
+function main(windowController, document) {
+
+ var copyFromPageName = "index";
+
+ var copyFromPage = [document pageForKey:copyFromPageName]
+ var currentPage = [windowController visibleItem];
+
+ var metaValues = [copyFromPage metaValues];
+
+ var currentMetaValues = [[currentPage metaValues] mutableCopy];
+
+
+ [currentMetaValues addEntriesFromDictionary:metaValues];
+
+
+ // OK, the following lines are kind of private. It's possible to add meta values via AppleScript, but I have yet to open it up to JavaScript… so this is the workaround till then. IT WILL PROBABLY BLOW UP IN A FUTURE RELEASE (yay!);
+ [currentPage setMetaValues:currentMetaValues];
+ [currentPage storeAttributes];
+ [[NSNotificationCenter defaultCenter] postNotificationName:"VPItemMetaRefreshNotification" object:currentPage];
+
+}

0 comments on commit b7d3bb6

Please sign in to comment.